changeset 860:8fc2f035abc0

* AI function renames * more PID replaces
author zipi
date Sun, 31 Mar 2013 12:39:29 +0100
parents 48c230c37d74
children fea81e031484
files Actor.cpp Actor.h Indoor.cpp Party.cpp Render.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp
diffstat 8 files changed, 85 insertions(+), 96 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Sun Mar 31 12:01:31 2013 +0100
+++ b/Actor.cpp	Sun Mar 31 12:39:29 2013 +0100
@@ -377,7 +377,7 @@
 }
 
 //----- (00404AC7) --------------------------------------------------------
-void __fastcall Actor::_404AC7(unsigned int uActorID, AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel)
+void __fastcall Actor::SpellAttack(unsigned int uActorID, AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel)
 {
   Actor *v5; // esi@1
   unsigned int v6; // edi@1
@@ -1482,7 +1482,7 @@
 }
 
 //----- (00404874) --------------------------------------------------------
-char __fastcall Actor::_404874(unsigned int uActorID, AIDirection *a2, int a3, char a4)
+char __fastcall Actor::RangedAttack(unsigned int uActorID, AIDirection *a2, int a3, char a4)
 {
   AIDirection *v4; // edi@1
   Actor *v5; // esi@1
@@ -2130,7 +2130,7 @@
     v3->UpdateAnimation();
   }
   else
-	Actor::_402AD7(v24, sTargetPid, rand() % 2, 64, arg0);
+	Actor::Pursue1(v24, sTargetPid, rand() % 2, 64, arg0);
 }
 
 //----- (00438CF3) --------------------------------------------------------
@@ -2494,7 +2494,7 @@
     v10 = 0;
     if ( !pDir )
     {
-      v11 = Actor::GetDirectionInfo(8 * v22 | OBJECT_Actor, a2, &a3, 0);
+      v11 = Actor::GetDirectionInfo(PID(v22,OBJECT_Actor), a2, &a3, 0);
       v9 = &v18;
       memcpy(&v18, v11, sizeof(v18));
       v10 = 0;
@@ -2538,7 +2538,7 @@
       v3->UpdateAnimation();
   }
   else
-    Actor::_402AD7(v22, a2, v22, 64, pDir);
+    Actor::Pursue1(v22, a2, v22, 64, pDir);
 }
 
 //----- (00403854) --------------------------------------------------------
@@ -2600,7 +2600,7 @@
     v10 = 0;
     if ( !pDir )
     {
-      v11 = Actor::GetDirectionInfo(8 * v22 | OBJECT_Actor, sTargetPid, &a3, 0);
+      v11 = Actor::GetDirectionInfo(PID(v22,OBJECT_Actor), sTargetPid, &a3, 0);
       v9 = &v18;
       memcpy(&v18, v11, sizeof(v18));
       v10 = 0;
@@ -2644,7 +2644,7 @@
       v3->UpdateAnimation();
   }
   else
-    Actor::_402AD7(v22, sTargetPid, v22, 64, pDir);
+    Actor::Pursue1(v22, sTargetPid, v22, 64, pDir);
 }
 
 //----- (0040368B) --------------------------------------------------------
@@ -2705,7 +2705,7 @@
     v10 = 0;
     if ( !pDir )
     {
-      v11 = Actor::GetDirectionInfo(8 * v21 | OBJECT_Actor, sTargetPid, &a3, 0);
+      v11 = Actor::GetDirectionInfo(PID(v21,OBJECT_Actor), sTargetPid, &a3, 0);
       v9 = &v17;
       memcpy(&v17, v11, sizeof(v17));
       v10 = 0;
@@ -2735,7 +2735,7 @@
     v3->UpdateAnimation();
   }
   else
-    Actor::_402AD7(v21, sTargetPid, v21, 64, pDir);
+    Actor::Pursue1(v21, sTargetPid, v21, 64, pDir);
 }
 
 //----- (00403476) --------------------------------------------------------
