diff mm7_5.cpp @ 1337:c6695ebd8fe6

Слияние
author Ritor1
date Thu, 04 Jul 2013 09:21:57 +0600
parents 3358b59b8fe8 f0be1fecd642
children 8bfdc44cebfd
line wrap: on
line diff
--- a/mm7_5.cpp	Thu Jul 04 09:21:40 2013 +0600
+++ b/mm7_5.cpp	Thu Jul 04 09:21:57 2013 +0600
@@ -5242,7 +5242,7 @@
   unsigned int v5; // edi@14
 
   v1 = this;
-  LOWORD(v2) = _404544();
+  _404544();
   if ( v1->pQueue[0].field_4 <= 0
     || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, PID_TYPE(v1->pQueue[0].uPackedID) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (PID_ID(v2)) + 1, uActiveCharacter = v2),
         viewparams->bRedrawGameUI = 1,
@@ -5583,43 +5583,44 @@
 //----- (00406A63) --------------------------------------------------------
 void stru262_TurnBased::_406A63()
 {
-  //stru262_TurnBased *v1; // ebx@1
-  //int v2; // esi@1
-  //unsigned __int8 v3; // zf@1
-  //unsigned __int8 v4; // sf@1
-  //signed int v5; // ecx@4
+  stru262_TurnBased *v1; // ebx@1
+  int v2; // esi@1
+  unsigned __int8 v3; // zf@1
+  unsigned __int8 v4; // sf@1
+  signed int v5; // ecx@4
   AIDirection a3; // [sp+8h] [bp-44h]@5
   AIDirection v7; // [sp+24h] [bp-28h]@5
   unsigned int v8; // [sp+40h] [bp-Ch]@5
   signed int a2; // [sp+44h] [bp-8h]@1
-  //TurnBased_QueueElem *v10; // [sp+48h] [bp-4h]@2
-
-  //v1 = this;
-  //v2 = 0;
+  TurnBased_QueueElem *v10; // [sp+48h] [bp-4h]@2
+
+  v1 = this;
+  v2 = 0;
   this->field_8 = 64;
   dword_50C994 = 0;
   uActiveCharacter = 0;
-  //v3 = this->uActorQueueSize == 0;
-  //v4 = this->uActorQueueSize < 0;
-
-  if ( this->uActorQueueSize )
+  v3 = this->uActorQueueSize == 0;
+  v4 = this->uActorQueueSize < 0;
+  a2 = 0;
+  if ( !(v4 | v3) )
   {
-    //v10 = this->pQueue;
-
-    for ( a2 = 0; a2 < this->uActorQueueSize; ++a2 )
+    v10 = this->pQueue;
+    while ( 1 )
     {
-      //v5 = this->pQueue[a2].uPackedID;
-      if (PID_TYPE(this->pQueue[a2].uPackedID) == OBJECT_Actor)
+      v5 = v10->uPackedID;
+      if (PID_TYPE(v10->uPackedID) == OBJECT_Actor)
       {
-        v8 = ai_near_actors_targets_pid[PID_ID(this->pQueue[a2].uPackedID)];
-        memcpy(&v7, Actor::GetDirectionInfo(this->pQueue[a2].uPackedID, v8, &a3, 0), sizeof(v7));
-        if ( !this->_406D10(a2) )
-          Actor::AI_Stand(PID_ID(this->pQueue[a2].uPackedID), v8, 0x20u, &v7);//actors move
+        v8 = ai_near_actors_targets_pid[PID_ID(v5)];
+        memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7));
+        if ( !v1->_406D10(a2) )
+          Actor::AI_Stand(PID_ID(v10->uPackedID), v8, 0x20u, &v7);
       }
-      //++v10;
-      //v2 = 0;
+      ++a2;
+      ++v10;
+      if ( a2 >= v1->uActorQueueSize )
+        break;
+      v2 = 0;
     }
-
   }
 }
 // 50C994: using guessed type int dword_50C994;
