changeset 115:74b27ccb2385

Слияние
author Ritor1
date Sun, 10 Feb 2013 13:36:09 +0600
parents 9df890bf7e6f (current diff) 909822c91d47 (diff)
children dcf80a0a9977
files
diffstat 3 files changed, 124 insertions(+), 121 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_3.cpp	Sun Feb 10 13:36:01 2013 +0600
+++ b/mm7_3.cpp	Sun Feb 10 13:36:09 2013 +0600
@@ -1426,6 +1426,7 @@
   ObjectDesc *v37; // [sp+78h] [bp-18h]@1
   unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4
   int v39; // [sp+80h] [bp-10h]@33
+  Actor *v39b;
   int v40; // [sp+84h] [bp-Ch]@28
   int v41; // [sp+88h] [bp-8h]@34
   int v42; // [sp+8Ch] [bp-4h]@4
@@ -1488,16 +1489,18 @@
         {
           if ( (signed int)uNumActors > v8 )
           {
-            v39 = (int)&pActors[0].word_000086_some_monster_id;
+            v39b = pActors;//[0].word_000086_some_monster_id;
             do
             {
-              v41 = pActors[v1->field_58 >> 3].pMonsterInfo.uID - 1;
-              v14 = (signed __int64)((double)v41 * 0.3333333333333333);
-              v41 = *(short *)(v39 - 38) - 1;
-              if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) )
-                _46DF1A_collide_against_actor(v42, *((short *)&pMonsterList->pMonsters[*(short *)v39] - 73));
+              //v41 = pActors[v1->field_58 >> 3].pMonsterInfo.uID - 1;
+              //v14 = (signed __int64)((double)v41 * 0.3333333333333333);
+              //v41 = *(short *)(v39 - 38) - 1;
+              //if ( v14 != (unsigned int)(signed __int64)((double)v41 * 0.3333333333333333) )
+				if( pActors[v1->field_58 >> 3].pMonsterInfo.uID != v39b->pMonsterInfo.uID )
+					//not sure: pMonsterList->pMonsters[v39b->word_000086_some_monster_id-1].uToHitRadius
+					_46DF1A_collide_against_actor(v42, *((short *)&pMonsterList->pMonsters[v39b->word_000086_some_monster_id] - 73));
               ++v42;
-              v39 += 836;
+              ++v39b;// += 836;
             }
             while ( v42 < (signed int)uNumActors );
             v8 = 0;
