changeset 1863:97b75e6100ff

Actor::Explode cleaned up
author Grumpy7
date Mon, 14 Oct 2013 07:40:44 +0200
parents a2bdc17ffd2f
children b6258f64e313
files Actor.cpp Actor.h
diffstat 2 files changed, 9 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Mon Oct 14 07:32:04 2013 +0200
+++ b/Actor.cpp	Mon Oct 14 07:40:44 2013 +0200
@@ -905,61 +905,32 @@
 }
 
 //----- (00404736) --------------------------------------------------------
-signed int __fastcall Actor::Explode(unsigned int uActorID)
+void Actor::Explode( unsigned int uActorID )
 {
   Actor *v1; // esi@1
-  signed int v2; // edx@1
-  char *v3; // ecx@2
-  unsigned __int16 v4; // ax@5
-  int v5; // ebx@6
-  int v6; // ecx@6
-  //int v7; // eax@6
   SpriteObject a1; // [sp+Ch] [bp-78h]@1
-  unsigned int v10; // [sp+7Ch] [bp-8h]@1
-  int v11; // [sp+80h] [bp-4h]@6
 
-  v10 = uActorID;
   v1 = &pActors[uActorID];
-  v2 = 0;
   a1.uType = 600;
-  if ( (signed int)pObjectList->uNumObjects <= 0 )
-  {
-LABEL_5:
-    v4 = 0;
-  }
-  else
-  {
-    v3 = (char *)&pObjectList->pObjects->uObjectID;
-    while ( *(short *)v3 != 600 )
-    {
-      ++v2;
-      v3 += 56;
-      if ( v2 >= (signed int)pObjectList->uNumObjects )
-        goto LABEL_5;
-    }
-    v4 = v2;
-  }
-  a1.uObjectDescID = v4;
+  a1.uObjectDescID = GetObjDescId(a1.uType);
   a1.stru_24.Reset();
   a1.vPosition.y = v1->vPosition.y;
   a1.spell_id = 0;
-  v5 = v1->vPosition.x;
-  v11 = v1->uActorHeight;
   a1.spell_level = 0;
   a1.spell_skill = 0;
-  a1.vPosition.x = v5;
-  v6 = v1->vPosition.z - (unsigned int)(signed __int64)((double)v11 * -0.75);
+  a1.vPosition.x = v1->vPosition.x;
   a1.uFacing = 0;
-  a1.vPosition.z = v6;
+  a1.vPosition.z = v1->vPosition.z - (unsigned int)(v1->uActorHeight * -0.75);
   a1.uSoundID = 0;
   a1.uAttributes = 0;
-  a1.uSectorID = pIndoor->GetSector(v5, a1.vPosition.y, v6);
+  a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z);
   a1.uSpriteFrameID = 0;
-  a1.spell_caster_pid = PID(OBJECT_Actor, v10);
+  a1.spell_caster_pid = PID(OBJECT_Actor, uActorID);
   a1.spell_target_pid = 0;
   a1.field_60_distance_related_prolly_lod = 3;
   a1.field_61 = 4;
-  return a1.Create(0, 0, 0, 0);
+  a1.Create(0, 0, 0, 0);
+  return;
 }
 
 //----- (004040E9) --------------------------------------------------------
--- a/Actor.h	Mon Oct 14 07:32:04 2013 +0200
+++ b/Actor.h	Mon Oct 14 07:40:44 2013 +0200
@@ -228,7 +228,7 @@
   static void AI_StandOrBored(unsigned int uActorID, signed int uObjID, int uActionLength, struct AIDirection *a4);
   static void AI_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 void Explode(unsigned int uActorID);
   static void AI_RangedAttack(unsigned int uActorID, struct AIDirection *a2, int type, char a4);
   static void AI_SpellAttack(unsigned int uActorID, struct AIDirection *pDir, int uSpellID, int a4, unsigned int uSkillLevel);