changeset 1865:e622546c8f0c

Actor::AI_FaceObject cleanup
author Grumpy7
date Mon, 14 Oct 2013 08:22:12 +0200
parents b6258f64e313
children eb580660bbbb 351b4ff10ac1
files Actor.cpp
diffstat 1 files changed, 13 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Mon Oct 14 08:00:30 2013 +0200
+++ b/Actor.cpp	Mon Oct 14 08:22:12 2013 +0200
@@ -1141,44 +1141,33 @@
 //----- (00404030) --------------------------------------------------------
 void Actor::AI_FaceObject(unsigned int uActorID, unsigned int uObjID, int _48, AIDirection *a4)
 {
-  unsigned int v4; // edi@1
-  unsigned int v5; // esi@1
-  //unsigned int result; // eax@2
   AIDirection *v7; // eax@3
-  unsigned int v8; // ecx@3
   Actor *v9; // ebx@3
-  AIDirection *v10; // esi@4
-  unsigned __int16 v11; // ax@5
   AIDirection a3; // [sp+8h] [bp-38h]@4
-  AIDirection v13; // [sp+24h] [bp-1Ch]@4
 
-  v4 = uObjID;
-  v5 = uActorID;
   if ( rand() % 100 >= 5 )
   {
-    v7 = a4;
-    v8 = 0;
-    v9 = &pActors[v5];
+    v9 = &pActors[uActorID];
     if ( !a4 )
     {
-      v10 = Actor::GetDirectionInfo(PID(OBJECT_Actor, v5), v4, &a3, 0);
-      v7 = &v13;
-      memcpy(&v13, v10, sizeof(v13));
-      v8 = 0;
+      v7 = Actor::GetDirectionInfo(PID(OBJECT_Actor, uActorID), uObjID, &a3, 0);
+    }
+    else
+    {
+      v7 = a4;
     }
-    v9->uYawAngle = LOWORD(v7->uYawAngle);
-    v11 = LOWORD(v7->uPitchAngle);
-    v9->uCurrentActionTime = v8;
-    v9->vVelocity.z = v8;
-    v9->vVelocity.y = v8;
-    v9->vVelocity.x = v8;
-    v9->uPitchAngle = v11;
+    v9->uYawAngle = v7->uYawAngle;
+    v9->uCurrentActionTime = 0;
+    v9->vVelocity.z = 0;
+    v9->vVelocity.y = 0;
+    v9->vVelocity.x = 0;
+    v9->uPitchAngle = v7->uPitchAngle;
     v9->uCurrentActionLength = 256;
     v9->uAIState = Interacting;
     v9->UpdateAnimation();
   }
   else
-    Actor::AI_Bored(v5, v4, a4);
+    Actor::AI_Bored(uActorID, uObjID, a4);
 }
 
 //----- (00403F58) --------------------------------------------------------