23uint32_t __attribute__((no_caller_saved_registers,
28 uint16_t dmg_target, uint32_t damage_amount,
29 uint32_t is_spell_damage,
30 uint32_t is_ranged_damage, uint32_t vry_unknown_6)
43 bool figure_set_new_job =
false;
44 if (check_spells_before_job)
46 uint16_t spell_job_start_node =
49 uint16_t current_list_size = 0;
51 uint32_t ids_by_phase[
COUNT][799];
52 size_t sizes_by_phase[
COUNT] = {0};
54 while (spell_job_start_node != 0)
56 uint16_t spell_index =
59 uint16_t spell_line_id =
73 ids_by_phase[phase][sizes_by_phase[phase]++] =
74 (spell_index << 0x10) | spell_line_id;
78 spell_job_start_node =
80 spell_job_start_node);
87 for (
size_t i = 0; i < sizes_by_phase[phase]; ++i)
89 uint32_t packed_id = ids_by_phase[phase][i];
90 uint16_t spell_line_id = packed_id & 0xffff;
91 uint16_t spell_index = (packed_id >> 0x10);
96 if(spell_damage_func != NULL)
98 damage_amount = spell_damage_func(figureToolbox, dmg_source,
99 dmg_target, damage_amount,
108 sprintf(message,
"Dealing Damage: %d", damage_amount);
110 return damage_amount;
133 asm (
"push 0x1c(%%ebp) \n\t"
134 "push 0x18(%%ebp) \n\t"
135 "push 0x14(%%ebp) \n\t"
136 "push 0x10(%%ebp) \n\t"
137 "push 0x0c(%%ebp) \n\t"
138 "push 0x08(%%ebp) \n\t"
139 "mov -0x26c(%%ebp), %%ecx \n\t"
141 "movw %%ax, 0x10(%%ebp) \n\t"
SpellFunctions * spellAPI
FigureFunctions * figureAPI
ToolboxFunctions * toolboxAPI
uint32_t g_damage_return_addr
uint32_t sf_deal_damage(SF_CGdFigureToolbox *figureToolbox, uint16_t dmg_source, uint16_t dmg_target, uint32_t damage_amount, uint32_t is_spell_damage, uint32_t is_ranged_damage, uint32_t vry_unknown_6)
void sf_damage_hook()
Hook function for damage handling in the game. This function intercepts the call to deal damage and r...
void log_error(const char *message)
Group of Structures and Enums used throught SFSF.
@ F_CHECK_SPELLS_BEFORE_JOB
uint16_t(__thiscall * damage_handler_ptr)(SF_CGdFigureToolbox *_toolbox, uint16_t source, uint16_t target, uint16_t current_damage, uint16_t is_spell_damage, uint32_t is_ranged_damage, uint16_t spell_id)
damage_handler_ptr get_spell_damage(const uint16_t spell_line_id, SpellDamagePhase phase)
getSpellLine_ptr getSpellLine
Retrieves the spell type ID of a given spell.
getSpellID_ptr getSpellID
Retrieves the Spell Effect ID for a given spell index. The spell effect ID can be used to obtain spel...