Mercurial > mm7
changeset 90:d61f6bc04bf2
more pointer fixes
author | zipi |
---|---|
date | Wed, 06 Feb 2013 22:32:43 +0000 |
parents | 98cd93e14777 |
children | 471b1354cc73 |
files | Party.cpp mm7_2.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp |
diffstat | 5 files changed, 103 insertions(+), 101 deletions(-) [+] |
line wrap: on
line diff
--- a/Party.cpp Wed Feb 06 21:19:42 2013 +0000 +++ b/Party.cpp Wed Feb 06 22:32:43 2013 +0000 @@ -774,7 +774,7 @@ //----- (0043AD34) -------------------------------------------------------- void Party::Yell() { - void *v0; // esi@5 + Actor *v0; // esi@5 int v1; // edi@9 int v2; // ebx@9 int v3; // eax@9 @@ -787,19 +787,19 @@ v4 = 0; if ( (signed int)uNumActors > 0 ) { - v0 = &pActors[0].pMonsterInfo.uMovementType; + v0 = pActors;//[0].pMonsterInfo.uMovementType; do { - if ( ((Actor *)((char *)v0 - 59))->Actor::CanAct() && *((char *)v0 + 2) != 4 && *(char *)v0 != 5 ) + if ( v0->Actor::CanAct() && v0->pMonsterInfo.uHostilityType != 4 && v0->pMonsterInfo.uMovementType != 5 ) { - v1 = abs(*(short *)((char *)v0 + 83) - pParty->vPosition.x); - v2 = abs(*(short *)((char *)v0 + 85) - pParty->vPosition.y); - v3 = abs(*(short *)((char *)v0 + 87) - pParty->vPosition.z); + v1 = abs(v0->vPosition.x - pParty->vPosition.x); + v2 = abs(v0->vPosition.y - pParty->vPosition.y); + v3 = abs(v0->vPosition.z - pParty->vPosition.z); if ( (double)sub_4621DA(v1, v2, v3) < 512.0 ) Actor::_402968(v4, 4, 0, 0); } ++v4; - v0 = (char *)v0 + 836; + ++v0; } while ( (signed int)v4 < (signed int)uNumActors ); }
--- a/mm7_2.cpp Wed Feb 06 21:19:42 2013 +0000 +++ b/mm7_2.cpp Wed Feb 06 22:32:43 2013 +0000 @@ -3225,7 +3225,7 @@ void __cdecl sub_4BBCDD() { signed int v0; // ebp@3 - char *v1; // eax@4 + Actor *v1; // eax@4 __int16 v2; // cx@5 int v3; // esi@8 Player *v4; // esi@14 @@ -3242,22 +3242,22 @@ else { v0 = 0; - if ( (signed int)uNumActors <= 0 ) - goto LABEL_23; - v1 = (char *)&pActors[0].uAIState; - v7 = uNumActors; - do - { - v2 = *(short *)v1; - if ( *(short *)v1 == 5 || v2 == 11 || v2 == 19 || (v3 = *((int *)v1 + 159)) != 0 && (v3 & 7) == 4 ) - ++v0; - v1 += 836; - --v7; - } - while ( v7 ); - if ( v0 >= (signed int)uNumActors ) - { -LABEL_23: + if ( (signed int)uNumActors > 0 ) + { + v1 = pActors;//[0].uAIState; + v7 = uNumActors; + do + { + v2 = v1->uAIState; + if ( v1->uAIState == 5 || v2 == 11 || v2 == 19 || (v3 = v1->uSummonerID) != 0 && (v3 & 7) == 4 ) + ++v0; + ++v1; + --v7; + } + while ( v7 ); + } + if ( v0 >= (signed int)uNumActors || (signed int)uNumActors <= 0) + { uDialogueType = 91; v4 = pParty->pPlayers; ++*((char *)&pParty->field_75A[3] + (unsigned __int8)pParty->field_7B5_in_arena_quest + 1); @@ -7781,7 +7781,7 @@ signed int __fastcall sub_44FA4C_spawn_light_elemental(int a1, int a2, int a3) { signed int v3; // ecx@6 - char *v4; // edx@7 + Actor *v4; // edx@7 signed int result; // eax@13 Actor *v6; // esi@16 char *v7; // ebx@16 @@ -7820,17 +7820,17 @@ v20 = uNumActors; if ( (signed int)uNumActors > 0 ) { - v4 = (char *)&pActors[0].uAIState; - while ( *(short *)v4 != Removed ) + v4 = pActors;//[0].uAIState; + while ( v4->uAIState != Removed ) { ++v3; - v4 += 836; + ++v4; if ( v3 >= (signed int)uNumActors ) - goto LABEL_12; - } - v20 = v3; - } -LABEL_12: + break; + } + if( v3 < (signed int)uNumActors ) + v20 = v3; + } if ( v20 != uNumActors || (result = uNumActors + 1, (signed int)(uNumActors + 1) < 500) ) { v21 = 0; @@ -15982,7 +15982,7 @@ int __fastcall sub_46A89E(int a1, int a2, signed int a3) { signed int v3; // edi@1 - char *v4; // esi@2 + Actor *v4; // esi@2 int v5; // ebx@3 int v6; // eax@3 int v7; // ebx@3 @@ -16004,12 +16004,12 @@ v19 = 0; if ( (signed int)uNumActors > 0 ) { - v4 = (char *)&pActors[0].uAIState; + v4 = pActors;//[0].uAIState; do { - v5 = abs(*((short *)v4 - 17) - pParty->vPosition.x); - v17 = abs(*((short *)v4 - 16) - pParty->vPosition.y); - v18 = abs(*((short *)v4 - 15) - pParty->vPosition.z); + v5 = abs(v4->vPosition.x - pParty->vPosition.x); + v17 = abs(v4->vPosition.y - pParty->vPosition.y); + v18 = abs(v4->vPosition.z - pParty->vPosition.z); v6 = v5; v7 = v17; v8 = v18; @@ -16033,8 +16033,8 @@ } if ( (signed int)(((unsigned int)(11 * v7) >> 5) + (v8 >> 2) + v6) <= a3 ) { - v12 = *(short *)v4; - if ( *(short *)v4 != 5 ) + v12 = v4->uAIState; + if ( v4->uAIState != 5 ) { if ( v12 != 4 ) { @@ -16055,7 +16055,7 @@ } } ++v3; - v4 += 836; + ++v4; } while ( v3 < (signed int)uNumActors ); } @@ -16353,7 +16353,7 @@ void LayingItem::_46BEF1_apply_spells() { LayingItem *v1; // edi@1 - char *v2; // esi@2 + Actor *v2; // esi@2 __int16 v3; // fps@4 unsigned __int8 v4; // c0@4 unsigned __int8 v5; // c3@4 @@ -16363,28 +16363,28 @@ v1 = this; if ( (signed int)uNumActors > 0 ) { - v2 = (char *)&pActors[0].vPosition.y; + v2 = pActors;//[0].vPosition.y; do { - if ( ((Actor *)(v2 - 144))->CanAct() ) + if ( v2->CanAct() ) { //UNDEF(v3); if ( !(v4 | v5) ) { - if ( stru_50C198.GetMagicalResistance((Actor *)(v2 - 144), 0xAu) ) - { - ((SpellBuff *)&v2[16 * v1->field_48 + 68])->Apply( + if ( stru_50C198.GetMagicalResistance(v2, 0xAu) ) + { + v2->pActorBuffs[v1->field_48].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)(v1->field_4C << 7) * 0.033333335), v1->field_50, 4u, 0, 0); - *(v2 - 106) |= 8u; + HIWORD(v2->uAttributes) |= 8u; } } } ++v6; - v2 += 836; + ++v2; } while ( v6 < (signed int)uNumActors ); } @@ -16730,7 +16730,7 @@ pActors[v108].uAIState = Standing; pActors[v108].UpdateAnimation(); } - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[v136] + v108 * 836))->Apply( + pActors[v108].pActorBuffs[v136].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)(v137 << 7) * 0.033333335), v152, v150,
--- a/mm7_4.cpp Wed Feb 06 21:19:42 2013 +0000 +++ b/mm7_4.cpp Wed Feb 06 22:32:43 2013 +0000 @@ -14436,7 +14436,7 @@ AIDirection a3; // [sp+4h] [bp-68h]@21 AIDirection v14; // [sp+20h] [bp-4Ch]@21 AIDirection v15; // [sp+3Ch] [bp-30h]@21 - SpellBuff *v16; // [sp+58h] [bp-14h]@2 + Actor *v16; // [sp+58h] [bp-14h]@2 int v17; // [sp+5Ch] [bp-10h]@6 stru262_TurnBased *v18; // [sp+60h] [bp-Ch]@1 int v19; // [sp+64h] [bp-8h]@8 @@ -14448,12 +14448,13 @@ v20 = 0; if ( (signed int)uNumActors > 0 ) { - v3 = pActors[0].pActorBuffs; - v16 = pActors[0].pActorBuffs; + //v3 = pActors;//[0].pActorBuffs; + v16 = pActors;//[0].pActorBuffs; + v3 = v16->pActorBuffs; do { - v4 = (Actor *)((char *)&v3[-13] - 4); - if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) + v4 = v16; + if ( SHIDWORD(v3[3].uExpireTime) < v2 || SHIDWORD(v3[3].uExpireTime) <= v2 && LODWORD(v3[3].uExpireTime) <= v2 ) v17 = v2; else v17 = 1; @@ -14516,8 +14517,8 @@ } } ++v20; - v3 = (SpellBuff *)((char *)v16 + 836); - v16 = (SpellBuff *)((char *)v16 + 836); + v3 = v16[1].pActorBuffs; + ++v16; } while ( (signed int)v20 < (signed int)uNumActors ); }
--- a/mm7_5.cpp Wed Feb 06 21:19:42 2013 +0000 +++ b/mm7_5.cpp Wed Feb 06 22:32:43 2013 +0000 @@ -4948,7 +4948,7 @@ Vec3_int_ v25; // ST04_12@19 unsigned int v26; // ebx@20 Player *v27; // edi@20 - char *v28; // edi@27 + Actor *v28; // edi@27 int v29; // ebx@29 int v30; // eax@29 int v31; // edx@29 @@ -5087,25 +5087,25 @@ uActorID = 0; if ( (signed int)uNumActors > 0 ) { - v28 = (char *)&pActors[0].vPosition.z; + v28 = pActors;//[0].vPosition.z; do { if ( ((Actor *)(v28 - 146))->CanAct() ) { v29 = *(short *)v1; - v30 = *((short *)v28 - 1) - *((short *)v1 - 100); - a1 = *((short *)v28 - 2) - *((short *)v1 - 200); - v31 = *(short *)v28; + v30 = *(&v28->vPosition.y - *((short *)v1 - 100); + a1 = *(&v28->vPosition.x - *((short *)v1 - 200); + v31 = v28->vPosition.z; v48 = v30; v44 = v31; - v32 = ((signed int)*((short *)v28 - 4) >> 1) - v29; - v33 = *((short *)v28 - 5) + *((short *)v1 + 100); + v32 = (v28->uActorHeight >> 1) - v29; + v33 = *(&v28->uActorRadius + *((short *)v1 + 100); if ( a1 * a1 + v48 * v48 + (v31 + v32) * (v31 + v32) < (unsigned int)(v33 * v33) ) { v34.z = *(short *)v1; v34.y = *((short *)v1 - 100); v34.x = *((short *)v1 - 200); - if ( sub_407A1C(*((short *)v28 - 2), *((short *)v28 - 1), *(short *)v28 + 50, v34) ) + if ( sub_407A1C(v28->vPosition.x, v28->vPosition.y, v28->vPosition.z + 50, v34) ) { Vec3_int_::Normalize(&a1, &v48, &v44); v35 = pVelocity; @@ -5118,7 +5118,7 @@ DamageMonsterFromParty(*((short *)v1 - 300), uActorID, v35); break; case 3: - if ( v36 && pActors[v37].GetActorsRelation((Actor *)(v28 - 146)) ) + if ( v36 && pActors[v37].GetActorsRelation(v28) ) sub_43B1B0(*((short *)v1 - 300), uActorID, pVelocity, v36->field_61); break; case 2: @@ -5129,7 +5129,7 @@ } } ++uActorID; - v28 += 836; + ++v28; } while ( (signed int)uActorID < (signed int)uNumActors ); }
--- a/mm7_6.cpp Wed Feb 06 21:19:42 2013 +0000 +++ b/mm7_6.cpp Wed Feb 06 22:32:43 2013 +0000 @@ -3063,7 +3063,7 @@ int v515; // ecx@951 int v516; // eax@953 int v517; // eax@956 - char *v518; // edx@957 + Actor *v518; // edx@957 __int16 v519; // cx@958 int v520; // ecx@968 int v521; // ecx@969 @@ -3272,6 +3272,7 @@ ItemGen *_this; // [sp+E50h] [bp-34h]@23 float v725; // [sp+E54h] [bp-30h]@23 Player *v726; // [sp+E58h] [bp-2Ch]@131 + int v726b; float v727; // [sp+E5Ch] [bp-28h]@1 unsigned int uRequiredMana; // [sp+E60h] [bp-24h]@53 Player *pPlayer; // [sp+E64h] [bp-20h]@8 @@ -3708,9 +3709,9 @@ goto LABEL_83; v726 = (Player *)(a2 >> 3); HIDWORD(v733) = 836 * (a2 >> 3); - if ( !stru_50C198.GetMagicalResistance((Actor *)((char *)pActors + HIDWORD(v733)), 3u) ) + if ( !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 3u) ) goto LABEL_1056; - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[10] + HIDWORD(v733)))->Apply( + pActors[a2 >> 3].pActorBuffs[10].Apply( pMiscTimer->uTotalGameTimeElapsed + 128, v1, v1, @@ -3898,8 +3899,8 @@ goto LABEL_83; if ( (a2 & 7) != 3 || (v721 = 836 * (a2 >> 3), - LODWORD(v718) = (int)(char *)pActors + v721, - !stru_50C198.GetMagicalResistance((Actor *)((char *)pActors + v721), 3u)) ) + LODWORD(v718) = (int)&pActors[a2 >> 3], + !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 3u)) ) goto LABEL_1056; v726 = (Player *)(23040 * v2); v58 = (signed __int64)((double)(23040 * v2) * 0.033333335); @@ -3918,7 +3919,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) goto LABEL_83; v730 = 836 * (a2 >> 3); - if ( !stru_50C198.GetMagicalResistance((Actor *)((char *)pActors + v730), 7u) ) + if ( !stru_50C198.GetMagicalResistance(&pActors[a2>>3], 7u) ) goto LABEL_1056; LODWORD(v733) = 300 * v2; if ( v731 == 2 ) @@ -3944,7 +3945,7 @@ a1.field_4C = v2; a1.field_50 = v731; v60 = pObjectList->ObjectIDByItemID(a1.uItemType); - v61 = v730; + v61 = a2 >> 3; goto LABEL_1086; case 92: if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -6307,23 +6308,23 @@ v730 = 836 * v426; if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) { - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Reset(); - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset(); + pActors[v426].pActorBuffs[1].Reset(); + pActors[v426].pActorBuffs[12].Reset(); v732 = amount << 7; - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Apply( + pActors[v426].pActorBuffs[9].Apply( pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), v731, v1, v1, v1); - *(&pActors[0].pMonsterInfo.uHostilityType + v730) = MonsterInfo::Hostility_Long; + pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; } a1.stru_24.Reset(); a1.field_48 = v3->spellnum; a1.field_4C = v2; a1.field_50 = v731; v60 = pObjectList->ObjectIDByItemID(a1.uItemType); - v61 = v730; + v61 = v426; goto LABEL_1086; case 66: if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -6335,12 +6336,12 @@ v730 = 836 * v427; if ( MonsterStats::BelongsToSupertype(pActors[v427].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) goto LABEL_83; - if ( stru_50C198.GetMagicalResistance((Actor *)((char *)pActors + v730), 7u) ) - { - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Reset(); + if ( stru_50C198.GetMagicalResistance(&pActors[v427], 7u) ) + { + pActors[v427].pActorBuffs[9].Reset(); + pActors[v427].pActorBuffs[1].Reset(); v732 = amount << 7; - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Apply( + pActors[v427].pActorBuffs[12].Apply( pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), v731, v1, @@ -6352,7 +6353,7 @@ a1.field_4C = v2; a1.field_50 = v731; v60 = pObjectList->ObjectIDByItemID(a1.uItemType); - v61 = v730; + v61 = v427; goto LABEL_1086; case 63: v428 = v12 - 2; @@ -6916,17 +6917,17 @@ LOBYTE(v517) = v517 | 4; if ( (signed int)uNumActors > v1 ) { - v518 = (char *)&pActors[0].uAIState; - v726 = (Player *)uNumActors; + v518 = pActors;//[0].uAIState; + v726b = uNumActors; do { - v519 = *(short *)v518; - if ( *(short *)v518 != 5 && v519 != 11 && v519 != 19 && v517 == *((int *)v518 + 159) ) + v519 = v518->uAIState; + if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && v517 == v518->uSummonerID ) ++HIDWORD(v733); - v518 += 836; - v726 = (Player *)((char *)v726 - 1); + ++v518; + --v726; } - while ( *(float *)&v726 != 0.0 ); + while ( v726 != 0 ); } if ( SHIDWORD(v733) >= amount ) { @@ -7437,12 +7438,12 @@ v730 = 836 * v599; if ( !MonsterStats::BelongsToSupertype(pActors[v599].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) goto LABEL_83; - if ( !stru_50C198.GetMagicalResistance((Actor *)((char *)pActors + v730), 0xAu) ) + if ( !stru_50C198.GetMagicalResistance(&pActors[v599], 0xAu) ) goto LABEL_200; - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset(); - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Reset(); + pActors[v599].pActorBuffs[9].Reset(); + pActors[v599].pActorBuffs[1].Reset(); v732 = (int)v733 << 7; - ((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Apply( + pActors[v599].pActorBuffs[12].Apply( pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v1, @@ -7453,14 +7454,14 @@ a1.field_4C = v2; a1.field_50 = v731; v60 = pObjectList->ObjectIDByItemID(a1.uItemType); - v61 = v730; + v61 = v599; LABEL_1086: - v600 = *(__int16 *)((char *)&pActors[0].vPosition.y + v61); - v601 = *(__int16 *)((char *)&pActors[0].vPosition.x + v61); + v600 = pActors[v61].vPosition.y; + v601 = pActors[v61].vPosition.x; a1.uObjectDescID = v60; a1.vPosition.x = v601; - v602 = *(unsigned __int16 *)((char *)&pActors[0].uActorHeight + v61); - v603 = *(__int16 *)((char *)&pActors[0].vPosition.z + v61); + v602 = pActors[v61].uActorHeight; + v603 = pActors[v61].vPosition.z; a1.vPosition.y = v600; v676 = v603 + v602; v665 = v600;