diff mm7_5.cpp @ 920:34ed2d5e7cfb

MagicShopDialog clean and other
author Ritor1
date Sun, 28 Apr 2013 19:11:36 +0600
parents 897b10712a1a
children 3696848c0413 21cc2b274220
line wrap: on
line diff
--- a/mm7_5.cpp	Sat Apr 27 09:37:22 2013 +0600
+++ b/mm7_5.cpp	Sun Apr 28 19:11:36 2013 +0600
@@ -7480,16 +7480,16 @@
 bool stru262_TurnBased::_406D10(signed int a2)
 {
   int v2; // ecx@1
-  int v3; // ecx@2
-  Actor *v4; // ebx@2
-  unsigned __int16 v5; // dx@2
+  //int v3; // ecx@2
+  Actor *actor; // ebx@2
+  //unsigned __int16 v5; // dx@2
   int *v6; // esi@7
   TurnBased_QueueElem *v7; // edi@7
   int v8; // eax@7
   AIDirection *v9; // esi@10
   int v10; // eax@10
   unsigned int v11; // ecx@10
-  unsigned __int8 v12; // al@12
+  unsigned __int8 pHostileType; // al@12
   unsigned __int8 v13; // sf@16
   unsigned __int8 v14; // of@16
   unsigned int v15; // edx@22
@@ -7509,26 +7509,26 @@
   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;
-  v3 = PID_ID(v2);
-  uActorID = v3;
-  v4 = &pActors[v3];
-  v5 = v4->uAIState;
-  if ( v5 == 5 || v5 == 4 || v5 == 11 || v5 == 19 || v5 == 17 )
+  uActorID = PID_ID(v2);
+  //uActorID = v3;
+  actor = &pActors[uActorID];
+  //v5 = v4->uAIState;
+  if ( actor->uAIState == 5 || actor->uAIState == 4 || actor->uAIState == 11 || actor->uAIState == 19 || actor->uAIState == 17 )
     return 1;
-  v6 = &ai_near_actors_targets_pid[v3];
+  v6 = &ai_near_actors_targets_pid[uActorID];
   v7 = &pTurnEngine->pQueue[a2];
   v8 = *v6;
   v29 = &pTurnEngine->pQueue[a2];
   a2a = v8;
-  Actor::_SelectTarget(v3, &ai_near_actors_targets_pid[v3], true);
-  if ( v4->pMonsterInfo.uHostilityType && !*v6 )
-    v4->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
+  Actor::_SelectTarget(uActorID, &ai_near_actors_targets_pid[uActorID], true);
+  if ( actor->pMonsterInfo.uHostilityType && !*v6 )
+    actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
   v9 = Actor::GetDirectionInfo(v7->uPackedID, a2a, &a3, 0);
-  v10 = v4->uActorRadius;
+  v10 = actor->uActorRadius;
   memcpy(&a3, v9, sizeof(a3));
   memcpy(&pDir, &a3, sizeof(pDir));
   v11 = a3.uDistance - v10;
@@ -7538,82 +7538,101 @@
     v11 = 0;
     v28 = 0;
   }
-  v12 = v4->pMonsterInfo.uHostilityType;
-  if ( v12 == 1 )
+  pHostileType = actor->pMonsterInfo.uHostilityType;
+  if ( pHostileType == 1 )
   {
     if ( (double)(signed int)v28 >= 307.2 )
       goto LABEL_21;
-LABEL_20:
-    v4->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
+    actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
     goto LABEL_21;
   }
-  if ( v12 == 2 )
+  if ( pHostileType == 2 )
   {
     v14 = __OFSUB__(v11, 1024);
     v13 = ((v11 - 1024) & 0x80000000u) != 0;
   }
   else
   {
-    if ( v12 != 3 )
+    if ( pHostileType != 3 )
       goto LABEL_21;
     v14 = __OFSUB__(v11, 2560);
     v13 = ((v11 - 2560) & 0x80000000u) != 0;
   }
   if ( v13 ^ v14 )
