diff Engine/Objects/Actor.cpp @ 2541:a902abdfc7f2

1. Renamed class Game to class Engine. 2. Separated game logic as state of FSM from game logic as engine. 3. Found out that many UI screen initializers were optimized away, intially they all returned newly created window as separate object like it is done in CharacterUI_Initialize.
author a.parshin
date Sun, 10 May 2015 01:29:11 +0200
parents 1bcadc6dd203
children b6140dfeac27
line wrap: on
line diff
--- a/Engine/Objects/Actor.cpp	Sat May 09 12:55:58 2015 +0200
+++ b/Engine/Objects/Actor.cpp	Sun May 10 01:29:11 2015 +0200
@@ -4,20 +4,16 @@
 
 #define _CRT_SECURE_NO_WARNINGS
 
+#include "Engine/Engine.h"
+
 #include "../Graphics/PaletteManager.h"
-#include "../ErrorHandling.h"
-
 #include "../Graphics/DecalBuilder.h"
-
 #include "../Graphics/Sprites.h"
 #include "../../stru6.h"
-
-
 #include "Actor.h"
 #include "../OurMath.h"
 #include "../Graphics/Outdoor.h"
 #include "Media/Audio/AudioPlayer.h"
-#include "../Game.h"
 #include "ObjectList.h"
 #include "../Graphics/Overlays.h"
 #include "../Tables/FactionTable.h"
@@ -27,11 +23,8 @@
 #include "../LOD.h"
 #include "../Party.h"
 #include "GUI/GUIWindow.h"
-
-#include "../MM7.h"
 #include "SpriteObject.h"
 #include "../stru298.h"
-#include "../Log.h"
 #include "../Texts.h"
 #include "../Graphics/Level/Decoration.h"
 #include "../Graphics/Viewport.h"
@@ -331,7 +324,7 @@
         v39 = 0;
       actorPtr->pActorBuffs[ACTOR_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(v39 << 7) * 0.033333335),
         masteryLevel, 0, 0, 0);
-      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFF3C1Eu);
+      pEngine->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFF3C1Eu);
       pAudioPlayer->PlaySound((SoundID)SOUND_Haste, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
       return;
 
@@ -478,7 +471,7 @@
       actorPtr->pActorBuffs[ACTOR_BUFF_STONESKIN].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v44 << 7) * 0.033333335),
         masteryLevel, realPoints + 5, 0, 0);
-      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x5C310Eu);
+      pEngine->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x5C310Eu);
       pAudioPlayer->PlaySound((SoundID)SOUND_Stoneskin, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0);
       return;
 
@@ -494,7 +487,7 @@
       actorPtr->pActorBuffs[ACTOR_BUFF_BLESS].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v42 << 7) * 0.033333335),
         masteryLevel, realPoints + 5, 0, 0);
-      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u);
+      pEngine->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u);
       pAudioPlayer->PlaySound((SoundID)SOUND_Bless, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0);
       return;
       break;
@@ -509,7 +502,7 @@
       else
         v48 = 0;
       actorPtr->pActorBuffs[ACTOR_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, masteryLevel, v48, 0, 0);
-      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u);
+      pEngine->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u);
       pAudioPlayer->PlaySound((SoundID)SOUND_Fate, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
       return;
 
@@ -525,7 +518,7 @@
       actorPtr->pActorBuffs[ACTOR_BUFF_HEROISM].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v54 << 7) * 0.033333335),
         masteryLevel, realPoints + 5, 0, 0);
-      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u);
+      pEngine->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0xC8C805u);
       pAudioPlayer->PlaySound((SoundID)SOUND_51heroism03, PID(OBJECT_Actor,uActorID), 0, -1, 0, 0, 0, 0);
       return;
 
@@ -540,7 +533,7 @@
         realPoints,
         0,
         0);
-      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xA81376u);
+      pEngine->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xA81376u);
       pAudioPlayer->PlaySound((SoundID)SOUND_51heroism03, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
       return;
 
@@ -548,7 +541,7 @@
       actorPtr->sCurrentHP += 5 * realPoints + 10;
       if ( actorPtr->sCurrentHP >= (signed int)actorPtr->pMonsterInfo.uHP )
         actorPtr->sCurrentHP = LOWORD(actorPtr->pMonsterInfo.uHP);
-      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xA81376u);
+      pEngine->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xA81376u);
       pAudioPlayer->PlaySound((SoundID)SOUND_Fate, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
       return;
 
@@ -591,7 +584,7 @@
       actorPtr->pActorBuffs[ACTOR_BUFF_DAY_OF_PROTECTION].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v96 << 7) * 0.033333335),
         masteryLevel, realPoints, 0, 0);
-      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu);
+      pEngine->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu);
       pAudioPlayer->PlaySound((SoundID)SOUND_94dayofprotection03, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
       return;
 
@@ -607,7 +600,7 @@
       actorPtr->pActorBuffs[ACTOR_BUFF_HOUR_OF_POWER].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v94 << 7) * 0.033333335),
         masteryLevel, realPoints + 5, 0, 0);
-      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu);
+      pEngine->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr, 0xFFFFFFu);
       pAudioPlayer->PlaySound((SoundID)SOUND_9armageddon01, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
       return;
 
@@ -673,7 +666,7 @@
       actorPtr->pActorBuffs[ACTOR_BUFF_PAIN_REFLECTION].Apply(
         pParty->uTimePlayed + (signed int)(signed __int64)((double)(v68 << 7) * 0.033333335),
         masteryLevel, 0, 0, 0);
-      pGame->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x7E7E7Eu);
+      pEngine->pStru6Instance->_4A7E89_sparkles_on_actor_after_it_casts_buff(actorPtr,0x7E7E7Eu);
       pAudioPlayer->PlaySound((SoundID)SOUND_Sacrifice2, PID(OBJECT_Actor, uActorID), 0, -1, 0, 0, 0, 0);
       return;
   }
@@ -1910,7 +1903,7 @@
 
   actor->uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[actor->pSpriteIDs[ANIM_Bored]].uAnimLength;
 
-  v7 = stru_5C6E00->Atan2(actor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, actor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
+  v7 = stru_5C6E00->Atan2(actor->vPosition.x - pEngine->pIndoorCameraD3D->vPartyPos.x, actor->vPosition.y - pEngine->pIndoorCameraD3D->vPartyPos.y);
   v9 = stru_5C6E00->uIntegerPi + actor->uYawAngle + ((signed int)stru_5C6E00->uIntegerPi >> 3) - v7;
 
   if ( v9 & 0x700 )      // turned away - just stand
@@ -3703,9 +3696,9 @@
   {
     if ( pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].bQuestMonster & 1 )
     {
-      if ( /*pRenderer->pRenderD3D &&*/ pGame->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
+      if ( /*pRenderer->pRenderD3D &&*/ pEngine->uFlags2 & GAME_FLAGS_2_DRAW_BLOODSPLATS )
       {
-        v33 = byte_4D864C && pGame->uFlags & 0x80000 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius;
+        v33 = byte_4D864C && pEngine->uFlags & 0x80000 ? 10 * pMonster->uActorRadius : pMonster->uActorRadius;
         pDecalBuilder->AddBloodsplat((float)pMonster->vPosition.x, (float)pMonster->vPosition.y, (float)pMonster->vPosition.z, 1.0, 0.0, 0.0, (float)v33, 0, 0);
       }
     }
@@ -3981,7 +3974,7 @@
 		v6 = a3 != 0;
 		if (a4)
 			LOBYTE(v6) = v6 | 8;
-		v7 = pGame->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1);
+		v7 = pEngine->pVisInstance->PickClosestActor(OBJECT_Actor, pick_depth, v6, 657456, -1);
 		if (v7 != -1)
 			return (unsigned __int16)v7;
 		else return 0;