Spellforce-Spell-framework
Loading...
Searching...
No Matches
sf_spellend_registry.cpp
Go to the documentation of this file.
1
6
7#include <iostream>
8#include <map>
9#include <cstdint>
10
11static std::map<uint16_t, handler_ptr> s_spellend_handler_map;
12
13void registerSpellEndHandler(uint16_t spell_line, handler_ptr handler)
14{
15 auto check = s_spellend_handler_map.find(spell_line);
16 if (check != s_spellend_handler_map.end())
17 {
18 char message[256];
19 sprintf(message,
20 "%s (v%s) has replaced an End Handler [%d] (Was this on purpose?)",
21 g_current_mod->mod_id, g_current_mod->mod_version, spell_line);
23 }
24
25 s_spellend_handler_map[spell_line] = handler;
26}
27
28handler_ptr get_spell_end(uint16_t spell_line)
29{
30 auto it = s_spellend_handler_map.find(spell_line);
31 if (it == s_spellend_handler_map.end())
32 {
33 // Element doesn't exist, insert the default value
34 /* char message[256];
35 sprintf(message, "Unknown Spell Line [%d] for Spell End Effect, Assigning a default handler.", spell_line);
36 log_warning(message);*/
37 it = s_spellend_handler_map.emplace(spell_line, &default_end_handler).first;
38 }
39 return it->second;
40}
41
43{
44 // As we define ALL of the end handlers ourself inside sf_spellend_handlers.cpp, we do NOT need to initialize them here. (unlike sf_spelleffect_registry.cpp)
45
46 // Basic Spells that use OnSpellRemove and the default handlers
56 registerSpellEndHandler(0x63, &suffocation_end_handler); // 99 and 100 in ghidra switch case respectivly
70 registerSpellEndHandler(0xc7, &mutation_end_handler); // 199 in ghidra switch case
74
75 // invulnerability, illuminate, remediless, unkn (85) and demoralization
81
82 // Freeze, Petrify
85
87
88 // Fireshield, Fiegn Death and Manashield
92
93 // Next block in switch
100
104
105 // Goto section in switch
134
138
139 // Case 0x48 (FUN_007b410) -> break;
140 // Case 0x4f (FUN_007b360) -> break;
141}
void log_warning_level(DebugLevel level, const char *format,...)
Logs a warning that is only shown once the log level reaches level.
@ kGdSpellLineDarknessArea
@ kGdSpellLineChainFireburst
@ kGdSpellLineSlowness
@ kGdSpellLineAcidCloud
@ kGdSpellLineHypnotizeArea
@ kGdSpellLineChainHallow
@ kGdSpellLineStoneRain
@ kGdSpellLineChainShock
@ kGdSpellLinePetrify
@ kGdSpellLinePlagueArea
@ kGdSpellLineChainRockBullet
@ kGdSpellLineConfuseArea
@ kGdSpellLineDecayArea
@ kGdSpellLineFlexibilityArea
@ kGdSpellLineChainPain
@ kGdSpellLineChainMutation
@ kGdSpellLineChainIceburst
@ kGdSpellLineRainOfFire
@ kGdSpellLineBlizzard
@ kGdSpellLineInflexibilityArea
@ kGdSpellLineQuicknessArea
@ kGdSpellLineFreezeArea
@ kGdSpellLineSlownessArea
@ kGdSpellLineFireResistance
@ kGdSpellLineChainLifetap
@ kGdSpellLineChainFireball
@ kGdSpellLineFreeze
@ kGdSpellLineChainManatap
@ kGdSpellLineWeakenArea
@ kGdSpellLineChainCharm
@ kGdSpellLineStrengthenArea
SFMod * g_current_mod
void __thiscall inablility_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_done(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall chill_resistance_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall melt_resistance_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall black_almightness_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall edurance_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall fast_fighting_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall eternity_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall dexterity_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall mutation_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall white_almightness_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall default_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_check_battle(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_check_unfreeze2(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_job_battle_check2(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_unfreeze(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall strength_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall weaken_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall enlightenment_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall fog_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall inflexibility_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall decay1_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall charisma_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall suffocation_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall brilliance_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall quickness_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_check_unfreeze(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall slow_fighting_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall slowness_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall clay_feet_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall flexibility_end_handler(SF_CGdSpell *_this, uint16_t spell_index)
void __thiscall common_handler_job_battle_check(SF_CGdSpell *_this, uint16_t spell_index)
handler_ptr get_spell_end(uint16_t spell_line)
void registerSpellEndHandler(uint16_t spell_line, handler_ptr handler)
void register_vanilla_spell_end_handlers()
void(__thiscall * handler_ptr)(SF_CGdSpell *, uint16_t)
Definition sfsf.h:30