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?)",
22 log_warning(message);
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,
38 &default_end_handler).first;
39 }
40 return it->second;
41}
42
44{
45 // 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)
46
47 // Basic Spells that use OnSpellRemove and the default handlers
57 registerSpellEndHandler(0x63, &suffocation_end_handler); // 99 and 100 in ghidra switch case respectivly
71 registerSpellEndHandler(0xc7, &mutation_end_handler); // 199 in ghidra switch case
75
76 // invulnerability, illuminate, remediless, unkn (85) and demoralization
82
83 // Freeze, Petrify
86
88
89 // Fireshield, Fiegn Death and Manashield
93
94 // Next block in switch
101
105
106 // Goto section in switch
123 registerSpellEndHandler(0xc8, &common_handler_done); // 200 in ghidra switch case
135
139
140 // Case 0x48 (FUN_007b410) -> break;
141 // Case 0x4f (FUN_007b360) -> break;
142}
void log_warning(const char *message)
Definition sf_wrappers.c:81
SFMod * g_current_mod
void(__thiscall * handler_ptr)(SF_CGdSpell *, uint16_t)
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()
char mod_id[64]
char mod_version[24]