@@ -2805,7 +2805,7 @@
     v11 = 0;
     if ( !pDir )
     {
-      v12 = Actor::GetDirectionInfo(8 * v21 | OBJECT_Actor, sTargetPid, &a3, 0);
+      v12 = Actor::GetDirectionInfo(PID(v21,OBJECT_Actor), sTargetPid, &a3, 0);
       v10 = &v18;
       memcpy(&v18, v12, sizeof(v18));
       v11 = 0;
@@ -2839,7 +2839,7 @@
     v3->UpdateAnimation();
   }
   else
-    Actor::_402AD7(v21, sTargetPid, v21, 64, pDir);
+    Actor::Pursue1(v21, sTargetPid, v21, 64, pDir);
 }
 
 //----- (004032B2) --------------------------------------------------------
@@ -3039,7 +3039,7 @@
   
   AIDirection a3; // [sp+Ch] [bp-5Ch]@2
   if (!a4)
-    a4 = Actor::GetDirectionInfo(8 * uActorID | OBJECT_Actor, uObjID, &a3, 0);
+    a4 = Actor::GetDirectionInfo(PID(uActorID,OBJECT_Actor), uObjID, &a3, 0);
 
   actor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[actor->pSpriteIDs[ANIM_Bored]].uAnimLength;
 
@@ -3204,7 +3204,7 @@
 }
 
 //----- (00402AD7) --------------------------------------------------------
-void Actor::_402AD7(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir)
+void Actor::Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, AIDirection *pDir)
 {
   unsigned int v5; // edi@1
   int v6; // eax@1
@@ -3285,7 +3285,7 @@
 }
 
 //----- (00402968) --------------------------------------------------------
-void Actor::_402968(unsigned int uActorID, signed int sTargetPid, int uActionLength, AIDirection *a4)
+void Actor::Flee(unsigned int uActorID, signed int sTargetPid, int uActionLength, AIDirection *a4)
 {
   unsigned int v4; // esi@1
   Actor *v5; // ebx@1
@@ -3346,7 +3346,7 @@
 }
 
 //----- (0040281C) --------------------------------------------------------
-void Actor::_40281C(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5)
+void Actor::Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *pDir, int a5)
 {
   unsigned int v5; // edi@1
   int v6; // eax@1
@@ -3429,14 +3429,14 @@
 }
 
 //----- (00402686) --------------------------------------------------------
