changeset 446:096c9a146ed0

Слияние
author Ritor1
date Sat, 23 Feb 2013 21:42:43 +0600
parents d0355e4f9be8 (current diff) d8b3056df4e2 (diff)
children 7c6e68307484
files mm7_4.cpp
diffstat 7 files changed, 128 insertions(+), 159 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Sat Feb 23 21:41:54 2013 +0600
+++ b/Actor.cpp	Sat Feb 23 21:42:43 2013 +0600
@@ -1991,87 +1991,42 @@
     v9->UpdateAnimation();
   }
   else
-    Actor::_402F87(v5, v4, a4);
+    Actor::AI_Bored(v5, v4, a4);
 }
 
 //----- (00403F58) --------------------------------------------------------
-void Actor::_403F58(unsigned int uActorID, signed int uObjID, int uActionLength, AIDirection *a4)
+void Actor::AI_StandOrBored(unsigned int uActorID, signed int uObjID, int uActionLength, AIDirection *a4)
 {
-  unsigned int v4; // esi@1
-  //unsigned int result; // eax@2
-  AIDirection *v6; // eax@3
-  unsigned int v7; // edi@3
-  Actor *v8; // ebx@3
-  AIDirection *v9; // esi@4
-  AIDirection a3; // [sp+4h] [bp-3Ch]@4
-  AIDirection v11; // [sp+20h] [bp-20h]@4
-  signed int a2; // [sp+3Ch] [bp-4h]@1
-
-  a2 = uObjID;
-  v4 = uActorID;
-  if ( rand() % 2 )
-  {
-    Actor::_402F87(v4, a2, a4);
-    return;
-  }
-
-    v6 = a4;
-    v7 = 0;
-    v8 = &pActors[v4];
-    if ( !a4 )
-    {
-      v9 = Actor::GetDirectionInfo(8 * v4 | 3, a2, &a3, 0);
-      v6 = &v11;
-      memcpy(&v11, v9, sizeof(v11));
-      v7 = 0;
-    }
-    v8->uYawAngle = LOWORD(v6->uYawAngle);
-    v8->uPitchAngle = LOWORD(v6->uPitchAngle);
-    if ( uActionLength == v7 )
-      v8->uCurrentActionLength = rand() % 256 + 256;
-    else
-      v8->uCurrentActionLength = uActionLength;
-    v8->uCurrentActionTime = v7;
-    v8->uAIState = Standing;
-    v8->vVelocity.z = v7;
-    v8->vVelocity.y = v7;
-    v8->vVelocity.x = v7;
-    v8->UpdateAnimation();
+  if (rand() % 2)
+    AI_Bored(uActorID, uObjID, a4);
+  else
+    AI_Stand(uActorID, uObjID, uActionLength, a4);
 }
 
 
 
 //----- (00403EB6) --------------------------------------------------------
-void Actor::_403EB6(unsigned int uActorID, unsigned int a2, unsigned int uActionLength, AIDirection *a4)
+void Actor::AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, AIDirection *a4)
 {
-  AIDirection *v4; // eax@1
-  unsigned int v5; // esi@1
-  Actor *v6; // ebx@1
-  AIDirection *v7; // esi@2
-  AIDirection a3; // [sp+Ch] [bp-38h]@2
-  AIDirection v10; // [sp+28h] [bp-1Ch]@2
+  assert(uActorID < uNumActors);
+  auto actor = pActors + uActorID;
+  
+  AIDirection a3;
+  if (!a4)
+    a4 = Actor::GetDirectionInfo(8 * uActorID | 3, object_to_face_pid, &a3, 0);
 
-  v4 = a4;
-  v5 = 0;
-  v6 = &pActors[uActorID];
-  if ( !a4 )
-  {
-    v7 = Actor::GetDirectionInfo(8 * uActorID | 3, a2, &a3, 0);
-    v4 = &v10;
-    memcpy(&v10, v7, sizeof(v10));
-    v5 = 0;
-  }
-  v6->uYawAngle = LOWORD(v4->uYawAngle);
-  if ( uActionLength == v5 )
-    v6->uCurrentActionLength = rand() % 256 + 256;
+  actor->uAIState = Standing;
+  if (!uActionLength)
+    actor->uCurrentActionLength = rand() % 256 + 256;
   else
-    v6->uCurrentActionLength = uActionLength;
-  v6->uCurrentActionTime = v5;
-  v6->uAIState = Standing;
-  v6->vVelocity.z = v5;
-  v6->vVelocity.y = v5;
-  v6->vVelocity.x = v5;
-  v6->UpdateAnimation();
+    actor->uCurrentActionLength = uActionLength;
+  actor->uCurrentActionTime = 0;
+  actor->uYawAngle = a4->uYawAngle;
+  actor->uPitchAngle = a4->uPitchAngle;
+  actor->vVelocity.z = 0;
+  actor->vVelocity.y = 0;
+  actor->vVelocity.x = 0;
+  actor->UpdateAnimation();
 }
 
 
