diff Party.cpp @ 97:8c0fcfa72fce

Слияние
author Ritor1
date Thu, 07 Feb 2013 13:54:32 +0600
parents d61f6bc04bf2
children 01ab35c85832
line wrap: on
line diff
--- a/Party.cpp	Thu Feb 07 13:54:23 2013 +0600
+++ b/Party.cpp	Thu Feb 07 13:54:32 2013 +0600
@@ -82,9 +82,9 @@
   Party *v1; // esi@1
   int v2; // eax@4
   signed int v4; // ecx@6
-  char *v5; // edx@6
+  Player *v5; // edx@6
   Player *v6; // eax@7
-  char *v7; // ecx@23
+  Player *v7; // ecx@23
   signed int v8; // esi@23
   signed int v9; // edx@23
   Player **v10; // edi@23
@@ -101,7 +101,7 @@
     return v2 + 1;
   }
   v4 = 0;
-  v5 = (char *)&v1->pPlayers[0].uTimeToRecovery;
+  v5 = v1->pPlayers;//[0].uTimeToRecovery;
   while ( 1 )
   {
     v6 = ::pPlayers[v4 + 1];
@@ -111,28 +111,28 @@
       || v6->pConditions[14]
       || v6->pConditions[15]
       || v6->pConditions[16]
-      || *(short *)v5 )
+	  || v5->uTimeToRecovery )
     {
       byte_AE3368[v4] = 1;
-      goto LABEL_21;
     }
-    if ( !byte_AE3368[v4] )
+    else if ( !byte_AE3368[v4] )
       break;
-LABEL_21:
     ++v4;
-    v5 += 6972;
+    ++v5;
     if ( v4 >= 4 )
-      goto LABEL_16;
+      break;
   }
-  v12 = v4;
-  byte_AE3368[v4] = 1;
-LABEL_16:
+  if(v4<4)
+  {
+	  v12 = v4;
+	  byte_AE3368[v4] = 1;
+  }
   if ( (unsigned __int8)(byte_AE3369 & byte_AE336A & byte_AE336B) & byte_AE3368[0] )
     memset(byte_AE3368, 0, 4u);
   v2 = v12;
   if ( v12 )
     return v2 + 1;
-  v7 = (char *)&v1->pPlayers[0].uSpeedBonus;
+  v7 = v1->pPlayers;//[0].uSpeedBonus;
   v8 = 0;
   v9 = 1;
   v10 = &::pPlayers[1];
@@ -145,26 +145,25 @@
       && !v11->pConditions[14]
       && !v11->pConditions[15]
       && !v11->pConditions[16]
-      && !*((short *)v7 + 3123) )
+	  && !v7->uTimeToRecovery )
     {
       if ( v12 )
       {
-        if ( *(short *)v7 > v8 )
+		if ( v7->uSpeedBonus > v8 )
         {
-          v8 = *(short *)v7;
-          goto LABEL_35;
+          v8 = v7->uSpeedBonus;
+          v12 = v9;
         }
       }
       else
       {
         v8 = *(short *)v7;
-LABEL_35:
         v12 = v9;
       }
     }
     ++v10;
     ++v9;
-    v7 += 6972;
+    ++v7;
     if ( v9 - 1 < 4 )
       continue;
     return v12;
@@ -175,15 +174,15 @@
 //----- (00493244) --------------------------------------------------------
 bool Party::HasItem(unsigned int uItemID)
 {
-  char *v2; // edx@1
+  Player *v2; // edx@1
   signed int v3; // ecx@2
   ItemGen *v4; // eax@2
 
-  v2 = (char *)pParty->pPlayers[0].pInventoryItems;
-  while ( 2 )
+  v2 = pParty->pPlayers;//[0].pInventoryItems;
+  while ( v2 <= &pParty->pPlayers[3] )
   {
     v3 = 0;
-    v4 = (ItemGen *)v2;
+	v4 = v2->pInventoryItems;
     do
     {
       if ( v4->uItemID == uItemID )
@@ -192,10 +191,7 @@
       ++v4;
     }
     while ( v3 < 138 );
-    v2 += 6972;
-    if ( (signed int)v2 < (signed int)&pParty->field_777C[85] )
-      continue;
-    break;
+    ++v2;
   }
   return 0;
 }
@@ -261,16 +257,16 @@
 unsigned int Party::GetPartyFame()
 {
   signed int v1; // eax@1
-  char *v2; // ecx@1
+  Player *v2; // ecx@1
   signed int v3; // edx@1
 
   v1 = 0;
-  v2 = (char *)&this->pPlayers[0].uExperience;
+  v2 = this->pPlayers;//[0].uExperience;
   v3 = 4;                                       // (E exp) / 1000
   do
   {
-    v1 += *(int *)v2;
-    v2 += 6972;
+	v1 += (int)v2->uExperience; // needs review
+    ++v2;
     --v3;
   }
   while ( v3 );
@@ -778,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
@@ -791,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 );
     }
@@ -814,7 +810,7 @@
 void Party::ResetPosMiscAndSpellBuffs()
 {
   Party *v1; // esi@1
-  char *v2; // edi@1
+  Player *v2; // edi@1
   SpellBuff *v3; // ebx@2
   SpellBuff *v4; // esi@5
   signed int v5; // edi@5
@@ -839,11 +835,11 @@
   this->field_6FC = 0;
   this->field_708 = 15;
   this->field_0 = 25;
-  v2 = (char *)this->pPlayers[0].pPlayerBuffs;
+  v2 = this->pPlayers;//[0].pPlayerBuffs;
   v6 = 4;
   do
   {
-    v3 = (SpellBuff *)v2;
+    v3 = v2->pPlayerBuffs;
     v7 = 24;
     do
     {
@@ -852,7 +848,7 @@
       --v7;
     }
     while ( v7 );
-    v2 += 6972;
+    ++v2;
     --v6;
   }
   while ( v6 );