diff mm7_6.cpp @ 90:d61f6bc04bf2

more pointer fixes
author zipi
date Wed, 06 Feb 2013 22:32:43 +0000
parents 98cd93e14777
children 909822c91d47
line wrap: on
line diff
--- 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;