@@ -5674,58 +5675,79 @@
 int stru262_TurnBased::_406B9F()
 {
   signed int result; // eax@1
-  Actor *pCurrentActor; // ebx@5
+  unsigned __int8 v2; // zf@1
+  unsigned __int8 v3; // sf@1
+  int v4; // esi@4
+  unsigned int v5; // esi@5
+  Actor *v6; // ebx@5
+  unsigned __int16 v7; // cx@15
   AIDirection a3; // [sp+0h] [bp-50h]@15
   AIDirection v9; // [sp+1Ch] [bp-34h]@15
+  signed int a1; // [sp+38h] [bp-18h]@4
+  stru262_TurnBased *thisa; // [sp+3Ch] [bp-14h]@1
   unsigned int v12; // [sp+40h] [bp-10h]@5
   unsigned int v13; // [sp+44h] [bp-Ch]@8
+  TurnBased_QueueElem *v14; // [sp+48h] [bp-8h]@2
   signed int a2; // [sp+4Ch] [bp-4h]@1
 
   result = 0;
-  if ( this->uActorQueueSize )
+  thisa = this;
+  v2 = this->uActorQueueSize == 0;
+  v3 = this->uActorQueueSize < 0;
+  a2 = 0;
+  if ( !(v3 | v2) )
   {
-
-    for ( a2 = 0; a2 < this->uActorQueueSize; ++a2 )
+    v14 = this->pQueue;
+    while ( 1 )
     {
-      if (PID_TYPE(this->pQueue[a2].uPackedID) != OBJECT_Player)
+      v4 = v14->uPackedID;
+      a1 = v14->uPackedID;
+      if (PID_TYPE(a1) != OBJECT_Player)
       {
-        pCurrentActor = &pActors[PID_ID(this->pQueue[a2].uPackedID)];
-        if ( pCurrentActor->pActorBuffs[5].uExpireTime <= 0 )
-          v13 = 0;
+        v5 = PID_ID(v4);
+        v12 = v5;
+        v6 = &pActors[v5];
+        if ( SHIDWORD(v6->pActorBuffs[5].uExpireTime) < result
+          || SHIDWORD(v6->pActorBuffs[5].uExpireTime) <= result && LODWORD(v6->pActorBuffs[5].uExpireTime) <= result )
+          v13 = result;
         else
           v13 = 1;
-        if ( pCurrentActor->pActorBuffs[6].uExpireTime >= 0 )
-          v12 = 1;
-        if ( !(v13 != 0 || v12 || pCurrentActor->uAIState == Dead || pCurrentActor->uAIState == Removed || pCurrentActor->uAIState == Disabled) )
+        if ( SHIDWORD(v6->pActorBuffs[6].uExpireTime) >= result
+          && (SHIDWORD(v6->pActorBuffs[6].uExpireTime) > result || LODWORD(v6->pActorBuffs[6].uExpireTime) > result) )
+          result = 1;
+        if ( !(v13 != 0 || result || v6->uAIState == 5 || v6->uAIState == 11 || v6->uAIState == 19) )
         {
-          v13 = ai_near_actors_targets_pid[PID_ID(this->pQueue[a2].uPackedID)];
-          memcpy(&v9, Actor::GetDirectionInfo(this->pQueue[a2].uPackedID, v13, &a3, 0), sizeof(v9));
-          if ( pCurrentActor->uAIState == Pursuing || pCurrentActor->uAIState == Tethered )
+          v13 = ai_near_actors_targets_pid[v5];
+          memcpy(&v9, Actor::GetDirectionInfo(a1, v13, &a3, 0), sizeof(v9));
+          v7 = v6->uAIState;
+          if ( v7 == 6 || v7 == 1 )
           {
             if ( (double)(signed int)v9.uDistance < 307.2 )
+              goto LABEL_26;
+          }
+          v6->uCurrentActionTime += pEventTimer->uTimeElapsed;
+          if ( (signed int)v6->uCurrentActionTime > v6->uCurrentActionLength )
+          {
+            if ( v7 == 4 )
             {
-              Actor::AI_Stand(PID_ID(this->pQueue[a2].uPackedID), v13, 0x20u, &v9);
-              continue;
+              v6->uCurrentActionTime = 0;
+              v6->uCurrentActionLength = 0;
+              v6->uAIState = Dead;
+              v6->UpdateAnimation();
             }
-          }
-          pCurrentActor->uCurrentActionTime += pEventTimer->uTimeElapsed;
-          if ( (signed int)pCurrentActor->uCurrentActionTime > pCurrentActor->uCurrentActionLength )
-          {
-            if ( pCurrentActor->uAIState == Dying )
-            {
-              pCurrentActor->uCurrentActionTime = 0;
-              pCurrentActor->uCurrentActionLength = 0;
-              pCurrentActor->uAIState = Dead;
-              pCurrentActor->UpdateAnimation();
-            }
-            if ( !this->_406D10(a2) )
-              Actor::AI_Stand(PID_ID(this->pQueue[a2].uPackedID), v13, 0x20u, &v9);
+            if ( !thisa->_406D10(a2) )
+LABEL_26:
+              Actor::AI_Stand(v12, v13, 0x20u, &v9);
           }
         }
       }
+      ++a2;
+      result = (signed int)thisa;
+      ++v14;
+      if ( a2 >= thisa->uActorQueueSize )
+        break;
       result = 0;
     }
-
   }
   return result;
 }
@@ -5763,7 +5785,7 @@
   unsigned int uActorID; // [sp+50h] [bp-4h]@2
   unsigned int a2a; // [sp+5Ch] [bp+8h]@7
 
-  //__debugbreak();//      
+ // __debugbreak();//      
   v2 = *(&this->field_0 + 4 * (a2 + 2));
   if (PID_TYPE(v2) == OBJECT_Player)
     return 0;