diff mm7_4.cpp @ 89:98cd93e14777

pointer fixes
author zipi
date Wed, 06 Feb 2013 21:19:42 +0000
parents 170259c8c71f
children d61f6bc04bf2
line wrap: on
line diff
--- a/mm7_4.cpp	Mon Feb 04 17:21:02 2013 +0600
+++ b/mm7_4.cpp	Wed Feb 06 21:19:42 2013 +0000
@@ -2871,31 +2871,31 @@
 
 
 //----- (004908DE) --------------------------------------------------------
-signed int __cdecl sub_4908DE()
-{
-  char *v0; // esi@1
+signed int __cdecl PlayerCreation_Chose4Skills()
+{
+  Player *v0; // esi@1
   signed int v1; // edx@2
-  char *v2; // eax@2
+  unsigned short *v2; // eax@2
   signed int v3; // ecx@2
 
-  v0 = (char *)pParty->pPlayers[0].pActiveSkills;
+  v0 = pParty->pPlayers;//[0].pActiveSkills;
   while ( 1 )
   {
     v1 = 0;
-    v2 = v0;
+	v2 = v0->pActiveSkills;
     v3 = 37;
     do
     {
-      if ( *(short *)v2 )
+      if ( *v2 )
         ++v1;
-      v2 += 2;
+      ++v2;
       --v3;
     }
     while ( v3 );
     if ( v1 < 4 )
       break;
-    v0 += 6972;
-    if ( (signed int)v0 >= (signed int)&pParty->field_777C[18] )
+    ++v0;
+	if ( v0 > &pParty->pPlayers[3] )
       return 1;
   }
   return 0;
@@ -9365,13 +9365,13 @@
   int v3; // eax@4
   signed int v4; // eax@9
   int v5; // ebx@11
-  char *v6; // esi@13
-  char *v7; // eax@14
+  Player *v6; // esi@13
+  ItemGen *v7; // eax@14
   signed int v8; // edi@14
-  int v9; // [sp+Ch] [bp-Ch]@11
+  ItemGen *v9; // [sp+Ch] [bp-Ch]@11
   signed int v10; // [sp+10h] [bp-8h]@13
   int v11; // [sp+14h] [bp-4h]@1
-  char *v12; // [sp+14h] [bp-4h]@11
+  Player *v12; // [sp+14h] [bp-4h]@11
 
   dword_F8B1A8 = 0;
   v11 = 0;
@@ -9380,13 +9380,13 @@
   v0 = _4F0882_evt_VAR_PlayerItemInHands_vals;
   while ( 1 )
   {
-    if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, *(v0 - 1)) )
+    if ( (unsigned __int16)_449B57_test_bit(pParty->_award_bits, *v0) )
     {
       v1 = 0;
       v2 = pParty->pPlayers;
       do
       {
-        LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *v0);
+        LOBYTE(v3) = v2->CompareVariable(VAR_PlayerItemInHands, *(v0+1));
         if ( v3 )
           break;
         ++v2;
@@ -9398,55 +9398,57 @@
     }
     ++v11;
     v0 += 2;
-    if ( (signed int)v0 >= (signed int)((char *)dword_4F08EC + 2) )
-      goto LABEL_10;
-  }
-  ptr_F8B1E8 = (char *)pNPCTopics[666].pText;
-  v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
-  dword_F8B1A8 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
-  pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4);
-LABEL_10:
+    if ( v0 > &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
+	  break;
+  }
+  if ( v0 <= &_4F0882_evt_VAR_PlayerItemInHands_vals[53] )
+  {
+	  ptr_F8B1E8 = (char *)pNPCTopics[666].pText;
+	  v4 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
+	  dword_F8B1A8 = _4F0882_evt_VAR_PlayerItemInHands_vals[2 * v11];
+	  pParty->pPlayers[0].AddVariable(VAR_PlayerItemInHands, v4);
+  }
   if ( dword_F8B1A8 == 601 )
   {
     v5 = 0;
-    v12 = (char *)&pParty->pPlayers[0].uClass;
+    v12 = pParty->pPlayers;//[0].uClass;
     v9 = 0;
     while ( 1 )
     {
-      if ( *v12 == 35 )
+	  if ( v12->uClass == 35 )
       {
         v10 = 0;
-        v6 = &pParty->pPlayers[0].pInventoryItems[0].field_1A;
+        v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A;
         do
         {
-          v7 = v6;
+		  v7 = v6->pInventoryItems;
           v8 = 138;
           do
           {
-            if ( *(int *)(v7 - 26) == 601 )
+			if ( v7->uItemID == 601 )
             {
-              if ( !*v7 )
-                v9 = (int)(v7 - 26);
-              if ( (unsigned __int8)*v7 == v5 )
+			  if ( !v7->field_1A )
+				  v9 = v7;
+			  if ( v7->field_1A == v5 )
                 v10 = 1;
             }
-            v7 += 36;
+            ++v7;
             --v8;
           }
           while ( v8 );
-          v6 += 6972;
-        }
-        while ( (signed int)v6 < (signed int)((char *)&pParty->field_777C[91] + 2) );
+          ++v6;
+        }
+		while ( v6 <= &pParty->pPlayers[3] );
         if ( !v10 )
           break;
       }
-      v12 += 6972;
+      ++v12;
       ++v5;
-      if ( (signed int)v12 >= (signed int)((char *)&pParty->pPickedItem.uExpireTime + 5) )
+	  if ( v12 > &pParty->pPlayers[3] )
         return;
     }
     if ( v9 )
-      *(char *)(v9 + 26) = v5;
+	  v9->field_1A = v5;
   }
 }
 // 4F08EC: using guessed type int dword_4F08EC[];