-    goto LABEL_20;
+  {
+    actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
+  }
 LABEL_21:
-  if ( (signed __int64)v4->pActorBuffs[4].uExpireTime > 0 )
-  {
-    v15 = a2a;
+  if ( (signed __int64)actor->pActorBuffs[4].uExpireTime > 0 )
+  {
     if ( (signed int)v11 < 10240 )
     {
-      v23 = &pDir;
-      v16 = uActorID;
-      v21 = 0;
-      goto LABEL_24;
-    }
-    v24 = 0;
-    v22 = 1024;
-    goto LABEL_58;
-  }
-  if ( v4->pMonsterInfo.uHostilityType != 4 )
+      Actor::Flee(uActorID, a2a, 0, &pDir);
+      v29->field_C = 4;
+      v29->uActionLength = actor->uCurrentActionLength;
+      return 1;
+    }
+    Actor::_4032B2(uActorID, a2a, 1024, 0);
+    v29->field_C = 2;
+    v29->uActionLength = actor->uCurrentActionLength;
+    return 1;
+  }
+  if ( actor->pMonsterInfo.uHostilityType != 4 )
     goto LABEL_46;
-  if ( !(v4->uAttributes & 0x020000) || v4->pMonsterInfo.uAIType == 1 )
-  {
-    if ( v4->pMonsterInfo.uAIType == 1 )
-      goto LABEL_36;
-    if ( v4->pMonsterInfo.uAIType == 2 )
-    {
-      v27 = v4->sCurrentHP;
+  if ( !(actor->uAttributes & 0x020000) || actor->pMonsterInfo.uAIType == 1 )
+  {
+    if ( actor->pMonsterInfo.uAIType == 1 )
+    {
+      if ( actor->pMonsterInfo.uMovementType == 5 )
+      {
+        Actor::AI_Stand(uActorID, a2a, 32, 0);
+        v29->field_C = 4;
+        v29->uActionLength = actor->uCurrentActionLength;
+        return 1;
+      }
+      Actor::Flee(uActorID, a2a, 32, 0);
+      v29->field_C = 4;
+      v29->uActionLength = actor->uCurrentActionLength;
+      return 1;
+    }
+    if ( actor->pMonsterInfo.uAIType == 2 )
+    {
+      v27 = actor->sCurrentHP;
       v18 = (double)v27;
-      v19 = (double)(signed int)v4->pMonsterInfo.uHP * 0.2;
-      goto LABEL_34;
-    }
-    if ( v4->pMonsterInfo.uAIType == 3 )
-    {
-      v27 = v4->sCurrentHP;
-      v18 = (double)v27;
-      v19 = (double)(signed int)v4->pMonsterInfo.uHP * 0.1;
-LABEL_34:
+      v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.2;
       if ( v19 > v18 && (signed int)v11 < 10240 )
       {
-LABEL_36:
-        v16 = uActorID;
-        v15 = a2a;
-        v23 = 0;
-        v21 = 32;
-        if ( v4->pMonsterInfo.uMovementType == 5 )
-        {
-          Actor::AI_Stand(uActorID, a2a, 0x20u, 0);
-          goto LABEL_25;
-        }
-LABEL_24:
-        Actor::Flee(v16, v15, v21, v23);
-LABEL_25:
-        v17 = v29;
+        if ( actor->pMonsterInfo.uMovementType == 5 )
+        {
+          Actor::AI_Stand(uActorID, a2a, 32, 0);
+          v29->field_C = 4;
+          v29->uActionLength = actor->uCurrentActionLength;
+          return 1;
+        }
+        Actor::Flee(uActorID, a2a, 32, 0);
         v29->field_C = 4;
-LABEL_60:
-        v17->uActionLength = v4->uCurrentActionLength;
+        v29->uActionLength = actor->uCurrentActionLength;
+        return 1;
+      }
+      goto LABEL_39;
+    }
+    if ( actor->pMonsterInfo.uAIType == 3 )
+    {
+      v27 = actor->sCurrentHP;
+      v18 = (double)v27;
+      v19 = (double)(signed int)actor->pMonsterInfo.uHP * 0.1;
+      if ( v19 > v18 && (signed int)v11 < 10240 )
+      {
+        if ( actor->pMonsterInfo.uMovementType == 5 )
+        {
+          Actor::AI_Stand(uActorID, a2a, 32, 0);
+          v29->field_C = 4;
+          v29->uActionLength = actor->uCurrentActionLength;
+          return 1;
+        }
+        Actor::Flee(uActorID, a2a, 32, 0);
+        v29->field_C = 4;
+        v29->uActionLength = actor->uCurrentActionLength;
         return 1;
       }
       goto LABEL_39;
@@ -7624,50 +7643,49 @@
     return 0;
   if ( (signed int)v11 < 5120 )
   {
-    if ( v4->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 )
+    if ( actor->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 )
       Actor::Pursue1(uActorID, a2a, uActorID, 32, &pDir);
     else
       Actor::Pursue2(uActorID, a2a, 32, &pDir, 307);
-    goto LABEL_59;
+    v29->field_C = 2;
+    v29->uActionLength = actor->uCurrentActionLength;
+     return 1;
   }
 LABEL_46:
-  if ( !v4->pMonsterInfo.uMovementType )
-  {
-    v24 = 32;
-    v22 = 1024;
-    goto LABEL_57;
-  }
-  if ( v4->pMonsterInfo.uMovementType == 1 )
-  {
-    v24 = 32;
-    v22 = 2560;
-    goto LABEL_57;
-  }
-  if ( v4->pMonsterInfo.uMovementType == 2 )
-  {
-    v24 = 32;
-    v22 = 5120;
-LABEL_57:
-    v15 = a2a;
-LABEL_58:
-    Actor::_4032B2(uActorID, v15, v22, v24);
-LABEL_59:
-    v17 = v29;
+  if ( !actor->pMonsterInfo.uMovementType )
+  {
+    Actor::_4032B2(uActorID, a2a, 1024, 32);
+    v29->field_C = 2;
+    v29->uActionLength = actor->uCurrentActionLength;
+    return 1;
+  }
+  if ( actor->pMonsterInfo.uMovementType == 1 )
+  {
+    Actor::_4032B2(uActorID, a2a, 2560, 32);
     v29->field_C = 2;
-    goto LABEL_60;
-  }
-  if ( v4->pMonsterInfo.uMovementType == 4 )
+    v29->uActionLength = actor->uCurrentActionLength;
+    return 1;
+  }
+  if ( actor->pMonsterInfo.uMovementType == 2 )
+  {
+    Actor::_4032B2(uActorID, a2a, 5120, 32);
+    v29->field_C = 2;
+    v29->uActionLength = actor->uCurrentActionLength;
+    return 1;
+  }
+  if ( actor->pMonsterInfo.uMovementType == 4 )
   {
     Actor::_4032B2(uActorID, a2a, 10240, 32);
-    goto LABEL_53;
-  }
-  if ( v4->pMonsterInfo.uMovementType == 5 )
-  {
-    Actor::AI_Stand(uActorID, a2a, 0x20u, 0);
-LABEL_53:
-    v17 = v29;
     v29->field_C = 2;
-    goto LABEL_60;
+    v29->uActionLength = actor->uCurrentActionLength;
+    return 1;
+  }
+  if ( actor->pMonsterInfo.uMovementType == 5 )
+  {
+    Actor::AI_Stand(uActorID, a2a, 32, 0);
+    v29->field_C = 2;
+    v29->uActionLength = actor->uCurrentActionLength;
+    return 1;
   }
   return 1;
 }