changeset 1935:1cbfb6e50e48

moving _4BBF61_summon_actor under Actor
author Grumpy7
date Wed, 23 Oct 2013 23:15:08 -0700
parents 564898c5882b
children a50511e4f3c6 e8d329651a2a
files Actor.cpp Actor.h mm7_2.cpp mm7_data.h
diffstat 4 files changed, 22 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Wed Oct 23 21:21:48 2013 -0700
+++ b/Actor.cpp	Wed Oct 23 23:15:08 2013 -0700
@@ -3578,7 +3578,7 @@
   unsigned __int16 v16; // cx@25
   int v33; // eax@100
   int v40; // ebx@107
-  signed __int64 extraRecoveryTime; // qax@125
+  int extraRecoveryTime; // qax@125
   unsigned __int16 v43; // ax@132
   unsigned __int16 v45; // ax@132
   unsigned __int64 v46; // [sp+Ch] [bp-60h]@6
@@ -3830,7 +3830,7 @@
       if ( pRenderer->pRenderD3D && pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
       {
         v33 = byte_4D864C && pGame->uFlags & 80000 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius;
-        pDecalBuilder->AddBloodsplat(pMonster->vPosition.x, pMonster->vPosition.y, pMonster->vPosition.z, 1.0, 0.0, 0.0, v33, 0, 0);
+        pDecalBuilder->AddBloodsplat((float)pMonster->vPosition.x, (float)pMonster->vPosition.y, (float)pMonster->vPosition.z, 1.0, 0.0, 0.0, (float)v33, 0, 0);
       }
     }
     Actor::Die(uActorID_Monster);
@@ -3859,7 +3859,7 @@
     extraRecoveryTime = 20;
     knockbackValue = 10;
     if ( !pParty->bTurnBasedModeOn )
-      extraRecoveryTime = (signed __int64)(flt_6BE3A8_debug_recmod2 * 42.66666666666666);
+      extraRecoveryTime = (int)(flt_6BE3A8_debug_recmod2 * 42.66666666666666);
     pMonster->pMonsterInfo.uRecoveryTime += extraRecoveryTime;
     if ( bShowDamage  )
     {
@@ -3895,51 +3895,36 @@
   Actor::AddBloodsplatOnDamageOverlay(uActorID_Monster, 1, v61);
 }
 //----- (004BBF61) --------------------------------------------------------
-void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z)
+void Actor::_4BBF61_summon_actor( int a1, __int16 x, int y, int z )
 {
-  size_t v4; // esi@1
-  int monster_id; // edi@1
-  __int16 v6; // ax@4
   Actor *v7; // esi@5
-  int v8; // eax@5
   MonsterInfo *v9; // edi@5
   MonsterDesc *v10; // ebx@5
-  unsigned __int16 *v11; // ebx@5
   int v12; // ebx@7
   int v13; // eax@8
-  __int16 x_; // [sp+8h] [bp-Ch]@1
-  __int16 v15; // [sp+Ch] [bp-8h]@1
   __int16 v16; // [sp+10h] [bp-4h]@3
-  signed int ya; // [sp+1Ch] [bp+8h]@5
 
-  v4 = uNumActors;
-  monster_id = a1;
-  x_ = x;
-  v15 = a1;
   if (uNumActors < 500)
   {
     v16 = 0;
     if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
     {
-      v6 = pIndoor->GetSector(x, y, z);
-      v4 = uNumActors;
-      v16 = v6;
+      v16 = pIndoor->GetSector(x, y, z);
     }
-    v7 = &pActors[v4];
+    v7 = &pActors[uNumActors];
     v7->Reset();
-    v8 = monster_id;
-    v9 = &pMonsterStats->pInfos[monster_id];
-    v10 = &pMonsterList->pMonsters[v8 - 1];
+    v9 = &pMonsterStats->pInfos[a1];
+    v10 = &pMonsterList->pMonsters[a1 - 1];
     strcpy(v7->pActorName, v9->pName);
     v7->sCurrentHP = LOWORD(v9->uHP);
     memcpy(&v7->pMonsterInfo, v9, 0x58u);
-    v7->word_000086_some_monster_id = v15;
+    v7->word_000086_some_monster_id = a1;
     v7->uActorRadius = v10->uMonsterRadius;
     v7->uActorHeight = v10->uMonsterHeight;
     v7->uMovementSpeed = v10->uMovementSpeed;
-    v7->vInitialPosition.x = x_;
-    v7->vPosition.x = x_;
-    BYTE2(v7->uAttributes) |= 8u;
+    v7->vInitialPosition.x = x;
+    v7->vPosition.x = x;
+    v7->uAttributes |= 80000;
     v7->pMonsterInfo.uTreasureType = 0;
     v7->pMonsterInfo.uTreasureLevel = 0;
     v7->pMonsterInfo.uTreasureDiceSides = 0;
@@ -3954,18 +3939,16 @@
     v7->uGroup = 1;
     v7->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
     v7->PrepareSprites(0);
-    v11 = v10->pSoundSampleIDs;
-    ya = 4;
+    for ( int i = 0; i < 4; i++)
+    {
+      pSoundList->LoadSound(v10->pSoundSampleIDs[i], 0);
+    }
+    v12 = 0;
     do
     {
-      pSoundList->LoadSound((signed __int16)*v11, 0);
-      ++v11;
-      --ya;
+      LOWORD(v13) = pSoundList->LoadSound(v12 + word_4EE088_sound_ids[v9->uSpell1ID], 1u);
+      v12++;
     }
-    while ( ya );
-    v12 = 0;
-    do
-      LOWORD(v13) = pSoundList->LoadSound(v12++ + word_4EE088_sound_ids[v9->uSpell1ID], 1u);
     while ( v13 );
     ++uNumActors;
   }
--- a/Actor.h	Wed Oct 23 21:21:48 2013 -0700
+++ b/Actor.h	Wed Oct 23 23:15:08 2013 -0700
@@ -246,6 +246,7 @@
   static void AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3);
 
   static bool _46DF1A_collide_against_actor(int a1, int a2);
+  static void _4BBF61_summon_actor(int a1, __int16 x, int y, int z); // idb
 
   char pActorName[32];
   signed __int16 sNPC_ID;
--- a/mm7_2.cpp	Wed Oct 23 21:21:48 2013 -0700
+++ b/mm7_2.cpp	Wed Oct 23 23:15:08 2013 -0700
@@ -22,6 +22,7 @@
 #include "GammaControl.h"
 #include "stru6.h"
 
+#include "Actor.h"
 #include "Vis.h"
 #include "MapInfo.h"
 #include "Game.h"
@@ -600,7 +601,7 @@
   {
     monster_y = pMonsterArenaPlacements[i].y;
     v21 = rand();
-    _4BBF61_summon_actor((unsigned __int16)monster_ids[v21 % num_monsters], pMonsterArenaPlacements[i].x, monster_y, 1);
+    Actor::_4BBF61_summon_actor((unsigned __int16)monster_ids[v21 % num_monsters], pMonsterArenaPlacements[i].x, monster_y, 1);
   }
   pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0);
 }
--- a/mm7_data.h	Wed Oct 23 21:21:48 2013 -0700
+++ b/mm7_data.h	Wed Oct 23 23:15:08 2013 -0700
@@ -1203,7 +1203,6 @@
 __int64 GetExperienceRequiredForLevel(int a1);
 void CheckBountyRespawnAndAward();
 void Arena_SelectionFightLevel();
-void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z); // idb
 void ArenaFight();
 void SpellBookGenerator();
 void UI_CreateEndConversationButton();