@@ -2123,7 +2078,7 @@
   v24 = uActorID;
   if ( v4 && v3->pMonsterInfo.uAIType == 1 )
   {
-    Actor::_403EB6(uActorID, edx0, 0, arg0);
+    Actor::AI_Stand(uActorID, edx0, 0, arg0);
     return;
   }
 
@@ -2929,6 +2884,8 @@
   unsigned int uActorID; // [sp+34h] [bp-8h]@1
   int v19; // [sp+38h] [bp-4h]@1
 
+  //v14 never filled, maybe it is passed to function but optimized away as local variable
+
   uActorID = a1;
   v4 = a1;
   v5 = &pActors[a1];
@@ -2946,14 +2903,14 @@
   {
     if ( !uActionLength )
       uActionLength = 256;
-    Actor::_403F58(uActorID, 4, uActionLength, &v14);
+    Actor::AI_StandOrBored(uActorID, OBJECT_Player, uActionLength, &v14);
     return;
   }
   if ( pActors[v4].pMonsterInfo.uMovementType == 3 && v19 < 128 )
   {
     v13 = &v14;
     v12 = 256;
-    Actor::_403EB6(uActorID, v16, v12, v13);
+    Actor::AI_Stand(uActorID, v16, v12, v13);
     return;
   }
   v15 = (rand() & 0xF) << 12;
@@ -2969,7 +2926,7 @@
   {
     v13 = &v14;
     v12 = 256;
-    Actor::_403EB6(uActorID, v16, v12, v13);
+    Actor::AI_Stand(uActorID, v16, v12, v13);
     return;
   }
   v11 = v5->uMovementSpeed;
@@ -3096,54 +3053,59 @@
 }
 
 //----- (00402F87) --------------------------------------------------------
