diff mm7_5.cpp @ 417:55684f4eda73

Actor::SelectTarget & ai_near_actors_targets_pid
author Nomad
date Sat, 23 Feb 2013 19:31:56 +0200
parents d8b3056df4e2
children 58b71c1af7d8
line wrap: on
line diff
--- a/mm7_5.cpp	Sat Feb 23 17:15:36 2013 +0200
+++ b/mm7_5.cpp	Sat Feb 23 19:31:56 2013 +0200
@@ -4749,7 +4749,7 @@
       v37 = v3;
       if ( stru_50FE08.field_3EC[v0] & 1 )
       {
-        v6 = dword_4F6E08[v3];
+        v6 = ai_near_actors_targets_pid[v3];
         v7 = v6 >> 3;
         v8 = (v6 & 7) - 3;
         uActorID = v7;
@@ -9721,7 +9721,7 @@
           if ( v6 != 8 )
             goto LABEL_19;
           v3 = 0;
-          Actor::AI_StandOrBored(v2->uPackedID >> 3, dword_4F6E08[v2->uPackedID >> 3], 32, 0);
+          Actor::AI_StandOrBored(v2->uPackedID >> 3, ai_near_actors_targets_pid[v2->uPackedID >> 3], 32, 0);
         }
       }
     }
@@ -9753,7 +9753,7 @@
           {
             if ( v11 != 17 )
             {
-              v12 = dword_4F6E08[v10];
+              v12 = ai_near_actors_targets_pid[v10];
               v9->uActionLength = v3;
               Actor::AI_StandOrBored(v10, v12, 32, (AIDirection *)v3);
             }
@@ -10044,8 +10044,8 @@
   if ( (v1->uPackedID & 7) != OBJECT_Player)
   {
     v4 = v3 >> 3;                               // turn based only stuff
-    a2a = dword_4F6E08[v3 >> 3];
-    memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, dword_4F6E08[v3 >> 3], &a3, 0), sizeof(a3));
+    a2a = ai_near_actors_targets_pid[v3 >> 3];
+    memcpy(&a3, Actor::GetDirectionInfo(v1->uPackedID, ai_near_actors_targets_pid[v3 >> 3], &a3, 0), sizeof(a3));
     memcpy(&a4, &a3, sizeof(a4));
     v5 = &pActors[v3 >> 3];
     LOWORD(v3) = v5->uAIState;
@@ -10189,8 +10189,8 @@
     {
       if ( (short)v3 != 4 && (short)v3 != 11 && (short)v3 != 19 && (short)v3 != 17 )
       {
-        v6 = (unsigned int *)&dword_4F6E08[(int)v4];
-        Actor::_401221((unsigned int)v4, &dword_4F6E08[(int)v4], 1u);
+        v6 = (unsigned int *)&ai_near_actors_targets_pid[(int)v4];
+        Actor::_SelectTarget((unsigned int)v4, &ai_near_actors_targets_pid[(int)v4], true);
         if ( v5->pMonsterInfo.uHostilityType && !*v6 )
           v5->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
         v22 = *v6;
@@ -10340,7 +10340,7 @@
       v5 = v10->uPackedID;
       if ( (v10->uPackedID & 7) == OBJECT_Actor)
       {
-        v8 = dword_4F6E08[v5 >> 3];
+        v8 = ai_near_actors_targets_pid[v5 >> 3];
         memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7));
         if ( !v1->_406D10(a2) )
           Actor::AI_Stand(v10->uPackedID >> 3, v8, 0x20u, &v7);
@@ -10384,7 +10384,7 @@
         if ( pActors[v3].CanAct() )
         {
           v4 = v2->uPackedID;
-          v9 = dword_4F6E08[v3];
+          v9 = ai_near_actors_targets_pid[v3];
           memcpy(&v6, Actor::GetDirectionInfo(v4, v9, &a3, 0), sizeof(v6));
           Actor::AI_Stand(v8, v9, 0x20u, &v6);
           v2->field_C = 0;
@@ -10447,7 +10447,7 @@
           result = 1;
         if ( !(v13 | result | v6->uAIState == 5 | v6->uAIState == 11 | v6->uAIState == 19) )
         {
-          v13 = dword_4F6E08[v5];
+          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 )
@@ -10524,12 +10524,12 @@
   v5 = v4->uAIState;
   if ( v5 == 5 || v5 == 4 || v5 == 11 || v5 == 19 || v5 == 17 )
     return 1;
-  v6 = &dword_4F6E08[v3];
+  v6 = &ai_near_actors_targets_pid[v3];
   v7 = &pTurnEngine->pQueue[a2];
   v8 = *v6;
   v29 = &pTurnEngine->pQueue[a2];
   a2a = v8;
-  Actor::_401221(v3, &dword_4F6E08[v3], 1u);
+  Actor::_SelectTarget(v3, &ai_near_actors_targets_pid[v3], true);
   if ( v4->pMonsterInfo.uHostilityType && !*v6 )
     v4->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
   v9 = Actor::GetDirectionInfo(v7->uPackedID, a2a, &a3, 0);
@@ -10724,10 +10724,10 @@
             {
               if ( v6 != 17 )
               {
-                v7 = (unsigned int *)&dword_4F6E08[v4];
+                v7 = (unsigned int *)&ai_near_actors_targets_pid[v4];
                 a2 = *v7;
                 v8 = a2;
-                Actor::_401221(v4, (int *)v7, 1u);
+                Actor::_SelectTarget(v4, (int *)v7, true);
                 memcpy(&v11, Actor::GetDirectionInfo(*(int *)((char *)&v3->uPackedID + v18), v8, &a3, 0), sizeof(v11));
                 memcpy(&a4, &v11, sizeof(a4));
                 v5->uCurrentActionTime += pMiscTimer->uTimeElapsed;
@@ -12099,7 +12099,7 @@
   if (_449B57_test_bit(pParty->_award_bits, 100))
     v5 = 1;
 
-  Log::Warning(L"%S %S %u", __FILE__, __FUNCTION__, __LINE__); // dword_4F6E08[i] for AI_Stand seems always 0;  original code behaviour is identical
+  Log::Warning(L"%S %S %u", __FILE__, __FUNCTION__, __LINE__); // ai_near_actors_targets_pid[i] for AI_Stand seems always 0;  original code behaviour is identical
   for (uint i = 0; i < uNumActors; ++i)
   {
     auto actor = pActors + i;
@@ -12112,7 +12112,7 @@
       actor->sCurrentHP = actor->pMonsterInfo.uHP;
       if (actor->uAIState != Disabled)
       {
-        Actor::AI_Stand(i, dword_4F6E08[i], actor->pMonsterInfo.uRecoveryTime, 0);
+        Actor::AI_Stand(i, ai_near_actors_targets_pid[i], actor->pMonsterInfo.uRecoveryTime, 0);
       }
     }