changeset 2244:66c509997062

TE monster attack
author Ritor1
date Mon, 24 Feb 2014 16:54:21 +0600
parents 9e1bd714d1d2
children 8817c398b792
files TurnEngine.cpp
diffstat 1 files changed, 5 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/TurnEngine.cpp	Mon Feb 24 16:19:09 2014 +0600
+++ b/TurnEngine.cpp	Mon Feb 24 16:54:21 2014 +0600
@@ -714,32 +714,19 @@
 //----- (0040680F) --------------------------------------------------------
 void stru262_TurnBased::AI_Action_( int queue_index )
 {
-  //TurnBased_QueueElem *v2; // eax@1
-  //unsigned int v3; // eax@1
   unsigned int actor_id; // edi@2
-  //Actor *v5; // ebx@2
   AIDirection v7; // esi@10
-  //int v8; // eax@10
   int v9; // ecx@10
   signed int v10; // eax@13
   int v14; // eax@29
   AIDirection a3; // [sp+Ch] [bp-44h]@10
   AIDirection v18; // [sp+28h] [bp-28h]@10
-  //int a2a; // [sp+44h] [bp-Ch]@2
-  //int v20; // [sp+48h] [bp-8h]@10
-  //TurnBased_QueueElem *v21; // [sp+4Ch] [bp-4h]@1
   signed int v22; // [sp+58h] [bp+8h]@10
 
-  //v2 = &pQueue[queue_index];
-  //v21 = v2;
   pQueue[queue_index].uActionLength = 0;
-  //v3 = pQueue[queue_index].uPackedID;
   if (PID_TYPE(pQueue[queue_index].uPackedID) == OBJECT_Actor)
   {
     actor_id = PID_ID(pQueue[queue_index].uPackedID);
-    //a2a = pQueue[queue_index].uPackedID;
-    //v5 = &pActors[actor_id];
-    //v3 = v5->uAIState;
     if (!(pActors[actor_id].uAIState == AIState::Dying || pActors[actor_id].uAIState == AIState::Dead || pActors[actor_id].uAIState == AIState::Summoned ||
           pActors[actor_id].uAIState == AIState::Disabled || pActors[actor_id].uAIState == AIState::Removed))
     {
@@ -748,16 +735,11 @@
       if ( pActors[actor_id].pMonsterInfo.uHostilityType && !v22)
         pActors[actor_id].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
       Actor::GetDirectionInfo(PID(OBJECT_Actor,actor_id), v22, &v7, 0);
-      //v8 = pActors[actor_id].uActorRadius;
       memcpy(&a3, &v7, sizeof(AIDirection));
       memcpy(&v18, &a3, sizeof(AIDirection));
       v9 = a3.uDistance - pActors[actor_id].uActorRadius;
-      //v20 = a3.uDistance - pActors[actor_id].uActorRadius;
       if ( v9 < 0 )
-      {
         v9 = 0;
-        //v20 = 0;
-      }
       if (PID_TYPE(v22) == OBJECT_Actor)
         //v10 = (unsigned __int8)*(&byte_5C8D1A[89 * (pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID - 1) / 3] + (v5->pMonsterInfo.uID - 1) / 3);
         v10 = pFactionTable->relations[(pMonsterStats->pInfos[pActors[PID_ID(v22)].pMonsterInfo.uID].uID) / 3 + 1][(pActors[actor_id].pMonsterInfo.uID - 1) / 3 + 1];
@@ -816,16 +798,20 @@
               pQueue[queue_index].AI_action_type = TE_AI_RANGED_ATTACK;
             }
         }
-        if (!pQueue[queue_index].AI_action_type)
+        //if (!pQueue[queue_index].AI_action_type)
           if ( (double)v9 < 307.2)
           {
             Actor::AI_MeleeAttack(actor_id, v22, &v18);
             pQueue[queue_index].AI_action_type = TE_AI_MELEE_ATTACK;
+            pQueue[queue_index].uActionLength = pActors[actor_id].uCurrentActionLength;
+            return;
           }
           else
           {
             Actor::AI_Stand(actor_id, v22, 64, &v18);
             pQueue[queue_index].AI_action_type = TE_AI_STAND;
+            pQueue[queue_index].uActionLength = pActors[actor_id].uCurrentActionLength;
+            return;
           }
       }
       else