Mercurial > mm7
diff Outdoor.cpp @ 105:56e11be29db1
Слияние
author | Ritor1 |
---|---|
date | Tue, 05 Feb 2013 19:08:52 +0600 |
parents | 41145af69341 170259c8c71f |
children | 23b213c3f8e1 |
line wrap: on
line diff
--- a/Outdoor.cpp Tue Feb 05 19:08:22 2013 +0600 +++ b/Outdoor.cpp Tue Feb 05 19:08:52 2013 +0600 @@ -89,27 +89,27 @@ if ( !pRenderer->pRenderD3D ) { pRenderer->OnOutdoorRedrawSW(); - goto LABEL_16; } - //goto LABEL_14; - pRenderer->DrawSkyD3D(); - pRenderer->DrawBuildingsD3D(); - pRenderer->DrawBezierTerrain(); - goto LABEL_16; + else + { + pRenderer->DrawSkyD3D(); + pRenderer->DrawBuildingsD3D(); + pRenderer->DrawBezierTerrain(); + } } - if ( pRenderer->pRenderD3D ) + else if ( pRenderer->pRenderD3D ) { -//LABEL_14: pRenderer->DrawSkyD3D(); pRenderer->DrawBuildingsD3D(); pRenderer->DrawBezierTerrain();// Ritor1: sometimes crash - goto LABEL_16; } - pRenderer->DrawBuildingsSW(); - pRenderer->DrawBezierTerrain(); - sr_sub_486F92_MessWithEdgesAndSpans(); - pOutdoorCamera->_487355(); -LABEL_16: + else + { + pRenderer->DrawBuildingsSW(); + pRenderer->DrawBezierTerrain(); + sr_sub_486F92_MessWithEdgesAndSpans(); + pOutdoorCamera->_487355(); + } pMobileLightsStack->uNumLightsActive = 0; pStationaryLightsStack->uNumLightsActive = 0; if ( !pRenderer->pRenderD3D ) @@ -1772,7 +1772,7 @@ for (uint i = 0; i < uNumBModels; ++i) { //v48 = 0; - auto model = pBModels + i; + auto model = &pBModels[i]; model->pVertices.pVertices = nullptr; model->pFaces = nullptr; @@ -1856,7 +1856,7 @@ //v149 = 0; //Str2 = (char *)ptr; - auto face = model->pFaces + j; + auto *face = &model->pFaces[j]; //pFilename = (char *)v149 + (unsigned int)v60[v48].pFaces; if (~face->uAttributes & 0x40) { @@ -2130,16 +2130,16 @@ //v151 = 0; for (uint i = 0; i < uNumBModels; ++i) { - auto model = pBModels + i; + auto model = pBModels[i]; //pNumItems = 0; //do //{ //v86 = pBModels; //thisa = 0; //v87 = (unsigned int)((char *)v86 + pNumItems); - for (uint j = 0; j < model->uNumFaces; ++j) + for (uint j = 0; j < model.uNumFaces; ++j) { - auto face = model->pFaces + j; + auto face = model.pFaces[j]; //if ( *(int *)(v87 + 76) > 0 ) //{ @@ -2147,7 +2147,7 @@ //do //{ //v106 = (char *)&File->uAttributes + *(int *)(v87 + 84); - memcpy(&face->uAttributes, pSrc, 4); + memcpy(&face.uAttributes, pSrc, 4); pSrc += 4; //v88 = pBModels; //++File; @@ -2160,20 +2160,20 @@ //v89 = pBModels; //thisa = 0; - for (uint j = 0; j < model->uNumFaces; ++j) + for (uint j = 0; j < model.uNumFaces; ++j) { - auto face = model->pFaces + j; + auto face = model.pFaces[j]; //pFilename = 0; //do //{ //v90 = (ODMFace *)&pFilename[*(unsigned int *)((char *)&v89->pFaces + pNumItems)]; //File = v90; - if (face->sCogTriggeredID) + if (face.sCogTriggeredID) { - if (face->HasEventHint()) - BYTE2(face->uAttributes) |= 0x10u; + if (face.HasEventHint()) + BYTE2(face.uAttributes) |= 0x10u; else - BYTE2(face->uAttributes) &= 0xEFu; + BYTE2(face.uAttributes) &= 0xEFu; } //++thisa; //v89 = pBModels; @@ -2789,7 +2789,7 @@ bool OutdoorLocation::InitalizeActors(int a1) { int v2; // ebx@1 - char *v3; // esi@2 + Actor *v3; // esi@2 int v4; // eax@3 __int16 v5; // ax@11 int v8; // [sp+348h] [bp-8h]@1 @@ -2800,50 +2800,67 @@ v9 = 0; if ( (signed int)uNumActors > 0 ) { - v3 = (char *)&pActors[0].uAttributes; - while ( 1 ) - { - v4 = *(int *)v3; - if ( !(v4 & 0x100000) ) - break; - if ( a1 == v2 ) - goto LABEL_8; - if ( v8 != v2 ) - goto LABEL_9; - *((short *)v3 + 70) = 19; - *(int *)v3 = v4 | 0x10000; - v8 = GetAlertStatus(); -LABEL_17: - ++v9; - v3 += 836; - if ( v9 >= (signed int)uNumActors ) - goto LABEL_18; - } - if ( v8 != 1 ) + v3 = pActors;//[0].uAttributes; + while ( v9 < (signed int)uNumActors ) { -LABEL_9: - *((int *)v3 + 37) = v2; - *((short *)v3 + 62) = v2; - if ( v4 & 0x10000 ) - *((short *)v3 + 70) = 19; - v5 = *((short *)v3 + 70); - if ( v5 != 11 && v5 != 19 && (*((short *)v3 + 2) == (short)v2 || *((int *)v3 + 18) == v2) ) - *((short *)v3 + 70) = 5; - *((short *)v3 + 56) = v2; - *((short *)v3 + 57) = v2; - *((short *)v3 + 58) = v2; - ((Actor *)(v3 - 36))->UpdateAnimation(); - v3[25] = 0; - ((Actor *)(v3 - 36))->PrepareSprites(0); - v2 = 0; - goto LABEL_17; + v4 = v3->uAttributes; + if ( !(v4 & 0x100000) ) + { + if ( v8 != 1 ) + { + v3->uCurrentActionTime = v2; + v3->uCurrentActionLength = v2; + if ( v4 & 0x10000 ) + v3->uAIState = (AIState) 19; + v5 = v3->uAIState; + if ( v5 != 11 && v5 != 19 && (v3->sCurrentHP == (short)v2 || v3->pMonsterInfo.uHP == v2) ) + v3->uAIState = (AIState) 5; + v3->vVelocity.x = v2; + v3->vVelocity.y = v2; + v3->vVelocity.z = v2; + v3->UpdateAnimation(); + v3->pMonsterInfo.uHostilityType = (MonsterInfo::HostilityRadius)0; + v3->PrepareSprites(0); + v2 = 0; + } + else + { + v3->uAIState = (AIState) 19; + v3->uAttributes = v4 | 0x10000; + } + } + else if ( a1 == v2 ) + { + v3->uAIState = (AIState) 19; + v3->uAttributes = v4 | 0x10000; + } + else if ( v8 != v2 ) + { + v3->uCurrentActionTime = v2; + v3->uCurrentActionLength = v2; + if ( v4 & 0x10000 ) + v3->uAIState = (AIState) 19; + v5 = v3->uAIState; + if ( v5 != 11 && v5 != 19 && (v3->sCurrentHP == (short)v2 || v3->pMonsterInfo.uHP == v2) ) + v3->uAIState = (AIState) 5; + v3->vVelocity.x = v2; + v3->vVelocity.y = v2; + v3->vVelocity.z = v2; + v3->UpdateAnimation(); + v3->pMonsterInfo.uHostilityType = (MonsterInfo::HostilityRadius)0; + v3->PrepareSprites(0); + v2 = 0; + } + else + { + v3->uAIState = (AIState) 19; + v3->uAttributes = v4 | 0x10000; + v8 = GetAlertStatus(); + } + ++v9; + ++v3; } -LABEL_8: - *((short *)v3 + 70) = 19; - *(int *)v3 = v4 | 0x10000; - goto LABEL_17; } -LABEL_18: pGameLoadingUI_ProgressBar->Progress(); Actor thisa; @@ -2876,7 +2893,7 @@ unsigned int OutdoorLocation::DrawActors() { unsigned int result; // eax@1 - char *v1; // edi@2 + Actor *v1; // edi@2 __int16 v2; // ax@3 int v3; // esi@5 float v4; // ST48_4@8 @@ -2944,23 +2961,23 @@ if ( (signed int)uNumActors > 0 ) { v54 = 0; - v1 = (char *)&pActors[0].vPosition.z; + v1 = pActors;//[0].vPosition.z; do { - v2 = *((short *)v1 + 15); - *(int *)(v1 - 110) &= 0xFFFFFFF7u; + v2 = v1->uAIState; + v1->uAttributes &= 0xFFFFFFF7u; if ( v2 == 11 || v2 == 19 ) goto LABEL_58; - v3 = *(short *)v1; + v3 = v1->vPosition.z; v49 = 0; - x = *((short *)v1 - 2); - y = *((short *)v1 - 1); - v61 = *(short *)v1; + x = v1->vPosition.x; + y = v1->vPosition.y; + v61 = v1->vPosition.z; if ( v2 == 17 ) { - if ( (v1[666] & 7) != 3 || pActors[*(int *)(v1 + 666) >> 3].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 ) + if ( (v1->uSummonerID & 7) != 3 || pActors[v1->uSummonerID >> 3].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 ) { - v6 = (double)*((short *)v1 - 4) * 0.5; + v6 = (double)v1->uActorHeight * 0.5; v7 = v6 + 6.7553994e15; v3 += LODWORD(v7); v61 = v3; @@ -2968,31 +2985,31 @@ else { v49 = 1; - pGame->pStru6Instance->_4A7F74(*((short *)v1 - 2), *((short *)v1 - 1), v3); + pGame->pStru6Instance->_4A7F74(v1->vPosition.x, v1->vPosition.y, v3); v4 = (1.0 - (double)*(signed int *)(v1 + 38) / (double)*((short *)v1 + 7)) - * (double)(2 * (signed int)*((short *)v1 - 4)); + * (double)(2 * (signed int)v1->uActorHeight); v5 = v4 + 6.7553994e15; v3 -= LODWORD(v5); v61 = v3; - if ( v3 > *(short *)v1 ) + if ( v3 > v1->vPosition.z ) { - v61 = *(short *)v1; - v3 = *(short *)v1; + v61 = v1->vPosition.z; + v3 = v1->vPosition.z; } } } v8 = stru_5C6E00->Atan2( - *((short *)v1 - 2) - pIndoorCamera->pos.x, - *((short *)v1 - 1) - pIndoorCamera->pos.y); - LOWORD(v9) = *((short *)v1 + 4); + v1->vPosition.x - pIndoorCamera->pos.x, + v1->vPosition.y - pIndoorCamera->pos.y); + LOWORD(v9) = v1->uYawAngle; v41 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v9 - v8) >> 8) & 7; - v10 = *((short *)v1 + 16); + v10 = v1->uCurrentActionAnimation; if ( pParty->bTurnBasedModeOn ) { if ( v10 != 1 ) { LABEL_17: - v12 = *(int *)(v1 + 38); + v12 = v1->uCurrentActionTime; goto LABEL_18; } v11 = pMiscTimer->uTotalGameTimeElapsed; @@ -3005,9 +3022,9 @@ } v12 = v54 + v11; LABEL_18: - if ( *(_QWORD *)(v1 + 146) > 0i64 || *(_QWORD *)(v1 + 162) > 0i64 ) + if ( (signed __int64)v1->pActorBuffs[5].uExpireTime > 0 || (signed __int64)v1->pActorBuffs[6].uExpireTime > 0 ) v12 = 0; - v13 = *((short *)v1 + 15); + v13 = v1->uAIState; if ( v13 == 17 && !v49 ) { v40 = v12; @@ -3017,7 +3034,7 @@ goto LABEL_25; } v40 = v12; - v39 = *(short *)&v1[2 * v10 + 42]; + v39 = v1->pSpriteIDs[v10]; if ( v13 != 16 ) goto LABEL_24; v14 = pSpriteFrameTable->GetFrameBy_x(v39, v12); @@ -3094,20 +3111,20 @@ return result; ++uNumBillboardsToDraw; ++uNumSpritesDrawnThisFrame; - *(int *)(v1 - 110) |= 8u; + v1->uAttributes |= 8u; v28->uHwSpriteID = v15->pHwSpriteIDs[v41]; v29 = v15->uPaletteIndex; v28->uIndoorSectorID = 0; v28->uPalette = v29; v28->field_0 = (unsigned __int64)(v15->scale * (signed __int64)v58) >> 16; - v30 = *(int *)(v1 + 118) == 0; - v31 = *(int *)(v1 + 118) < 0; + v30 = HIDWORD(v1->pActorBuffs[3].uExpireTime) == 0; + v31 = SHIDWORD(v1->pActorBuffs[3].uExpireTime) < 0; v28->field_4 = (unsigned __int64)(v15->scale * (signed __int64)v57) >> 16; - if ( v31 || v31 | v30 && *(int *)(v1 + 114) <= 0u ) + if ( v31 || v31 | v30 && LODWORD(v1->pActorBuffs[3].uExpireTime) <= 0u ) { - if ( *(_QWORD *)(v1 + 226) > 0i64 ) + if ( (signed __int64)v1->pActorBuffs[10].uExpireTime > 0i64 ) { - v52 = (unsigned __int64)(pGame->pStru6Instance->_4A806F((Actor *)(v1 - 146)) + v52 = (unsigned __int64)(pGame->pStru6Instance->_4A806F(v1) * (signed __int64)v28->field_4) >> 16; LABEL_53: LOWORD(v27) = v43; @@ -3116,10 +3133,10 @@ } else { - v32 = *((short *)v1 + 61); + v32 = v1->pActorBuffs[3].uPower; if ( v32 ) { - v33 = *((short *)v1 + 61); + v33 = v1->pActorBuffs[3].uPower; v28->field_0 = (unsigned __int64)(65536 / (unsigned __int16)v32 * (signed __int64)v28->field_0) >> 16; v52 = (unsigned __int64)(65536 / v33 * (signed __int64)v28->field_4) >> 16; goto LABEL_53; @@ -3136,20 +3153,20 @@ v28->sZValue = v34 + (8 * v59 | 3); v28->field_14 = v59; v35 = pMonsterList->pMonsters; - v36 = *((short *)v1 - 25); - v37 = *(int *)(v1 + 150) == 0; - v38 = *(int *)(v1 + 150) < 0; + v36 = v1->pMonsterInfo.uID; + v37 = HIDWORD(v1->pActorBuffs[5].uExpireTime) == 0; + v38 = SHIDWORD(v1->pActorBuffs[5].uExpireTime) < 0; v28->field_1E = v62 | 0x200; v28->pSpriteFrame = v15; v28->uTintColor = *((int *)&v35[v36] - 36); - if ( !v38 && (!(v38 | v37) || *(int *)(v1 + 146)) ) + if ( !v38 && (!(v38 | v37) || LODWORD(v1->pActorBuffs[5].uExpireTime)) ) v28->field_1E = v62 | 0x200; } LABEL_58: ++v59; v54 += 32; result = v59; - v1 += 836; + ++v1; } while ( v59 < (signed int)uNumActors ); }