-void Actor::_402686(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4)
+void Actor::Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4)
 {
-  unsigned int v4; // edi@1
+  //unsigned int v4; // edi@1
   int v5; // eax@1
   Actor *v6; // ebx@1
   int v7; // ecx@1
   char v8; // zf@1
-  AIDirection *v9; // esi@7
+  //AIDirection *v9; // esi@7
   signed int v10; // edx@12
   signed __int16 v12; // cx@19
   int v13; // edx@25
@@ -3444,19 +3444,17 @@
   unsigned __int16 v15; // ax@26
   unsigned __int16 v16; // ax@28
   int v17; // [sp-8h] [bp-54h]@12
-  AIDirection *v18; // [sp-4h] [bp-50h]@12
+  //AIDirection *v18; // [sp-4h] [bp-50h]@12
   AIDirection a3; // [sp+Ch] [bp-40h]@8
   AIDirection v20; // [sp+28h] [bp-24h]@8
   int v21; // [sp+44h] [bp-8h]@1
-  unsigned int v22; // [sp+48h] [bp-4h]@1
+  //unsigned int v22; // [sp+48h] [bp-4h]@1
 
-  v4 = uActorID;
   v5 = 0;
   v6 = &pActors[uActorID];
   v21 = a2;
   v7 = PID(uActorID,OBJECT_Actor);
   v8 = v6->pMonsterInfo.uFlying == 0;
-  v22 = v4;
   if ( !v8 && !pParty->bFlying )
   {
     if ( v6->pMonsterInfo.uMissleAttack1Type && uCurrentlyLoadedLevelType == LEVEL_Outdoor )
@@ -3464,31 +3462,21 @@
     else
       v5 = pParty->uPartyHeight;
   }
-  v9 = a4;
   if ( !a4 )
   {
     memcpy(&v20, Actor::GetDirectionInfo(v7, a2, &a3, v5), sizeof(v20));
-    memcpy(0, &v20, 0x1Cu);
-    v9 = 0;
-    v4 = v22;
   }
   if ( MonsterStats::BelongsToSupertype(v6->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
   {
     if ( !uActionLength )
       uActionLength = 256;
-    v18 = v9;
-    v17 = uActionLength;
-    v10 = 4;
-    return Actor::AI_StandOrBored(v4, v10, v17, v18);
+    return Actor::AI_StandOrBored(uActorID, 4, uActionLength, a4);
   }
-  if ( (double)(signed int)v9->uDistance < 307.2 )
+  if ( (double)(signed int)a4->uDistance < 307.2 )
   {
     if ( !uActionLength )
       uActionLength = 256;
-    v10 = v21;
-    v18 = v9;
-    v17 = uActionLength;
-    return Actor::AI_StandOrBored(v4, v10, v17, v18);
+    return Actor::AI_StandOrBored(uActorID, v21, uActionLength, a4);
   }
   if ( uActionLength )
   {
@@ -3498,25 +3486,25 @@
   {
     v12 = v6->uMovementSpeed;
     if ( v12 )
-      v6->uCurrentActionLength = (signed int)(v9->uDistanceXZ << 7) / v12;
+      v6->uCurrentActionLength = (signed int)(a4->uDistanceXZ << 7) / v12;
     else
       v6->uCurrentActionLength = 0;
     if ( v6->uCurrentActionLength > 128 )
       v6->uCurrentActionLength = 128;
   }
   v13 = rand() % 2;
-  v14 = LOWORD(v9->uYawAngle);
+  v14 = LOWORD(a4->uYawAngle);
   if ( v13 )
     v15 = v14 + 256;
   else
     v15 = v14 - 256;
   v6->uYawAngle = v15;
-  v16 = LOWORD(v9->uPitchAngle);
+  v16 = LOWORD(a4->uPitchAngle);
   v6->uCurrentActionTime = 0;
   v6->uPitchAngle = v16;
   v6->uAIState = Pursuing;
   if ( rand() % 100 < 2 )
-    Actor::PlaySound(v4, 2u);
+    Actor::PlaySound(uActorID, 2u);
   v6->UpdateAnimation();
 }
 
@@ -3621,7 +3609,7 @@
   	  if ( v25 != -1 )
 	  {
 		//v13 = 8 * v21;
-		//LOBYTE(v13) = 8 * v21 | OBJECT_Actor;
+		//LOBYTE(v13) = PID(v21,OBJECT_Actor);
 		*a2 = PID(OBJECT_Actor, v21);
 	  }
 
--- a/Actor.h	Sun Mar 31 12:01:31 2013 +0100
+++ b/Actor.h	Sun Mar 31 12:39:29 2013 +0100
@@ -193,10 +193,10 @@
 
   
   static void _SelectTarget(unsigned int uActorID, int *a2, bool can_target_party);
-  static void _402686(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *a4);
-  static void _40281C(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *pDir, int a5);
-  static void _402968(unsigned int uActorID, signed int edx0, int uActionLength, struct AIDirection *a4);
-  static void _402AD7(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, struct AIDirection *pDir);
+  static void Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *a4);
+  static void Pursue2(unsigned int uActorID, unsigned int a2, signed int uActionLength, struct AIDirection *pDir, int a5);
+  static void Flee(unsigned int uActorID, signed int edx0, int uActionLength, struct AIDirection *a4);
+  static void Pursue1(unsigned int uActorID, unsigned int a2, signed int arg0, signed int uActionLength, struct AIDirection *pDir);
   static void PlaySound(unsigned int uActorID, unsigned int uSoundID);
   static void Die(unsigned int uActorID);
   static void Resurrect(unsigned int uActorID);
@@ -215,8 +215,8 @@
   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);
-  static char __fastcall _404874(unsigned int uActorID, struct AIDirection *a2, int a3, char a4);
-  static void __fastcall _404AC7(unsigned int uActorID, struct AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel);
+  static char __fastcall RangedAttack(unsigned int uActorID, struct AIDirection *a2, int type, char a4);
+  static void __fastcall SpellAttack(unsigned int uActorID, struct AIDirection *pDir, int spellnum, int a4, unsigned int uSkillLevel);
   static void AggroSurroundingPeasants(unsigned int uActorID, int a2);
   static bool ArePeasantsOfSameFaction(Actor *a1, Actor *a2);
   static bool StealFrom(unsigned int uActorID);
--- a/Indoor.cpp	Sun Mar 31 12:01:31 2013 +0100
+++ b/Indoor.cpp	Sun Mar 31 12:39:29 2013 +0100
@@ -3478,15 +3478,15 @@
             //v66 = 0;
             //v65 = 0;
             //v64 = 0;
-            //v7 = 8 * i | OBJECT_BLVDoor;
+            //v7 = PID(i,OBJECT_BLVDoor);
             //v63 = 0;
             //v62 = -1;
-            //LOBYTE(v7) = 8 * i | OBJECT_BLVDoor;
+            //LOBYTE(v7) = PID(i,OBJECT_BLVDoor);
             //v61 = 0;
-            //v60 = 8 * i | OBJECT_BLVDoor;
+            //v60 = PID(i,OBJECT_BLVDoor);
             //v59 = (SoundID)((int)eDoorSoundID + 1);
 //LABEL_17:
-            pAudioPlayer->PlaySound((SoundID)((int)eDoorSoundID + 1), 8 * i | OBJECT_BLVDoor, 0, -1, 0, 0, 0, 0);
+            pAudioPlayer->PlaySound((SoundID)((int)eDoorSoundID + 1), PID(i,OBJECT_BLVDoor), 0, -1, 0, 0, 0, 0);
             //goto LABEL_18;
           }
           goto LABEL_18;
