OpenEnroth 73e68f7
Loading...
Searching...
No Matches
Functions | Variables
CastSpellInfo.cpp File Reference
#include "CastSpellInfo.h"
#include <vector>
#include <string>
#include "Engine/Engine.h"
#include "Engine/EngineGlobals.h"
#include "Engine/Events/Processor.h"
#include "Engine/Graphics/Camera.h"
#include "Engine/Objects/Decoration.h"
#include "Engine/Graphics/Outdoor.h"
#include "Engine/Graphics/Indoor.h"
#include "Engine/Graphics/Renderer/Renderer.h"
#include "Engine/Localization.h"
#include "Engine/Objects/Actor.h"
#include "Engine/Objects/ObjectList.h"
#include "Engine/Objects/SpriteObject.h"
#include "Engine/Objects/NPC.h"
#include "Engine/Objects/CharacterEnumFunctions.h"
#include "Engine/Objects/MonsterEnumFunctions.h"
#include "Engine/OurMath.h"
#include "Engine/Party.h"
#include "Engine/MapEnumFunctions.h"
#include "Engine/SpellFxRenderer.h"
#include "Engine/Tables/ItemTable.h"
#include "Engine/Tables/IconFrameTable.h"
#include "Engine/Time/Timer.h"
#include "Engine/TurnEngine/TurnEngine.h"
#include "Engine/Random/Random.h"
#include "Engine/Spells/Spells.h"
#include "Engine/Spells/SpellEnumFunctions.h"
#include "GUI/GUIButton.h"
#include "GUI/GUIMessageQueue.h"
#include "GUI/UI/UIGame.h"
#include "GUI/UI/UIStatusBar.h"
#include "GUI/UI/UISpell.h"
#include "Io/Mouse.h"
#include "Media/Audio/AudioPlayer.h"
#include "Utility/Math/TrigLut.h"

Functions

static void initSpellSprite (SpriteObject *spritePtr, int spellLevel, CharacterSkillMastery spellMastery, CastSpellInfo *pCastSpell)
 
static void spellFailed (CastSpellInfo *pCastSpell, int error_str_id)
 
static void setSpellRecovery (CastSpellInfo *pCastSpell, Duration recoveryTime)
 
static size_t pushCastSpellInfo (SpellId uSpellID, int casterIndex, CombinedSkillValue skill_level, SpellCastFlags uFlags, int overrideSoundId)
 
void pushSpellOrRangedAttack (SpellId spell, int casterIndex, CombinedSkillValue skill_value, SpellCastFlags flags, int overrideSoundId)
 
void pushTempleSpell (SpellId spell)
 
void pushNPCSpell (SpellId spell)
 
void pushScrollSpell (SpellId spell, int casterIndex)
 
void spellTargetPicked (Pid targetPid, int targetCharacterIndex)
 

Variables

static SpellFxRendererspell_fx_renderer = EngineIocContainer::ResolveSpellFxRenderer()
 
static const size_t CAST_SPELL_QUEUE_SIZE = 10
 
static std::array< CastSpellInfo, CAST_SPELL_QUEUE_SIZEpCastSpellInfo
 
static constexpr Duration SPELL_FAILURE_RECOVERY_TIME_ON_CURSE = 100_ticks
 

Function Documentation

◆ initSpellSprite()

static void initSpellSprite ( SpriteObject spritePtr,
int  spellLevel,
CharacterSkillMastery  spellMastery,
CastSpellInfo pCastSpell 
)
static

Common initialization of SpriteObject for spell casting

Correct field uType of spritePtr must be set before calling this function because initialization depends on it.

◆ pushCastSpellInfo()

static size_t pushCastSpellInfo ( SpellId  uSpellID,
int  casterIndex,
CombinedSkillValue  skill_level,
SpellCastFlags  uFlags,
int  overrideSoundId 
)
static

Add spell or skill into spell queue. Spells from this queue will be cast in event queue processing.

Original binary offset:
0x00427DA0

◆ pushNPCSpell()

void pushNPCSpell ( SpellId  spell)

Register spell cast by NPC companions.

Parameters
spellSpell id.

◆ pushScrollSpell()

void pushScrollSpell ( SpellId  spell,
int  casterIndex 
)

Register spell cast through scroll.

Parameters
spellSpell id.
casterIndex0-based index of the character casting the spell.

◆ pushSpellOrRangedAttack()

void pushSpellOrRangedAttack ( SpellId  spell,
int  casterIndex,
CombinedSkillValue  skill_value,
SpellCastFlags  flags,
int  overrideSoundId 
)

General function that registers spell or skill implemented through spell casting mechanism to be cast/performed later.

Actual casting will be performed with event queue processing.

If spell is targeted then corresponding target mode is entered and actual casting will be performed after target is picked. Registered targeted spells will have one of the flags listed in ON_CAST_CastingInProgress and this flag will be removed in event queue if correct target is picked.

Original binary offset:
0x0042777D
Parameters
spellSpell id.
casterIndexZero-based index of a character casting the spell.
skill_valueSkill value that the spell is cast with.
flagsSpell flags. Can be empty or have several flags.
overrideSoundId???

◆ pushTempleSpell()

void pushTempleSpell ( SpellId  spell)

Register spell cast on party with temple donation. Temple spells are cast with MASTER mastery of skill level equal to the day of week.

Parameters
spellSpell id.

◆ setSpellRecovery()

static void setSpellRecovery ( CastSpellInfo pCastSpell,
Duration  recoveryTime 
)
static

Set recovery time for spell casting

◆ spellFailed()

static void spellFailed ( CastSpellInfo pCastSpell,
int  error_str_id 
)
static

Notify that spell casting failed.

◆ spellTargetPicked()

void spellTargetPicked ( Pid  targetPid,
int  targetCharacterIndex 
)

Process successful picking target for spell.

Parameters
targetPidPid of the target.
targetCharacterIndex0-based index of the character being targeted by the spell.

Variable Documentation

◆ CAST_SPELL_QUEUE_SIZE

const size_t CAST_SPELL_QUEUE_SIZE = 10
static

◆ pCastSpellInfo

std::array<CastSpellInfo, CAST_SPELL_QUEUE_SIZE> pCastSpellInfo
static

◆ SPELL_FAILURE_RECOVERY_TIME_ON_CURSE

constexpr Duration SPELL_FAILURE_RECOVERY_TIME_ON_CURSE = 100_ticks
staticconstexpr

◆ spell_fx_renderer