Mercurial > mm7
diff mm7_6.cpp @ 924:a78f08dbeb88
CastSpellInfo
author | Ritor1 |
---|---|
date | Wed, 01 May 2013 14:50:52 +0600 |
parents | 3696848c0413 |
children | 7c798dd88993 |
line wrap: on
line diff
--- a/mm7_6.cpp Tue Apr 30 20:08:42 2013 +0600 +++ b/mm7_6.cpp Wed May 01 14:50:52 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" @@ -2251,19 +2251,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 +2279,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 +2299,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 +2309,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 +2321,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 +2331,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 +2341,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 +2367,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 +2396,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 +2428,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 +3140,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 +3169,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 +3186,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 +3219,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 +3236,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 +3289,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 +3419,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 +3456,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 +3473,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 +3521,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 +3555,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 +3585,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 +3722,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 +3770,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 +3797,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 +3873,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 +3905,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 +3932,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 +4049,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 +4085,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 +4101,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 +4110,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 +4156,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 +4183,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 +4212,7 @@ } LODWORD(v733) = v126; LABEL_296: - v127 = v3->spellnum; + v127 = pCastSpell->spellnum; if ( v127 == 17 ) { amount = 0; @@ -4264,10 +4235,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 +4256,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 +4281,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 +4314,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 +4335,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 +4373,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 +4382,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 +4461,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 +4501,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 +4564,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 +4582,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 +4598,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 +4621,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 +4637,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 +4652,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 +4706,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 +4825,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 +4878,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 +4896,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 +4910,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 +4930,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 +4940,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 +4979,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 +4995,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 +5058,7 @@ LODWORD(v727) = 1; break; } - goto LABEL_615; + goto LABEL_616; } LABEL_613: v316 = _this->uItemID; @@ -5122,9 +5083,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 +5187,8 @@ break; } } - goto LABEL_525; + ++*(int *)(v245 + 12); + goto LABEL_612; } } else @@ -5326,12 +5287,10 @@ break; } } -LABEL_525: ++*(int *)(v245 + 12); goto LABEL_612; } } -LABEL_615: //v1 = 0; goto LABEL_616; } @@ -5360,7 +5319,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 +5334,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 +5419,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 +5434,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 +5443,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 +5473,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 +5490,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 +5531,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 +5580,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 +5618,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 +5666,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 +5681,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 +5703,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 +5714,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 +5735,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 +5777,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 +5788,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 +5856,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 +5870,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 +5892,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 +5900,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 +5954,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 +5971,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 +6004,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 +6021,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 +6074,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 +6175,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 +6204,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 +6224,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 +6268,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 +6409,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 +6426,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 +6454,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 +6512,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 +6525,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 +6538,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 +6553,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 +6570,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 +6584,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 +6600,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 +6613,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 +6626,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 +6648,7 @@ int v1 = 0; do { - pGame->GetStru6()->SetPlayerBuffAnim(v3->spellnum, v1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, v1); v501->Heal(amount); ++v501; ++v1; @@ -6668,34 +6665,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 +6702,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 +6751,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 +6762,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 +6800,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 +6816,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 +6878,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 +6938,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 +6970,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 +6993,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 +7034,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 +7054,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 +7063,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 +7122,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 +7138,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 +7176,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 +7203,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 +7226,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 +7250,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 +7328,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 +7382,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 +7393,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 +7412,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 +7432,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 +7478,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 +7494,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 +7504,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 +7534,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 +7546,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 +7560,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 +7786,7 @@ if (!player->CanAct()) return; - pStru277->_427D48(uActiveCharacter); + pCastSpellInfo->_427D48(uActiveCharacter); //v3 = 0; if (pParty->Invisible()) pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); @@ -8798,7 +8795,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(); } }