@@ -3509,12 +3509,12 @@
         //v66 = 0;
         //v65 = 0;
         //v64 = 0;
-        //v8 = 8 * i | OBJECT_BLVDoor;
+        //v8 = PID(i,OBJECT_BLVDoor);
         //v63 = 0;
         //v62 = -1;
         //LOBYTE(v8) = 8 * v1 | 1;
         //v61 = 1;
-        //v60 = 8 * i | OBJECT_BLVDoor;
+        //v60 = PID(i,OBJECT_BLVDoor);
         //v59 = eDoorSoundID;
         pAudioPlayer->PlaySound(eDoorSoundID, PID(i,OBJECT_BLVDoor), 1, -1, 0, 0, 0, 0);
         //goto LABEL_18;
@@ -4207,7 +4207,7 @@
                 if ( !pActors[v37].pMonsterInfo.uHostilityType )
                   goto LABEL_118;
 LABEL_114:
-                Actor::_402968(v63, v36, v22, (AIDirection *)v22);
+                Actor::Flee(v63, v36, v22, (AIDirection *)v22);
                 goto LABEL_119;
               }
             }
--- a/Party.cpp	Sun Mar 31 12:01:31 2013 +0100
+++ b/Party.cpp	Sun Mar 31 12:39:29 2013 +0100
@@ -835,7 +835,7 @@
 		  v2 = abs(v0->vPosition.y - pParty->vPosition.y);
 		  v3 = abs(v0->vPosition.z - pParty->vPosition.z);
           if (int_get_vector_length(v1, v2, v3) < 512)
-            Actor::_402968(v4, 4, 0, 0);
+            Actor::Flee(v4, 4, 0, 0);
         }
         ++v4;
         ++v0;
