diff mm7_6.cpp @ 112:909822c91d47

pointer fixes
author zipi
date Sat, 09 Feb 2013 18:46:06 +0000
parents d61f6bc04bf2
children 9b0d651821f1
line wrap: on
line diff
--- a/mm7_6.cpp	Sun Feb 10 00:17:23 2013 +0600
+++ b/mm7_6.cpp	Sat Feb 09 18:46:06 2013 +0000
@@ -2902,7 +2902,7 @@
   int v354; // ecx@686
   int v355; // ecx@687
   int v356; // eax@689
-  SpellBuff *v357; // edi@694
+  Player *v357; // edi@694
   unsigned __int16 v358; // ST1C_2@695
   __int16 v359; // ST18_2@695
   stru6 *v360; // eax@695
@@ -2920,7 +2920,7 @@
   int v372; // ecx@710
   int v373; // eax@715
   int v374; // eax@717
-  char *v375; // edi@717
+  Player *v375; // edi@717
   int v376; // eax@717
   Player *v377; // ecx@719
   int v378; // ecx@721
@@ -3164,7 +3164,7 @@
   __int16 v616; // ST1C_2@1122
   __int16 v617; // ST18_2@1122
   stru6 *v618; // eax@1122
-  SpellBuff *v619; // edi@1123
+  Player *v619; // edi@1123
   unsigned __int16 v620; // ST1C_2@1124
   __int16 v621; // ST18_2@1124
   stru6 *v622; // eax@1124
@@ -3905,8 +3905,9 @@
         v726 = (Player *)(23040 * v2);
         v58 = (signed __int64)((double)(23040 * v2) * 0.033333335);
         v59 = v721;
