diff Actor.cpp @ 860:8fc2f035abc0

* AI function renames * more PID replaces
author zipi
date Sun, 31 Mar 2013 12:39:29 +0100
parents 48c230c37d74
children fea81e031484
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);
 	  }