-void Actor::_402F87(unsigned int uActorID, unsigned int uObjID, AIDirection *a4)
+void Actor::AI_Bored(unsigned int uActorID, unsigned int uObjID, AIDirection *a4)
 {
-  int v3; // edi@1
-  AIDirection *v4; // esi@1
-  Actor *v5; // ebx@1
-  SpriteFrame *v6; // ecx@3
+  //int v3; // edi@1
+  //AIDirection *v4; // esi@1
+  //Actor *v5; // ebx@1
+  //SpriteFrame *v6; // ecx@3
   unsigned int v7; // eax@3
-  int v8; // edx@3
+  //int v8; // edx@3
   unsigned int v9; // eax@3
   //int result; // eax@4
   AIDirection a3; // [sp+Ch] [bp-5Ch]@2
-  AIDirection v12; // [sp+28h] [bp-40h]@2
-  AIDirection v13; // [sp+44h] [bp-24h]@2
-  unsigned int v14; // [sp+60h] [bp-8h]@1
-  unsigned int v15; // [sp+64h] [bp-4h]@1
+  //AIDirection v12; // [sp+28h] [bp-40h]@2
+  //AIDirection v13; // [sp+44h] [bp-24h]@2
+  //unsigned int v14; // [sp+60h] [bp-8h]@1
+  //unsigned int v15; // [sp+64h] [bp-4h]@1
+
+  assert(uActorID < uNumActors);
+  auto actor = pActors + uActorID;
 
-  v3 = uActorID;
-  v4 = a4;
-  v5 = &pActors[uActorID];
-  v14 = uObjID;
-  v15 = uActorID;
-  if ( !a4 )
-  {
-    memcpy(&v13, Actor::GetDirectionInfo(8 * uActorID | AI_OBJECT_ACTOR, uObjID, &a3, (int)a4), sizeof(v13));
+  //v3 = uActorID;
+  //v4 = a4;
+  //v5 = &pActors[uActorID];
+  //v14 = uObjID;
+  //v15 = uActorID;
+  if (!a4)
+    a4 = Actor::GetDirectionInfo(8 * uActorID | OBJECT_Actor, uObjID, &a3, 0);
+  /*{
+    memcpy(&v13, Actor::GetDirectionInfo(8 * uActorID | OBJECT_Actor, uObjID, &a3, (int)a4), sizeof(v13));
     memcpy(&v12, &v13, sizeof(v12));
     v3 = v15;
     v4 = &v12;
-  }
-  v6 = pSpriteFrameTable->pSpriteSFrames;
-  v5->uYawAngle = LOWORD(v4->uYawAngle);
-  v5->uCurrentActionLength = 8 * v6[v5->pSpriteIDs[ANIM_Bored]].uAnimLength;
-  v7 = stru_5C6E00->Atan2(v5->vPosition.x - pIndoorCamera->pos.x, v5->vPosition.y - pIndoorCamera->pos.y);
-  LOWORD(v8) = v5->uYawAngle;
-  v9 = stru_5C6E00->uIntegerPi + v8 + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v7;
-  if ( BYTE1(v9) & 7 )
+  }*/
+
+  //v6 = pSpriteFrameTable->pSpriteSFrames;
+  actor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[actor->pSpriteIDs[ANIM_Bored]].uAnimLength;
+
+  v7 = stru_5C6E00->Atan2(actor->vPosition.x - pIndoorCamera->pos.x, actor->vPosition.y - pIndoorCamera->pos.y);
+  //LOWORD(v8) = actor->uYawAngle;
+  v9 = stru_5C6E00->uIntegerPi + actor->uYawAngle + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v7;
+
+  if ( BYTE1(v9) & 7 )      // turned away - just stand
+    Actor::AI_Stand(uActorID, uObjID, actor->uCurrentActionLength, a4);
+  else                      // facing player - play bored anim
   {
-    Actor::_403EB6(v3, v14, v5->uCurrentActionLength, v4);
-  }
-  else
-  {
-    v5->uAIState = Fidgeting;
-    v5->uCurrentActionTime = 0;
-    v5->vVelocity.z = 0;
-    v5->vVelocity.y = 0;
-    v5->vVelocity.x = 0;
+    actor->uAIState = Fidgeting;
+    actor->uCurrentActionTime = 0;
+    actor->uYawAngle = a4->uYawAngle;
+    actor->vVelocity.z = 0;
+    actor->vVelocity.y = 0;
+    actor->vVelocity.x = 0;
     if ( rand() % 100 < 5 )
-      Actor::PlaySound(v3, 3u);
-    v5->UpdateAnimation();
+      Actor::PlaySound(uActorID, 3);
+    actor->UpdateAnimation();
   }
 }
 
@@ -3335,19 +3297,19 @@
   {
     if ( !uActionLength )
       uActionLength = 256;
-    Actor::_403F58(v5, 4, uActionLength, v10);
+    Actor::AI_StandOrBored(v5, 4, uActionLength, v10);
     return;
   }
   if ( (double)(signed int)v10->uDistance < 307.2 )
   {
     if ( !uActionLength )
       uActionLength = 256;
-    Actor::_403EB6(v5, v18, uActionLength, v10);
+    Actor::AI_Stand(v5, v18, uActionLength, v10);
     return;
   }
   if ( !v7->uMovementSpeed )
   {
-    Actor::_403EB6(v5, v18, uActionLength, v10);
+    Actor::AI_Stand(v5, v18, uActionLength, v10);
     return;
   }
   v18 = 16;
@@ -3411,7 +3373,7 @@
     {
       if ( !uActionLength )
         uActionLength = 256;
-      Actor::_403F58(v15, 4, uActionLength, &v13);
+      Actor::AI_StandOrBored(v15, 4, uActionLength, &v13);
     }
     else
     {
@@ -3482,7 +3444,7 @@
     v16 = v10;
     v15 = uActionLength;
     v11 = 4;
-    Actor::_403F58(v5, v11, v15, v16);
+    Actor::AI_StandOrBored(v5, v11, v15, v16);
     return;
   }
   if ( (signed int)v10->uDistance < a5 )
@@ -3492,7 +3454,7 @@
     v11 = v19;
     v16 = v10;
     v15 = uActionLength;
-    Actor::_403F58(v5, v11, v15, v16);
+    Actor::AI_StandOrBored(v5, v11, v15, v16);
     return;
   }
   if ( uActionLength )