--- a/Render.cpp	Sun Mar 31 12:01:31 2013 +0100
+++ b/Render.cpp	Sun Mar 31 12:39:29 2013 +0100
@@ -23,6 +23,7 @@
 #include "TileFrameTable.h"
 #include "texts.h"
 #include "mm7_data.h"
+#include "MM7.h"
 
 #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib")
 #pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib")
@@ -3182,7 +3183,7 @@
                   HIWORD(v26) = HIWORD(v42);
                   LOWORD(v26) = 0;
                   v27 = (object->uAttributes & 0x20) == 0;
-                  v3->sZValue = v26 + (8 * i | OBJECT_Item);
+                  v3->sZValue = v26 + (PID(i,OBJECT_Item));
                   v3->dimming_level = 0;
                   v3->uTintColor = 0;
                   if ( !v27 )
@@ -3682,7 +3683,7 @@
                     v27->world_z = decor->vPosition.z;
                     v27->uScreenSpaceY = v40;
                     HIWORD(v30) = HIWORD(v39);
-                    v31 = 8 * i | OBJECT_Decoration;
+                    v31 = PID(i,OBJECT_Decoration);
                     LOWORD(v30) = 0;
                     v27->uIndoorSectorID = 0;
                     v27->sZValue = v30 + v31;
--- a/mm7_3.cpp	Sun Mar 31 12:01:31 2013 +0100
+++ b/mm7_3.cpp	Sun Mar 31 12:39:29 2013 +0100
@@ -1114,7 +1114,7 @@
       v30 = WorldPosToGridCellX(v0->vPosition.x);
       _46E26D_collide_against_sprites(v30, v29);
       _46EF01_collision_chech_player(0);
-      _46ED8A_collide_against_sprite_objects(8 * v75 | OBJECT_Actor);
+      _46ED8A_collide_against_sprite_objects(PID(v75,OBJECT_Actor));
       v31 = 0;
       for ( i = 0; v31 < ai_arrays_size; ++v31 )
       {
@@ -1178,7 +1178,7 @@
             {
               if ( v71 == 0 )
 			  {
-				  Actor::_402968(v75, v38, 0, (AIDirection *)0);
+				  Actor::Flee(v75, v38, 0, (AIDirection *)0);
 			  }
 			  else
 			  {
@@ -1191,7 +1191,7 @@
 			}
 			else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly )
             {
-              Actor::_402968(v75, v38, 0, (AIDirection *)0);
+              Actor::Flee(v75, v38, 0, (AIDirection *)0);
             }
 			else
 			{
@@ -1447,7 +1447,7 @@
           v10 = i;
           if ( !(v9 & 0x40) )
             goto LABEL_35;
-          _46BFFA_check_object_intercept(i, 8 * i | OBJECT_Item);
+          _46BFFA_check_object_intercept(i, PID(i,OBJECT_Item));
         }
     }
 LABEL_36:
@@ -2343,7 +2343,7 @@
           v6 = v108 & 0x3F;
           /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 )
           {
-            pParty->field_6F4_packedid = 8 * v108 | OBJECT_BModel;
+            pParty->field_6F4_packedid = PID(v108,OBJECT_BModel);
             v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292);
           }*/
 		  if ( BYTE3(v7[v6].uAttributes) & 4 )
@@ -11152,11 +11152,11 @@
               v15->uScreenSpaceX = a5;
               v15->uScreenSpaceY = a6;
               //v23 = 8 * uDecorationID;
-              //LOBYTE(v23) = 8 * uDecorationID | OBJECT_Decoration;
+              //LOBYTE(v23) = PID(uDecorationID,OBJECT_Decoration);
 
               //v15->sZValue = v22 + v23;
               v15->actual_z = HIWORD(x);
-              v15->object_pid = 8 * uDecorationID | OBJECT_Decoration;
+              v15->object_pid = PID(uDecorationID,OBJECT_Decoration);
 
               v15->uTintColor = 0;
               v15->pSpriteFrame = v12;
