changeset 1328:8ed112935a48

m
author Ritor1
date Tue, 02 Jul 2013 14:08:30 +0600
parents 8433de6fd7d0
children 27a699abee51
files Viewport.cpp mm7_3.cpp
diffstat 2 files changed, 73 insertions(+), 67 deletions(-) [+]
line wrap: on
line diff
--- a/Viewport.cpp	Mon Jul 01 09:26:35 2013 +0600
+++ b/Viewport.cpp	Tue Jul 02 14:08:30 2013 +0600
@@ -303,6 +303,7 @@
     }
     if ( !pParty->pPickedItem.uItemID )
       return;
+		__debugbreak();//no checker
     v6 = 0;
     a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
     if ( (signed int)pObjectList->uNumObjects <= 0 )
@@ -356,6 +357,7 @@
       }
       if ( !pParty->pPickedItem.uItemID )
         return;
+		__debugbreak();//no checker
       v6 = 0;
       a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
       if ( (signed int)pObjectList->uNumObjects <= 0 )
@@ -404,6 +406,7 @@
         {
           if ( !pParty->pPickedItem.uItemID )
             return;
+		__debugbreak();//no checker
           v6 = 0;
           a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
           if ( (signed int)pObjectList->uNumObjects <= 0 )
@@ -489,6 +492,7 @@
     {
       if ( !pParty->pPickedItem.uItemID )
         return;
+		__debugbreak();//no checker
       v6 = 0;
       a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
       if ( (signed int)pObjectList->uNumObjects <= 0 )
@@ -554,6 +558,7 @@
           if ( !pParty->pPickedItem.uItemID )
             return;
         }
+		__debugbreak();//no checker
         v6 = 0;
         a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
         if ( (signed int)pObjectList->uNumObjects <= 0 )
@@ -606,6 +611,7 @@
           if ( !pParty->pPickedItem.uItemID )
             return;
         }
+		__debugbreak();//no checker
         v6 = 0;
         a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
         if ( (signed int)pObjectList->uNumObjects <= 0 )
@@ -655,6 +661,7 @@
   {
     if ( !pParty->pPickedItem.uItemID )
       return;
+		__debugbreak();//no checker
     v6 = 0;
     a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID;
     if ( (signed int)pObjectList->uNumObjects <= 0 )
--- a/mm7_3.cpp	Mon Jul 01 09:26:35 2013 +0600
+++ b/mm7_3.cpp	Tue Jul 02 14:08:30 2013 +0600
@@ -12578,15 +12578,15 @@
   Actor *pActor; // edi@7
   unsigned int v7; // eax@9
   unsigned int v8; // edx@10
-  unsigned __int8 v9; // zf@14
-  unsigned __int8 v10; // sf@14
-  unsigned __int8 v11; // of@14
-  char *v12; // esi@15
-  int v13; // ecx@16
-  unsigned __int16 v14; // ax@17
+  //unsigned __int8 v9; // zf@14
+  //unsigned __int8 v10; // sf@14
+  //unsigned __int8 v11; // of@14
+  //char *v12; // esi@15
+  //int v13; // ecx@16
+  //unsigned __int16 v14; // ax@17
   int v15; // ecx@18
   signed __int64 v16; // qax@19
-  int v17; // edx@22
+  //int v17; // edx@22
   unsigned int v18; // esi@27
   char *v19; // esi@32
   int v20; // edx@33
@@ -12601,7 +12601,7 @@
   AIDirection v30; // [sp+Ch] [bp-68h]@10
   AIDirection v31; // [sp+28h] [bp-4Ch]@10
   AIDirection a3; // [sp+44h] [bp-30h]@10
-  int v33; // [sp+60h] [bp-14h]@10
+  //int v33; // [sp+60h] [bp-14h]@10
   int *v34; // [sp+64h] [bp-10h]@6
   int v35; // [sp+68h] [bp-Ch]@5
   Player *pPlayer; // [sp+6Ch] [bp-8h]@1
@@ -12622,23 +12622,20 @@
   this->field_8 = 64;
   this->field_4 = 1;
   this->uActorQueueSize = 0;
-  v3 = 0;
-  do
+  for ( v3 = 0; pPlayer <= &pParty->pPlayers[3]; ++v3 )
   {
     if ( pPlayer->CanAct() )
     {
-      *(&this->field_0 + 4 * (this->uActorQueueSize + 2)) = PID(OBJECT_Player,v3);
+      this->pQueue[this->uActorQueueSize].uPackedID = PID(OBJECT_Player,v3);
       this->pQueue[this->uActorQueueSize].field_C = 2;
       this->pQueue[this->uActorQueueSize].uActionLength = 0;
       pParty->pTurnBasedPlayerRecoveryTimes[this->uActorQueueSize++] = 0;
     }
     ++pPlayer;
-    ++v3;
-  }
-  while ( pPlayer <= &pParty->pPlayers[3] );
+  }
   v35 = this->uActorQueueSize;