@@ -3569,7 +3531,7 @@
     v18 = v9;
     v17 = uActionLength;
     v10 = 4;
-    return Actor::_403F58(v4, v10, v17, v18);
+    return Actor::AI_StandOrBored(v4, v10, v17, v18);
   }
   if ( (double)(signed int)v9->uDistance < 307.2 )
   {
@@ -3578,7 +3540,7 @@
     v10 = v21;
     v18 = v9;
     v17 = uActionLength;
-    return Actor::_403F58(v4, v10, v17, v18);
+    return Actor::AI_StandOrBored(v4, v10, v17, v18);
   }
   if ( uActionLength )
   {
--- a/Actor.h	Sat Feb 23 21:41:54 2013 +0600
+++ b/Actor.h	Sat Feb 23 21:42:43 2013 +0600
@@ -209,7 +209,7 @@
   static void PlaySound(unsigned int uActorID, unsigned int uSoundID);
   static void Die(unsigned int uActorID);
   static void Resurrect(unsigned int uActorID);
-  static void _402F87(unsigned int uActorID, unsigned int uObjID, struct AIDirection *a4);
+  static void AI_Bored(unsigned int uActorID, unsigned int uObjID, struct AIDirection *a4);
   static void _4030AD(unsigned int uActorID, signed int edx0, int arg0);
   static char __fastcall _4031C1_update_job(unsigned int uActorID, signed int a2, int a3);
   static void _4032B2(unsigned int a1, unsigned int a2, int a3, int uActionLength);
@@ -219,8 +219,8 @@
   static void _403A60(unsigned int uActorID, signed int edx0, struct AIDirection *pDir);
   static void _403C6C(unsigned int uActorID, signed int edx0, struct AIDirection *arg0);
   static void __fastcall StandAwhile(unsigned int uActorID);
-  static void _403EB6(unsigned int uActorID, unsigned int a2, unsigned int uActionLength, struct AIDirection *a4);
-  static void _403F58(unsigned int uActorID, signed int uObjID, int uActionLength, struct AIDirection *a4);
+  static void AI_Stand(unsigned int uActorID, unsigned int object_to_face_pid, unsigned int uActionLength, struct AIDirection *a4);
+  static void AI_StandOrBored(unsigned int uActorID, signed int uObjID, int uActionLength, struct AIDirection *a4);
   static void FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, struct AIDirection *a4);
   static struct AIDirection *__fastcall GetDirectionInfo(unsigned int uObj1ID, unsigned int uObj2ID, struct AIDirection *pOut, int a4);
   static signed int __fastcall Explode(unsigned int uActorID);
--- a/Indoor.cpp	Sat Feb 23 21:41:54 2013 +0600
+++ b/Indoor.cpp	Sat Feb 23 21:42:43 2013 +0600
@@ -4345,7 +4345,7 @@
                 goto LABEL_119;
               }
             }
-            Actor::_403F58(v63, 4, v22, &v53);
+            Actor::AI_StandOrBored(v63, 4, v22, &v53);
             goto LABEL_119;
           }
           if ( v0->vPosition.x & 1 )
@@ -4359,7 +4359,7 @@
             goto LABEL_123;
           if ( !v0->pMonsterInfo.uHostilityType || v56 != v22 )
           {
-            Actor::_403F58(v63, 4, v22, &v52);
+            Actor::AI_StandOrBored(v63, 4, v22, &v52);
             goto LABEL_123;
           }
         }
