changeset 1887:25655815623a

Actor::AI_Pursue3 cleaned up
author Grumpy7
date Sat, 19 Oct 2013 08:15:08 +0200
parents df873a01767a
children cbeb25a148ad
files Actor.cpp
diffstat 1 files changed, 9 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Sat Oct 19 07:56:16 2013 +0200
+++ b/Actor.cpp	Sat Oct 19 08:15:08 2013 +0200
@@ -2297,31 +2297,19 @@
 //----- (00402686) --------------------------------------------------------
 void Actor::AI_Pursue3(unsigned int uActorID, unsigned int a2, signed int uActionLength, AIDirection *a4)
 {
-  //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
-  signed int v10; // edx@12
   signed __int16 v12; // cx@19
-  int v13; // edx@25
   __int16 v14; // ax@25
-  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 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
+  AIDirection* v20; // [sp+28h] [bp-24h]@8
 
   v5 = 0;
   v6 = &pActors[uActorID];
-  v21 = a2;
   v7 = PID(OBJECT_Actor,uActorID);
-  v8 = v6->pMonsterInfo.uFlying == 0;
-  if ( !v8 && !pParty->bFlying )
+  if ( v6->pMonsterInfo.uFlying != 0 && !pParty->bFlying )
   {
     if ( v6->pMonsterInfo.uMissleAttack1Type && uCurrentlyLoadedLevelType == LEVEL_Outdoor )
       v5 = v6->uActorRadius + 512;
@@ -2330,7 +2318,7 @@
   }
   if ( !a4 )
   {
-    memcpy(&v20, Actor::GetDirectionInfo(v7, a2, &a3, v5), sizeof(v20));
+    v20 = Actor::GetDirectionInfo(v7, a2, &a3, v5);
   }
   if ( MonsterStats::BelongsToSupertype(v6->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT) )
   {
@@ -2338,11 +2326,11 @@
       uActionLength = 256;
     return Actor::AI_StandOrBored(uActorID, 4, uActionLength, a4);
   }
-  if ( (double)(signed int)a4->uDistance < 307.2 )
+  if ( a4->uDistance < 307.2 )
   {
     if ( !uActionLength )
       uActionLength = 256;
-    return Actor::AI_StandOrBored(uActorID, v21, uActionLength, a4);
+    return Actor::AI_StandOrBored(uActorID, a2, uActionLength, a4);
   }
   if ( uActionLength )
   {
@@ -2358,13 +2346,12 @@
     if ( v6->uCurrentActionLength > 128 )
       v6->uCurrentActionLength = 128;
   }
-  v13 = rand() % 2;
   v14 = LOWORD(a4->uYawAngle);
-  if ( v13 )
-    v15 = v14 + 256;
+  if ( rand() % 2 )
+    v14 += 256;
   else
-    v15 = v14 - 256;
-  v6->uYawAngle = v15;
+    v14 -= 256;
+  v6->uYawAngle = v14;
   v16 = LOWORD(a4->uPitchAngle);
   v6->uCurrentActionTime = 0;
   v6->uPitchAngle = v16;