Mercurial > mm7
diff Outdoor.cpp @ 87:170259c8c71f
Слияние
author | Ritor1 |
---|---|
date | Mon, 04 Feb 2013 09:17:49 +0600 |
parents | ec84db4c8f9d be45fc285970 |
children | b9196a36b7c9 56e11be29db1 |
line wrap: on
line diff
--- a/Outdoor.cpp Mon Feb 04 09:17:35 2013 +0600 +++ b/Outdoor.cpp Mon Feb 04 09:17:49 2013 +0600 @@ -58,7 +58,9 @@ v1 = 2; pIndoorCamera->sRotationX = pParty->sRotationX; pIndoorCamera->sRotationY = pParty->sRotationY; - pIndoorCamera->pos.x = pParty->vPosition.x - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) * (signed __int64)pParty->field_18) >> 16); + pIndoorCamera->pos.x = pParty->vPosition.x + - ((unsigned __int64)(stru_5C6E00->SinCos(pParty->sRotationY) + * (signed __int64)pParty->field_18) >> 16); v3 = stru_5C6E00->SinCos(pParty->sRotationY - stru_5C6E00->uIntegerHalfPi); pIndoorCamera->field_4C = v1; pIndoorCamera->pos.y = pParty->vPosition.y - pParty->field_18 * ((stru_5C6E00->SinCos(pParty->sRotationY)) >> 16); @@ -87,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 ) @@ -217,7 +219,7 @@ // 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); //----- (00488EEF) -------------------------------------------------------- -unsigned int OutdoorLocation::GetTileTexture(int sX, int sZ) +unsigned int OutdoorLocation::GetTileTexture(int sX, int sY) { //OutdoorLocation *v3; // esi@1 unsigned int v4; // edi@1 @@ -232,7 +234,7 @@ else result = DoGetTileTexture(v5, v4); return result;*/ - v4 = WorldPosToGridCellZ(sZ); + v4 = WorldPosToGridCellZ(sY); v5 = WorldPosToGridCellX(sX); if ( v5 < 0 || v5 > 127 || v4 < 0 || v4 > 127 ) return -1; @@ -1770,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; @@ -1854,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) { @@ -2128,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 ) //{ @@ -2145,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; @@ -2158,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; @@ -2397,9 +2399,9 @@ } //----- (0047ED08) -------------------------------------------------------- -unsigned int OutdoorLocation::DoGetTileTexture(unsigned int uX, unsigned int uZ) +unsigned int OutdoorLocation::DoGetTileTexture(unsigned int uX, unsigned int uY) { - int uTileID; // esi@5 + int v3; // esi@5 unsigned int result; // eax@9 @@ -2416,19 +2418,19 @@ result = pTileTable->pTiles[v3].uBitmapID; } return result;*/ - if (uX > 127 || uZ > 127) + if (uX > 127 || uY > 127) return 0; - uTileID = this->pTerrain.pTilemap[uZ * 128 + uX]; - if (uTileID < 198) + v3 = this->pTerrain.pTilemap[uY * 128 + uX]; + if (v3 < 198) { - if (uTileID >= 90) - uTileID = uTileID + this->pTileTypes[(uTileID - 90) / 18].uTileID - 36 * (uTileID - 90) / 36 - 90; + if (v3 >= 90) + v3 = v3 + this->pTileTypes[(v3 - 90) / 18].uTileID - 36 * (v3 - 90) / 36 - 90; } else - uTileID = uTileID + this->pTileTypes[3].uTileID - 198; + v3 = v3 + this->pTileTypes[3].uTileID - 198; - return pTileTable->pTiles[uTileID].uBitmapID; + return pTileTable->pTiles[v3].uBitmapID; } //----- (0047ED83) -------------------------------------------------------- @@ -2787,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 @@ -2798,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; @@ -2874,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 @@ -2942,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; @@ -2966,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; @@ -3003,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; @@ -3015,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); @@ -3092,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; @@ -3114,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; @@ -3134,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 ); }