Spellforce-Spell-framework
Loading...
Searching...
No Matches
Damage Hook
Collaboration diagram for Damage Hook:

Functions

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 redirects it to a custom implementation while preserving the original behavior.
 

Variables

uint32_t g_damage_return_addr
 

Detailed Description

Function Documentation

◆ sf_damage_hook()

void sf_damage_hook ( )

Hook function for damage handling in the game. This function intercepts the call to deal damage and redirects it to a custom implementation while preserving the original behavior.

Note
This is a naked function, meaning it does not have standard prologue/epilogue generated by the compiler. All stack management and register saving/restoring must be handled manually in assembly.
  • Pushes arguments from the stack for sf_deal_damage.
  • Sets up the ECX register to the appropriate value.
  • Calls sf_deal_damage.
  • Modifies a value in the stack based on the result.
  • Jumps back to the original return address stored in g_damage_return_addr.
Warning
This function is architecture-dependent (x86) and may not work on other platforms.

Definition at line 131 of file sf_damage_hook.c.

Here is the call graph for this function:

◆ sf_deal_damage()

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 )

Definition at line 24 of file sf_damage_hook.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ g_damage_return_addr

uint32_t g_damage_return_addr

Definition at line 21 of file sf_damage_hook.c.