-        ((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply(
-          pParty->uTimePlayed + (signed int)v58,
+        //((SpellBuff *)((char *)&pActors[0].pActorBuffs[7] + v721))->Apply(
+		pActors[a2 >> 3].pActorBuffs[7].Apply(
+		  pParty->uTimePlayed + (signed int)v58,
           v731,
           amount,
           v1,
@@ -3931,10 +3932,13 @@
           if ( v731 == 3 )
             LODWORD(v733) = 29030400;
         }
-        ((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset();
-        ((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset();
-        v726 = (Player *)((int)v733 << 7);
-        ((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply(
+        //((SpellBuff *)((char *)&pActors[0].pActorBuffs[9] + v730))->Reset();
+		pActors[a2 >> 3].pActorBuffs[9].Reset();
+        //((SpellBuff *)((char *)&pActors[0].pActorBuffs[12] + v730))->Reset();
+        pActors[a2 >> 3].pActorBuffs[12].Reset();
+		v726 = (Player *)((int)v733 << 7);
+        //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply(
+		pActors[a2 >> 3].pActorBuffs[1].Apply(
           pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335),
           v731,
           v1,
@@ -5897,18 +5901,18 @@
         a2 = v1;
         v732 = (int)v733 << 7;
         v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
-        v357 = &pParty->pPlayers[0].pPlayerBuffs[11];
+        v357 = pParty->pPlayers;//[0].pPlayerBuffs[11];
         do
         {
           v358 = a2;
           v359 = v3->spellnum;
           v360 = pGame->GetStru6();
           pGame->GetStru6()->SetPlayerBuffAnim(v359, v358);
-          v357->Apply(pParty->uTimePlayed + v717, v731, v1, v1, v1);
+		  v357->pPlayerBuffs[11].Apply(pParty->uTimePlayed + v717, v731, v1, v1, v1);
           ++a2;
-          v357 = (SpellBuff *)((char *)v357 + 6972);
-        }
-        while ( (signed int)v357 < (signed int)&pParty->field_871C[508] );
+          ++v357;// = (SpellBuff *)((char *)v357 + 6972);
+        }
+        while ( v357 <= &pParty->pPlayers[3] );
         goto LABEL_1056;
       case 48:
         v364 = v12 - 2;
@@ -5978,7 +5982,6 @@
         if ( v14 )
         {
           v374 = v3->uPlayerID_2;
-          v375 = (char *)pParty->pPlayers;
           LODWORD(pParty->pPlayers[v374].pConditions[14]) = v1;
           HIDWORD(pParty->pPlayers[v374].pConditions[14]) = v1;
           v376 = v3->uPlayerID_2;
@@ -5989,7 +5992,6 @@
         {
           v732 = amount << 7;
           *(float *)&a2 = (double)(amount << 7) * 0.033333335;
-          v375 = (char *)pParty->pPlayers;
           pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan(
             0xEu,
             (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
@@ -5997,7 +5999,7 @@
             0xDu,
             (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
         }
-        v377 = (Player *)&v375[6972 * v3->uPlayerID_2];
+        v377 = &pParty->pPlayers[v3->uPlayerID_2];
         goto LABEL_720;
       case 54:
         v378 = v12 - 2;
@@ -6099,13 +6101,11 @@
             v399 = v3->uPlayerID_2;
             LODWORD(pParty->pPlayers[v399].pConditions[13]) = v1;
             HIDWORD(pParty->pPlayers[v399].pConditions[13]) = v1;
-            v400 = (char *)pParty->pPlayers;
           }
           else
           {
             v732 = amount << 7;
             *(float *)&a2 = (double)(amount << 7) * 0.033333335;
-            v400 = (char *)pParty->pPlayers;
             pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan(
               0x10u,
               (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
@@ -6117,7 +6117,7 @@
               (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
           }
           v83 = 1;
-          ((Player *)&v400[6972 * v3->uPlayerID_2])->SetCondition(1u, 1);
+          pParty->pPlayers[v3->uPlayerID_2].SetCondition(1u, 1);
           v401 = pGame;
           pParty->pPlayers[v3->uPlayerID_2].sHealth = 1;
           v402 = v3->uPlayerID_2;
@@ -6679,7 +6679,6 @@
         pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan(
           6u,
           (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-        v473 = (char *)pParty->pPlayers;
         pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan(
           8u,
           (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
@@ -6791,14 +6790,13 @@
           pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan(
             7u,
             (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
-          v473 = (char *)pParty->pPlayers;
           pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan(
             9u,
             (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2));
           v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2);
           v656 = 11;
 LABEL_937:
-          v325 = (Player *)&v473[6972 * v3->uPlayerID_2];
+          v325 = &pParty->pPlayers[v3->uPlayerID_2];
 LABEL_641:
           v325->DiscardConditionIfLastsLongerThan(v656, v663);
         }
@@ -7585,18 +7583,18 @@
         a2 = v1;
         v732 = (int)v733 << 7;
         v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335);
-        v619 = &pParty->pPlayers[0].pPlayerBuffs[10];
+        v619 = pParty->pPlayers;//[0].pPlayerBuffs[10];
         do
         {
           v620 = a2;
           v621 = v3->spellnum;
           v622 = pGame->GetStru6();
           pGame->GetStru6()->SetPlayerBuffAnim(v621, v620);
-          v619->Apply(pParty->uTimePlayed + v717, v731, amount, v716, v1);
+		  v619->pPlayerBuffs[10].Apply(pParty->uTimePlayed + v717, v731, amount, v716, v1);
           ++a2;
-          v619 = (SpellBuff *)((char *)v619 + 6972);
-        }
-        while ( (signed int)v619 < (signed int)&pParty->field_871C[504] );
+          ++v619;
+        }
+        while ( v619 <= &pParty->pPlayers[3] );
         goto LABEL_1056;
       case 99:
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
@@ -7863,7 +7861,8 @@
   Vec3_int_ a3; // [sp+Ch] [bp-30h]@19
   unsigned int a2; // [sp+18h] [bp-24h]@20
   unsigned int v27; // [sp+1Ch] [bp-20h]@1
-  char *v28; // [sp+20h] [bp-1Ch]@9
+  int v28; // [sp+20h] [bp-1Ch]@9
+  unsigned int *v28b;
   int v29; // [sp+24h] [bp-18h]@16
   int v30; // [sp+28h] [bp-14h]@16
   int v31; // [sp+2Ch] [bp-10h]@4
@@ -7889,27 +7888,27 @@
     v33 = 0;
     if ( v4 )
     {
-      v5 = (char *)v1 + 36 * v4;
-      if ( !(v5[516] & 2) )
+      //v5 = (char *)v1 + 36 * v4;
+	  if ( !(v1->pInventoryItems[v4].field_1A & 2) )//v5[516] & 2) )
       {
-        v28 = v5 + 496;
-        v6 = *((int *)v5 + 124);
+		v28b = &v1->pInventoryItems[v4].uItemID;
+        v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
         if ( pItemsTable->pItems[v6].uEquipType == 12 )
         {
-          if ( *((int *)v5 + 128) <= 0 )
+		  if ( v1->pInventoryItems[v4]._bonus_type <= 0 )
           {
-            *(int *)v28 = 0;
+            *v28b = 0;
             v1->pEquipment.uMainHand = 0;
           }
           else
           {
-            v32 = *((int *)v5 + 124);
+			v32 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
           }
         }
         else
         {
           if ( v6 == 64 || v6 == 65 )
-            v33 = *((int *)v5 + 124);
+            v33 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124);
         }
       }
     }
@@ -7939,7 +7938,7 @@
       }
       if ( v33 != v9 )
       {
-        v28 = (char *)1;
+        v28 = 1;
         v22 = v0 + 8;
         v20 = v9;
         v18 = v9;
@@ -8003,7 +8002,7 @@
     }
     if ( v33 )
     {
-      v28 = (char *)1;
+      v28 = 1;
       v23 = v0 + 8;
       v21 = 0;
       v19 = 0;
@@ -8035,7 +8034,7 @@
         {
           if ( v29 != v3 )
             return 1;
-          if ( v28 == (char *)v3 )
+          if ( v28 == v3 )
           {
             v15 = v1->pEquipment.uMainHand;
             if ( v1->HasItemEquipped(EQUIP_TWO_HANDED) )