@@ -11309,12 +11309,12 @@
               v3->uTintColor = 0;
               v3->uScreenSpaceY = v22;
               //v23 = 8 * i;
-              //LOBYTE(v23) = 8 * i | OBJECT_Item;
+              //LOBYTE(v23) = PID(i,OBJECT_Item);
               v3->pSpriteFrame = v24;
               //v12 = (p->uAttributes & 0x20) == 0;
               //v3->sZValue = v21 + v23;
               v3->actual_z = HIWORD(x);
-              v3->object_pid = 8 * i | OBJECT_Item;
+              v3->object_pid = PID(i,OBJECT_Item);
               if (p->uAttributes & 0x20)
               {
                 if ( !pRenderer->pRenderD3D )
@@ -15388,8 +15388,8 @@
 				v21->pMonsterInfo.uRecoveryTime = 0;
 			if ( !(v21->uAttributes & 0x8000) )
 				v21->uAttributes |= 0x8000;
-			a1 = 8 * actor_id | OBJECT_Actor;
-			v30 = Actor::GetDirectionInfo(8 * actor_id | OBJECT_Actor, target_pid, &a3, 0);
+			a1 = PID(actor_id,OBJECT_Actor);
+			v30 = Actor::GetDirectionInfo(PID(actor_id,OBJECT_Actor), target_pid, &a3, 0);
 			memcpy(&v75, v30, sizeof(v75));
 			memcpy(&pDir, &v75, sizeof(pDir));
 			uAIState = v21->uAIState; 
@@ -15429,24 +15429,24 @@
 				else if ( v21->uAIState == AttackingRanged1 )
 				{
 					v34 = v21->pMonsterInfo.uMissleAttack1Type;
-					Actor::_404874(actor_id, &pDir, v34, 0);
+					Actor::RangedAttack(actor_id, &pDir, v34, 0);
 				}
 				else if ( v21->uAIState == AttackingRanged2 )
 				{
 					v34 = v21->pMonsterInfo.uMissleAttack2Type;
-					Actor::_404874(actor_id, &pDir, v34, 1);
+					Actor::RangedAttack(actor_id, &pDir, v34, 1);
 				}
 				else if ( v21->uAIState == AttackingRanged3 )
 				{
 					v65 = v21->pMonsterInfo.uSpellSkillAndMastery1;
 					v33 = v21->pMonsterInfo.uSpell1ID;
-					Actor::_404AC7(actor_id, &pDir, v33, 2, v65);
+					Actor::SpellAttack(actor_id, &pDir, v33, 2, v65);
 				}
 				else if ( v21->uAIState == AttackingRanged4 )
 				{
 					v65 = v21->pMonsterInfo.uSpellSkillAndMastery2;
 					v33 = v21->pMonsterInfo.uSpell2ID;
-					Actor::_404AC7(actor_id, &pDir, v33, 3, v65);
+					Actor::SpellAttack(actor_id, &pDir, v33, 3, v65);
 				}
 			}
 
@@ -15492,7 +15492,7 @@
 				{
 					//peasents after attacked
 					//guard after attacked
-					Actor::_402968(actor_id, target_pid, 0, &pDir);
+					Actor::Flee(actor_id, target_pid, 0, &pDir);
 				}
 				continue;
 			}
@@ -15508,7 +15508,7 @@
 					}
 					else
 					{
-						Actor::_402968(actor_id, target_pid, 0, &pDir);
+						Actor::Flee(actor_id, target_pid, 0, &pDir);
 						continue;
 					}
 						
@@ -15525,7 +15525,7 @@
 						v42 = (double)(signed int)v84;
 						if ( v43 > v42 && (signed int)v36 < 10240 )
 						{
-							Actor::_402968(actor_id, target_pid, 0, &pDir);
+							Actor::Flee(actor_id, target_pid, 0, &pDir);
 							continue;
 						}
 					}
