diff Actor.cpp @ 1895:6b4e14436ee8

renaming Actor::_44FD29 to Actor::SummonMinion
author Grumpy7
date Sun, 20 Oct 2013 02:48:35 -0700
parents fe7182c30aad
children b6a7410ff0ef
line wrap: on
line diff
--- a/Actor.cpp	Sun Oct 20 02:30:36 2013 -0700
+++ b/Actor.cpp	Sun Oct 20 02:48:35 2013 -0700
@@ -2682,7 +2682,7 @@
 }
 
 //----- (0044FD29) --------------------------------------------------------
-void Actor::_44FD29( int a2 )
+void Actor::SummonMinion( int summonerId )
 {
   unsigned __int8 v3; // al@1
   int v4; // esi@1
@@ -2691,7 +2691,6 @@
   Actor *v8; // esi@10
   MonsterInfo *v9; // ebx@10
   MonsterDesc *v10; // edi@10
-  unsigned __int16 v11; // ax@10
   int v13; // ebx@10
   int v15; // edi@10
   int v17; // ebx@10
@@ -2701,6 +2700,34 @@
   int v27; // [sp+18h] [bp-10h]@10
   int actorSector; // [sp+1Ch] [bp-Ch]@8
 
+
+  actorSector = 0;
+  if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
+    actorSector = pIndoor->GetSector(this->vPosition.x, this->vPosition.y, this->vPosition.z);
+
+  v19 = this->uAlly;
+  if ( !v19 )
+  {
+    monsterId = this->pMonsterInfo.uID - 1;
+    v19 = (uint)(monsterId * 0.33333334);
+  }
+  v27 = uCurrentlyLoadedLevelType == LEVEL_Outdoor ? 128 : 64;
+  v13 = rand() % 2048;
+  v15 = ((stru_5C6E00->Cos(v13) * (signed __int64)v27) >> 16) + this->vPosition.x;
+  v17 = ((stru_5C6E00->Sin(v13) * (signed __int64)v27) >> 16) + this->vPosition.y;
+
+  if (uCurrentlyLoadedLevelType != LEVEL_Outdoor)
+  {
+    result = pIndoor->GetSector(v15, v17, this->vPosition.z);
+    if (result != actorSector)
+      return;
+    result = BLV_GetFloorLevel(v15, v17, v27, result, &monsterId);
+    if (result != -30000)
+      return;
+    if (abs(result - v27) > 1024)
+      return;
+  }
+
   v3 = this->pMonsterInfo.uSpecialAbilityDamageDiceRolls;
   v4 = this->pMonsterInfo.field_3C_some_special_attack;
   if ( v3 )
@@ -2718,12 +2745,8 @@
       v4 += 1;
     }
   }
-  actorSector = 0;
-  if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-    actorSector = pIndoor->GetSector(this->vPosition.x, this->vPosition.y, this->vPosition.z);
   v7 = v4 - 1;
   v8 = &pActors[uNumActors];
-  v27 = (((uCurrentlyLoadedLevelType != LEVEL_Outdoor) - 1) & 0x40) + 64;
   v9 = &pMonsterStats->pInfos[v7 + 1];
   pActors[uNumActors].Reset();
   v10 = &pMonsterList->pMonsters[v7];
@@ -2733,14 +2756,10 @@
   v8->word_000086_some_monster_id = v4;
   v8->uActorRadius = v10->uMonsterRadius;
   v8->uActorHeight = v10->uMonsterHeight;
-  v11 = v10->uMovementSpeed;
   v8->pMonsterInfo.uTreasureDiceRolls = 0;
   v8->pMonsterInfo.uTreasureType = 0;
   v8->pMonsterInfo.uExp = 0;
-  v8->uMovementSpeed = v11;
-  v13 = rand() % 2048;
-  v15 = ((stru_5C6E00->Cos(v13) * (signed __int64)v27) >> 16) + this->vPosition.x;
-  v17 = ((stru_5C6E00->Sin(v13) * (signed __int64)v27) >> 16) + this->vPosition.y;
+  v8->uMovementSpeed = v10->uMovementSpeed;
   v8->vInitialPosition.z = this->vPosition.z;
   v8->vPosition.z = this->vPosition.z;
   v8->vInitialPosition.x = v15;
@@ -2751,12 +2770,6 @@
   v8->uSectorID = actorSector;
   v8->PrepareSprites(0);
   v8->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
-  v19 = this->uAlly;
-  if ( !v19 )
-  {
-    monsterId = this->pMonsterInfo.uID - 1;
-    v19 = (uint)(monsterId * 0.33333334);
-  }
   v8->uAlly = v19;
   v8->uCurrentActionTime = 0;
   v8->uGroup = this->uGroup;
@@ -2764,23 +2777,11 @@
   v8->uCurrentActionLength = 256;
   v8->UpdateAnimation();
 
-  if (uCurrentlyLoadedLevelType != LEVEL_Outdoor)
-  {
-    result = pIndoor->GetSector(v15, v17, this->vPosition.z);
-    if (result != actorSector)
-      return;
-    result = BLV_GetFloorLevel(v15, v17, v27, result, &monsterId);
-    if (result != -30000)
-      return;
-    if (abs(result - v27) > 1024)
-      return;
-  }
-
   ++uNumActors;
   ++this->pMonsterInfo.uSpecialAbilityDamageDiceBonus;
   if ( this->uAttributes & 0x80000 )
     v8->uAttributes |= 0x80000u;
-  v8->uSummonerID = PID(OBJECT_Actor,a2);
+  v8->uSummonerID = PID(OBJECT_Actor,summonerId);
 
 }
 // 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int);