# HG changeset patch # User Ritor1 # Date 1367399863 -21600 # Node ID 6dd1766051cf7d0ad9808e0cc36d5d5d8e92770c # Parent 88e15900c9820bbde86128f7777a980aa1e3fd99# Parent 055ac998c606e673f8ccf6c56080b1e5494d164c Слияние diff -r 055ac998c606 -r 6dd1766051cf Actor.cpp --- a/Actor.cpp Wed May 01 12:04:02 2013 +0200 +++ b/Actor.cpp Wed May 01 15:17:43 2013 +0600 @@ -14,7 +14,7 @@ #include "FactionTable.h" #include "TurnEngine.h" #include "MapInfo.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Time.h" #include "LOD.h" #include "Party.h" @@ -581,7 +581,7 @@ v10 = v105; LABEL_29: spellnuma = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; - a1.uType = stru_4E3ACC[15].field_0; + a1.uType = stru_4E3ACC[15].uType; v118 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v10 - 1); v11 = 0; if ( (signed int)pObjectList->uNumObjects <= 0 ) @@ -592,7 +592,7 @@ else { v12 = &pObjectList->pObjects->uObjectID; - while ( stru_4E3ACC[15].field_0 != *v12 ) + while ( stru_4E3ACC[15].uType != *v12 ) { ++v11; v12 += 28; @@ -660,7 +660,7 @@ return; } LABEL_159: - a1.uType = stru_4E3ACC[spellnum].field_0; + a1.uType = stru_4E3ACC[spellnum].uType; v119 = 0.0; if ( (signed int)pObjectList->uNumObjects <= 0 ) { @@ -806,7 +806,7 @@ pitch = stru_5C6E00->Atan2(v31, (signed __int64)spellnumc); } a1.stru_24.Reset(); - a1.uType = stru_4E3ACC[9].field_0; + a1.uType = stru_4E3ACC[9].uType; spellnumd = 0; if ( (signed int)pObjectList->uNumObjects <= 0 ) { @@ -1350,7 +1350,7 @@ v70 = v108; LABEL_179: spellnume = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; - a1.uType = stru_4E3ACC[SPELL_DARK_SHARPMETAL].field_0; + a1.uType = stru_4E3ACC[SPELL_DARK_SHARPMETAL].uType; v116 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360 / (v70 - 1); v71 = 0; if ( (signed int)pObjectList->uNumObjects <= 0 ) @@ -1361,7 +1361,7 @@ else { v72 = &pObjectList->pObjects->uObjectID; - while ( stru_4E3ACC[SPELL_DARK_SHARPMETAL].field_0 != *v72 ) + while ( stru_4E3ACC[SPELL_DARK_SHARPMETAL].uType != *v72 ) { ++v71; v72 += 28; @@ -2446,7 +2446,7 @@ result = pPlayer->CanAct(); if ( result ) { - pStru277->_427D48(v1); + pCastSpellInfo->_427D48(v1); v4 = 0; v5 = pMapStats->GetMapInfo(pCurrentMapName); if ( v5 ) diff -r 055ac998c606 -r 6dd1766051cf Player.cpp --- a/Player.cpp Wed May 01 12:04:02 2013 +0200 +++ b/Player.cpp Wed May 01 15:17:43 2013 +0600 @@ -6594,6 +6594,7 @@ spellbook.pBodySpellbook.bIsSpellAvailable[8] = true; spellbook.pBodySpellbook.bIsSpellAvailable[9] = true; spellbook.pBodySpellbook.bIsSpellAvailable[10] = true; + spellbook.pMindSpellbook.bIsSpellAvailable[0] = true; spellbook.pMindSpellbook.bIsSpellAvailable[1] = true; spellbook.pMindSpellbook.bIsSpellAvailable[2] = true; spellbook.pMindSpellbook.bIsSpellAvailable[3] = true; @@ -6604,6 +6605,7 @@ spellbook.pMindSpellbook.bIsSpellAvailable[8] = true; spellbook.pMindSpellbook.bIsSpellAvailable[9] = true; spellbook.pMindSpellbook.bIsSpellAvailable[10] = true; + spellbook.pSpiritSpellbook.bIsSpellAvailable[0] = true; spellbook.pSpiritSpellbook.bIsSpellAvailable[1] = true; spellbook.pSpiritSpellbook.bIsSpellAvailable[2] = true; spellbook.pSpiritSpellbook.bIsSpellAvailable[3] = true; diff -r 055ac998c606 -r 6dd1766051cf Spells.h --- a/Spells.h Wed May 01 12:04:02 2013 +0200 +++ b/Spells.h Wed May 01 15:17:43 2013 +0600 @@ -208,7 +208,7 @@ #pragma pack(push, 1) struct stru324_spell { - __int16 field_0; + __int16 uType; __int16 field_2; }; #pragma pack(pop) diff -r 055ac998c606 -r 6dd1766051cf UIBooks.cpp --- a/UIBooks.cpp Wed May 01 12:04:02 2013 +0200 +++ b/UIBooks.cpp Wed May 01 15:17:43 2013 +0600 @@ -35,7 +35,7 @@ #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" diff -r 055ac998c606 -r 6dd1766051cf UICharacter.cpp --- a/UICharacter.cpp Wed May 01 12:04:02 2013 +0200 +++ b/UICharacter.cpp Wed May 01 15:17:43 2013 +0600 @@ -35,7 +35,7 @@ #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" diff -r 055ac998c606 -r 6dd1766051cf UIMainMenu.cpp --- a/UIMainMenu.cpp Wed May 01 12:04:02 2013 +0200 +++ b/UIMainMenu.cpp Wed May 01 15:17:43 2013 +0600 @@ -35,7 +35,7 @@ #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" diff -r 055ac998c606 -r 6dd1766051cf UIOptions.cpp --- a/UIOptions.cpp Wed May 01 12:04:02 2013 +0200 +++ b/UIOptions.cpp Wed May 01 15:17:43 2013 +0600 @@ -35,7 +35,7 @@ #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" diff -r 055ac998c606 -r 6dd1766051cf UIPartyCreation.cpp --- a/UIPartyCreation.cpp Wed May 01 12:04:02 2013 +0200 +++ b/UIPartyCreation.cpp Wed May 01 15:17:43 2013 +0600 @@ -35,7 +35,7 @@ #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" diff -r 055ac998c606 -r 6dd1766051cf UIPopup.cpp --- a/UIPopup.cpp Wed May 01 12:04:02 2013 +0200 +++ b/UIPopup.cpp Wed May 01 15:17:43 2013 +0600 @@ -35,7 +35,7 @@ #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" diff -r 055ac998c606 -r 6dd1766051cf UIRest.cpp --- a/UIRest.cpp Wed May 01 12:04:02 2013 +0200 +++ b/UIRest.cpp Wed May 01 15:17:43 2013 +0600 @@ -35,7 +35,7 @@ #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" diff -r 055ac998c606 -r 6dd1766051cf UISaveLoad.cpp --- a/UISaveLoad.cpp Wed May 01 12:04:02 2013 +0200 +++ b/UISaveLoad.cpp Wed May 01 15:17:43 2013 +0600 @@ -35,7 +35,7 @@ #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" diff -r 055ac998c606 -r 6dd1766051cf UiGame.cpp --- a/UiGame.cpp Wed May 01 12:04:02 2013 +0200 +++ b/UiGame.cpp Wed May 01 15:17:43 2013 +0600 @@ -36,7 +36,7 @@ #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" diff -r 055ac998c606 -r 6dd1766051cf mm7_1.cpp --- a/mm7_1.cpp Wed May 01 12:04:02 2013 +0200 +++ b/mm7_1.cpp Wed May 01 15:17:43 2013 +0600 @@ -41,7 +41,7 @@ #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" @@ -682,7 +682,7 @@ } //----- (004219BE) -------------------------------------------------------- -GUIWindow *stru277::sub_4219BE() +GUIWindow *CastSpellInfo::sub_4219BE() { int v1; // esi@1 GUIWindow *v2; // ebx@1 diff -r 055ac998c606 -r 6dd1766051cf mm7_2.cpp --- a/mm7_2.cpp Wed May 01 12:04:02 2013 +0200 +++ b/mm7_2.cpp Wed May 01 15:17:43 2013 +0600 @@ -43,7 +43,7 @@ #include "FactionTable.h" #include "StorylineTextTable.h" #include "Random.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "stru298.h" #include "stru12.h" #include "stru351.h" @@ -8002,7 +8002,7 @@ pEventTimer->Pause(); pMiscTimer->Pause(); pParty->uFlags = 2; - pStru277->_427D48(1); + pCastSpellInfo->_427D48(1); ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); DoPrepareWorld(0, (v1 == 0) + 1); pMiscTimer->Resume(); @@ -9224,7 +9224,7 @@ assert(sizeof(GUIFont) == 0x1020); assert(sizeof(stru262_TurnBased) == 0x40); assert(sizeof(ArcomageGame) == 0xFB); - assert(sizeof(stru277) == 0x14); + assert(sizeof(CastSpellInfo) == 0x14); assert(sizeof(ArcomageCard) == 0x6C); assert(sizeof(stru320) == 0x3FC); assert(sizeof(TravelInfo) == 0x20); diff -r 055ac998c606 -r 6dd1766051cf mm7_3.cpp --- a/mm7_3.cpp Wed May 01 12:04:02 2013 +0200 +++ b/mm7_3.cpp Wed May 01 15:17:43 2013 +0600 @@ -13718,7 +13718,7 @@ SpriteObject a1; // [sp+38h] [bp-7Ch]@12 //SpriteObject::SpriteObject(&a1); - a1.uType = stru_4E3ACC[spellnum].field_0; + a1.uType = stru_4E3ACC[spellnum].uType; if ( spellnum > 58 ) { if ( spellnum == 69 ) diff -r 055ac998c606 -r 6dd1766051cf mm7_4.cpp --- a/mm7_4.cpp Wed May 01 12:04:02 2013 +0200 +++ b/mm7_4.cpp Wed May 01 15:17:43 2013 +0600 @@ -43,7 +43,7 @@ #include "FactionTable.h" #include "StorylineTextTable.h" #include "Random.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "stru298.h" #include "stru12.h" #include "stru351.h" @@ -2103,7 +2103,7 @@ else { v11 = &pObjectList->pObjects->uObjectID; - while ( stru_4E3ACC[8].field_0 != *v11 ) + while ( stru_4E3ACC[8].uType != *v11 ) { ++v10; v11 += 28; diff -r 055ac998c606 -r 6dd1766051cf mm7_5.cpp --- a/mm7_5.cpp Wed May 01 12:04:02 2013 +0200 +++ b/mm7_5.cpp Wed May 01 15:17:43 2013 +0600 @@ -34,7 +34,7 @@ #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" @@ -1657,7 +1657,7 @@ { pParty->field_6E4 = 0; pParty->field_6E0 = 0; - pStru277->_427D48(v0); + pCastSpellInfo->_427D48(v0); sub_44603D(); pEventTimer->Pause(); pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); @@ -3309,7 +3309,7 @@ } } } - pStru277->_427E01_cast_spell(); + pCastSpellInfo->_427E01_cast_spell(); } //----- (004356FF) -------------------------------------------------------- diff -r 055ac998c606 -r 6dd1766051cf mm7_6.cpp --- a/mm7_6.cpp Wed May 01 12:04:02 2013 +0200 +++ b/mm7_6.cpp Wed May 01 15:17:43 2013 +0600 @@ -33,7 +33,7 @@ #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" -#include "stru277.h" +#include "CastSpellInfo.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" @@ -1186,7 +1186,6 @@ LOWORD(v2) = (a1 >> 5) & 0x7E0; return ((unsigned __int8)a1 >> 3) | v2 | v1; } - //----- (00426947) -------------------------------------------------------- void __cdecl sub_426947() { @@ -2251,19 +2250,19 @@ if (a5 & 0x3CA) { - assert(sizeof(pStru277) / sizeof(*pStru277) == 10); + assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); for (uint i = 0; i < 10; ++i) - if (pStru277[i].field_8 & 0x3CA) + if (pCastSpellInfo[i].field_8 & 0x3CA) { - pStru277[i].spellnum = 0; + pCastSpellInfo[i].spellnum = 0; break; } } - assert(sizeof(pStru277) / sizeof(*pStru277) == 10); + assert(sizeof(pCastSpellInfo) / sizeof(*pCastSpellInfo) == 10); for (uint i = 0; i < 10; ++i) { - auto spell = pStru277 + i; + auto spell = pCastSpellInfo + i; if (!spell->spellnum) continue; @@ -2279,14 +2278,14 @@ } } - int result = pStru277->PushStru277(a1, uPlayerID, a4, a5, a6); + int result = pCastSpellInfo->PushCastSpellInfo(a1, uPlayerID, a4, a5, a6); if ( result != -1 ) { if ( a5 & 2 ) { if ( pGUIWindow_Settings ) return; - pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); + pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 0, 0x31u, "", 0); pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 1u, 0x32u, "", 0); pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_45, 2u, 0x33u, "", 0); @@ -2299,7 +2298,7 @@ if ( pGUIWindow_Settings ) return; - pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); + pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_46, 0, 0, "", 0); sub_421B2C_PlaceInInventory_or_DropPickedItem(); return; @@ -2309,7 +2308,7 @@ if ( pGUIWindow_Settings ) return; - pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); + pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_BE, 0, 0, "", 0); sub_421B2C_PlaceInInventory_or_DropPickedItem(); return; @@ -2321,7 +2320,7 @@ ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pGUIWindow_Settings = pStru277[result].sub_4219BE(); + pGUIWindow_Settings = pCastSpellInfo[result].sub_4219BE(); unk_50C9A0 = 1; some_active_character = uActiveCharacter; sub_421B2C_PlaceInInventory_or_DropPickedItem(); @@ -2331,7 +2330,7 @@ { if ( pGUIWindow_Settings ) return; - pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); + pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 0, 0x31u, "", 0); pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 1, 0x32u, "", 0); pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_8D, 2, 0x33u, "", 0); @@ -2341,7 +2340,7 @@ } if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) { - pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pStru277[result], 0); + pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|0x2), (int)&pCastSpellInfo[result], 0); pBtn_NPCLeft = pGUIWindow_Settings->CreateButton(469, 178, pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureWidth, pIcons_LOD->GetTexture(uTextureID_Btn_NPCLeft)->uTextureHeight, @@ -2367,9 +2366,9 @@ } //----- (00427D48) -------------------------------------------------------- -void stru277::_427D48(unsigned int uPlayerID) +void CastSpellInfo::_427D48(unsigned int uPlayerID) { - stru277 *v2; // esi@1 + CastSpellInfo *v2; // esi@1 signed int v3; // ebx@1 v2 = this; @@ -2396,11 +2395,11 @@ } //----- (00427DA0) -------------------------------------------------------- -unsigned int stru277::PushStru277(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) +unsigned int CastSpellInfo::PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int spell_sound_id) { unsigned int result; // eax@1 - stru277 *v7; // edx@1 - stru277 *v8; // ecx@5 + CastSpellInfo *v7; // edx@1 + CastSpellInfo *v8; // ecx@5 result = 0; v7 = this; @@ -2428,11 +2427,11 @@ } //----- (00427E01) -------------------------------------------------------- -void stru277::_427E01_cast_spell() +void CastSpellInfo::_427E01_cast_spell() { //int v1; // esi@1 int v2; // edi@1 - stru277 *v3; // ebx@2 + CastSpellInfo *pCastSpell; // ebx@2 //signed int v4; // eax@8 //__int16 v5; // ax@9 signed int v6; // eax@14 @@ -3140,7 +3139,7 @@ //int v708; // [sp+D84h] [bp-100h]@1127 //int v709; // [sp+D88h] [bp-FCh]@1127 char v710; // [sp+D8Ch] [bp-F8h]@1156 - stru277 *v711; // [sp+D90h] [bp-F4h]@1 + //stru277 *v711; // [sp+D90h] [bp-F4h]@1 __int64 v712; // [sp+D94h] [bp-F0h]@991 int v713; // [sp+D9Ch] [bp-E8h]@324 int n; // [sp+DA0h] [bp-E4h]@1 @@ -3169,11 +3168,11 @@ signed int a2; // [sp+E7Ch] [bp-8h]@14 int amount; // [sp+E80h] [bp-4h]@1 - auto ecx0 = this; - - v711 = ecx0; - - SpriteObject a1; // [sp+DDCh] [bp-A8h]@1 + //auto ecx0 = this; + + //v711 = ecx0; + + SpriteObject pSpellSprite; // [sp+DDCh] [bp-A8h]@1 //SpriteObject::SpriteObject(&a1); //v1 = 0; @@ -3186,28 +3185,28 @@ //while ( 1 ) for(n = 0; n < 10; ++n) { - v3 = &v711[n]; - HIDWORD(v733) = (int)v3; - if ( v3->spellnum == 0 ) + pCastSpell = &this[n]; + HIDWORD(v733) = (int)pCastSpell; + if ( pCastSpell->spellnum == 0 ) continue; if (pParty->Invisible()) pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); - if ( v3->field_8 & 0x3CA ) + if ( pCastSpell->field_8 & 0x3CA ) { - if ( !pParty->pPlayers[v3->uPlayerID].CanAct() ) - v711->_427D48(1u); + if ( !pParty->pPlayers[pCastSpell->uPlayerID].CanAct() ) + this->_427D48(1); continue; } - pPlayer = &pParty->pPlayers[v3->uPlayerID]; - - a2 = v3->spell_target_pid; - if (!a2) + pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; + + a2 = pCastSpell->spell_target_pid; + if (!pCastSpell->spell_target_pid) { - if (v3->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || - v3->spellnum == SPELL_SPIRIT_TURN_UNDEAD || - v3->spellnum == SPELL_DARK_CONTROL_UNDEAD ) + if (pCastSpell->spellnum == SPELL_LIGHT_DESTROY_UNDEAD || + pCastSpell->spellnum == SPELL_SPIRIT_TURN_UNDEAD || + pCastSpell->spellnum == SPELL_DARK_CONTROL_UNDEAD ) v666 = 1; else v666 = 0; @@ -3219,12 +3218,12 @@ } - a1.uType = stru_4E3ACC[v3->spellnum].field_0; - if (a1.uType) + pSpellSprite.uType = stru_4E3ACC[pCastSpell->spellnum].uType; + if (pSpellSprite.uType) { if (PID_TYPE(a2) == OBJECT_Actor) { - memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, v3->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); + memcpy(&v715, Actor::GetDirectionInfo(PID(OBJECT_Player, pCastSpell->uPlayerID + 1), a2, &a3, 0), sizeof(v715)); v2 = v723; } else @@ -3236,34 +3235,34 @@ LODWORD(v725) = 0; _this = 0; - if (v3->forced_spell_skill_level) + if (pCastSpell->forced_spell_skill_level) { - v11 = v3->forced_spell_skill_level; + v11 = pCastSpell->forced_spell_skill_level; v723 = v11 & 0x3F; v2 = v723; } else { //v667 = PLAYER_SKILL_STAFF; - if (v3->spellnum < SPELL_AIR_WIZARD_EYE) + if (pCastSpell->spellnum < SPELL_AIR_WIZARD_EYE) v667 = PLAYER_SKILL_FIRE; - else if (v3->spellnum < SPELL_WATER_AWAKEN) + else if (pCastSpell->spellnum < SPELL_WATER_AWAKEN) v667 = PLAYER_SKILL_AIR; - else if (v3->spellnum < SPELL_EARTH_STUN) + else if (pCastSpell->spellnum < SPELL_EARTH_STUN) v667 = PLAYER_SKILL_WATER; - else if (v3->spellnum < SPELL_SPIRIT_DETECT_LIFE) + else if (pCastSpell->spellnum < SPELL_SPIRIT_DETECT_LIFE) v667 = PLAYER_SKILL_EARTH; - else if (v3->spellnum < SPELL_MIND_REMOVE_FEAR) + else if (pCastSpell->spellnum < SPELL_MIND_REMOVE_FEAR) v667 = PLAYER_SKILL_SPIRIT; - else if (v3->spellnum < SPELL_BODY_CURE_WEAKNESS) + else if (pCastSpell->spellnum < SPELL_BODY_CURE_WEAKNESS) v667 = PLAYER_SKILL_MIND; - else if (v3->spellnum < SPELL_LIGHT_LIGHT_BOLT) + else if (pCastSpell->spellnum < SPELL_LIGHT_LIGHT_BOLT) v667 = PLAYER_SKILL_BODY; - else if (v3->spellnum < SPELL_DARK_REANIMATE) + else if (pCastSpell->spellnum < SPELL_DARK_REANIMATE) v667 = PLAYER_SKILL_LIGHT; - else if (v3->spellnum < SPELL_BOW_ARROW) + else if (pCastSpell->spellnum < SPELL_BOW_ARROW) v667 = PLAYER_SKILL_DARK; - else if (v3->spellnum == SPELL_BOW_ARROW) + else if (pCastSpell->spellnum == SPELL_BOW_ARROW) v667 = PLAYER_SKILL_BOW; else assert(false && "Unknown spell"); @@ -3289,136 +3288,125 @@ } } - if (v3->forced_spell_skill_level) + if (pCastSpell->forced_spell_skill_level) uRequiredMana = 0; else - uRequiredMana = pSpellDatas[v3->spellnum].mana_per_skill[v731 - 1]; - sRecoveryTime = pSpellDatas[v3->spellnum].recovery_per_skill[v731 - 1]; + uRequiredMana = pSpellDatas[pCastSpell->spellnum].mana_per_skill[v731 - 1]; + sRecoveryTime = pSpellDatas[pCastSpell->spellnum].recovery_per_skill[v731 - 1]; if (LODWORD(v725) == PLAYER_SKILL_DARK && pParty->uCurrentHour == 0 && pParty->uCurrentMinute == 0 || LODWORD(v725) == PLAYER_SKILL_LIGHT && pParty->uCurrentHour == 12 && pParty->uCurrentMinute == 0) uRequiredMana = 0; - if (v3->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" - v3->spellnum = 0; - continue; - } - v730 = v3->spellnum; - if (pPlayer->Cursed() && v3->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) - { - if (!pParty->bTurnBasedModeOn) - { - //v646 = pPlayer; - pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); - //v647 = n; - } - else - { - //v647 = n; - //v646 = pPlayer; - //v648 = sRecoveryTime; - //v649 = pPlayer; - pParty->pTurnBasedPlayerRecoveryTimes[v711[n].uPlayerID] = 100; - pPlayer->SetRecoveryTime(sRecoveryTime); - pTurnEngine->_40471C(); - } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v711[n].spellnum = 0; - pPlayer->sMana -= uRequiredMana; - return; - } - - switch ( v3->spellnum ) - { - case SPELL_101: - assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); - case SPELL_BOW_ARROW: - { - v17 = pPlayer; - _this = (ItemGen *)1; - if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) - _this = (ItemGen *)2; - sRecoveryTime = v17->GetAttackRecoveryTime(true); - a1.stru_24.Reset(); - a1.spell_level = v2; - a1.spell_id = v3->spellnum; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - if ( v17->WearsItem(510, 2) ) - a1.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); - a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.y = pParty->vPosition.y; - a1.uAttributes = 0; - a1.uSpriteFrameID = 0; - a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - a1.uFacing = LOWORD(v715.uYawAngle); - a1.uSoundID = LOWORD(v3->sound_id); - v20 = &pParty->pPlayers[v3->uPlayerID]; - memcpy(&a1.stru_24, &v20[v20->pEquipment.uBow], sizeof(a1.stru_24)); - a1.uAttributes = 256; + if (pCastSpell->spellnum < SPELL_BOW_ARROW && pPlayer->sMana < uRequiredMana) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[586], 2u); // "Not enough spell points" + pCastSpell->spellnum = 0; + continue; + } + v730 = pCastSpell->spellnum; + if (pPlayer->Cursed() && pCastSpell->spellnum < SPELL_BOW_ARROW && rand() % 100 < 50) + { + if (!pParty->bTurnBasedModeOn) + { + //v646 = pPlayer; + pPlayer->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * 213.3333333333333)); + //v647 = n; + } + else + { + //v647 = n; + //v646 = pPlayer; + //v648 = sRecoveryTime; + //v649 = pPlayer; + pParty->pTurnBasedPlayerRecoveryTimes[this[n].uPlayerID] = 100; + pPlayer->SetRecoveryTime(sRecoveryTime); + pTurnEngine->_40471C(); + } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); // "Spell failed" + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + this[n].spellnum = 0; + pPlayer->sMana -= uRequiredMana; + return; + } + + switch ( pCastSpell->spellnum ) + { + case SPELL_101: + assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); + case SPELL_BOW_ARROW: + { + v17 = pPlayer; + _this = (ItemGen *)1; + if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) + _this = (ItemGen *)2; + sRecoveryTime = v17->GetAttackRecoveryTime(true); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_level = v2; + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + if ( v17->WearsItem(510, 2) ) + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.vPosition.y = pParty->vPosition.y; + pSpellSprite.uAttributes = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + v20 = &pParty->pPlayers[pCastSpell->uPlayerID]; + memcpy(&pSpellSprite.stru_24, &v20[v20->pEquipment.uBow], sizeof(pSpellSprite.stru_24)); + pSpellSprite.uAttributes = 256; + if ( pParty->bTurnBasedModeOn == 1 ) + pSpellSprite.uAttributes = 260; + for ( i = 0; i < (signed int)_this; ++i ) + { + if ( i ) + pSpellSprite.vPosition.z += 32; + pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); + if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, + pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) + ++pTurnEngine->field_1C; + } + break; + } + case SPELL_LASER_PROJECTILE: + { + sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v723; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.vPosition.y = pParty->vPosition.y; + pSpellSprite.uAttributes = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + memcpy(&pSpellSprite.stru_24, + &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 + * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], sizeof(pSpellSprite.stru_24)); + v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); + HIBYTE(pSpellSprite.uAttributes) |= 1u; + pSpellSprite.uSectorID = v23; if ( pParty->bTurnBasedModeOn == 1 ) - a1.uAttributes = 260; - for ( i = 0; i < (signed int)_this; ++i ) - { - if ( i ) - a1.vPosition.z += 32; - a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); - if ( a1.Create( - v715.uYawAngle, - v715.uPitchAngle, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - v3->uPlayerID + 1) != -1 - && pParty->bTurnBasedModeOn == 1 ) + LOBYTE(pSpellSprite.uAttributes) |= 4u; + if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, + pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->field_1C; - } - break; - } - case SPELL_LASER_PROJECTILE: - { - sRecoveryTime = pPlayer->GetAttackRecoveryTime(0); - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v723; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.y = pParty->vPosition.y; - a1.uAttributes = 0; - a1.uSpriteFrameID = 0; - a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - a1.uFacing = LOWORD(v715.uYawAngle); - a1.uSoundID = LOWORD(v3->sound_id); - memcpy( - &a1.stru_24, - &pParty->pPlayers[v3->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 - * pParty->pPlayers[v3->uPlayerID].pEquipment.uMainHand - + 5], - sizeof(a1.stru_24)); - v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, a1.vPosition.z); - HIBYTE(a1.uAttributes) |= 1u; - a1.uSectorID = v23; - if ( pParty->bTurnBasedModeOn == 1 ) - LOBYTE(a1.uAttributes) |= 4u; - if ( a1.Create( - v715.uYawAngle, - v715.uPitchAngle, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - v3->uPlayerID + 1) != -1 - && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; - break; - } - case SPELL_FIRE_TORCH_LIGHT: - { + break; + } + case SPELL_FIRE_TORCH_LIGHT: + { LODWORD(v733) = 3600 * v2; switch (v731) @@ -3430,16 +3418,14 @@ default: assert(false); } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)3600 * v2 * 4.2666669), v731, amount, 0, 0); LODWORD(v727) = 1; break; - } - case SPELL_FIRE_FIRE_SPIKE: - { + } + case SPELL_FIRE_FIRE_SPIKE: + { v29 = v731 - 2; if ( v29 ) { @@ -3469,7 +3455,7 @@ for (uint i = 0; i < uNumSpriteObjects; ++i) { auto object = pSpriteObjects + i; - if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, v3->uPlayerID)) + if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) ++_v733; /*v33 = (char *)&pSpriteObjects[0].field_48; v730 = uNumSpriteObjects; @@ -3486,49 +3472,44 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.vPosition.y = pParty->vPosition.y; - a1.vPosition.x = pParty->vPosition.x; - a1.uAttributes = 0; - a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; - a1.uSectorID = pIndoor->GetSector( - pParty->vPosition.x, - pParty->vPosition.y, - pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); - a1.uSpriteFrameID = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - a1.uFacing = LOWORD(v715.uYawAngle); - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.y = pParty->vPosition.y; + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); if ( pParty->bTurnBasedModeOn == 1 ) - LOBYTE(a1.uAttributes) |= 4u; - v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; - if ( a1.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) + LOBYTE(pSpellSprite.uAttributes) |= 4u; + v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; + if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX + 10, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->field_1C; LODWORD(v727) = 1; break; - } - - case SPELL_AIR_IMPLOSION: - { + } + case SPELL_AIR_IMPLOSION: + { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; if (!a2) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if (PID_TYPE(a2) != OBJECT_Actor) @@ -3539,33 +3520,31 @@ v697.x = 0; v697.y = 0; v697.z = 0; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.uAttributes = 0; - a1.uSectorID = 0; - a1.uSpriteFrameID = 0; - a1.field_60_distance_related_prolly_lod = 0; - a1.uFacing = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.uSoundID = LOWORD(v3->sound_id); - a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; - a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; - a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; - a1.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); - auto obj_id = a1.Create(0, 0, 0, 0); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; + pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; + pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, PID_ID(a2)); + auto obj_id = pSpellSprite.Create(0, 0, 0, 0); DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v697); LODWORD(v727) = 1; break; - } - - case SPELL_EARTH_MASS_DISTORTION: - { + } + case SPELL_EARTH_MASS_DISTORTION: + { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 3u) ) { LODWORD(v727) = 1; @@ -3575,32 +3554,29 @@ v704.x = 0; v704.y = 0; v704.z = 0; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.uAttributes = 0; - a1.uSectorID = 0; - a1.uSpriteFrameID = 0; - a1.field_60_distance_related_prolly_lod = 0; - a1.uFacing = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.uSoundID = LOWORD(v3->sound_id); - a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; - a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; - a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; - a1.spell_target_pid = PID(OBJECT_Actor, (int)v726); - - auto obj_id = a1.Create(0, 0, 0, 0); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; + pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; + pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v726); + auto obj_id = pSpellSprite.Create(0, 0, 0, 0); DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v704); - LODWORD(v727) = 1; break; - } - - case SPELL_LIGHT_DESTROY_UNDEAD: - { + } + case SPELL_LIGHT_DESTROY_UNDEAD: + { if ( !pPlayer->CanCastSpell(uRequiredMana) || !a2 || PID_TYPE(a2) != OBJECT_Actor) break; //v730 = a2 >> 3; @@ -3608,128 +3584,129 @@ v691.x = 0; v691.y = 0; v691.z = 0; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.vPosition.x = pActors[PID_ID(a2)].vPosition.x; - a1.vPosition.y = pActors[PID_ID(a2)].vPosition.y; - a1.vPosition.z = pActors[PID_ID(a2)].vPosition.z; - a1.uAttributes = 0; - a1.uSectorID = pIndoor->GetSector(a1.vPosition.x, a1.vPosition.y, a1.vPosition.z); - a1.uSpriteFrameID = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - a1.uFacing = LOWORD(v715.uYawAngle); - a1.uAttributes |= 0x80u; - a1.uSoundID = LOWORD(v3->sound_id); - - auto obj_id = a1.Create(0, 0, 0, 0); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = pActors[PID_ID(a2)].vPosition.x; + pSpellSprite.vPosition.y = pActors[PID_ID(a2)].vPosition.y; + pSpellSprite.vPosition.z = pActors[PID_ID(a2)].vPosition.z; + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = pIndoor->GetSector(pSpellSprite.vPosition.x, pSpellSprite.vPosition.y, pSpellSprite.vPosition.z); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + pSpellSprite.uAttributes |= 0x80u; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + auto obj_id = pSpellSprite.Create(0, 0, 0, 0); if ( !MonsterStats::BelongsToSupertype(*(short *)(HIDWORD(v733) + 96), MONSTER_SUPERTYPE_UNDEAD) ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } DamageMonsterFromParty(PID(OBJECT_Item, obj_id), PID_ID(a2), &v691); LODWORD(v727) = 1; break; - } - - - case SPELL_FIRE_FIRE_BOLT: - case SPELL_FIRE_FIREBALL: - case SPELL_FIRE_INCINERATE: - case SPELL_AIR_LIGHNING_BOLT: - case SPELL_WATER_ICE_BOLT: - case SPELL_WATER_ICE_BLAST: - case SPELL_EARTH_STUN: - case SPELL_EARTH_DEADLY_SWARM: - case SPELL_MIND_MIND_BLAST: - case SPELL_MIND_PSYCHIC_SHOCK: - case SPELL_BODY_HARM: - case SPELL_LIGHT_LIGHT_BOLT: - case SPELL_DARK_DRAGON_BREATH: - { + } + case SPELL_FIRE_FIRE_BOLT: + case SPELL_FIRE_FIREBALL: + case SPELL_FIRE_INCINERATE: + case SPELL_AIR_LIGHNING_BOLT: + case SPELL_WATER_ICE_BOLT: + case SPELL_WATER_ICE_BLAST: + case SPELL_EARTH_STUN: + case SPELL_EARTH_DEADLY_SWARM: + case SPELL_MIND_MIND_BLAST: + case SPELL_MIND_PSYCHIC_SHOCK: + case SPELL_BODY_HARM: + case SPELL_LIGHT_LIGHT_BOLT: + case SPELL_DARK_DRAGON_BREATH: + { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.vPosition.y = pParty->vPosition.y; - a1.vPosition.x = pParty->vPosition.x; - a1.uAttributes = 0; - a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.y = pParty->vPosition.y; + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; if (uCurrentlyLoadedLevelType == LEVEL_Indoor) - a1.uSectorID = pIndoor->GetSector(pParty->vPosition.x, - pParty->vPosition.y, - pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); - else a1.uSectorID = 0; - - a1.uSpriteFrameID = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - a1.uFacing = LOWORD(v715.uYawAngle); - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); + else + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); if ( pParty->bTurnBasedModeOn == 1 ) - LOBYTE(a1.uAttributes) |= 4u; - if ( v3->spellnum == SPELL_AIR_LIGHNING_BOLT ) - LOBYTE(a1.uAttributes) |= 0x40u; - - v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; - if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) + LOBYTE(pSpellSprite.uAttributes) |= 4u; + if ( pCastSpell->spellnum == SPELL_AIR_LIGHNING_BOLT ) + LOBYTE(pSpellSprite.uAttributes) |= 0x40u; + v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; + if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->field_1C; LODWORD(v727) = 1; break; - } - case SPELL_WATER_ACID_BURST: - case SPELL_EARTH_BLADES: - case SPELL_BODY_FLYING_FIST: - case SPELL_DARK_TOXIC_CLOUD: - { + } + case SPELL_WATER_ACID_BURST: + case SPELL_EARTH_BLADES: + case SPELL_BODY_FLYING_FIST: + case SPELL_DARK_TOXIC_CLOUD: + { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; - a1.vPosition.y = pParty->vPosition.y; + pSpellSprite.vPosition.y = pParty->vPosition.y; v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; v660 = pParty->vPosition.y; goto LABEL_153; - } - case SPELL_LIGHT_SUNRAY: - { + } + case SPELL_LIGHT_SUNRAY: + { if ( uCurrentlyLoadedLevelType == LEVEL_Indoor || uCurrentlyLoadedLevelType == LEVEL_Outdoor && (pParty->uCurrentHour < 5 || pParty->uCurrentHour >= 0x15) ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( pPlayer->CanCastSpell(uRequiredMana) ) - goto LABEL_152; - break; - } - - case SPELL_LIGHT_PARALYZE: - { + { + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_skill = v731; + pSpellSprite.spell_level = v2; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.y = pParty->vPosition.y; + v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + v660 = pParty->vPosition.y; + goto LABEL_153; + } + break; + } + case SPELL_LIGHT_PARALYZE: + { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - - if (PID_TYPE(a2) != OBJECT_Actor || - (v730 = PID_ID(a2), - v721 = (int)&pActors[PID_ID(a2)], - !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9u)) ) + if (PID_TYPE(a2) != OBJECT_Actor || (v730 = PID_ID(a2), v721 = (int)&pActors[PID_ID(a2)], + !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 9)) ) { LODWORD(v727) = 1; break; @@ -3744,10 +3721,9 @@ *(short *)(v55 + 150) = 0; v661 = (Actor *)v55; goto LABEL_165; - } - - case SPELL_EARTH_SLOW: - { + } + case SPELL_EARTH_SLOW: + { if ( v731 == 2 ) { v57 = 300 * v2; @@ -3793,10 +3769,9 @@ v672 = 0; v661 = (Actor *)LODWORD(v718); goto LABEL_165; - } - - case SPELL_MIND_CHARM: - { + } + case SPELL_MIND_CHARM: + { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; @@ -3821,50 +3796,49 @@ //((SpellBuff *)((char *)&pActors[0].pActorBuffs[1] + v730))->Apply( pActors[PID_ID(a2)].pActorBuffs[1].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)(power << 7) * 0.033333335), v731, 0, 0, 0); - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - v60 = pObjectList->ObjectIDByItemID(a1.uType); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); v61 = PID_ID(a2); goto LABEL_1086; - } - - case SPELL_DARK_SHRINKING_RAY: - { + } + case SPELL_DARK_SHRINKING_RAY: + { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - a1.stru_24.Reset(); - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.y = pParty->vPosition.y; - a1.uAttributes = 0; - a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; - a1.uSectorID = pIndoor->GetSector( + pSpellSprite.stru_24.Reset(); + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.vPosition.y = pParty->vPosition.y; + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + pSpellSprite.uSectorID = pIndoor->GetSector( pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); - a1.uSpriteFrameID = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - a1.uFacing = LOWORD(v715.uYawAngle); - a1.uSoundID = LOWORD(v3->sound_id); - a1.spell_skill = v731; - a1.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; - a1.spell_level = 300 * v2; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.spell_skill = v731; + pSpellSprite.spell_id = SPELL_FIRE_PROTECTION_FROM_FIRE; + pSpellSprite.spell_level = 300 * v2; if ( pParty->bTurnBasedModeOn == 1 ) - LOBYTE(a1.uAttributes) |= 4u; - - v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; - - if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) + LOBYTE(pSpellSprite.uAttributes) |= 4u; + + v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; + + if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->field_1C; LODWORD(v727) = 1; break; - } - case SPELL_FIRE_FIRE_AURA: - { + } + case SPELL_FIRE_FIRE_AURA: + { v63 = v731 - 1; if ( !v63 ) { @@ -3898,7 +3872,7 @@ LABEL_196: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v730c = &pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; + v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; auto _itm = &pItemsTable->pItems[v730c->uItemID]; v730c->UpdateTempBonus(pParty->uTimePlayed); if ( v730c->uItemID < 64 || v730c->uItemID > 65 @@ -3930,12 +3904,11 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; - } - - case SPELL_BODY_REGENERATION: - { + } + case SPELL_BODY_REGENERATION: + { v70 = v731 - 1; LODWORD(v733) = 3600 * v2; if ( v70 && (v71 = v70 - 1) != 0 ) @@ -3958,90 +3931,87 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); - - pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); + + pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_REGENERATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)v733 * 4.2666669), v731, amount, 0, 0); LODWORD(v727) = 1; break; - } - - case SPELL_FIRE_PROTECTION_FROM_FIRE: - case SPELL_AIR_PROTECTION_FROM_AIR: - case SPELL_WATER_PROTECTION_FROM_WATER: - case SPELL_EARTH_PROTECTION_FROM_EARTH: - case SPELL_MIND_PROTECTION_FROM_MIND: - case SPELL_BODY_PROTECTION_FROM_BODY: - { - v76 = v731 - 1; - LODWORD(v733) = 3600 * v2; - if ( v76 ) - { - v77 = v76 - 1; - if ( v77 ) - { - v78 = v77 - 1; - if ( v78 ) - { - if ( v78 != 1 ) - goto LABEL_232; - v79 = 4 * v2; - } - else - { - v79 = 3 * v2; - } - } - else - { - v79 = 2 * v2; - } - amount = v79; - } - else - { - amount = v2; - } - LABEL_232: - //v80 = v3->spellnum; - switch (v3->spellnum) - { - case SPELL_FIRE_PROTECTION_FROM_FIRE: - LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; - break; - case SPELL_AIR_PROTECTION_FROM_AIR: - LODWORD(v725) = PARTY_BUFF_RESIST_AIR; - break; - case SPELL_WATER_PROTECTION_FROM_WATER: - LODWORD(v725) = PARTY_BUFF_RESIST_WATER; - break; - case SPELL_EARTH_PROTECTION_FROM_EARTH: - LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; - break; - case SPELL_MIND_PROTECTION_FROM_MIND: - LODWORD(v725) = PARTY_BUFF_RESIST_MIND; - break; - case SPELL_BODY_PROTECTION_FROM_BODY: - LODWORD(v725) = PARTY_BUFF_RESIST_BODY; - break; - default: - assert(false); - continue; - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); - - v90 = (double)(signed int)v733 * 4.2666669; - pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); - LODWORD(v727) = 1; - break; - } - case SPELL_FIRE_HASTE: - { + } + case SPELL_FIRE_PROTECTION_FROM_FIRE: + case SPELL_AIR_PROTECTION_FROM_AIR: + case SPELL_WATER_PROTECTION_FROM_WATER: + case SPELL_EARTH_PROTECTION_FROM_EARTH: + case SPELL_MIND_PROTECTION_FROM_MIND: + case SPELL_BODY_PROTECTION_FROM_BODY: + { + v76 = v731 - 1; + LODWORD(v733) = 3600 * v2; + if ( v76 ) + { + v77 = v76 - 1; + if ( v77 ) + { + v78 = v77 - 1; + if ( v78 ) + { + if ( v78 != 1 ) + goto LABEL_232; + v79 = 4 * v2; + } + else + { + v79 = 3 * v2; + } + } + else + { + v79 = 2 * v2; + } + amount = v79; + } + else + { + amount = v2; + } +LABEL_232: + //v80 = v3->spellnum; + switch (pCastSpell->spellnum) + { + case SPELL_FIRE_PROTECTION_FROM_FIRE: + LODWORD(v725) = PARTY_BUFF_RESIST_FIRE; + break; + case SPELL_AIR_PROTECTION_FROM_AIR: + LODWORD(v725) = PARTY_BUFF_RESIST_AIR; + break; + case SPELL_WATER_PROTECTION_FROM_WATER: + LODWORD(v725) = PARTY_BUFF_RESIST_WATER; + break; + case SPELL_EARTH_PROTECTION_FROM_EARTH: + LODWORD(v725) = PARTY_BUFF_RESIST_EARTH; + break; + case SPELL_MIND_PROTECTION_FROM_MIND: + LODWORD(v725) = PARTY_BUFF_RESIST_MIND; + break; + case SPELL_BODY_PROTECTION_FROM_BODY: + LODWORD(v725) = PARTY_BUFF_RESIST_BODY; + break; + default: + assert(false); + continue; + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); + v90 = (double)(signed int)v733 * 4.2666669; + pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); + LODWORD(v727) = 1; + break; + } + case SPELL_FIRE_HASTE: + { if ( v731 <= 0 ) goto LABEL_254; if ( v731 <= 2 ) @@ -4078,16 +4048,16 @@ { pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); } } break; - } - case SPELL_SPIRIT_BLESS: - { + } + case SPELL_SPIRIT_BLESS: + { v101 = v731 - 1; if ( v101 && (v102 = v101 - 1) != 0 ) { @@ -4114,11 +4084,11 @@ break; if ( v731 == 1 ) { - v108 = v3->uPlayerID_2; - v109 = v3->spellnum; + v108 = pCastSpell->uPlayerID_2; + v109 = pCastSpell->spellnum; v110 = pGame->GetStru6(); pGame->GetStru6()->SetPlayerBuffAnim(v109, v108); - v111 = pOtherOverlayList->_4418B1(10000, v3->uPlayerID_2 + 310, 0, 65536); + v111 = pOtherOverlayList->_4418B1(10000, pCastSpell->uPlayerID_2 + 310, 0, 65536); //v668 = 0; v716 = v111; //v658 = v111; @@ -4130,7 +4100,7 @@ //HIDWORD(v650) = HIDWORD(v28); //LABEL_104: //LODWORD(v650) = v28; - pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 1, amount, v111, 0); + pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_BLESS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), 1, amount, v111, 0); LODWORD(v727) = 1; break; } @@ -4139,7 +4109,7 @@ v730b = pParty->pPlayers;//[0].pPlayerBuffs[1]; do { - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v105); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v105); v716 = pOtherOverlayList->_4418B1(10000, v105 + 310, 0, 65536); v730b->pPlayerBuffs[1].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); ++v730b; @@ -4185,24 +4155,24 @@ v701.x = 0; v701.y = 0; v701.z = 0; - a1.stru_24.Reset(); + pSpellSprite.stru_24.Reset(); v119 = HIDWORD(v733); - a1.spell_id = *(int *)HIDWORD(v733); - a1.spell_level = v723; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.uAttributes = 0; - a1.uSectorID = 0; - a1.uSpriteFrameID = 0; - a1.field_60_distance_related_prolly_lod = 0; - a1.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); - a1.uFacing = 0; - a1.uSoundID = *(short *)(v119 + 16); - a1.vPosition.x = v112->vPosition.x; - a1.vPosition.y = v112->vPosition.y; - a1.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); - a1.spell_target_pid = PID(OBJECT_Actor, a2); - v122 = a1.Create(0, 0, 0, 0); + pSpellSprite.spell_id = *(int *)HIDWORD(v733); + pSpellSprite.spell_level = v723; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, *(short *)(v119 + 2)); + pSpellSprite.uFacing = 0; + pSpellSprite.uSoundID = *(short *)(v119 + 16); + pSpellSprite.vPosition.x = v112->vPosition.x; + pSpellSprite.vPosition.y = v112->vPosition.y; + pSpellSprite.vPosition.z = v112->vPosition.z - (unsigned int)(signed __int64)((double)(signed int)v112->uActorHeight * unk_4D8548); + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, a2); + v122 = pSpellSprite.Create(0, 0, 0, 0); DamageMonsterFromParty(PID(OBJECT_Item, v122), PID_ID(a2), &v701); LODWORD(v727) = 1; } @@ -4212,7 +4182,7 @@ pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); *(int *)HIDWORD(v733) = 0; } - v3 = (stru277 *)HIDWORD(v733); + pCastSpell = (CastSpellInfo *)HIDWORD(v733); } break; } @@ -4241,7 +4211,7 @@ } LODWORD(v733) = v126; LABEL_296: - v127 = v3->spellnum; + v127 = pCastSpell->spellnum; if ( v127 == 17 ) { amount = 0; @@ -4264,10 +4234,10 @@ } if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); v90 = (double)(signed int)((int)v733 << 7) * 0.033333335; //LABEL_304: pParty->pPartyBuffs[LODWORD(v725)].Apply(pParty->uTimePlayed + (signed int)(signed __int64)v90, v731, amount, 0, 0); @@ -4285,10 +4255,10 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); pParty->pPartyBuffs[PARTY_BUFF_IMMOLATION].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); LODWORD(v727) = 1; @@ -4310,7 +4280,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[491], 2); // Can't cast Meteor Shower indoors! pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -4343,13 +4313,13 @@ auto _this_cpy = (int)_this; do { - v157 = rand(); + //v157 = rand(); v158 = (double)SLODWORD(v718); v718 = v158; v159 = (double)v721; *(float *)&v721 = v159; - a2 = v157 % 1000; - *((float *)&v733 + 1) = (double)(v157 % 1000) + *(float *)&y - *(float *)&v732; + a2 = rand() % 1000; + *((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732; v725 = v159 * v159; *(float *)&_this = v158 * v158; if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) @@ -4364,35 +4334,31 @@ stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); } - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.uAttributes = 0; - a1.vPosition.x = uRequiredMana; - a1.vPosition.y = LODWORD(v727); - a1.uSectorID = 0; - a1.vPosition.z = a2 + v713; - a1.uSpriteFrameID = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = v730; - a1.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); - a1.uFacing = v687; - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.x = uRequiredMana; + pSpellSprite.vPosition.y = LODWORD(v727); + pSpellSprite.uSectorID = 0; + pSpellSprite.vPosition.z = a2 + v713; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = v730; + pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546(a2 + 2500); + pSpellSprite.uFacing = v687; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); if ( pParty->bTurnBasedModeOn == 1 ) - a1.uAttributes = 4; - if ( a1.Create( - v687, - SHIDWORD(v687), - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - 0) != -1 + pSpellSprite.uAttributes = 4; + if ( pSpellSprite.Create(v687, SHIDWORD(v687), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->field_1C; LODWORD(v718) = rand() % 1024 - 512; - v160 = rand(); + //v160 = rand(); v14 = _this_cpy-- == 1; - v721 = (unsigned __int64)(v160 % 1024) - 512; + v721 = (unsigned __int64)(rand() % 1024) - 512; } while ( !v14 ); } @@ -4406,7 +4372,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[492], 2); // Can't cast Inferno outdoors! pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -4415,32 +4381,32 @@ v700.z = 0; v700.y = 0; v700.x = 0; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.uAttributes = 0; - a1.uSectorID = 0; - a1.uSpriteFrameID = 0; - a1.field_60_distance_related_prolly_lod = 0; - a1.uFacing = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); a2 = 0; if ( (signed int)_v726 > 0 ) { do { v162 = dword_50BF30[a2]; - a1.vPosition.x = pActors[v162].vPosition.x; - a1.vPosition.y = pActors[v162].vPosition.y; - a1.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); - a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); - v164 = a1.Create(0, 0, 0, 0); + pSpellSprite.vPosition.x = pActors[v162].vPosition.x; + pSpellSprite.vPosition.y = pActors[v162].vPosition.y; + pSpellSprite.vPosition.z = pActors[v162].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v162].uActorHeight * unk_4D8548); + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); + v164 = pSpellSprite.Create(0, 0, 0, 0); v165 = a2; DamageMonsterFromParty(PID(OBJECT_Item, v164), dword_50BF30[a2], &v700); - pGame->GetStru6()->_4A81CA(&a1); + pGame->GetStru6()->_4A81CA(&pSpellSprite); pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFF3C1Eu, 0x40u); a2 = v165 + 1; } @@ -4494,10 +4460,10 @@ do pOtherOverlayList->_4418B1(2010, v174++ + 100, 0, 65536); while ( v174 < 4 ); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); pParty->pPartyBuffs[PARTY_BUFF_FEATHER_FALL].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); LODWORD(v727) = 1; @@ -4534,36 +4500,36 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; auto _v726 = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.vPosition.y = pParty->vPosition.y; - a1.vPosition.x = pParty->vPosition.x; - a1.uAttributes = 0; - a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; - a1.uSectorID = pIndoor->GetSector( + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.y = pParty->vPosition.y; + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + pSpellSprite.uSectorID = pIndoor->GetSector( pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); - a1.uSpriteFrameID = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); if ( pParty->bTurnBasedModeOn == 1 ) - LOBYTE(a1.uAttributes) |= 4u; + LOBYTE(pSpellSprite.uAttributes) |= 4u; v188 = (signed int)_v726 / -2; v189 = (signed int)_v726 / 2; while ( v188 <= v189 ) { - a1.uFacing = v188 + LOWORD(v715.uYawAngle); - if ( a1.Create( + pSpellSprite.uFacing = v188 + LOWORD(v715.uYawAngle); + if ( pSpellSprite.Create( (signed __int16)(v188 + LOWORD(v715.uYawAngle)), v715.uPitchAngle, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - v3->uPlayerID + 1) != -1 + pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, + pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->field_1C; v188 += _v726 / (amount - 1); @@ -4597,15 +4563,17 @@ if ( !v192 ) { amount = v2; - goto LABEL_391; + //goto LABEL_391; + v195 = 600 * v2; + goto LABEL_392; } v193 = v192 - 1; if ( !v193 ) { v196 = 2 * v2; - LABEL_389: + //LABEL_389: amount = v196; - LABEL_391: + //LABEL_391: v195 = 600 * v2; goto LABEL_392; } @@ -4613,7 +4581,10 @@ if ( !v194 ) { v196 = 3 * v2; - goto LABEL_389; + //goto LABEL_389; + amount = v196; + v195 = 600 * v2; + goto LABEL_392; } if ( v194 != 1 ) goto LABEL_393; @@ -4626,15 +4597,15 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( pPlayer->CanCastSpell(uRequiredMana) ) { - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); LODWORD(v727) = 1; @@ -4649,7 +4620,7 @@ pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); break; } - if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() ) + if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); @@ -4665,7 +4636,7 @@ pOtherOverlayList->_4418B1(2090, v205++ + 100, 0, 65536); while ( v205 < 4 ); v206 = pOtherOverlayList->_4418B1(10008, 203, 0, 65536); - v207 = v3->uPlayerID + 1; + v207 = pCastSpell->uPlayerID + 1; v716 = v206; pParty->pPartyBuffs[PARTY_BUFF_FLY].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, v206, v207); @@ -4680,7 +4651,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[495], 2); // Can't cast Starburst indoors! pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -4734,32 +4705,28 @@ stru_5C6E00->Atan2(v684, (signed __int64)*((float *)&v733 + 1)), stru_5C6E00->Atan2((signed __int64)v216, (signed __int64)*(float *)&uRequiredMana)); } - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.uAttributes = 0; - a1.vPosition.x = LODWORD(v718); - a1.vPosition.y = v713; - a1.uSectorID = 0; - a1.vPosition.z = (int)((char *)_this + LODWORD(v725)); - a1.uSpriteFrameID = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = v730; + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.x = LODWORD(v718); + pSpellSprite.vPosition.y = v713; + pSpellSprite.uSectorID = 0; + pSpellSprite.vPosition.z = (int)((char *)_this + LODWORD(v725)); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = v730; //__debugbreak();// - a1.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); - a1.uFacing = v685; - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.field_60_distance_related_prolly_lod = stru_50C198._427546((int)&_this[69].uNumCharges); + pSpellSprite.uFacing = v685; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); if ( pParty->bTurnBasedModeOn == 1 ) - a1.uAttributes = 4; - if ( a1.Create( - v685, - SHIDWORD(v685), - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - 0) != -1 - && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + pSpellSprite.uAttributes = 4; + if ( pSpellSprite.Create(v685, SHIDWORD(v685), pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, 0) != -1 + && pParty->bTurnBasedModeOn == 1 ) + ++pTurnEngine->field_1C; v721 = rand() % 1024 - 512; v218 = rand(); v14 = a2-- == 1; @@ -4857,59 +4824,52 @@ HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; if ( amount == 1 ) { - LABEL_152: - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_skill = v731; - a1.spell_level = v2; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.vPosition.y = pParty->vPosition.y; + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_skill = v731; + pSpellSprite.spell_level = v2; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.y = pParty->vPosition.y; v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v660 = pParty->vPosition.y; LABEL_153: - a1.uAttributes = 0; - a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.z = v51; + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.vPosition.z = v51; v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); - a1.uSpriteFrameID = 0; - a1.uSectorID = v52; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - a1.uFacing = LOWORD(v715.uYawAngle); - a1.uSoundID = LOWORD(v3->sound_id); - + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.uSectorID = v52; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); if ( pParty->bTurnBasedModeOn == 1 ) - LOBYTE(a1.uAttributes) |= 4u; - - v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; - - if ( a1.Create(v715.uYawAngle, v715.uPitchAngle, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; + LOBYTE(pSpellSprite.uAttributes) |= 4u; + v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; + if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) + ++pTurnEngine->field_1C; } else { - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.vPosition.y = pParty->vPosition.y; - a1.vPosition.x = pParty->vPosition.x; - a1.uAttributes = 0; - a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; - a1.uSectorID = pIndoor->GetSector( - pParty->vPosition.x, - pParty->vPosition.y, - pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); - a1.uSpriteFrameID = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.y = pParty->vPosition.y; + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + pSpellSprite.uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); if ( pParty->bTurnBasedModeOn == 1 ) - LOBYTE(a1.uAttributes) |= 4u; + LOBYTE(pSpellSprite.uAttributes) |= 4u; v227 = SHIDWORD(v733) / -2; y = (char *)(SHIDWORD(v733) / 2); if ( SHIDWORD(v733) / -2 <= SHIDWORD(v733) / 2 ) @@ -4917,12 +4877,12 @@ v228 = v715.uYawAngle; do { - a1.uFacing = v227 + v228; - if ( a1.Create( + pSpellSprite.uFacing = v227 + v228; + if ( pSpellSprite.Create( v227 + v228, v715.uPitchAngle, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - v3->uPlayerID + 1) != -1 + pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, + pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->field_1C; v227 += SHIDWORD(v733) / (amount - 1); @@ -4935,7 +4895,7 @@ } case SPELL_WATER_WATER_WALK: { - if ( !pPlayers[v3->uPlayerID + 1]->GetMaxMana() ) + if ( !pPlayers[pCastSpell->uPlayerID + 1]->GetMaxMana() ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); @@ -4949,17 +4909,17 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; v716 = pOtherOverlayList->_4418B1(10005, 201, 0, 65536); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].Apply( pParty->uTimePlayed + (signed int)(signed __int64)((double)(v229 << 7) * 0.033333335), v731, amount, v716, - v3->uPlayerID + 1); + pCastSpell->uPlayerID + 1); if ( v731 == 4 ) pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags = 1; LODWORD(v727) = 1; @@ -4969,7 +4929,7 @@ { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v240 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pInventoryItems[a2]; + v240 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; y = v240; if ( pItemsTable->pItems[*(int *)v240].uEquipType != 12 || v240[20] & 2 ) { @@ -4979,7 +4939,7 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( v731 == 1 || v731 == 2 ) @@ -5018,7 +4978,7 @@ dword_50C9D8 = 1; ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2u); pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; v2 = v723; continue; } @@ -5034,7 +4994,7 @@ uRequiredMana = 0; HIDWORD(v733) = 10 * v2; v730 = 1; - v244 = (char *)&pParty->pPlayers[v3->uPlayerID_2]; + v244 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; if ( v731 == 1 ) { v245 = (int)&v244[36 * a2 + 532]; @@ -5097,7 +5057,7 @@ LODWORD(v727) = 1; break; } - goto LABEL_615; + goto LABEL_616; } LABEL_613: v316 = _this->uItemID; @@ -5122,9 +5082,8 @@ v317 = pGlobalTXT_LocalizationStrings[585]; ShowStatusBarString(v317, 2u); pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - __debugbreak(); // decompilation error; most probably v318 is the caster, filled in case 54 - //v318 = v726; - v3->spellnum = 0; + v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; + pCastSpell->spellnum = 0; v318->PlaySound(SPEECH_43, 0); } break; @@ -5227,7 +5186,8 @@ break; } } - goto LABEL_525; + ++*(int *)(v245 + 12); + goto LABEL_612; } } else @@ -5326,12 +5286,10 @@ break; } } -LABEL_525: ++*(int *)(v245 + 12); goto LABEL_612; } } -LABEL_615: //v1 = 0; goto LABEL_616; } @@ -5360,7 +5318,7 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } v292 = *(char *)(LODWORD(v725) + 28); @@ -5375,7 +5333,7 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( rand() % 100 >= 80 ) @@ -5460,10 +5418,10 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } - town_portal_caster_id = LOBYTE(v3->uPlayerID); + town_portal_caster_id = LOBYTE(pCastSpell->uPlayerID); pMessageQueue_50CBD0->AddMessage(UIMSG_OnCastTownPortal, 0, 0); LODWORD(v727) = 1; break; @@ -5475,7 +5433,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } v319 = uRequiredMana; @@ -5484,12 +5442,12 @@ pEventTimer->Pause(); pMessageQueue_50CBD0->AddMessage(UIMSG_B1, 0, 0); qword_506350 = (signed int)v733; - _506348_current_lloyd_playerid = v3->uPlayerID; + _506348_current_lloyd_playerid = pCastSpell->uPlayerID; ::uRequiredMana = v319; ::sRecoveryTime = sRecoveryTime; - dword_50633C = v3->sound_id; - dword_506338 = v3->spellnum; - LOBYTE(v3->field_8) |= 0x20u; + dword_50633C = pCastSpell->sound_id; + dword_506338 = pCastSpell->spellnum; + LOBYTE(pCastSpell->field_8) |= 0x20u; } break; } @@ -5514,7 +5472,7 @@ LABEL_634: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v323 = v3->uPlayerID_2; + v323 = pCastSpell->uPlayerID_2; v324 = (char *)&pParty->pPlayers[v323].pConditions[15]; if ( !pParty->pPlayers[v323].pConditions[15] ) { @@ -5531,36 +5489,37 @@ v732 = amount << 7; v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); v656 = 15; - goto LABEL_640; + v325 = &pParty->pPlayers[v323]; + goto LABEL_641; } case SPELL_EARTH_ROCK_BLAST: { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.vPosition.y = pParty->vPosition.y; - a1.vPosition.x = pParty->vPosition.x; - a1.uAttributes = 0; - a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; - a1.uSectorID = pIndoor->GetSector( + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.y = pParty->vPosition.y; + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + pSpellSprite.uSectorID = pIndoor->GetSector( pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3); - a1.uSpriteFrameID = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - a1.uFacing = LOWORD(pParty->sRotationY); - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(pParty->sRotationY); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); if ( pParty->bTurnBasedModeOn == 1 ) - LOBYTE(a1.uAttributes) |= 4u; - - v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; - if ( a1.Create(pParty->sRotationY, pParty->sRotationX, v659, v3->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) + LOBYTE(pSpellSprite.uAttributes) |= 4u; + + v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; + if ( pSpellSprite.Create(pParty->sRotationY, pParty->sRotationX, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->field_1C; LODWORD(v727) = 1; break; @@ -5571,33 +5530,33 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - a1.uType = 4090; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.y = pParty->vPosition.y; - a1.uAttributes = 0; - a1.uSectorID = 0; - a1.uSpriteFrameID = 0; - a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; - a1.field_60_distance_related_prolly_lod = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.uFacing = LOWORD(pParty->sRotationY); - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.uType = 4090; + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.vPosition.y = pParty->vPosition.y; + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.uFacing = LOWORD(pParty->sRotationY); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); if ( pParty->bTurnBasedModeOn == 1 ) - a1.uAttributes = 4; - - v659 = pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed; - if ( a1.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) + pSpellSprite.uAttributes = 4; + + v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; + if ( pSpellSprite.Create(pParty->sRotationY, stru_5C6E00->uIntegerHalfPi / 2, v659, 0) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->field_1C; LODWORD(v727) = 1; break; @@ -5620,10 +5579,10 @@ LODWORD(v733) = v330; if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); LODWORD(v727) = 1; @@ -5658,12 +5617,12 @@ LABEL_667: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v342 = v3->spell_target_pid; + v342 = pCastSpell->spell_target_pid; if ( v342 == 0 ) { - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); - - pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); + + pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_FATE].Apply(pParty->uTimePlayed + 1280, v731, amount, 0, 0); LODWORD(v727) = 1; break; } @@ -5706,7 +5665,7 @@ LABEL_679: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v351 = &pParty->pPlayers[v3->uPlayerID_2]; + v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; if ( !v351->pConditions[0] ) { LODWORD(v727) = 1; @@ -5721,13 +5680,13 @@ { v732 = amount << 7; v351->DiscardConditionIfLastsLongerThan(0, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); - if ( HIDWORD(pParty->pPlayers[v3->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[v3->uPlayerID_2].pConditions[0]) ) + if ( HIDWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) | LODWORD(pParty->pPlayers[pCastSpell->uPlayerID_2].pConditions[0]) ) { LODWORD(v727) = 1; break; } } - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); LODWORD(v727) = 1; break; } @@ -5743,9 +5702,9 @@ break; if ( v731 == 1 || v731 == 2 ) { - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); - - pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); + + pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); LODWORD(v727) = 1; break; } @@ -5754,7 +5713,7 @@ v357 = pParty->pPlayers;//[0].pPlayerBuffs[11]; do { - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); v357->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].Apply(pParty->uTimePlayed + v717, v731, 0, 0, 0); ++a2; ++v357;// = (SpellBuff *)((char *)v357 + 6972); @@ -5775,30 +5734,30 @@ break; auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xFFFFFFu, 0xC0u); - ++a1.uType; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.uAttributes = 0; - a1.uSectorID = 0; - a1.uSpriteFrameID = 0; - a1.field_60_distance_related_prolly_lod = 0; - a1.uFacing = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.uSoundID = LOWORD(v3->sound_id); + ++pSpellSprite.uType; + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) { v369 = &pActors[dword_50BF30[a2]]; if ( MonsterStats::BelongsToSupertype(v369->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) { - a1.vPosition.x = v369->vPosition.x; - a1.vPosition.y = v369->vPosition.y; - a1.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); - - a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); - a1.Create(0, 0, 0, 0); + pSpellSprite.vPosition.x = v369->vPosition.x; + pSpellSprite.vPosition.y = v369->vPosition.y; + pSpellSprite.vPosition.z = v369->vPosition.z - (unsigned int)(signed __int64)((double)v369->uActorHeight * unk_4D8548); + + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); + pSpellSprite.Create(0, 0, 0, 0); v369->pActorBuffs[4].Apply( pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); @@ -5817,8 +5776,8 @@ amount = 86400 * v2; if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pOtherOverlayList->_4418B1(5080, v3->uPlayerID_2 + 100, 0, 65536); - v373 = v3->uPlayerID_2; + pOtherOverlayList->_4418B1(5080, pCastSpell->uPlayerID_2 + 100, 0, 65536); + v373 = pCastSpell->uPlayerID_2; if ( !(HIDWORD(pParty->pPlayers[v373].pConditions[14]) | LODWORD(pParty->pPlayers[v373].pConditions[14])) ) { LODWORD(v727) = 1; @@ -5828,24 +5787,24 @@ pParty->pPlayers[v373].sHealth = 1; if ( v14 ) { - v374 = v3->uPlayerID_2; + v374 = pCastSpell->uPlayerID_2; LODWORD(pParty->pPlayers[v374].pConditions[14]) = 0; HIDWORD(pParty->pPlayers[v374].pConditions[14]) = 0; - v376 = v3->uPlayerID_2; + v376 = pCastSpell->uPlayerID_2; LODWORD(pParty->pPlayers[v376].pConditions[13]) = 0; HIDWORD(pParty->pPlayers[v376].pConditions[13]) = 0; } else { *(float *)&a2 = (double)(amount << 7) * 0.033333335; - pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); - pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); } - v377 = &pParty->pPlayers[v3->uPlayerID_2]; + v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; goto LABEL_720; } case SPELL_SPIRIT_SHARED_LIFE: @@ -5896,7 +5855,7 @@ } v388 = HIDWORD(v733); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, LOWORD(v682[HIDWORD(v733)]) - 1); HIDWORD(v733) = v388 + 1; } while ( v388 + 1 < v730 ); @@ -5910,19 +5869,20 @@ if ( !v392 ) { v395 = 180 * v2; - goto LABEL_750; + amount = v395; + goto LABEL_751; } v393 = v392 - 1; if ( !v393 ) { v395 = 10800 * v2; - goto LABEL_750; + amount = v395; + goto LABEL_751; } v394 = v393 - 1; if ( !v394 ) { v395 = 259200 * v2; -LABEL_750: amount = v395; goto LABEL_751; } @@ -5931,7 +5891,7 @@ LABEL_751: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v396 = v3->uPlayerID_2; + v396 = pCastSpell->uPlayerID_2; if ( HIDWORD(pParty->pPlayers[v396].pConditions[16]) | LODWORD(pParty->pPlayers[v396].pConditions[16]) || HIDWORD(pParty->pPlayers[v396].pConditions[14]) | LODWORD(pParty->pPlayers[v396].pConditions[14]) ) { @@ -5939,31 +5899,31 @@ pParty->pPlayers[v396].PlaySound(SPEECH_25, 0); if ( v731 == 4 ) { - v397 = v3->uPlayerID_2; + v397 = pCastSpell->uPlayerID_2; LODWORD(pParty->pPlayers[v397].pConditions[16]) = 0; HIDWORD(pParty->pPlayers[v397].pConditions[16]) = 0; - v398 = v3->uPlayerID_2; + v398 = pCastSpell->uPlayerID_2; LODWORD(pParty->pPlayers[v398].pConditions[14]) = 0; HIDWORD(pParty->pPlayers[v398].pConditions[14]) = 0; - v399 = v3->uPlayerID_2; + v399 = pCastSpell->uPlayerID_2; LODWORD(pParty->pPlayers[v399].pConditions[13]) = 0; HIDWORD(pParty->pPlayers[v399].pConditions[13]) = 0; } else { *(float *)&a2 = (double)(amount << 7) * 0.033333335; - pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0x10u, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); - pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xEu, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); - pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 0xDu, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); } - pParty->pPlayers[v3->uPlayerID_2].SetCondition(1u, 1); - - pParty->pPlayers[v3->uPlayerID_2].sHealth = 1; - - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); + pParty->pPlayers[pCastSpell->uPlayerID_2].SetCondition(1u, 1); + + pParty->pPlayers[pCastSpell->uPlayerID_2].sHealth = 1; + + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); } LODWORD(v727) = 1; break; @@ -5993,8 +5953,8 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); - v323 = v3->uPlayerID_2; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); + v323 = pCastSpell->uPlayerID_2; v324 = (char *)&pParty->pPlayers[v323].pConditions[12]; if ( !pParty->pPlayers[v323].pConditions[12] ) { @@ -6010,7 +5970,8 @@ } v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); v656 = 12; - goto LABEL_640; + v325 = &pParty->pPlayers[v323]; + goto LABEL_641; } case SPELL_MIND_REMOVE_FEAR: @@ -6042,8 +6003,8 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); - v323 = v3->uPlayerID_2; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); + v323 = pCastSpell->uPlayerID_2; v324 = (char *)&pParty->pPlayers[v323].pConditions[3]; if ( !pParty->pPlayers[v323].pConditions[3] ) { @@ -6059,7 +6020,8 @@ } v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); v656 = 3; - goto LABEL_640; + v325 = &pParty->pPlayers[v323]; + goto LABEL_641; } case SPELL_MIND_TELEPATHY: { @@ -6111,33 +6073,68 @@ { v422 = v683.GetDisplayName(); sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); - goto LABEL_807; + ShowStatusBarString(pTmpBuf2, 2u); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = *(short *)(v730 + 142); + pSpellSprite.vPosition.y = *(short *)(v730 + 144); + v676 = *(short *)(v730 + 138); + v665 = pSpellSprite.vPosition.y; + pSpellSprite.vPosition.z = *(short *)(v730 + 138); + v657 = pSpellSprite.vPosition.x; + goto LABEL_1087; } v664 = "%d gold"; - goto LABEL_803; + sprintf(pTmpBuf2, v664, v675); + ShowStatusBarString(pTmpBuf2, 2u); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = *(short *)(v730 + 142); + pSpellSprite.vPosition.y = *(short *)(v730 + 144); + v676 = *(short *)(v730 + 138); + v665 = pSpellSprite.vPosition.y; + pSpellSprite.vPosition.z = *(short *)(v730 + 138); + v657 = pSpellSprite.vPosition.x; + goto LABEL_1087; } if (v683.uItemID) { v675 = v683.GetDisplayName(); v664 = "(%s)"; -LABEL_803: sprintf(pTmpBuf2, v664, v675); - goto LABEL_807; + ShowStatusBarString(pTmpBuf2, 2u); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = *(short *)(v730 + 142); + pSpellSprite.vPosition.y = *(short *)(v730 + 144); + v676 = *(short *)(v730 + 138); + v665 = pSpellSprite.vPosition.y; + pSpellSprite.vPosition.z = *(short *)(v730 + 138); + v657 = pSpellSprite.vPosition.x; + goto LABEL_1087; } strcpy(pTmpBuf2, "nothing"); -LABEL_807: ShowStatusBarString(pTmpBuf2, 2u); - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.vPosition.x = *(short *)(v730 + 142); - a1.vPosition.y = *(short *)(v730 + 144); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = *(short *)(v730 + 142); + pSpellSprite.vPosition.y = *(short *)(v730 + 144); v676 = *(short *)(v730 + 138); - v665 = a1.vPosition.y; - a1.vPosition.z = *(short *)(v730 + 138); - v657 = a1.vPosition.x; + v665 = pSpellSprite.vPosition.y; + pSpellSprite.vPosition.z = *(short *)(v730 + 138); + v657 = pSpellSprite.vPosition.x; goto LABEL_1087; } case SPELL_MIND_BERSERK: @@ -6177,11 +6174,11 @@ v731, 0, 0, 0); pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; } - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - v60 = pObjectList->ObjectIDByItemID(a1.uType); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); v61 = v426; goto LABEL_1086; @@ -6206,11 +6203,11 @@ pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), v731, 0, 0, 0); } - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - v60 = pObjectList->ObjectIDByItemID(a1.uType); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); v61 = PID_ID(a2); goto LABEL_1086; } @@ -6226,30 +6223,30 @@ break; auto _v726 = sub_46A6AC((int)dword_50BF30, 100, 4096); pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xA0A0Au, 0xC0u); - ++a1.uType; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.uAttributes = 0; - a1.uSectorID = 0; - a1.uSpriteFrameID = 0; - a1.field_60_distance_related_prolly_lod = 0; - a1.uFacing = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.uSoundID = LOWORD(v3->sound_id); + ++pSpellSprite.uType; + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); for ( a2 = 0; a2 < (signed int)_v726; ++a2 ) { v433 = &pActors[dword_50BF30[a2]]; if ( MonsterStats::BelongsToSupertype(v433->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) break; - a1.vPosition.x = v433->vPosition.x; - a1.vPosition.y = v433->vPosition.y; - a1.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); - - a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); - a1.Create(0, 0, 0, 0); + pSpellSprite.vPosition.x = v433->vPosition.x; + pSpellSprite.vPosition.y = v433->vPosition.y; + pSpellSprite.vPosition.z = v433->vPosition.z - (unsigned int)(signed __int64)((double)v433->uActorHeight * unk_4D8548); + + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); + pSpellSprite.Create(0, 0, 0, 0); if ( stru_50C198.GetMagicalResistance(v433, 7u) ) { v433->pActorBuffs[4].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), @@ -6270,24 +6267,24 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); - v440 = v3->uPlayerID_2; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); + v440 = pCastSpell->uPlayerID_2; if ( HIDWORD(pParty->pPlayers[v440].pConditions[5]) | LODWORD(pParty->pPlayers[v440].pConditions[5]) ) { if ( !(HIDWORD(pParty->pPlayers[v440].pConditions[1]) | LODWORD(pParty->pPlayers[v440].pConditions[1])) ) pParty->pPlayers[v440].PlaySound(SPEECH_25, 0); if ( v731 == 4 ) { - v441 = v3->uPlayerID_2; + v441 = pCastSpell->uPlayerID_2; LODWORD(pParty->pPlayers[v441].pConditions[5]) = 0; HIDWORD(pParty->pPlayers[v441].pConditions[5]) = 0; } else { - pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan(5u, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); } - v377 = &pParty->pPlayers[v3->uPlayerID_2]; + v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; LABEL_720: v377->SetCondition(1, 0); } @@ -6411,8 +6408,8 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); - v323 = v3->uPlayerID_2; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); + v323 = pCastSpell->uPlayerID_2; v324 = (char *)&pParty->pPlayers[v323].pConditions[1]; if ( !pParty->pPlayers[v323].pConditions[1] ) { @@ -6428,7 +6425,6 @@ } v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); v656 = 1; -LABEL_640: v325 = &pParty->pPlayers[v323]; goto LABEL_641; } @@ -6457,11 +6453,11 @@ amount = v459; if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v460 = v3->spell_target_pid; + v460 = pCastSpell->spell_target_pid; if (!v460) { - pParty->pPlayers[v3->uPlayerID_2].Heal(amount); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); + pParty->pPlayers[pCastSpell->uPlayerID_2].Heal(amount); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); } else { @@ -6515,8 +6511,8 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); - v470 = v3->uPlayerID_2; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); + v470 = pCastSpell->uPlayerID_2; if ( !(HIDWORD(pParty->pPlayers[v470].pConditions[6]) | LODWORD(pParty->pPlayers[v470].pConditions[6])) && !(HIDWORD(pParty->pPlayers[v470].pConditions[8]) | LODWORD(pParty->pPlayers[v470].pConditions[8])) && !(HIDWORD(pParty->pPlayers[v470].pConditions[10]) | LODWORD(pParty->pPlayers[v470].pConditions[10])) ) @@ -6528,10 +6524,10 @@ { LODWORD(pParty->pPlayers[v470].pConditions[6]) = 0; HIDWORD(pParty->pPlayers[v470].pConditions[6]) = 0; - v471 = v3->uPlayerID_2; + v471 = pCastSpell->uPlayerID_2; LODWORD(pParty->pPlayers[v471].pConditions[8]) = 0; HIDWORD(pParty->pPlayers[v471].pConditions[8]) = 0; - v472 = v3->uPlayerID_2; + v472 = pCastSpell->uPlayerID_2; LODWORD(pParty->pPlayers[v472].pConditions[10]) = 0; HIDWORD(pParty->pPlayers[v472].pConditions[10]) = 0; LODWORD(v727) = 1; @@ -6541,7 +6537,7 @@ pParty->pPlayers[v470].DiscardConditionIfLastsLongerThan( 6u, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); - pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 8u, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); @@ -6556,10 +6552,10 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); pParty->pPartyBuffs[PARTY_BUFF_PROTECTION_FROM_MAGIC].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, 0, 0); LODWORD(v727) = 1; @@ -6573,10 +6569,10 @@ break; if ( v731 == 4 ) { - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); v732 = (int)v733 << 7; v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); pParty->pPlayers[0].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + v717, 4u, v2, v2, 0); @@ -6587,9 +6583,9 @@ LODWORD(v727) = 1; break; } - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); - - pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, v2, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); + + pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v2, v2, 0); LODWORD(v727) = 1; break; } @@ -6603,8 +6599,8 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); - v498 = v3->uPlayerID_2; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); + v498 = pCastSpell->uPlayerID_2; if ( !(HIDWORD(pParty->pPlayers[v498].pConditions[7]) | LODWORD(pParty->pPlayers[v498].pConditions[7])) && !(HIDWORD(pParty->pPlayers[v498].pConditions[9]) | LODWORD(pParty->pPlayers[v498].pConditions[9])) && !(HIDWORD(pParty->pPlayers[v498].pConditions[11]) | LODWORD(pParty->pPlayers[v498].pConditions[11])) ) @@ -6616,10 +6612,10 @@ { LODWORD(pParty->pPlayers[v498].pConditions[7]) = 0; HIDWORD(pParty->pPlayers[v498].pConditions[7]) = 0; - v499 = v3->uPlayerID_2; + v499 = pCastSpell->uPlayerID_2; LODWORD(pParty->pPlayers[v499].pConditions[9]) = 0; HIDWORD(pParty->pPlayers[v499].pConditions[9]) = 0; - v500 = v3->uPlayerID_2; + v500 = pCastSpell->uPlayerID_2; LODWORD(pParty->pPlayers[v500].pConditions[11]) = 0; HIDWORD(pParty->pPlayers[v500].pConditions[11]) = 0; } @@ -6629,13 +6625,13 @@ pParty->pPlayers[v498].DiscardConditionIfLastsLongerThan( 7u, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); - pParty->pPlayers[v3->uPlayerID_2].DiscardConditionIfLastsLongerThan( + pParty->pPlayers[pCastSpell->uPlayerID_2].DiscardConditionIfLastsLongerThan( 9u, (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); v656 = 11; LABEL_937: - v325 = &pParty->pPlayers[v3->uPlayerID_2]; + v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; LABEL_641: v325->DiscardConditionIfLastsLongerThan(v656, v663); } @@ -6651,7 +6647,7 @@ int v1 = 0; do { - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); v501->Heal(amount); ++v501; ++v1; @@ -6668,34 +6664,34 @@ pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0xAFF0Au, 0xC0u); v505 = sub_46A6AC((int)dword_50BF30, 100, 4096); - ++a1.uType; + ++pSpellSprite.uType; HIDWORD(v733) = v505; v688.x = 0; v688.y = 0; v688.z = 0; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.uAttributes = 0; - a1.uSectorID = 0; - a1.uSpriteFrameID = 0; - a1.field_60_distance_related_prolly_lod = 0; - a1.uFacing = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); a2 = 0; if ( SHIDWORD(v733) > 0 ) { do { v507 = dword_50BF30[a2]; - a1.vPosition.x = pActors[v507].vPosition.x; - a1.vPosition.y = pActors[v507].vPosition.y; - a1.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); - a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); - v509 = a1.Create(0, 0, 0, 0); + pSpellSprite.vPosition.x = pActors[v507].vPosition.x; + pSpellSprite.vPosition.y = pActors[v507].vPosition.y; + pSpellSprite.vPosition.z = pActors[v507].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v507].uActorHeight * unk_4D8548); + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); + v509 = pSpellSprite.Create(0, 0, 0, 0); v510 = a2; DamageMonsterFromParty(PID(OBJECT_Item, v509), dword_50BF30[a2], (Vec3_int_ *)&v688); a2 = v510 + 1; @@ -6705,11 +6701,11 @@ for ( a2 = 0; a2 < SHIDWORD(v733); ++a2 ) { v511 = &pActors[dword_50BF30[a2]]; - a1.vPosition.x = v511->vPosition.x; - a1.vPosition.y = v511->vPosition.y; - a1.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); - a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); - a1.Create(0, 0, 0, 0); + pSpellSprite.vPosition.x = v511->vPosition.x; + pSpellSprite.vPosition.y = v511->vPosition.y; + pSpellSprite.vPosition.z = v511->vPosition.z - (unsigned int)(signed __int64)((double)v511->uActorHeight * unk_4D8548); + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); + pSpellSprite.Create(0, 0, 0, 0); v513 = v511->pActorBuffs; for (int _v726 = 22; _v726 != 0; --_v726) { @@ -6754,7 +6750,7 @@ do { v519 = v518->uAIState; - if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, v3->uPlayerID) == v518->uSummonerID ) + if ( v518->uAIState != 5 && v519 != 11 && v519 != 19 && PID(OBJECT_Player, pCastSpell->uPlayerID) == v518->uSummonerID ) ++HIDWORD(v733); ++v518; --_v726; @@ -6765,12 +6761,12 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[648], 2); // This character can't summon any more monsters! pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - sub_44FA4C_spawn_light_elemental(v3->uPlayerID, v731, v733); + sub_44FA4C_spawn_light_elemental(pCastSpell->uPlayerID, v731, v733); LODWORD(v727) = 1; break; } @@ -6803,10 +6799,10 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); pParty->pPartyBuffs[PARTY_BUFF_DAY_OF_GODS].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, amount, 0, 0); LODWORD(v727) = 1; @@ -6819,39 +6815,39 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[497], 2); // Can't cast Prismatic Light outdoors! pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; v531 = sub_46A6AC((int)dword_50BF30, 100, 4096); - ++a1.uType; + ++pSpellSprite.uType; v694.x = 0; v694.y = 0; v694.z = 0; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.uAttributes = 0; - a1.uSectorID = 0; - a1.uSpriteFrameID = 0; - a1.field_60_distance_related_prolly_lod = 0; - a1.uFacing = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); a2 = 0; if ( (signed int)v531 > 0 ) { do { v533 = dword_50BF30[a2]; - a1.vPosition.x = pActors[v533].vPosition.x; - a1.vPosition.y = pActors[v533].vPosition.y; - a1.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); - a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); - v535 = a1.Create(0, 0, 0, 0); + pSpellSprite.vPosition.x = pActors[v533].vPosition.x; + pSpellSprite.vPosition.y = pActors[v533].vPosition.y; + pSpellSprite.vPosition.z = pActors[v533].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v533].uActorHeight * unk_4D8548); + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); + v535 = pSpellSprite.Create(0, 0, 0, 0); v536 = a2; DamageMonsterFromParty(PID(OBJECT_Item, v535), dword_50BF30[a2], &v694); a2 = v536 + 1; @@ -6881,10 +6877,10 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); v732 = v730 << 7; v549 = (double)(v730 << 7) * 0.033333335; @@ -6941,10 +6937,10 @@ *((float *)&v733 + 1) = (double)v732 * 0.033333335; do { - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, 3); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); //((SpellBuff *)(v553 + 6056))->Apply( v553->pPlayerBuffs[4].Apply((signed __int64)((double)(signed __int64)pParty->uTimePlayed + *((float *)&v733 + 1)), v731, v730, 0, 0); @@ -6973,7 +6969,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -6996,7 +6992,7 @@ *(int *)(_this->uItemID + 6460) = v565; v567 = (*v566)->GetMaxMana(); *(int *)(_this->uItemID + 6464) = v567; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); ++a2; _this = (ItemGen *)((char *)_this + 4); } @@ -7037,16 +7033,16 @@ amount = v575; if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v576 = v3->spell_target_pid; + v576 = pCastSpell->spell_target_pid; if (!v576) { - v585 = (char *)&pParty->pPlayers[v3->uPlayerID_2]; - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); + v585 = (char *)&pParty->pPlayers[pCastSpell->uPlayerID_2]; + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); if ( *((_QWORD *)v585 + 14) ) { ((Player *)v585)->SetCondition(0x11u, 1); v587 = ((Player *)v585)->GetSexByVoice(); - ReloadPlayerPortraits(v3->uPlayerID_2, (v587 != 0) + 23); + ReloadPlayerPortraits(pCastSpell->uPlayerID_2, (v587 != 0) + 23); *((_QWORD *)v585 + 17) = pParty->uTimePlayed; } break; @@ -7057,7 +7053,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[496], 2); // No valid target exists! pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } v578 = (int)&pActors[(int)v577]; @@ -7066,29 +7062,29 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } - ++a1.uType; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.uAttributes = 0; - a1.uSectorID = 0; - a1.uSpriteFrameID = 0; - a1.field_60_distance_related_prolly_lod = 0; + ++pSpellSprite.uType; + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; v581 = v721; - a1.uFacing = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.uSoundID = LOWORD(v3->sound_id); - a1.vPosition.x = *(short *)(v721 + 142); - a1.vPosition.y = *(short *)(v721 + 144); + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.vPosition.x = *(short *)(v721 + 142); + pSpellSprite.vPosition.y = *(short *)(v721 + 144); v732 = *(short *)(v721 + 138); - a1.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); - a1.spell_target_pid = PID(OBJECT_Actor, (int)v577); - a1.Create(0, 0, 0, 0); + pSpellSprite.vPosition.z = *(short *)(v721 + 146) - (unsigned int)(signed __int64)((double)v732 * unk_4D8548); + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, (int)v577); + pSpellSprite.Create(0, 0, 0, 0); if ( *(char *)(v581 + 52) > amount ) break; Actor::Resurrect((unsigned int)v577); @@ -7125,7 +7121,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; __debugbreak(); - HIDWORD(v733) = (int)(char *)&pParty + 6972 * v3->uPlayerID_2 + 36 * a2 + 3040; + HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; v732 = (signed int)&pItemsTable->pItems[*(int *)HIDWORD(v733)].pIconName; ((ItemGen *)HIDWORD(v733))->UpdateTempBonus(pParty->uTimePlayed); if ( *(int *)HIDWORD(v733) >= 64 && *(int *)HIDWORD(v733) <= 65 @@ -7141,7 +7137,7 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } v592 = HIDWORD(v733); @@ -7179,26 +7175,26 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.vPosition.x = pParty->vPosition.x; - a1.vPosition.y = pParty->vPosition.y; - a1.uAttributes = 0; - a1.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; - a1.uSectorID = pIndoor->GetSector( + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.vPosition.y = pParty->vPosition.y; + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.z = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; + pSpellSprite.uSectorID = pIndoor->GetSector( pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2); - a1.uSpriteFrameID = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); if ( pParty->bTurnBasedModeOn == 1 ) - LOBYTE(a1.uAttributes) |= 4u; + LOBYTE(pSpellSprite.uAttributes) |= 4u; v596 = (signed int)_v726 / -2; y = (char *)((signed int)_v726 / 2); if ( (signed int)_v726 / -2 <= (signed int)_v726 / 2 ) @@ -7206,12 +7202,12 @@ v597 = v715.uYawAngle; do { - a1.uFacing = v596 + v597; - if ( a1.Create( + pSpellSprite.uFacing = v596 + v597; + if ( pSpellSprite.Create( v596 + v597, v715.uPitchAngle, - pObjectList->pObjects[(signed __int16)a1.uObjectDescID].uSpeed, - v3->uPlayerID + 1) != -1 + pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed, + pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) ++pTurnEngine->field_1C; v596 += _v726 / (amount - 1); @@ -7229,12 +7225,12 @@ if ( v731 == 1 || v731 == 2 ) { v598 = 180 * v2; - goto LABEL_1081; + LODWORD(v733) = v598; + goto LABEL_1082; } if ( v731 == 3 ) { v598 = 300 * v2; -LABEL_1081: LODWORD(v733) = v598; goto LABEL_1082; } @@ -7253,45 +7249,45 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } pActors[PID_ID(a2)].pActorBuffs[9].Reset(); pActors[PID_ID(a2)].pActorBuffs[1].Reset(); pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - v60 = pObjectList->ObjectIDByItemID(a1.uType); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); v61 = PID_ID(a2); LABEL_1086: v600 = pActors[v61].vPosition.y; v601 = pActors[v61].vPosition.x; - a1.uObjectDescID = v60; - a1.vPosition.x = v601; + pSpellSprite.uObjectDescID = v60; + pSpellSprite.vPosition.x = v601; v602 = pActors[v61].uActorHeight; v603 = pActors[v61].vPosition.z; - a1.vPosition.y = v600; + pSpellSprite.vPosition.y = v600; v676 = v603 + v602; v665 = v600; - a1.vPosition.z = v603 + v602; + pSpellSprite.vPosition.z = v603 + v602; v657 = v601; LABEL_1087: - a1.uAttributes = 0; - a1.uSectorID = pIndoor->GetSector(v657, v665, v676); - a1.uSpriteFrameID = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.spell_target_pid = a2; - a1.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - a1.uFacing = LOWORD(v715.uYawAngle); - LOBYTE(a1.uAttributes) |= 0x80u; - a1.uSoundID = LOWORD(v3->sound_id); - a1.Create(0, 0, 0, v3->uPlayerID + 1); - LODWORD(v727) = 1; - break; - } + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + LOBYTE(pSpellSprite.uAttributes) |= 0x80u; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); + LODWORD(v727) = 1; + break; + } case SPELL_DARK_SACRIFICE: { if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -7331,14 +7327,14 @@ } while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); } - v608 = v3->uPlayerID_2; + v608 = pCastSpell->uPlayerID_2; if ( v608 != 4 && v608 != 5 || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) || v609 >= 3 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } v610 = 76 * v609; @@ -7385,9 +7381,9 @@ break; if ( v731 != 3 && v731 != 4 ) { - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v3->uPlayerID_2); - - pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v615, v716, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); + + pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v615, v716, 0); LODWORD(v727) = 1; break; } @@ -7396,7 +7392,7 @@ v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; do { - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, a2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); ++a2; ++v619; @@ -7415,18 +7411,18 @@ v707.x = 0; v707.y = 0; v707.z = 0; - a1.stru_24.Reset(); - a1.spell_id = v3->spellnum; - a1.spell_level = v2; - a1.spell_skill = v731; - a1.uObjectDescID = pObjectList->ObjectIDByItemID(a1.uType); - a1.uAttributes = 0; - a1.uSectorID = 0; - a1.uSpriteFrameID = 0; - a1.field_60_distance_related_prolly_lod = 0; - a1.uFacing = 0; - a1.spell_caster_pid = PID(OBJECT_Player, v3->uPlayerID); - a1.uSoundID = LOWORD(v3->sound_id); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); a2 = 0; int _v726 = 0; if ( SHIDWORD(v733) > 0 ) @@ -7435,12 +7431,12 @@ do { v625 = dword_50BF30[a2]; - a1.vPosition.x = pActors[v625].vPosition.x; - a1.vPosition.y = pActors[v625].vPosition.y; + pSpellSprite.vPosition.x = pActors[v625].vPosition.x; + pSpellSprite.vPosition.y = pActors[v625].vPosition.y; //v732 = pActors[v625].uActorHeight; - a1.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); - a1.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); - v627 = a1.Create(0, 0, 0, 0); + pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); + v627 = pSpellSprite.Create(0, 0, 0, 0); v628 = a2; DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); a2 = v628 + 1; @@ -7481,7 +7477,7 @@ v726->sHealth = v726->GetMaxHealth(); v635 = HIDWORD(v733); - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, WORD2(v733)); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); HIDWORD(v733) = v635 + 1; } while ( v635 + 1 < v730 ); @@ -7497,7 +7493,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } v640 = v731 - 2; @@ -7507,7 +7503,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v3->spellnum = 0; + pCastSpell->spellnum = 0; continue; } if ( !pPlayer->CanCastSpell(uRequiredMana) ) @@ -7537,10 +7533,10 @@ default: break; } - if ( v3->field_8 & 0x20 ) + if ( pCastSpell->field_8 & 0x20 ) { if ( v727 != 0.0 ) - pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[v3->spellnum], 0, 0, -1, 0, v3->sound_id, 0, 0); + pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); } else { @@ -7549,7 +7545,7 @@ if ( pParty->bTurnBasedModeOn ) { v645 = sRecoveryTime; - pParty->pTurnBasedPlayerRecoveryTimes[v3->uPlayerID] = sRecoveryTime; + pParty->pTurnBasedPlayerRecoveryTimes[pCastSpell->uPlayerID] = sRecoveryTime; pPlayer->SetRecoveryTime(v645); if ( !some_active_character ) pTurnEngine->_40471C(); @@ -7563,13 +7559,13 @@ { pPlayer->PlaySound(SPEECH_49, 0); if ( v727 != 0.0 ) - pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[v3->spellnum], 0, 0, -1, 0, v3->sound_id, 0, 0); - v3->spellnum = 0; + pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); + pCastSpell->spellnum = 0; v2 = v723; continue; } } - v3->spellnum = 0; + pCastSpell->spellnum = 0; v2 = v723; continue; @@ -7789,7 +7785,7 @@ if (!player->CanAct()) return; - pStru277->_427D48(uActiveCharacter); + pCastSpellInfo->_427D48(uActiveCharacter); //v3 = 0; if (pParty->Invisible()) pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); @@ -8798,7 +8794,7 @@ v24 = v6->GetAttackRecoveryTime(false); if ( !pParty->bTurnBasedModeOn ) pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); - pStru277->_427D48(uActiveCharacter); + pCastSpellInfo->_427D48(uActiveCharacter); pTurnEngine->_40471C(); } } diff -r 055ac998c606 -r 6dd1766051cf mm7_data.cpp --- a/mm7_data.cpp Wed May 01 12:04:02 2013 +0200 +++ b/mm7_data.cpp Wed May 01 15:17:43 2013 +0600 @@ -34,9 +34,9 @@ #include "TurnEngine.h" struct stru262_TurnBased *pTurnEngine = new stru262_TurnBased; -#include "stru277.h" -stru277 pStru277[10]; -stru277 stru_50CDB4; // idb +#include "CastSpellInfo.h" +CastSpellInfo pCastSpellInfo[10]; +CastSpellInfo stru_50CDB4; // idb #include "Viewport.h" struct Viewport *pViewport = new Viewport; diff -r 055ac998c606 -r 6dd1766051cf stru277.h --- a/stru277.h Wed May 01 12:04:02 2013 +0200 +++ b/stru277.h Wed May 01 15:17:43 2013 +0600 @@ -4,10 +4,10 @@ /* 271 */ #pragma pack(push, 1) -struct stru277 +struct CastSpellInfo { //----- (00426987) -------------------------------------------------------- - inline stru277() + inline CastSpellInfo() { field_8 = 0; spellnum = 0; @@ -18,7 +18,7 @@ } void _427D48(unsigned int uPlayerID); - unsigned int PushStru277(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int sound_id); + unsigned int PushCastSpellInfo(__int16 a2, __int16 uPlayerID, __int16 skill_level, __int16 a5, int sound_id); struct GUIWindow *sub_4219BE(); void _427E01_cast_spell(); @@ -34,5 +34,5 @@ #pragma pack(pop) -extern stru277 pStru277[10]; -extern stru277 stru_50CDB4; // idb +extern CastSpellInfo pCastSpellInfo[10]; +extern CastSpellInfo stru_50CDB4; // idb