--- a/mm7_3.cpp	Sat Feb 23 21:41:54 2013 +0600
+++ b/mm7_3.cpp	Sat Feb 23 21:42:43 2013 +0600
@@ -1229,7 +1229,7 @@
               if ( v71 == v34 )
                 goto LABEL_99;
 LABEL_101:
-              Actor::_403F58(v75, 4, v34, (AIDirection *)v34);
+              Actor::AI_StandOrBored(v75, 4, v34, (AIDirection *)v34);
               break;
             }
             if ( v71 != v34 )
@@ -17754,7 +17754,7 @@
   float v80; // [sp+98h] [bp-18h]@33
   int v81; // [sp+9Ch] [bp-14h]@100
   int v82; // [sp+A0h] [bp-10h]@45
-  unsigned int uActorID; // [sp+A4h] [bp-Ch]@32
+  //unsigned int uActorID; // [sp+A4h] [bp-Ch]@32
   unsigned int v84; // [sp+A8h] [bp-8h]@11
   signed int a2; // [sp+ACh] [bp-4h]@83
 
@@ -17911,7 +17911,7 @@
     {
       if (actor->uAIState != Summoned)
       {
-        Actor::_403F58(i, Dying, 256, 0);
+        Actor::AI_StandOrBored(i, OBJECT_Player, 256, nullptr);
         continue;
       }
       actor->uAIState = Standing;
@@ -17929,14 +17929,17 @@
 
 
   v78 = 0;
+  int actor_id = -1;
   if ( ai_arrays_size > 0 )
   {
     while ( 1 )
     {
-      uActorID = ai_near_actors_ids[v78];
-      v20 = &dword_4F6E08[uActorID];
-      v21 = &pActors[uActorID];
-      Actor::_401221(uActorID, &dword_4F6E08[uActorID], 1u);
+      actor_id = ai_near_actors_ids[v78];
+      assert(actor_id < uNumActors);
+
+      v20 = &dword_4F6E08[actor_id];
+      v21 = &pActors[actor_id];
+      Actor::_401221(actor_id, &dword_4F6E08[actor_id], 1u);
       if ( v21->pMonsterInfo.uHostilityType && !*v20 )
         v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
       a2 = *v20;
@@ -17949,7 +17952,7 @@
       if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned)
         goto LABEL_254;
       if ( !v21->sCurrentHP )
-        Actor::Die(uActorID);
+        Actor::Die(actor_id);
       if ( (signed __int64)v21->pActorBuffs[3].uExpireTime <= 0 )
       {
         v84 = 0;
@@ -18017,8 +18020,8 @@
       v29 = v21->uAttributes;
       if ( !(v29 & 0x8000) )
         v21->uAttributes = v29 | 0x8000;
-      a1 = 8 * uActorID | 3;
-      v30 = Actor::GetDirectionInfo(8 * uActorID | 3, a2, &a3, 0);
+      a1 = 8 * actor_id | OBJECT_Actor;
+      v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, a2, &a3, 0);
       v49 = v21->pMonsterInfo.uHostilityType == 0;
       memcpy(&v75, v30, sizeof(v75));
       memcpy(&pDir, &v75, sizeof(pDir));
@@ -18028,7 +18031,7 @@
           && ((v31 = v21->uAIState, v31 == 6) || !v31 || v31 == 1 || v31 == 9)
           || v21->pMonsterInfo.uMissleAttack1Type && v21->uAIState == 8 )
         {
-          v32 = uActorID;
+          v32 = actor_id;
           goto LABEL_152;
         }
       }