@@ -15564,7 +15564,7 @@
 									Actor::AI_Stand(actor_id, target_pid, v64, &pDir);
 									continue;
 								}
-								Actor::_402AD7(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir);
+								Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir);
 							}
 						}
 						else
@@ -15583,7 +15583,7 @@
 									else
 									{
 										//monsters
-										Actor::_402686(actor_id, target_pid, 0, &pDir);
+										Actor::Pursue3(actor_id, target_pid, 0, &pDir);
 									}
 								}
 								else if ( v21->pMonsterInfo.uMovementType == 5 )
@@ -15598,7 +15598,7 @@
 									//monsters
 									//guard after player runs away
 									// follow player
-									Actor::_40281C(actor_id, target_pid, 0, &pDir, v70);
+									Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70);
 								}
 							}
 							else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
@@ -15639,7 +15639,7 @@
 							else
 							{
 								v47 = (double)(signed int)v21->pMonsterInfo.uRecoveryTime * 2.133333333333333;
-								Actor::_402AD7(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir);
+								Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir);
 							}
 						}
 						else
@@ -15657,7 +15657,7 @@
 									}
 									else
 									{
-										Actor::_402686(actor_id, target_pid, 256, &pDir);
+										Actor::Pursue3(actor_id, target_pid, 256, &pDir);
 									}
 								}
 								else if ( v21->pMonsterInfo.uMovementType == 5 )
@@ -15669,7 +15669,7 @@
 								else
 								{
 									v70 = (signed __int64)v48;
-									Actor::_40281C(actor_id, target_pid, 0, &pDir, v70);
+									Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70);
 								}
 							}
 							else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
@@ -15731,7 +15731,7 @@
 						}
 						else
 						{
-							Actor::_402686(actor_id, target_pid, 256, &pDir);
+							Actor::Pursue3(actor_id, target_pid, 256, &pDir);
 						}
 					}
 					else if ( v21->pMonsterInfo.uMovementType == 5 )
@@ -15743,7 +15743,7 @@
 					else
 					{
 						v70 = (signed __int64)v56;
-						Actor::_40281C(actor_id, target_pid, 0, &pDir, v70);
+						Actor::Pursue2(actor_id, target_pid, 0, &pDir, v70);
 					}
 				}
 				else if ( (signed int)v21->pMonsterInfo.uRecoveryTime > 0 )
@@ -15767,7 +15767,7 @@
 				}
 				else
 				{
-					Actor::_402AD7(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir);
+					Actor::Pursue1(actor_id, target_pid, actor_id, (signed __int64)v47, &pDir);
 				}
 			}
 			else
