Mercurial > mm7
changeset 82:1faa29fd4c2d
many type, memory, boundary fixes
author | zipi |
---|---|
date | Sun, 03 Feb 2013 23:37:17 +0000 |
parents | 377535d6e366 |
children | be45fc285970 |
files | Actor.cpp AudioPlayer.cpp Outdoor.cpp Party.cpp Vis.cpp mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_5.cpp mm7_6.cpp |
diffstat | 10 files changed, 321 insertions(+), 289 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Sun Feb 03 15:36:54 2013 +0000 +++ b/Actor.cpp Sun Feb 03 23:37:17 2013 +0000 @@ -1435,7 +1435,7 @@ void Actor::_43AC45(unsigned int uActorID, int a2) { Actor *v2; // esi@1 - char *v3; // edi@4 + Actor *v3; // edi@4 int v4; // ebx@8 int v5; // ST1C_4@8 int v6; // eax@8 @@ -1451,29 +1451,29 @@ v9 = 0; if ( (signed int)uNumActors > 0 ) { - v3 = (char *)&pActors[0].vPosition.y; + v3 = pActors; do { - if ( ((Actor *)(v3 - 144))->CanAct() ) + if ( v3->CanAct() ) { if ( v9 != uActorID_ ) { - if ( Actor::_43ABB0(v2, (Actor *)(v3 - 144)) ) + if ( Actor::_43ABB0(v2, v3) ) { - v4 = abs(*((short *)v3 - 1) - v2->vPosition.x); - v5 = abs(*(short *)v3 - v2->vPosition.y); - v6 = abs(*((short *)v3 + 1) - v2->vPosition.z); + v4 = abs(v3->vPosition.x - v2->vPosition.x); + v5 = abs(v3->vPosition.y - v2->vPosition.y); + v6 = abs(v3->vPosition.z - v2->vPosition.z); if ( (double)sub_4621DA(v4, v5, v6) < 4096.0 ) { - *(v3 - 83) = 4; + v3->pMonsterInfo.uHostilityType = (MonsterInfo::HostilityRadius)4; if ( v7 == 1 ) - *(v3 - 106) |= 8u; + BYTE2(v3->uAttributes) |= 8u; } } } } ++v9; - v3 += 836; + ++v3; } while ( v9 < (signed int)uNumActors ); } @@ -3026,7 +3026,7 @@ signed int v6; // edx@2 ActorJob *v7; // eax@2 signed int v8; // edi@2 - char *v9; // ecx@2 + ActorJob *v9; // ecx@2 __int16 v10; // cx@15 signed int v12; // [sp+8h] [bp-4h]@1 @@ -3039,16 +3039,16 @@ v6 = 65535; v7 = &v4->pScheduledJobs[v3]; v8 = 7; - v9 = (char *)&v7[7].uHour; - while ( !(*(v9 - 3) & 1) || (unsigned __int8)*v9 > v12 ) + v9 = &v7[7];//(char *)&v7[7].uHour; + while ( !(v9->uAttributes & 1) || v9->uHour > v12 ) { --v8; - v9 -= 12; + --v9; if ( v8 < 0 ) - goto LABEL_8; + break; } - v6 = v8; -LABEL_8: + if( v8 >= 0 ) + v6 = v8; if ( !v8 && v6 == 65535 ) v6 = 7; v5 = &v7[v6]; @@ -3692,7 +3692,7 @@ unsigned int v4; // ebx@1 int v5; // ecx@1 unsigned int v6; // eax@1 - char *v7; // edi@2 + Actor *v7; // edi@2 __int16 v8; // ax@3 int v9; // eax@10 signed int v10; // eax@13 @@ -3728,25 +3728,25 @@ v26 = 0; if ( (signed int)uNumActors <= 0 ) goto LABEL_26; - v7 = (char *)&pActors[0].uAIState; + v7 = pActors; do { - v8 = *(short *)v7; - if ( *(short *)v7 == 5 || v8 == 4 || v8 == 11 || v8 == 17 || v8 == 19 || v22 == v5 ) + v8 = v7->uAIState; + if ( v7->uAIState == 5 || v8 == 4 || v8 == 11 || v8 == 17 || v8 == 19 || v22 == v5 ) goto LABEL_23; if ( v24 == v4 || (v9 = 8 * v5, LOBYTE(v9) = 8 * v5 | 3, v24 != v9) ) goto LABEL_13; - if ( ((Actor *)(v7 - 176))->IsAlive() == 1 ) + if ( v7->IsAlive() == 1 ) { v24 = v4; v3->uLastCharacterIDToHit = v4; LABEL_13: - v10 = v3->GetActorsRelation((Actor *)(v7 - 176)); + v10 = v3->GetActorsRelation(v7); if ( v10 == v4 ) goto LABEL_23; goto LABEL_14; } - v18 = *((unsigned int *)v7 + 133); + v18 = v7->uGroup; if ( (v18 != v4 || v3->uGroup != v4) && v18 == v3->uGroup ) goto LABEL_23; v10 = 4; @@ -3754,9 +3754,9 @@ if ( v3->pMonsterInfo.uHostilityType ) v10 = pMonsterStats->pInfos[v3->pMonsterInfo.uID].uHostilityType; v11 = dword_4DF380[v10]; - v23 = abs(v3->vPosition.x - *((short *)v7 - 17)); - v27 = abs(v3->vPosition.y - *((short *)v7 - 16)); - v12 = abs(v3->vPosition.z - *((short *)v7 - 15)); + v23 = abs(v3->vPosition.x - v7->vPosition.x); + v27 = abs(v3->vPosition.y - v7->vPosition.y); + v12 = abs(v3->vPosition.z - v7->vPosition.z); v19 = v12; if ( v23 <= v11 && v27 <= v11 @@ -3769,7 +3769,7 @@ } v4 = 0; LABEL_23: - v7 += 836; + ++v7; v5 = v26++ + 1; } while ( v26 < (signed int)uNumActors );
--- a/AudioPlayer.cpp Sun Feb 03 15:36:54 2013 +0000 +++ b/AudioPlayer.cpp Sun Feb 03 23:37:17 2013 +0000 @@ -1797,7 +1797,7 @@ { //AudioPlayer *v3; // esi@1 int v4; // ecx@1 - char *v5; // edi@4 + AudioPlayer_3DSample *v5; // edi@4 int v6; // ebx@12 MixerChannel *pChannel; // edi@14 //_STREAM *v8; // esi@23 @@ -1812,16 +1812,16 @@ v9 = 0; if ( uNum3DSamples > 0 ) { - v5 = (char *)&p3DSamples[0].field_8; + v5 = p3DSamples;//;(char *)&p3DSamples[0].field_8; do { if ( (uStartChannel == -1 || v4 < uStartChannel || v4 > uEndChannel) - && *(int *)v5 - && pSoundList->pSounds[*(int *)v5].eType != SOUND_DESC_SYSTEM) + && v5->field_8 + && pSoundList->pSounds[v5->field_8].eType != SOUND_DESC_SYSTEM) { - AIL_end_3D_sample(*((int **)v5 - 2)); - _4ABF23((AudioPlayer_3DSample *)(v5 - 8)); - *((int *)v5 - 1) = 0; + AIL_end_3D_sample(v5->hSample); + _4ABF23(v5); + v5->field_4 = 0; v4 = v9; } ++v4;
--- a/Outdoor.cpp Sun Feb 03 15:36:54 2013 +0000 +++ b/Outdoor.cpp Sun Feb 03 23:37:17 2013 +0000 @@ -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;
--- a/Party.cpp Sun Feb 03 15:36:54 2013 +0000 +++ b/Party.cpp Sun Feb 03 23:37:17 2013 +0000 @@ -870,13 +870,13 @@ //----- (004909F4) -------------------------------------------------------- void Party::_4909F4() { - char *v1; // esi@2 + Player *v1; // esi@2 unsigned int v2; // eax@3 __int16 v3; // cx@5 int v4; // edx@27 signed int v5; // eax@52 PlayerFrame *v6; // edx@53 - char *v7; // esi@60 + NPCData *v7; // esi@60 signed int v8; // ebp@61 int v9; // ebx@62 unsigned int v10; // edi@62 @@ -885,21 +885,21 @@ if ( dword_A75070 != stru_51076C.field_8 ) { dword_A75070 = stru_51076C.field_8; - v1 = (char *)&this->pPlayers[0].uExpressionID; + v1 = this->pPlayers;//(char *)&this->pPlayers[0].uExpressionID; v11 = 4; do { v2 = ((Player *)(v1 - 6812))->GetMajorConditionIdx(); if ( v2 == 18 || v2 == 17 ) { - *((short *)v1 + 1) += LOWORD(pMiscTimer->uTimeElapsed); - if ( *((short *)v1 + 1) >= *((short *)v1 + 2) ) + v1->uExpressionTimePassed += LOWORD(pMiscTimer->uTimeElapsed); + if ( (unsigned __int16)v1->uExpressionTimePassed >= v1->uExpressionTimeLength ) { - if ( *(short *)v1 != 1 || rand() % 5 ) + if ( v1->uExpressionID != 1 || rand() % 5 ) { - *((short *)v1 + 1) = 0; - *(short *)v1 = 1; - *((short *)v1 + 2) = rand() % 256 + 32; + v1->uExpressionTimePassed = 0; + v1->uExpressionID = 1; + v1->uExpressionTimeLength = rand() % 256 + 32; } else { @@ -927,67 +927,67 @@ if ( v4 >= 82 ) { if ( v4 >= 88 ) - *(short *)v1 = (v4 >= 94) + 29; + v1->uExpressionID = (v4 >= 94) + 29; else - *(short *)v1 = 57; + v1->uExpressionID = 57; } else { - *(short *)v1 = 56; + v1->uExpressionID = 56; } } else { - *(short *)v1 = 55; + v1->uExpressionID = 55; } } else { - *(short *)v1 = 54; + v1->uExpressionID = 54; } } else { - *(short *)v1 = 20; + v1->uExpressionID = 20; } } else { - *(short *)v1 = 19; + v1->uExpressionID = 19; } } else { - *(short *)v1 = 18; + v1->uExpressionID = 18; } } else { - *(short *)v1 = 17; + v1->uExpressionID = 17; } } else { - *(short *)v1 = 16; + v1->uExpressionID = 16; } } else { - *(short *)v1 = 15; + v1->uExpressionID = 15; } } else { - *(short *)v1 = 14; + v1->uExpressionID = 14; } } else { - *(short *)v1 = 13; + v1->uExpressionID = 13; } v5 = 0; - *((short *)v1 + 1) = 0; - if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) + v1->uExpressionTimePassed = 0; + if ( (signed int)pPlayerFrameTable->uNumFrames <= 0 ) { LABEL_56: v5 = 0; @@ -995,7 +995,7 @@ else { v6 = pPlayerFrameTable->pFrames; - while ( v6->uSequenceID != *(short *)v1 ) + while ( v6->uSequenceID != v1->uExpressionID ) { ++v5; ++v6; @@ -1003,62 +1003,62 @@ goto LABEL_56; } } - *((short *)v1 + 2) = 8 * pPlayerFrameTable->pFrames[v5].uAnimLength; + v1->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[v5].uAnimLength; } } } else { - v3 = *(short *)v1; - if ( *(short *)v1 != 34 && v3 != 35 && v3 != 36 - || (signed int)(pMiscTimer->uTimeElapsed + *((short *)v1 + 1)) >= *((short *)v1 + 2) ) + v3 = v1->uExpressionID; + if ( v1->uExpressionID != 34 && v3 != 35 && v3 != 36 + || (signed int)(pMiscTimer->uTimeElapsed + v1->uExpressionTimePassed) >= v1->uExpressionTimeLength ) { - *((short *)v1 + 2) = 0; - *((short *)v1 + 1) = 0; + v1->uExpressionTimeLength = 0; + v1->uExpressionTimePassed = 0; switch ( v2 ) { case 0xEu: - *(short *)v1 = 98; + v1->uExpressionID = 98; break; case 0xFu: - *(short *)v1 = 12; + v1->uExpressionID = 12; break; case 0x10u: - *(short *)v1 = 99; + v1->uExpressionID = 99; break; case 0u: - *(short *)v1 = 2; + v1->uExpressionID = 2; break; case 1u: - *(short *)v1 = 3; + v1->uExpressionID = 3; break; case 2u: - *(short *)v1 = 4; + v1->uExpressionID = 4; break; case 3u: - *(short *)v1 = 5; + v1->uExpressionID = 5; break; case 4u: - *(short *)v1 = 6; + v1->uExpressionID = 6; break; case 5u: - *(short *)v1 = 7; + v1->uExpressionID = 7; break; case 6u: case 8u: case 0xAu: - *(short *)v1 = 8; + v1->uExpressionID = 8; break; case 7u: case 9u: case 0xBu: - *(short *)v1 = 9; + v1->uExpressionID = 9; break; case 0xCu: - *(short *)v1 = 10; + v1->uExpressionID = 10; break; case 0xDu: - *(short *)v1 = 11; + v1->uExpressionID = 11; break; default: break; @@ -1066,38 +1066,38 @@ } else { - *((short *)v1 + 1) += LOWORD(pMiscTimer->uTimeElapsed); - } + v1->uExpressionTimePassed += LOWORD(pMiscTimer->uTimeElapsed); + } } - v1 += 6972; + ++v1; --v11; } while ( v11 ); - v7 = (char *)&pParty->pHirelings[0].evtb; + v7 = pParty->pHirelings;//(char *)&pParty->pHirelings[0].evtb; do { - v8 = *((int *)v7 + 1); + v8 = v7->evtc; if ( v8 ) { - v9 = *((int *)v7 - 1); - v10 = pMiscTimer->uTimeElapsed + *(int *)v7; + v9 = v7->bDrawSomeAnim; + v10 = pMiscTimer->uTimeElapsed + v7->evtb; if ( (signed int)v10 >= v8 ) { v9 = 0; v8 = 0; v10 = 0; - memset(v7 - 44, 0, 0x4Cu); + memset(v7, 0, 0x4Cu); pParty->field_709 = 0; //sub_44A56A();Ritor1: it's temporarily viewparams->bRedrawGameUI = 1; } - *(int *)v7 = v10; - *((int *)v7 + 1) = v8; - *((int *)v7 - 1) = v9; + v7->evtb = v10; + v7->evtc = v8; + v7->bDrawSomeAnim = v9; } - v7 += 76; + ++v7; } - while ( (signed int)v7 < (signed int)&pParty->field_777C[1] ); + while ( v7 <= &pParty->pHirelings[1] ); } } // A75070: using guessed type int dword_A75070;
--- a/Vis.cpp Sun Feb 03 15:36:54 2013 +0000 +++ b/Vis.cpp Sun Feb 03 23:37:17 2013 +0000 @@ -119,10 +119,10 @@ char Vis::_4C12C3_FindSomeBillboard(RenderVertexSoft *a1, int a2, float a3, float a4) { signed int v5; // esi@1 - char *v6; // edi@2 + RenderBillboardD3D *v6; // edi@2 double v7; // st7@9 int v8; // edx@9 - char *v9; // ecx@10 + RenderVertexSoft *v9; // ecx@10 char result; // al@24 Vis *thisa; // [sp+10h] [bp-8h]@1 float thisb; // [sp+10h] [bp-8h]@9 @@ -134,20 +134,24 @@ v5 = 0; thisa = this; if ( (signed int)pRenderer->uNumBillboardsToDraw <= 0 ) - goto LABEL_28; - v6 = (char *)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID; + { + return 0; + } + v6 = pRenderer->pBillboardRenderListD3D; do { - if ( IsPointInsideD3DBillboard((RenderBillboardD3D *)(v6 - 152), a3, a4) + if ( IsPointInsideD3DBillboard(v6, a3, a4) && (v13 == -1 - || (unsigned int)pBillboardRenderList[*(int *)v6].sZValue < pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].uParentBillboardID].sZValue) ) + || (unsigned int)pBillboardRenderList[v6->uParentBillboardID].sZValue < pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].uParentBillboardID].sZValue) ) v13 = v5; ++v5; - v6 += 156; + ++v6; } while ( v5 < (signed int)pRenderer->uNumBillboardsToDraw ); if ( v13 == -1 ) - goto LABEL_28; + { + return 0; + } v7 = 3.4028235e38; v8 = a2; a4a = 3.4028235e38; @@ -155,18 +159,18 @@ thisb = -3.4028235e38; if ( a2 > 0 ) { - v9 = (char *)&a1->vWorldViewProjY; + v9 = a1; do { - if ( *((float *)v9 - 1) < v7 ) - v7 = *((float *)v9 - 1); - if ( *((float *)v9 - 1) > (double)a3a ) - a3a = *((float *)v9 - 1); - if ( *(float *)v9 < (double)a4a ) - a4a = *(float *)v9; - if ( *(float *)v9 > (double)thisb ) - thisb = *(float *)v9; - v9 += 48; + if ( v9->vWorldViewProjX < v7 ) + v7 = v9->vWorldViewProjX; + if ( v9->vWorldViewProjX > (double)a3a ) + a3a = v9->vWorldViewProjX; + if ( v9->vWorldViewProjY < (double)a4a ) + a4a = v9->vWorldViewProjY; + if ( v9->vWorldViewProjY > (double)thisb ) + thisb = v9->vWorldViewProjY; + ++v9; --v8; } while ( v8 ); @@ -175,7 +179,6 @@ || pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.y > (double)a4a || pRenderer->pBillboardRenderListD3D[v13].pQuards[3].pos.x < (double)a3a || pRenderer->pBillboardRenderListD3D[v13].pQuards[1].pos.y < (double)thisb ) -LABEL_28: result = 0; else result = 1; @@ -237,14 +240,14 @@ int v6; // ST1C_4@6 Vis_stru1_stru0 *v7; // edi@6 Vis *thisa; // [sp+20h] [bp-Ch]@1 - void **v9; // [sp+24h] [bp-8h]@2 + RenderBillboardD3D *v9; // [sp+24h] [bp-8h]@2 unsigned int uD3DBillboardIdx; // [sp+28h] [bp-4h]@1 uD3DBillboardIdx = 0; thisa = this; if ( (signed int)pRenderer->uNumBillboardsToDraw > 0 ) { - v9 = (void **)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID; + v9 = pRenderer->pBillboardRenderListD3D;//[0].uParentBillboardID; do { if ( is_part_of_selection((BLVFace *)uD3DBillboardIdx, a2) @@ -252,9 +255,9 @@ { if ( DoesRayIntersectBillboard(fPickDepth, uD3DBillboardIdx) ) { - v6 = pBillboardRenderList[(int)*v9].sZValue; + v6 = pBillboardRenderList[v9->uParentBillboardID].sZValue; v7 = &a4->array_0004[a4->uNumPointers]; - v7->pObjectInfo = *v9; + v7->pObjectInfo = (void *)v9->uParentBillboardID; v7 = (Vis_stru1_stru0 *)((char *)v7 + 4); v7->pObjectInfo = (void *)v6; v7->sZValue = 1; @@ -262,7 +265,7 @@ } } ++uD3DBillboardIdx; - v9 += 39; + ++v9; } while ( (signed int)uD3DBillboardIdx < (signed int)pRenderer->uNumBillboardsToDraw ); }
--- a/mm7_1.cpp Sun Feb 03 15:36:54 2013 +0000 +++ b/mm7_1.cpp Sun Feb 03 23:37:17 2013 +0000 @@ -4253,7 +4253,7 @@ int v9; // [sp+9Ch] [bp-10h]@10 unsigned int v10; // [sp+A0h] [bp-Ch]@1 unsigned int v11; // [sp+A4h] [bp-8h]@8 - unsigned int *v12; // [sp+A8h] [bp-4h]@9 + ItemGen *v12; // [sp+A8h] [bp-4h]@9 v1 = 0; v2 = uChestID; @@ -4282,10 +4282,10 @@ v11 = 0; if ( uChestArea > 0 ) { - v12 = &pChests[v3].mm7__vector_pItems[0].uAttributes; + v12 = pChests[v3].mm7__vector_pItems;//&pChests[v3].mm7__vector_pItems[0].uAttributes; do { - v9 = *(v12 - 5); + v9 = v12->uItemID; if ( v9 ) { v6 = 0; @@ -4293,15 +4293,17 @@ { ++v6; if ( v6 >= uChestArea ) - goto LABEL_17; + break; } - Chest::PlaceItemAt((unsigned __int8)Dst[v6], v11, v10); - if ( pChests[v3].uFlags & 4 ) - *v12 |= 1u; - } -LABEL_17: + if(v6<uChestArea) + { + Chest::PlaceItemAt((unsigned __int8)Dst[v6], v11, v10); + if ( pChests[v3].uFlags & 4 ) + v12->uAttributes |= 1u; + } + } ++v11; - v12 += 9; + ++v12; } while ( (signed int)v11 < uChestArea ); }
--- a/mm7_2.cpp Sun Feb 03 15:36:54 2013 +0000 +++ b/mm7_2.cpp Sun Feb 03 23:37:17 2013 +0000 @@ -2930,10 +2930,10 @@ { unsigned int v1; // esi@8 unsigned int v3; // ecx@10 - char *v4; // esi@15 + Player *v4; // esi@15 int v5; // ebx@16 int v6; // ST38_4@16 - char *v7; // esi@18 + Player *v7; // esi@18 int v8; // ebx@19 int v9; // ST30_4@19 int v10; // ST44_4@19 @@ -3064,10 +3064,10 @@ } if ( a1 == 11 ) { - v7 = (char *)&pParty->pPlayers[0].pConditions[15]; + v7 = pParty->pPlayers;//(char *)&pParty->pPlayers[0].pConditions[15]; do { - v8 = *((int *)v7 - 2); + /*v8 = *((int *)v7 - 2); v9 = *((int *)v7 - 1); v10 = *(int *)v7; v11 = *((int *)v7 + 1); @@ -3076,38 +3076,48 @@ v14 = *((int *)v7 + 8); v15 = *((int *)v7 + 9); v16 = *((int *)v7 + 4); - v17 = *((int *)v7 + 5); - memset(v7 - 120, 0, 0xA0u); - *((int *)v7 + 2) = v12; - *((int *)v7 + 3) = v13; - *(int *)v7 = v10; - *((int *)v7 + 1) = v11; - *((int *)v7 - 1) = v9; - *((int *)v7 + 8) = v14; - *((int *)v7 + 9) = v15; - *((int *)v7 + 4) = v16; - *((int *)v7 - 2) = v8; - *((int *)v7 + 5) = v17; - *((int *)v7 + 1585) = ((Player *)(v7 - 120))->GetMaxHealth(); - v7 += 6972; - } - while ( (signed int)v7 < (signed int)&pParty->pHirelings[1].evtb ); + v17 = *((int *)v7 + 5);*/ + v8 = LODWORD(v7->pConditions[14]); + v9 = HIDWORD(v7->pConditions[14]); + v10 = LODWORD(v7->pConditions[15]); + v11 = HIDWORD(v7->pConditions[15]); + v12 = LODWORD(v7->pConditions[16]); + v13 = HIDWORD(v7->pConditions[16]); + v14 = LODWORD(v7->pConditions[19]); + v15 = HIDWORD(v7->pConditions[19]); + v16 = LODWORD(v7->pConditions[17]); + v17 = HIDWORD(v7->pConditions[17]); + memset(v7, 0, 0xA0u); + LODWORD(v7->pConditions[16]) = v12; + HIDWORD(v7->pConditions[16]) = v13; + LODWORD(v7->pConditions[15]) = v10; + HIDWORD(v7->pConditions[15]) = v11; + HIDWORD(v7->pConditions[14]) = v9; + LODWORD(v7->pConditions[19]) = v14; + HIDWORD(v7->pConditions[19]) = v15; + LODWORD(v7->pConditions[17]) = v16; + LODWORD(v7->pConditions[14]) = v8; + HIDWORD(v7->pConditions[17]) = v17; + v7->sHealth = v7->GetMaxHealth(); + ++v7; + } + while ( v7 <= pPlayers[3] ); return 0; } if ( a1 == 12 ) { - v4 = (char *)&pParty->pPlayers[0].pActiveSkills[8]; + v4 = pParty->pPlayers;//(char *)&pParty->pPlayers[0].pActiveSkills[8]; do { - v5 = *((int *)v4 - 32); - v6 = *((int *)v4 - 31); - memset(v4 - 280, 0, 0xA0u); - *(int *)v4 = v5; - *((int *)v4 + 1) = v6; - *((int *)v4 + 1545) = ((Player *)(v4 - 280))->GetMaxHealth(); - v4 += 6972; - } - while ( (signed int)v4 < (signed int)&pParty->field_777C[22] ); + v5 = LODWORD(v4->pConditions[19]);//*((int *)v4 - 32); + v6 = HIDWORD(v4->pConditions[19]);//*((int *)v4 - 31); + memset(v4->pConditions, 0, 0xA0u); + v4->pActiveSkills[8] = v5; + v4->pActiveSkills[10] = v6; + v4->sHealth = v4->GetMaxHealth(); + ++v4; + } + while ( v4 <= pPlayers[3] ); return 0; } if ( a1 == 33 )
--- a/mm7_3.cpp Sun Feb 03 15:36:54 2013 +0000 +++ b/mm7_3.cpp Sun Feb 03 23:37:17 2013 +0000 @@ -18366,9 +18366,9 @@ unsigned int v3; // ebx@1 unsigned int v4; // ebp@1 signed int v5; // edi@1 - char *v6; // esi@4 + Actor *v6; // esi@4 size_t v7; // ecx@10 - char *v8; // eax@11 + Actor *v8; // eax@11 unsigned __int16 v9; // dx@14 v4 = uGroupID; @@ -18380,20 +18380,20 @@ { if ( (signed int)uNumActors > Standing ) { - v6 = (char *)&pActors[0].uAttributes; + v6 = pActors;//[0].uAttributes; do { - if ( *((_DWORD *)v6 + 168) == v4 ) - { - *(_DWORD *)v6 |= v3; + if ( v6->uGroup == v4 ) + { + v6->uAttributes |= v3; if ( v3 == 0x10000 ) { - *((_WORD *)v6 + 70) = Disabled; - ((Actor *)(v6 - 36))->UpdateAnimation(); + v6->uAIState = Disabled; + v6->UpdateAnimation(); } } ++v5; - v6 += 836; + ++v6; } while ( v5 < (signed int)uNumActors ); } @@ -18403,23 +18403,23 @@ v7 = uNumActors; if ( (signed int)uNumActors > Standing ) { - v8 = (char *)&pActors[0].uAIState; + v8 = pActors;//[0].uAIState; do { - if ( *((_DWORD *)v8 + 133) == v4 ) + if ( v8->uGroup == v4 ) { if ( v3 == 0x10000 ) { - v9 = *(_WORD *)v8; - if ( *(_WORD *)v8 != Dead ) + v9 = v8->uAIState; + if ( v8->uAIState != Dead ) { if ( v9 != 4 && v9 != 11 ) - *(_WORD *)v8 = Standing; - } - } - *((_DWORD *)v8 - 35) &= ~v3; - } - v8 += 836; + v8->uAIState = Standing; + } + } + LODWORD(v8->uAttributes) &= ~v3; + } + ++v8; --v7; } while ( v7 ); @@ -19905,7 +19905,7 @@ //----- (004016FA) -------------------------------------------------------- int __cdecl BLV_4016FA_AI() { - char *v0; // esi@2 + Actor *v0; // esi@2 int v1; // eax@4 int v2; // ebx@4 unsigned int v3; // ecx@4 @@ -19929,7 +19929,7 @@ bool v21; // eax@33 int v22; // eax@34 signed int v23; // ebx@36 - char *v24; // esi@37 + Actor *v24; // esi@37 signed int v25; // eax@40 int v26; // eax@43 int v27; // ebx@45 @@ -19957,15 +19957,15 @@ v43 = 0; if ( (signed int)uNumActors > 0 ) { - v0 = (char *)&pActors[0].uAttributes; - do - { - v0[1] &= 0xFBu; - if ( ! ((Actor *)(v0 - 36))->CanAct() ) + v0 = pActors;//[0].uAttributes; + do + { + BYTE1(v0->uAttributes) &= 0xFBu; + if ( ! v0->CanAct() ) goto LABEL_60; - v39 = abs(pParty->vPosition.z - *((short *)v0 + 55)); - v38 = abs(pParty->vPosition.y - *((short *)v0 + 54)); - v1 = abs(pParty->vPosition.x - *((short *)v0 + 53)); + v39 = abs(pParty->vPosition.z - v0->vPosition.z); + v38 = abs(pParty->vPosition.y - v0->vPosition.y); + v1 = abs(pParty->vPosition.x - v0->vPosition.x); v2 = v38; v3 = v39; if ( v1 < v38 ) @@ -19987,7 +19987,7 @@ v2 = v6; } v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1; - v8 = *((short *)v0 + 50); + v8 = v0->uActorRadius; v9 = v7 - v8; v40 = v7 - v8; if ( v40 < 0 ) @@ -19997,12 +19997,12 @@ } if ( v9 < 10240 ) { - v10 = *(int *)v0 & 0xFEFFFFFF; - *(int *)v0 = v10; - if ( v10 & 0x80000 || ((Actor *)(v0 - 36))->GetActorsRelation(0) ) + v10 = v0->uAttributes & 0xFEFFFFFF; + v0->uAttributes = v10; + if ( v10 & 0x80000 || v0->GetActorsRelation(0) ) { v11 = (pParty->uFlags & 0x10) == 0; - *(int *)v0 = v10 | 0x1000000; + v0->uAttributes = v10 | 0x1000000; if ( v11 && (double)v40 < 307.2 ) pParty->uFlags |= 0x10u; if ( !(pParty->uFlags & 0x20) && v9 < 5120 ) @@ -20015,10 +20015,10 @@ else { LABEL_60: - v0[1] &= 0xBFu; + BYTE1(v0->uAttributes) &= 0xBFu; } ++v43; - v0 += 836; + ++v0; } while ( v43 < (signed int)uNumActors ); } @@ -20074,17 +20074,17 @@ ai_arrays_size = v19; if ( (signed int)uNumActors > 0 ) { - v24 = (char *)&pActors[0].uAttributes; - do - { - if ( ((Actor *)(v24 - 36))->CanAct() && *((short *)v24 + 61) == v37 ) + v24 = pActors;//[0].uAttributes; + do + { + if ( v24->CanAct() && v24->uSectorID == v37 ) { v25 = 0; if ( v19 <= 0 ) { LABEL_43: v26 = ai_arrays_size; - v24[1] |= 0x40u; + BYTE1(v24->uAttributes) |= 0x40u; ++ai_arrays_size; ai_array_4F6638_actor_ids[v26] = v23; } @@ -20099,7 +20099,7 @@ } } ++v23; - v24 += 836; + ++v24; } while ( v23 < (signed int)uNumActors ); } @@ -20160,7 +20160,7 @@ int v2; // ecx@7 int v3; // eax@7 signed int v4; // edi@10 - char *v5; // esi@12 + Actor *v5; // esi@12 signed int v6; // eax@14 __int16 v7; // cx@14 Player **v8; // esi@20 @@ -20271,14 +20271,14 @@ v84 = 0; if ( (signed int)uNumActors > 0 ) { - v5 = (char *)&pActors[0].sCurrentHP; + v5 = pActors;//[0].sCurrentHP; do { - if ( ((Actor *)(v5 - 40))->CanAct() ) - { - v6 = stru_50C198.CalcMagicalDamageToActor((Actor *)(v5 - 40), 5, v4); - v7 = *(short *)v5 - v6; - *(short *)v5 = v7; + if ( v5->CanAct() ) + { + v6 = stru_50C198.CalcMagicalDamageToActor(v5, 5, v4); + v7 = v5->sCurrentHP - v6; + v5->sCurrentHP = v7; if ( v6 ) { if ( v7 >= 0 ) @@ -20288,13 +20288,13 @@ else { Actor::Die(v84); - if ( *((int *)v5 + 19) ) - sub_4269A2_GivePartyExp(pMonsterStats->pInfos[*((short *)v5 + 28)].uExp); + if ( v5->pMonsterInfo.uExp ) + sub_4269A2_GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp); } } } ++v84; - v5 += 836; + ++v5; } while ( (signed int)v84 < (signed int)uNumActors ); }
--- a/mm7_5.cpp Sun Feb 03 15:36:54 2013 +0000 +++ b/mm7_5.cpp Sun Feb 03 23:37:17 2013 +0000 @@ -12102,7 +12102,7 @@ { unsigned int *v2; // esi@1 signed int v3; // ebx@1 - char *v4; // edi@2 + Actor *v4; // edi@2 int v5; // eax@3 int v7; // [sp+8h] [bp-Ch]@1 int v8; // [sp+Ch] [bp-8h]@1 @@ -12116,21 +12116,21 @@ v9 = 0; if ( (signed int)uNumActors > 0 ) { - v4 = (char *)&pActors[0].pMonsterInfo.uID; + v4 = pActors;//[0].pMonsterInfo.uID; do { - v5 = *((int *)v4 - 15); // actor::attributes + v5 = v4->uAttributes; // actor::attributes if ( (v5 & 0x100000) == v8 ) { - if ( *(short *)v4 - 1 == v7 ) + if ( v4->pMonsterInfo.field_33 == v7 ) { ++*v2; - if ( ((Actor *)(v4 - 96))->IsAlive() == 1 ) + if ( v4->IsAlive() == 1 ) ++v9; } } ++v3; - v4 += 836; + ++v4; } while ( v3 < (signed int)uNumActors ); } @@ -12142,7 +12142,7 @@ { unsigned int *v2; // esi@1 signed int v3; // ebx@1 - char *v4; // edi@2 + Actor *v4; // edi@2 int v5; // eax@3 unsigned int v7; // [sp+8h] [bp-Ch]@1 int v8; // [sp+Ch] [bp-8h]@1 @@ -12156,21 +12156,21 @@ v9 = 0; if ( (signed int)uNumActors > 0 ) { - v4 = (char *)&pActors[0].uGroup; + v4 = pActors;//[0].uGroup; do { - v5 = *((int *)v4 - 168); + v5 = v4->uAttributes; if ( (v5 & 0x100000) == v8 ) { - if ( *(int *)v4 == v7 ) + if ( v4->uGroup == v7 ) { ++*v2; - if ( ((Actor *)(v4 - 708))->IsAlive() == 1 ) + if ( v4->IsAlive() == 1 ) ++v9; } } ++v3; - v4 += 836; + ++v4; } while ( v3 < (signed int)uNumActors ); }
--- a/mm7_6.cpp Sun Feb 03 15:36:54 2013 +0000 +++ b/mm7_6.cpp Sun Feb 03 23:37:17 2013 +0000 @@ -1296,13 +1296,13 @@ { unsigned __int64 v1; // qax@1 signed int v2; // ecx@1 - char *v3; // esi@1 + int *v3; // esi@1 bool v4; // edi@6 - char *v5; // edi@10 - char *v6; // esi@10 + int *v5; // edi@10 + Player *v6; // esi@10 int v7; // eax@13 unsigned __int8 v8; // cf@13 - char v10; // [sp+Ch] [bp-14h]@1 + int v10; // [sp+Ch] [bp-14h]@1 int v11; // [sp+1Ch] [bp-4h]@10 v1 = __PAIR__((int)((char *)&pParty + 2620), a1); @@ -1314,40 +1314,40 @@ && !*(int *)HIDWORD(v1) && !*(_QWORD *)(HIDWORD(v1) + 8) && !*(_QWORD *)(HIDWORD(v1) + 16); - *(int *)v3 = v4; + *v3 = v4; HIDWORD(v1) += 6972; v2 += v4; - v3 += 4; + ++v3; } while ( SHIDWORD(v1) < (signed int)&pParty->pHirelings[1].field_24 ); if ( v2 ) { LODWORD(v1) = (signed int)v1 / v2; v5 = &v10; - v6 = (char *)&pParty->pPlayers[0].uExperience; + v6 = pParty->pPlayers;//[0].uExperience; v11 = v1; do { - if ( *(int *)v5 ) + if ( *v5 ) { if ( v11 ) { - LOBYTE(v7) = ((Player *)(v6 - 160))->GetLearningPercent(); + LOBYTE(v7) = v6->GetLearningPercent(); v1 = v11 + v11 * v7 / 100; - v8 = __CFADD__((int)v1, *(int *)v6); - *(int *)v6 += v1; - *((int *)v6 + 1) += HIDWORD(v1) + v8; - if ( *(_QWORD *)v6 > 4000000000i64 ) + v8 = __CFADD__((int)v1, LODWORD(v6->uExperience)); + LODWORD(v6->uExperience) += v1; + HIDWORD(v6->uExperience) += HIDWORD(v1) + v8; + if ( v6->uExperience > 4000000000i64 ) { - *((int *)v6 + 1) = 0; - *(int *)v6 = -294967296; + HIDWORD(v6->uExperience) = 0; + LODWORD(v6->uExperience) = -294967296; } } } - v6 += 6972; - v5 += 4; + ++v6; + ++v5; } - while ( (signed int)v6 < (signed int)&pParty->pPickedItem._bonus_strength ); + while ( v6 <= &pParty->pPlayers[3] ); } return v1; } @@ -8292,7 +8292,7 @@ signed int __cdecl sub_42F4DA() { signed int v0; // edi@1 - char *v1; // esi@4 + Actor *v1; // esi@4 int v2; // ebx@5 int v3; // eax@5 int v4; // ebx@5 @@ -8317,12 +8317,12 @@ } else { - v1 = (char *)&pActors[0].uAIState; + v1 = pActors; while ( 1 ) { - v2 = abs(*((short *)v1 - 17) - pParty->vPosition.x); - v11 = abs(*((short *)v1 - 16) - pParty->vPosition.y); - v12 = abs(*((short *)v1 - 15) - pParty->vPosition.z); + v2 = abs(v1->vInitialPosition.x - pParty->vPosition.x); + v11 = abs(v1->vInitialPosition.y - pParty->vPosition.y); + v12 = abs(v1->vInitialPosition.z - pParty->vPosition.z); v3 = v2; v4 = v11; v5 = v12; @@ -8346,19 +8346,19 @@ } if ( (signed int)(((unsigned int)(11 * v4) >> 5) + (v5 >> 2) + v3) < v0 ) { - v9 = *(short *)v1; - if ( *(short *)v1 != 5 ) + v9 = v1->uAIState; + if ( v1->uAIState != 5 ) { if ( v9 != 4 && v9 != 11 && v9 != 19 && v9 != 17 - && (*(v1 - 138) & 8 || ((Actor *)nullptr)->GetActorsRelation( (Actor *)(v1 - 176))) ) + && (BYTE2(v1->uAttributes) & 8 || ((Actor *)nullptr)->GetActorsRelation( v1)) ) break; } } ++v13; - v1 += 836; + ++v1; if ( v13 >= (signed int)uNumActors ) goto LABEL_20; }