@@ -1507,11 +1510,11 @@
         {
           if ( (signed int)uNumActors > v8 )
           {
-            v39 = (int)&pActors[0].word_000086_some_monster_id;
+            v39b = pActors;//[0].word_000086_some_monster_id;
             do
             {
-              _46DF1A_collide_against_actor(v42++, *((short *)&pMonsterList->pMonsters[*(short *)v39] - 73));
-              v39 += 836;
+              _46DF1A_collide_against_actor(v42++, *((short *)&pMonsterList->pMonsters[*(short *)v39b] - 73));
+              ++v39b;
             }
             while ( v42 < (signed int)uNumActors );
           }
@@ -3163,7 +3166,7 @@
     bWaterWalk = 1;
     *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u;
     if ( !(pParty->pPartyBuffs[18].uFlags & 1)
-      && *(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 )
+		&& pParty->pPlayers[pParty->pPartyBuffs[18].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 )
       bWaterWalk = 0;
   }
   v3 = sub_46D49E_prolly_get_world_y_under_party(v116, v117, v123, pParty->uPartyHeight, &v130, &v108, bWaterWalk);
@@ -3264,7 +3267,7 @@
           pParty->bFlying = 0;
           if ( bUnderwater
             || pParty->pPartyBuffs[7].uFlags & 1
-            || *(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 )
+            || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 )
           {
             if ( pParty->vPosition.z < 4000 || bJumping )
             {
@@ -3304,7 +3307,7 @@
           pParty->bFlying = 0;
           if ( bUnderwater
             || pParty->pPartyBuffs[7].uFlags & 1
-            || *(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 )
+            || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 )
           {
             v123 -= 30;
             v113 -= 30;
@@ -13627,7 +13630,7 @@
   float uZooma; // [sp+64h] [bp+10h]@117
   signed int flagsa; // [sp+68h] [bp+14h]@42
   unsigned int flagsb; // [sp+68h] [bp+14h]@66
-  char *flagsc; // [sp+68h] [bp+14h]@86
+  Actor *flagsc; // [sp+68h] [bp+14h]@86
   unsigned int flagsd; // [sp+68h] [bp+14h]@105
 
   //a3 = uY;
@@ -13949,16 +13952,16 @@
     uZf = v33;
     if ( (signed int)uNumActors > v33 )
     {
-      flagsc = (char *)&pActors[0].uAIState;
+      flagsc = pActors;//[0].uAIState;
       do
       {
-        v39 = *(short *)flagsc;
-        if ( *(short *)flagsc != 11 && v39 != 19 && (v39 == 5 || *(flagsc - 139) & 0x80) )
-        {
-          v40 = ((unsigned __int64)(((signed int)*((short *)flagsc - 17) - pParty->vPosition.x)
+		v39 = flagsc->uAIState;
+		if ( flagsc->uAIState != 11 && v39 != 19 && (v39 == 5 || BYTE1(flagsc->uAttributes) & 0x80) )
+        {
+		  v40 = ((unsigned __int64)(( flagsc->vPosition.x - pParty->vPosition.x)
                                   * (signed __int64)(signed int)uZoom) >> 16)
               + uCenterX;
-          v76 = (unsigned __int64)(((signed int)*((short *)flagsc - 16) - pParty->vPosition.y)
+          v76 = (unsigned __int64)(( flagsc->vPosition.y - pParty->vPosition.y)
                                  * (signed __int64)(signed int)uZoom) >> 16;
           v41 = uCenterY - v76;
           if ( v40 >= pRenderer->field_1C_clipx )
@@ -13966,9 +13969,9 @@
             if ( v40 <= pRenderer->field_24_clipz && v41 >= pRenderer->field_20_clipy && v41 <= pRenderer->field_28_clipw )
             {
               uWd = v61;
-              if ( *(flagsc - 137) & 1 )
+			  if ( BYTE3(flagsc->uAttributes) & 1 )
                 uWd = v63;
-              if ( *(short *)flagsc == 5 )
+              if ( flagsc->uAIState == 5 )
                 uWd = v65;
               if ( (signed int)uZoom > 1024 )
               {
@@ -13998,7 +14001,7 @@
           }
         }
         ++uZf;
-        flagsc += 836;
+        ++flagsc;
       }
       while ( uZf < (signed int)uNumActors );
       v36 = 255;
@@ -16863,11 +16866,11 @@
   int v38; // eax@78
   int v39; // ecx@78
   size_t v40; // edx@78
-  char *v41; // esi@79
+  Actor *v41; // esi@79
   int v42; // eax@84
   int v43; // ecx@84
   size_t v44; // edx@84
-  char *v45; // esi@85
+  Actor *v45; // esi@85
   void *v46; // eax@91
   GUIWindow *v47; // eax@93
   GUIButton *v48; // ecx@93
@@ -17251,12 +17254,12 @@
             __debugbreak();
             if ( (signed int)uNumActors > 0 )
             {
-              v41 = (char *)&pActors[0].uGroup;
+              v41 = pActors;//[0].uGroup;
               do
               {
-                if ( *(int *)v41 == v38 )
-                  *(int *)v41 = v39;
-                v41 += 836;
+				if ( v41->uGroup == v38 )
+				  v41->uGroup = v39;
+                ++v41;
                 --v40;
               }
               while ( v40 );
@@ -17269,12 +17272,12 @@
             __debugbreak();
             if ( (signed int)uNumActors > 0 )
             {
-              v45 = (char *)&pActors[0].uAlly;
+              v45 = pActors;//[0].uAlly;
               do
               {
-                if ( *((int *)v45 - 1) == v42 )
-                  *(int *)v45 = v43;
-                v45 += 836;
+				if ( v45->uGroup == v42 )
+				  v45->uAlly = v43;
+                ++v45;
                 --v44;
               }
               while ( v44 );
@@ -19752,7 +19755,7 @@
 //----- (004014E6) --------------------------------------------------------
 int __cdecl ODM_4014E6_AI()
 {
-  int v0; // esi@2
+  Actor *v0; // esi@2
   int v1; // eax@4
   int v2; // ebx@4
   unsigned int v3; // ecx@4
@@ -19786,15 +19789,16 @@
   v25 = 0;
   if ( (signed int)uNumActors > 0 )
   {
-    v0 = (int)&pActors[0].uAttributes;
-    do
-    {
-      *(char *)(v0 + 1) &= 0xFBu;
-      if ( ! ((Actor *)(v0 - offsetof(Actor, uAttributes)))->CanAct() )
+    v0 = pActors;//[0].uAttributes;
+    do
+    {
+	  //*(char *)(v0 + 1) &= 0xFBu;
+	  BYTE1(v0->uAttributes) &= 0xFBu;
+      if ( ! v0->CanAct() )
         goto LABEL_37;
-      v22 = abs(pParty->vPosition.z - *(short *)(v0 + 110));
-      v21 = abs(pParty->vPosition.y - *(short *)(v0 + 108));
-      v1 = abs(pParty->vPosition.x - *(short *)(v0 + 106));
+	  v22 = abs(pParty->vPosition.z - v0->vPosition.z);
+      v21 = abs(pParty->vPosition.y - v0->vPosition.y);
+      v1 = abs(pParty->vPosition.x - v0->vPosition.x);
       v2 = v21;
       v3 = v22;
       if ( v1 < v21 )
@@ -19816,7 +19820,7 @@
         v2 = v6;
       }
       v7 = ((unsigned int)(11 * v2) >> 5) + (v3 >> 2) + v1;
-      v8 = *(short *)(v0 + 100);
+	  v8 = v0->uActorRadius;
       v9 = v7 - v8;
       v23 = v7 - v8;
       if ( v23 < 0 )
@@ -19826,18 +19830,18 @@
       }
       if ( v9 < 5632 )
       {
-        v10 = *(int *)v0 & 0xFEFFFFFF;
-        *(int *)v0 = v10;
-        if ( v10 & 0x80000 || ((Actor *)(v0 - offsetof(Actor, uAttributes)))->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)v23 < 307.2 )
             pParty->uFlags |= 0x10u;
           if ( !(pParty->uFlags & 0x20) && v9 < 5120 )
             pParty->uFlags |= 0x20u;
         }
-        *(char *)(v0 + 1) |= 0x40u;
+		BYTE1(v0->uAttributes) |= 0x40u;
         v12 = v27++;
         ai_array_4F75E0[v12] = v9;
         ai_array_4F7DB0_actor_ids[v12] = v25;
@@ -19845,10 +19849,10 @@
       else
       {
 LABEL_37:
-        *(char *)(v0 + 1) &= 0xBFu;
+		  BYTE1(v0->uAttributes) &= 0xBFu;
       }
       ++v25;
-      v0 += 836;
+      ++v0;
     }
     while ( v25 < (signed int)uNumActors );
   }
--- a/mm7_4.cpp	Sun Feb 10 13:36:01 2013 +0600
+++ b/mm7_4.cpp	Sun Feb 10 13:36:09 2013 +0600
@@ -79,7 +79,7 @@
   unsigned int v6; // ecx@3
   unsigned int v7; // edx@6
   unsigned int v8; // edx@8
-  char *v9; // edi@13
+  Actor *v9; // edi@13
   int v10; // ebx@14
   int v11; // eax@14
   int v12; // ebx@14
@@ -153,12 +153,12 @@
       v37 = 0;
       if ( (signed int)uNumActors > 0 )
       {
-        v9 = (char *)&pActors[0].vPosition.y;
+        v9 = pActors;//[0].vPosition.y;
         do
         {
-          v10 = abs(v33 - *((short *)v9 - 1));
-          v29 = abs(v32 - *(short *)v9);
-          v26 = abs(v35 - *((short *)v9 + 1));
+		  v10 = abs(v33 - v9->vPosition.x);
+          v29 = abs(v32 - v9->vPosition.y);
+          v26 = abs(v35 - v9->vPosition.z);
           v11 = v10;
           v12 = v29;
           v13 = v26;
@@ -183,7 +183,7 @@
           if ( (signed int)(((unsigned int)(11 * v12) >> 5) + (v13 >> 2) + v11) < v31 )
             EventProcessor(v1->field_16_event_id, 0, 1);
           ++v37;
-          v9 += 836;
+          ++v9;
         }
         while ( v37 < (signed int)uNumActors );
       }
@@ -3399,9 +3399,9 @@
   int result; // eax@1
   int v4; // eax@2
   int v5; // edi@5
-  char *v6; // ecx@5
+  int *v6; // ecx@5
   char v7; // sf@5
-  char *v8; // ecx@10
+  int *v8; // ecx@10
   int v9; // edi@15
   signed int v10; // eax@15
   __int16 *v11; // edx@16
@@ -3462,12 +3462,12 @@
         {
           v5 = v4 * pParty->pPartyBuffs[7].uPower;
           __debugbreak();
-          v6 = &stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000];
-          v7 = *(int *)v6 - v5 < 0;
-          *(int *)v6 -= v5;
+		  v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[7].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[7].uCaster + 2000];
+          v7 = *v6 < v5;
+          *v6 -= v5;
           if ( v7 )
           {
-            *(int *)v6 = 0;
+            *v6 = 0;
             pParty->uFlags &= 0xFFFFFFBFu;
             pParty->bFlying = 0;
             v51 = 1;
@@ -3482,12 +3482,12 @@
         if ( !(pParty->pPartyBuffs[18].uFlags & 1) )
         {
           __debugbreak();
-          v8 = &stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000];
-          v7 = *(int *)v8 - v4 < 0;
-          *(int *)v8 -= v4;
+          v8 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[18].uCaster].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[18].uCaster + 2000];
+          v7 = *v8 < v4;
+          *v8 -= v4;
           if ( v7 )
           {
-            *(int *)v8 = 0;
+            *v8 = 0;
             LOBYTE(pParty->uFlags) &= 0x7Fu;
             v51 = 1;
           }
@@ -9214,7 +9214,7 @@
   signed __int64 v3; // ST1C_8@1
   unsigned __int64 v4; // qax@1
   unsigned int v5; // ebx@1
-  void *v6; // ebx@1
+  Player *v6; // ebx@1
 
   pParty->pHirelings[0].bHasUsedTheAbility = 0;
   pParty->pHirelings[1].bHasUsedTheAbility = 0;
@@ -9233,14 +9233,14 @@
   pParty->uCurrentYear = v5 / 0xC + 1168;
   pParty->RestAndHeal();
   dword_507B94 = 1;
-  v6 = &pParty->pPlayers[0].uNumDivineInterventionCastsThisDay;
+  v6 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay;
   do
   {
-    *((short *)v6 - 258) = 0;
-    memset(v6, 0, 4u);
-    v6 = (char *)v6 + 6972;
-  }
-  while ( (signed int)v6 < (signed int)&pParty->field_871C[694] );
+	v6->uTimeToRecovery = 0;
+	memset(&v6->uTimeToRecovery, 0, 4u);
+    ++v6;
+  }
+  while ( v6 <= &pParty->pPlayers[3] );
   pParty->_4909F4();
 }
 // 507B94: using guessed type int dword_507B94;
@@ -15092,7 +15092,7 @@
   unsigned int v10; // esi@16
   int v11; // ecx@17
   unsigned int v12; // kr00_4@25
-  void *v13; // esi@25
+  Player *v13; // esi@25
   int v14; // eax@25
   Player *v15; // esi@27
   signed int v16; // eax@32
@@ -15189,17 +15189,17 @@
       v25 = (HOUSE_TYPE)187;
       v12 = LODWORD(pParty->uTimePlayed);
       LODWORD(pParty->uTimePlayed) += 0x7620000u;
-      v13 = &pParty->pPlayers[0].uNumDivineInterventionCastsThisDay;
+      v13 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay;
       v14 = LOBYTE(pAnimatedRooms[(signed __int16)p2DEvents[186].uAnimationID].field_C);
       pParty->uTimePlayed = __PAIR__(HIDWORD(pParty->uTimePlayed), v12) + 0x7620000;
       dword_F8B198 = v14;
       do
       {
-        *((short *)v13 - 258) = 0;
-        memset(v13, 0, 4u);
-        v13 = (char *)v13 + 6972;
-      }
-      while ( (signed int)v13 < (signed int)&pParty->field_871C[694] );
+		v13->uTimeToRecovery = 0;
+		memset(&v13->uTimeToRecovery, 0, 4u);
+        ++v13;
+      }
+      while ( v13 <= &pParty->pPlayers[3] );
       ++pParty->uNumPrisonTerms;
       pParty->uFine = 0;
       v15 = pParty->pPlayers;
@@ -15208,7 +15208,7 @@
         v15->SetVariable(VAR_Award, 87);
         ++v15;
       }
-      while ( (signed int)v15 < (signed int)pParty->pHirelings );
+      while ( v15 <= &pParty->pPlayers[3] );
       v10 = v25;
     }
     ++pIcons_LOD->uTexturePacksCount;
--- a/mm7_6.cpp	Sun Feb 10 13:36:01 2013 +0600
+++ b/mm7_6.cpp	Sun Feb 10 13:36:09 2013 +0600
@@ -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) )