-  v4 = v35;
-  v40b = v35;
+  v4 = this->uActorQueueSize;
+  v40b = this->uActorQueueSize;
   if ( v40b < v40b + ai_arrays_size )
   {
     v34 = (int *)ai_near_actors_ids.data();
@@ -12652,16 +12649,16 @@
         if ( pActors[v37].CanAct() )
         {
           v7 = pActor->uAttributes;
-          if ( v7 & 0x8000 )
+          if ( pActor->uAttributes & 0x8000 )
           {
             v8 = ai_near_actors_targets_pid[v5];
             LOBYTE(v7) = v7 | 0x80;
             pActor->uAttributes = v7;
-            v33 = PID(OBJECT_Actor,v5);
+            //v33 = PID(OBJECT_Actor,v5);
             memcpy(&v31, Actor::GetDirectionInfo(PID(OBJECT_Actor,v5), v8, &a3, 0), sizeof(v31));
             memcpy(&v30, &v31, sizeof(v30));
             Actor::AI_StandOrBored(v37, 4, 32, &v30);
-            *(&this->field_0 + 4 * (this->uActorQueueSize + 2)) = v33;
+            this->pQueue[this->uActorQueueSize].uPackedID = PID(OBJECT_Actor,v5);
             this->pQueue[this->uActorQueueSize].field_C = 2;
             this->pQueue[this->uActorQueueSize++].uActionLength = 0;
           }
@@ -12674,60 +12671,62 @@
     while ( v40b < v4 + ai_arrays_size );
     v2 = 0;
   }
-  v11 = __OFSUB__(this->uActorQueueSize, v2);
-  v9 = this->uActorQueueSize == v2;
-  v10 = ((this->uActorQueueSize - v2) & 0x80000000u) != 0;
+  //v11 = __OFSUB__(this->uActorQueueSize, v2);
+  //v9 = this->uActorQueueSize == v2;
+  //v10 = ((this->uActorQueueSize - v2) & 0x80000000u) != 0;
   v37 = v2;
-  v40b = v2;
-  if ( !((unsigned __int8)(v10 ^ v11) | v9) )
-  {
-    v12 = (char *)&this->pQueue[0].field_4;
-    while ( 1 )
-    {
-      v13 = PID_TYPE(*((int *)v12 - 1));
-      if ( v13 != OBJECT_Player )
+  //if ( !((unsigned __int8)(v10 ^ v11) | v9) )
+  if ( this->uActorQueueSize > v2 )
+  {
+    //v12 = (char *)&this->pQueue[0].field_4;
+
+    //while ( 1 )
+    for ( v40b = v2; v40b < this->uActorQueueSize; ++v40b )
+    {
+      //v13 = PID_TYPE(this->pQueue[0].uPackedID);
+      if ( PID_TYPE(this->pQueue[0].uPackedID) != OBJECT_Player )
         break;
-      v14 = pPlayers[(*((int *)v12 - 1) >> 3) + 1]->uTimeToRecovery;
-      if ( v14 != (short)v2 )
-      {
-        v33 = v14;
-        v16 = (signed __int64)((double)v14 * 0.46875);
-        *(int *)v12 = v16;
-        goto LABEL_26;
+      //v14 = pPlayers[(this->pQueue[0].uPackedID >> 3) + 1]->uTimeToRecovery;
+      if ( pPlayers[(this->pQueue[0].uPackedID >> 3) + 1]->uTimeToRecovery != (short)v2 )
+      {
+        //v33 = pPlayers[(this->pQueue[0].uPackedID >> 3) + 1]->uTimeToRecovery;
+        v16 = (signed __int64)((double)pPlayers[(this->pQueue[0].uPackedID >> 3) + 1]->uTimeToRecovery * 0.46875);
+        *(int *)this->pQueue[0].field_4 = v16;
+        this->pQueue[0].field_4 += 16;
+        continue;
       }
       v15 = v37++;
       *(&a3.uDistance + v15) = v40b;
-LABEL_26:
-      ++v40b;
-      v12 += 16;
-      if ( v40b >= this->uActorQueueSize )
-        goto LABEL_27;
-    }
-    if ( v13 != 3 )
-    {
-      *(int *)v12 = 666;
-      goto LABEL_26;
-    }
-    v17 = rand() % 99;
-    if ( v17 < 33 )
-    {
-      *(int *)v12 = 1;
-      goto LABEL_26;
-    }
-    LODWORD(v16) = SHIDWORD(v16) < 66;
-    LOBYTE(v16) = SHIDWORD(v16) >= 66;
-    LODWORD(v16) = 2 * v16 + 3;
-    *(int *)v12 = v16;
-    goto LABEL_26;
-  }
+
+      if ( PID_TYPE(this->pQueue[0].uPackedID) != 3 )
+      {
+        this->pQueue[0].field_4 = 666;
+        this->pQueue[0].field_4 += 16;
+        continue;
+      }
+      //v17 = rand() % 99;
+      if ( rand() % 99 < 33 )
+      {
+        *(int *)this->pQueue[0].field_4 = 1;
+        this->pQueue[0].field_4 += 16;
+        continue;
+      }
+      //LODWORD(v16) = SHIDWORD(v16) < 66;
+      LOBYTE(v16) = SHIDWORD(v16) >= 66;
+      LODWORD(v16) = 2 * v16 + 3;
+      *(int *)this->pQueue[0].field_4 = v16;
+      this->pQueue[0].field_4 += 16;
+    }
+  }
+
 LABEL_27:
   v18 = 0;
   if ( (signed int)v37 > (signed int)v2 )
   {
     do
     {
-      __debugbreak();
-      *(&v31.uDistance + v18) = pParty->pPlayers[*(&this->field_0 + 4 * (*(&a3.uDistance + v18) + 2)) >> 3].GetAttackRecoveryTime(v2);
+      //__debugbreak();
+      *(&v31.uDistance + v18) = pParty->pPlayers[this->pQueue[*(&a3.uDistance + v18)].uPackedID >> 3].GetAttackRecoveryTime(v2);//result crash
       ++v18;
     }
     while ( (signed int)v18 < (signed int)v37 );
@@ -12744,13 +12743,13 @@
           do
           {
             v20 = *(int *)v19;
-            v33 = 4 * v40b;
+            //v33 = 4 * v40b;
             v21 = (char *)(&v31.uDistance + v40b);
             v22 = *(int *)v21;
             if ( *(int *)v21 < v20 )
             {
               *(int *)v21 = v20;
-              v23 = v33;
+              v23 = 4 * v40b;
               *(int *)v19 = v22;
               v24 = (char *)&a3.uDistance + v23;
               v25 = (char *)&a3.uDistance + v35;
@@ -12773,11 +12772,11 @@
         {
           v27 = v2 + 2;
           v28 = *(&a3.uDistance + v2++);
-          v11 = __OFSUB__(v2, v37);
-          v10 = ((v2 - v37) & 0x80000000u) != 0;
+          //v11 = __OFSUB__(v2, v37);
+          //v10 = ((v2 - v37) & 0x80000000u) != 0;
           this->pQueue[v28].field_4 = v27;
         }
-        while ( v10 ^ v11 );
+        while ( v37 > v2 );
       }
     }
   }