@@ -18036,8 +18039,8 @@
         goto LABEL_254;
       if ( v21->uAIState == 2 )
       {
-        v32 = uActorID;
-        v35 = stru_50C198.special_ability_use_check(v21, uActorID);
+        v32 = actor_id;
+        v35 = stru_50C198.special_ability_use_check(v21, actor_id);
         stru_50FE08.Add(
           a1,
           5120,
@@ -18059,11 +18062,11 @@
         v34 = v21->pMonsterInfo.uMissleAttack2Type;
         v66 = 1;
 LABEL_149:
-        v32 = uActorID;
-        Actor::_404874(uActorID, &pDir, v34, v66);
+        v32 = actor_id;
+        Actor::_404874(actor_id, &pDir, v34, v66);
         goto LABEL_152;
       }
-      v32 = uActorID;
+      v32 = actor_id;
       if ( v21->uAIState == 13 )
         break;
       if ( v21->uAIState == 18 )
@@ -18072,7 +18075,7 @@
         v60 = 3;
         v33 = v21->pMonsterInfo.uSpell2ID;
 LABEL_146:
-        Actor::_404AC7(uActorID, &pDir, v33, v60, v65);
+        Actor::_404AC7(actor_id, &pDir, v33, v60, v65);
       }
 LABEL_152:
       v36 = v75.uDistance;
@@ -18136,7 +18139,7 @@
           v67 = &pDir;
           if ( v21->pMonsterInfo.uMovementType != 5 )
             goto LABEL_181;
-          Actor::_403EB6(
+          Actor::AI_Stand(
             v32,
             a2,
             (signed __int64)((double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333),
@@ -18252,7 +18255,7 @@
               v64 = (signed __int64)v47;
               v52 = v32;
 LABEL_247:
-              Actor::_403EB6(v52, v51, v64, v69);
+              Actor::AI_Stand(v52, v51, v64, v69);
               goto LABEL_254;
             }
             v69 = &pDir;
@@ -18321,7 +18324,7 @@
           memcpy(&v74, v57, sizeof(v74));
           memcpy(&pDir, &v74, sizeof(pDir));
           v69 = &pDir;
-          v52 = uActorID;
+          v52 = actor_id;
           v64 = (signed __int64)v58;
           v51 = 4;
           goto LABEL_247;
@@ -18699,7 +18702,7 @@
             v33 = 8 * v5 | OBJECT_Actor;
             memcpy(&v31, Actor::GetDirectionInfo(8 * v5 | OBJECT_Actor, v8, &a3, 0), sizeof(v31));
             memcpy(&v30, &v31, sizeof(v30));
-            Actor::_403F58(v37, 4, 32, &v30);
+            Actor::AI_StandOrBored(v37, 4, 32, &v30);
             *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = v33;
             v1->pQueue[v1->uActorQueueSize].field_C = 2;
             v1->pQueue[v1->uActorQueueSize++].uActionLength = 0;
--- a/mm7_4.cpp	Sat Feb 23 21:41:54 2013 +0600
+++ b/mm7_4.cpp	Sat Feb 23 21:42:43 2013 +0600
@@ -14389,7 +14389,7 @@
                   if ( v10 )
                   {
                     if ( v10 != 8 )
-                      Actor::_403F58(v20, v17, 32, &v14);
+                      Actor::AI_StandOrBored(v20, v17, 32, &v14);
                   }
                 }
               }
--- a/mm7_5.cpp	Sat Feb 23 21:41:54 2013 +0600
+++ b/mm7_5.cpp	Sat Feb 23 21:42:43 2013 +0600
@@ -9721,7 +9721,7 @@
           if ( v6 != 8 )
             goto LABEL_19;
           v3 = 0;
-          Actor::_403F58(v2->uPackedID >> 3, dword_4F6E08[v2->uPackedID >> 3], 32, 0);
+          Actor::AI_StandOrBored(v2->uPackedID >> 3, dword_4F6E08[v2->uPackedID >> 3], 32, 0);
         }
       }
     }
@@ -9755,7 +9755,7 @@
             {
               v12 = dword_4F6E08[v10];
               v9->uActionLength = v3;
-              Actor::_403F58(v10, v12, 32, (AIDirection *)v3);
+              Actor::AI_StandOrBored(v10, v12, 32, (AIDirection *)v3);
             }
           }
         }
@@ -10099,12 +10099,12 @@
                       v16 = a2a;
                       if ( !(v14 % 2) )
                       {
-                        Actor::_402F87(v4, a2a, &a4);
+                        Actor::AI_Bored(v4, a2a, &a4);
                         return;
                       }
                       v21 = 64;
 LABEL_26:
-                      Actor::_403EB6(v15, v16, v21, v23);
+                      Actor::AI_Stand(v15, v16, v21, v23);
                       return;
                     }
 LABEL_21:
@@ -10300,7 +10300,7 @@
           goto LABEL_48;
         }
 LABEL_47:
-        Actor::_403EB6(v13, v22, 0x40u, &v18);
+        Actor::AI_Stand(v13, v22, 0x40u, &v18);
         v3 = v21;
         v21->field_C = 0;
         goto LABEL_48;
@@ -10343,7 +10343,7 @@
         v8 = dword_4F6E08[v5 >> 3];
         memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7));
         if ( !v1->_406D10(a2) )
-          Actor::_403EB6(v10->uPackedID >> 3, v8, 0x20u, &v7);
+          Actor::AI_Stand(v10->uPackedID >> 3, v8, 0x20u, &v7);
       }
       ++a2;
       ++v10;
@@ -10386,7 +10386,7 @@
           v4 = v2->uPackedID;
           v9 = dword_4F6E08[v3];
           memcpy(&v6, Actor::GetDirectionInfo(v4, v9, &a3, 0), sizeof(v6));
-          Actor::_403EB6(v8, v9, 0x20u, &v6);
+          Actor::AI_Stand(v8, v9, 0x20u, &v6);
           v2->field_C = 0;
           v2->uActionLength = 0;
           v1 = v7;
@@ -10467,7 +10467,7 @@
             }
             if ( !thisa->_406D10(a2) )
 LABEL_26:
-              Actor::_403EB6(v12, v13, 0x20u, &v9);
+              Actor::AI_Stand(v12, v13, 0x20u, &v9);
           }
         }
       }
@@ -10609,7 +10609,7 @@
         v21 = 32;
         if ( v4->pMonsterInfo.uMovementType == 5 )
         {
-          Actor::_403EB6(uActorID, a2a, 0x20u, 0);
+          Actor::AI_Stand(uActorID, a2a, 0x20u, 0);
           goto LABEL_25;
         }
 LABEL_24:
@@ -10668,7 +10668,7 @@
   }
   if ( v4->pMonsterInfo.uMovementType == 5 )
   {
-    Actor::_403EB6(uActorID, a2a, 0x20u, 0);
+    Actor::AI_Stand(uActorID, a2a, 0x20u, 0);
 LABEL_53:
     v17 = v29;
     v29->field_C = 2;
@@ -10742,9 +10742,9 @@
                     return;
                   }
                   if ( rand() % 2 )
-                    Actor::_403EB6(uActorID, a2, 0x40u, &a4);
+                    Actor::AI_Stand(uActorID, a2, 0x40u, &a4);
                   else
-                    Actor::_402F87(uActorID, a2, &a4);
+                    Actor::AI_Bored(uActorID, a2, &a4);
                 }
               }
             }
@@ -12098,6 +12098,8 @@
     v7 = 1;
   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
   for (uint i = 0; i < uNumActors; ++i)
   {
     auto actor = pActors + i;
@@ -12109,7 +12111,9 @@
       actor->vPosition.z = actor->vInitialPosition.z;
       actor->sCurrentHP = actor->pMonsterInfo.uHP;
       if (actor->uAIState != Disabled)
-        Actor::_403EB6(i, dword_4F6E08[i], actor->pMonsterInfo.uRecoveryTime, 0);
+      {
+        Actor::AI_Stand(i, dword_4F6E08[i], actor->pMonsterInfo.uRecoveryTime, 0);
+      }
     }
 
     actor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
--- a/mm7_6.cpp	Sat Feb 23 21:41:54 2013 +0600
+++ b/mm7_6.cpp	Sat Feb 23 21:42:43 2013 +0600
@@ -3860,7 +3860,7 @@
               v721 = (int)&pActors[a2 >> 3],
               !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 9u)) )
           goto LABEL_1056;
-        Actor::_403EB6(v730, 4u, 0x80u, (AIDirection *)v1);
+        Actor::AI_Stand(v730, 4u, 0x80u, (AIDirection *)v1);
         v726 = (Player *)(23040 * v2);
         v54 = (signed __int64)((double)(23040 * v2) * 0.033333335);
         v55 = v721;