@@ -16025,7 +16025,7 @@
   {
     if ( v40->CanAct() )
     {
-      *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = 8 * v3 | OBJECT_Player;
+      *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = PID(v3,OBJECT_Player);
       v1->pQueue[v1->uActorQueueSize].field_C = 2;
       v1->pQueue[v1->uActorQueueSize].uActionLength = 0;
       pParty->pTurnBasedPlayerRecoveryTimes[v1->uActorQueueSize++] = 0;
@@ -16055,8 +16055,8 @@
             v8 = ai_near_actors_targets_pid[v5];
             LOBYTE(v7) = v7 | 0x80;
             v6->uAttributes = v7;
-            v33 = 8 * v5 | OBJECT_Actor;
-            memcpy(&v31, Actor::GetDirectionInfo(8 * v5 | OBJECT_Actor, v8, &a3, 0), sizeof(v31));
+            v33 = PID(v5,OBJECT_Actor);
+            memcpy(&v31, Actor::GetDirectionInfo(PID(v5,OBJECT_Actor), v8, &a3, 0), sizeof(v31));
             memcpy(&v30, &v31, sizeof(v30));
             Actor::AI_StandOrBored(v37, 4, 32, &v30);
             *(&v1->field_0 + 4 * (v1->uActorQueueSize + 2)) = v33;
--- a/mm7_4.cpp	Sun Mar 31 12:01:31 2013 +0100
+++ b/mm7_4.cpp	Sun Mar 31 12:39:29 2013 +0100
@@ -8707,7 +8707,7 @@
             if ( (signed int)v4->uCurrentActionTime >= v5 )
             {
               v17 = ai_near_actors_targets_pid[v20];
-              v6 = Actor::GetDirectionInfo(8 * v20 | OBJECT_Actor, v17, &a3, v2);
+              v6 = Actor::GetDirectionInfo(PID(v20,OBJECT_Actor), v17, &a3, v2);
               v7 = v4->uAIState;
               memcpy(&v15, v6, sizeof(v15));
               v8 = v7 - 4;
@@ -8996,9 +8996,9 @@
     LOWORD(v25) = 0;
     LOBYTE(v26) = v41;
 
-    //v0->sZValue = v25 + (8 * i | OBJECT_Actor);
+    //v0->sZValue = v25 + (PID(i,OBJECT_Actor));
     v0->actual_z = HIWORD(x);
-    v0->object_pid = v8 * i | OBJECT_Actor;
+    v0->object_pid = PID(i,OBJECT_Actor);
 
     v29 = HIDWORD(p->pActorBuffs[5].uExpireTime) == 0;
     v30 = HIDWORD(p->pActorBuffs[5].uExpireTime) < 0;
--- a/mm7_5.cpp	Sun Mar 31 12:01:31 2013 +0100
+++ b/mm7_5.cpp	Sun Mar 31 12:39:29 2013 +0100
@@ -5381,7 +5381,7 @@
             {
               if ( v7->sCurrentHP >= 1 )
               {
-                Actor::_4030AD(uActorID, 8 * a4 | OBJECT_Player, 0);
+                Actor::_4030AD(uActorID, PID(a4,OBJECT_Player), 0);
                 Actor::AggroSurroundingPeasants(uActorID, 1);
               }
               else
@@ -5567,7 +5567,7 @@
                   {
                     if ( v44->sCurrentHP >= 1 )
                     {
-                      Actor::_4030AD(uActorID, 8 * a4 | OBJECT_Player, 0);
+                      Actor::_4030AD(uActorID, PID(a4,OBJECT_Player), 0);
                       Actor::AggroSurroundingPeasants(uActorID, 1);
                     }
                     else
@@ -7339,7 +7339,7 @@
                   v22 = 2;
                   v17 = v5->pMonsterInfo.uSpell1ID;
                 }
-                Actor::_404AC7(v4, &a4, v17, v22, v24);
+                Actor::SpellAttack(v4, &a4, v17, v22, v24);
 LABEL_25:
                 v16 = a2a;
                 v23 = &a4;
@@ -7355,7 +7355,7 @@
               v18 = v5->pMonsterInfo.uMissleAttack1Type;
               v25 = 0;
             }
-            Actor::_404874(v4, &a4, v18, v25);
+            Actor::RangedAttack(v4, &a4, v18, v25);
             goto LABEL_25;
           }
         }
@@ -7827,7 +7827,7 @@
           goto LABEL_25;
         }
 LABEL_24:
-        Actor::_402968(v16, v15, v21, v23);
+        Actor::Flee(v16, v15, v21, v23);
 LABEL_25:
         v17 = v29;
         v29->field_C = 4;
@@ -7844,9 +7844,9 @@
   if ( (signed int)v11 < 5120 )
   {
     if ( v4->pMonsterInfo.uMissleAttack1Type && (signed int)v11 < 1024 )
-      Actor::_402AD7(uActorID, a2a, uActorID, 32, &pDir);
+      Actor::Pursue1(uActorID, a2a, uActorID, 32, &pDir);
     else
-      Actor::_40281C(uActorID, a2a, 32, &pDir, 307);
+      Actor::Pursue2(uActorID, a2a, 32, &pDir, 307);
     goto LABEL_59;
   }
 LABEL_46: