diff Engine/Spells/CastSpellInfo.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/Spells/CastSpellInfo.cpp	Sat May 09 12:55:58 2015 +0200
+++ b/Engine/Spells/CastSpellInfo.cpp	Sun May 10 01:29:11 2015 +0200
@@ -3,13 +3,14 @@
 #include <crtdbg.h>
 
 #define _CRT_SECURE_NO_WARNINGS
+
+#include "Engine/Engine.h"
+
 #include "CastSpellInfo.h"
 #include "../Objects/Actor.h"
 #include "../Party.h"
-#include "../MM7.h"
 #include "IO/Mouse.h"
 #include "../../stru6.h"
-#include "../Game.h"
 #include "GUI/GUIWindow.h"
 #include "Media/Audio/AudioPlayer.h"
 #include "../Graphics/Outdoor.h"
@@ -27,7 +28,6 @@
 #include "../texts.h"
 #include "../LOD.h"
 #include "../Graphics/Level/Decoration.h"
-
 #include "..\..\GUI\UI\UIPartyCreation.h"
 
 const size_t CastSpellInfoCount = 10;
@@ -632,7 +632,7 @@
           pActors[mon_id].uAttributes |= ACTOR_AGGRESSOR;
           pActors[mon_id].vVelocity.x = 0;
           pActors[mon_id].vVelocity.y = 0;
-          pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0);
+          pEngine->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0);
         }
         spell_sound_flag = true;
         break;
@@ -656,7 +656,7 @@
         {
           pActors[mon_id].pActorBuffs[ACTOR_BUFF_SLOWED].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)23040 * spell_level * 0.033333335), skill_level, amount, 0, 0);
           pActors[mon_id].uAttributes |= ACTOR_AGGRESSOR;
-          pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0);
+          pEngine->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0);
         }
         spell_sound_flag = true;
         break;
@@ -782,7 +782,7 @@
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
         pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(3600 * spell_level) * 4.2666669), skill_level, amount, 0, 0);
         spell_sound_flag = true;
         break;
@@ -829,10 +829,10 @@
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
         //v90 = (double)(signed int)(3600 * spell_level) * 4.2666669;
         pParty->pPartyBuffs[buff_resist].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(3600 * spell_level) * 4.2666669), skill_level, amount, 0, 0);
         spell_sound_flag = true;
@@ -860,10 +860,10 @@
           if ( spell_sound_flag )
           {
             pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0);
-            pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-            pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-            pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-            pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+            pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+            pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+            pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+            pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
           }
         }
         break;
@@ -884,7 +884,7 @@
           break;
         if ( skill_level == 1 )
         {
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
           v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536);
           pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed +
                                 (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), 1, amount, v111, 0);
@@ -893,7 +893,7 @@
         }
         for ( uint pl_id = 0; pl_id < 4; pl_id++ )
         {
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
           v111 = pOtherOverlayList->_4418B1(10000, pl_id + 310, 0, 65536);
           pParty->pPlayers[pl_id].pPlayerBuffs[1].Apply(pParty->uTimePlayed +
                              (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, v111, 0);
@@ -976,10 +976,10 @@
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
         pParty->pPartyBuffs[buff_resist].Apply(pParty->uTimePlayed +
                        (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0);
         spell_sound_flag = true;
@@ -993,10 +993,10 @@
           duration = 60 * spell_level;
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
         pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + 
                                (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, spell_level, 0, 0);
         spell_sound_flag = true;
@@ -1113,8 +1113,8 @@
           pSpellSprite.vPosition.z = pActors[_50BF30_actors_in_viewport_ids[i]].vPosition.z - (unsigned int)(signed __int64)((double)pActors[_50BF30_actors_in_viewport_ids[i]].uActorHeight * -0.8);
           pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[i]);
           Actor::DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), _50BF30_actors_in_viewport_ids[i], &v700);
-          pGame->GetStru6()->_4A81CA(&pSpellSprite);
-          pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1E, 0x40);
+          pEngine->GetStru6()->_4A81CA(&pSpellSprite);
+          pEngine->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1E, 0x40);
         }
         spell_sound_flag = true;
         break;
@@ -1145,10 +1145,10 @@
           break;
         for ( uint pl_id = 0; pl_id < 4; pl_id++ )
           pOtherOverlayList->_4418B1(2010, pl_id + 100, 0, 65536);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
 
         pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(pParty->uTimePlayed + 
           (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0);
@@ -1238,10 +1238,10 @@
         }
         if ( pPlayer->CanCastSpell(uRequiredMana) )
         {
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
           pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed +
                  (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0);
           spell_sound_flag = true;
@@ -1473,10 +1473,10 @@
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
         v169 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
         pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(duration << 7) * 0.033333335),
                                        skill_level, amount, v169, pCastSpell->uPlayerID + 1);
         if ( skill_level == 4 )
@@ -1836,10 +1836,10 @@
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
         pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed + 
             (signed int)(signed __int64)((double)(signed int)((int)amount << 7) * 0.033333335), skill_level, 0, 0, 0);
         spell_sound_flag = true;
@@ -1861,7 +1861,7 @@
           break;
         if ( pCastSpell->spell_target_pid == 0 )
         {
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
           pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, skill_level, amount, 0, 0);
           spell_sound_flag = true;
           break;
@@ -1871,7 +1871,7 @@
           mon_id = PID_ID(pCastSpell->spell_target_pid);
           pActors[mon_id].pActorBuffs[ACTOR_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, skill_level, amount, 0, 0);
           pActors[mon_id].uAttributes |= ACTOR_AGGRESSOR;
-          pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0);
+          pEngine->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(&pActors[mon_id], 0);
         }
         spell_sound_flag = true;
         break;
@@ -1906,7 +1906,7 @@
             break;
           }
         }
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
         spell_sound_flag = true;
         break;
       }
@@ -1920,7 +1920,7 @@
           break;
         if ( skill_level == 1 || skill_level == 2 )
         {
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
           pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed +
             (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0);
           spell_sound_flag = true;
@@ -1928,7 +1928,7 @@
         }
         for ( uint pl_id = 0; pl_id < 4; pl_id++ )
         {
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
           pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + 
             (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, 0, 0, 0);
         }
@@ -1944,7 +1944,7 @@
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
         int mon_num = pRenderer->_46À6ÀÑ_GetActorsInViewport(4096);
-        pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFF, 192);
+        pEngine->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFF, 192);
         ++pSpellSprite.uType;
         pSpellSprite.stru_24.Reset();
         pSpellSprite.spell_id = pCastSpell->uSpellID;
@@ -2033,7 +2033,7 @@
             pPlayers[pl_array[i]]->sHealth = pPlayers[pl_array[i]]->GetMaxHealth();
           if ( pPlayers[pl_array[i]]->sHealth > 0 )
             pPlayers[pl_array[i]]->SetUnconcious(0);
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_array[i] - 1);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_array[i] - 1);
         }
         spell_sound_flag = true;
         break;
@@ -2073,7 +2073,7 @@
           }
           pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(Condition_Weak, 1);
           pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1;
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
         }
         spell_sound_flag = true;
         break;
@@ -2091,7 +2091,7 @@
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
         if ( !pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Paralyzed] )
         {
           spell_sound_flag = true;
@@ -2121,7 +2121,7 @@
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
         if ( !pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Fear] )
         {
           spell_sound_flag = true;
@@ -2300,7 +2300,7 @@
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
         int mon_num = pRenderer->_46À6ÀÑ_GetActorsInViewport(4096);
-        pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0A, 192);
+        pEngine->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0A, 192);
         ++pSpellSprite.uType;
         pSpellSprite.stru_24.Reset();
         pSpellSprite.spell_id = pCastSpell->uSpellID;
@@ -2340,7 +2340,7 @@
           amount = 86400 * spell_level;
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
         if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Insane] )
         {
           if ( !(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Weak]) )
@@ -2424,7 +2424,7 @@
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
         if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Weak] )
         {
           if ( skill_level == 4 )
@@ -2455,7 +2455,7 @@
         if ( !pCastSpell->spell_target_pid )
         {
           pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount);
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
         }
         if (PID_TYPE(pCastSpell->spell_target_pid) == OBJECT_Actor)
         {
@@ -2484,7 +2484,7 @@
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
         if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Weak] 
           || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Medium] 
           || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Poison_Severe] )
@@ -2508,10 +2508,10 @@
       {
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
         pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + 
                          (signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), skill_level, spell_level, 0, 0);
         spell_sound_flag = true;
@@ -2523,17 +2523,17 @@
           break;
         if ( skill_level == 4 )
         {
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
           for ( uint pl_id = 0; pl_id < 4; pl_id++)
             pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + 
                 (signed int)(signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), 4, spell_level, spell_level, 0);
           spell_sound_flag = true;
           break;
         }
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
         pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + 
            (signed int)(signed __int64)((double)(signed int)((int)(3600 * spell_level) << 7) * 0.033333335), skill_level, spell_level, spell_level, 0);
         spell_sound_flag = true;
@@ -2547,7 +2547,7 @@
           amount = 86400 * spell_level;
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
         if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Weak]
           || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Medium]
           || pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Disease_Severe] )
@@ -2574,7 +2574,7 @@
           break;
         for ( uint pl_id = 0; pl_id < 4;  ++pl_id )
         {
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
           pParty->pPlayers[pl_id].Heal(5 * spell_level + 10);
         }
         spell_sound_flag = true;
@@ -2585,7 +2585,7 @@
         sRecoveryTime -= spell_level;
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0A, 192);
+        pEngine->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0A, 192);
         int mon_num = pRenderer->_46À6ÀÑ_GetActorsInViewport(4096);
         ++pSpellSprite.uType;
         v688.x = 0;
@@ -2670,10 +2670,10 @@
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
         pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + 
                           (signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0);
         spell_sound_flag = true;
@@ -2716,8 +2716,8 @@
           pSpellSprite.spell_target_pid = PID(OBJECT_Actor, _50BF30_actors_in_viewport_ids[mon_id]);
           Actor::DamageMonsterFromParty(PID(OBJECT_Item, pSpellSprite.Create(0, 0, 0, 0)), _50BF30_actors_in_viewport_ids[mon_id], &v694);
         }
-        //v537 = pGame->GetStru6();
-        pGame->GetStru6()->_4A8BFC();
+        //v537 = pEngine->GetStru6();
+        pEngine->GetStru6()->_4A8BFC();
         spell_sound_flag = true;
         break;
       }
@@ -2734,10 +2734,10 @@
         }
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-        pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+        pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
         pParty->pPartyBuffs[PARTY_BUFF_RESIST_BODY].Apply(pParty->uTimePlayed + 
                            (signed __int64)((double)(duration << 7) * 0.033333335), skill_level, amount, 0, 0);
         pParty->pPartyBuffs[PARTY_BUFF_RESIST_MIND].Apply(pParty->uTimePlayed + 
@@ -2773,10 +2773,10 @@
         bool player_weak = false;
         for ( uint pl_id = 0; pl_id < 4; pl_id++ )
         {
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 0);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 1);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 2);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, 3);
           pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + 
             (signed __int64)((double)((300 * amount * spell_level + 60) << 7) * 0.033333335), skill_level, spell_level + 5, 0, 0);
           if ( pParty->pPlayers[pl_id].pConditions[Condition_Weak] )
@@ -2812,7 +2812,7 @@
             pParty->pPlayers[pl_id].pConditions[buff_id] = 0;
           pParty->pPlayers[pl_id].sHealth = pParty->pPlayers[pl_id].GetMaxHealth();
           pParty->pPlayers[pl_id].sMana = pParty->pPlayers[pl_id].GetMaxMana();
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
         }
         if ( pPlayer->sAgeModifier + 10 >= 120 )
           pPlayer->sAgeModifier = 120;
@@ -2838,7 +2838,7 @@
           break;
         if (!pCastSpell->spell_target_pid)
         {
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
           if ( pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[Condition_Dead] )
           {
             pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(Condition_Zombie, 1);
@@ -3111,7 +3111,7 @@
           break;
         if ( skill_level != 3 && skill_level != 4 )
         {
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pCastSpell->uPlayerID_2);
           pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + 
                                (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0);
           spell_sound_flag = true;
@@ -3119,7 +3119,7 @@
         }
         for ( uint pl_id = 0; pl_id < 4; pl_id++ )
         {
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_id);
           pParty->pPlayers[pl_id].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + 
                             (signed int)(signed __int64)((double)(signed int)((int)duration << 7) * 0.033333335), skill_level, amount, 0, 0);
         }
@@ -3130,8 +3130,8 @@
       {
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           break;
-        pGame->GetIndoorCamera();
-        int mon_num = pRenderer->_46À6ÀÑ_GetActorsInViewport((signed __int64)pGame->pIndoorCameraD3D->GetPickDepth());
+        pEngine->GetIndoorCamera();
+        int mon_num = pRenderer->_46À6ÀÑ_GetActorsInViewport((signed __int64)pEngine->pIndoorCameraD3D->GetPickDepth());
         v707.x = 0;
         v707.y = 0;
         v707.z = 0;
@@ -3177,9 +3177,9 @@
           pPlayers[pl_array[j]]->sHealth += (signed __int64)((double)(signed int)amount / (double)pl_num);
           if ( pPlayers[pl_array[j]]->sHealth > pPlayers[pl_array[j]]->GetMaxHealth())
             pPlayers[pl_array[j]]->sHealth = pPlayers[pl_array[j]]->GetMaxHealth();
-          pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_array[j]);
+          pEngine->GetStru6()->SetPlayerBuffAnim(pCastSpell->uSpellID, pl_array[j]);
         }
-        pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 64);
+        pEngine->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 64);
         spell_sound_flag = true;
         break;
       }