dsekai
World engine for retrocomputers.
Loading...
Searching...
No Matches
Macros
Mobile MP/HP

Details of how the MOBILE::mp_hp field works. More...

Collaboration diagram for Mobile MP/HP:

Macros

#define MOBILE_HP_MASK   0x00ff
 Bitmask denoting half of MOBILE::mp_hp devoted to MP.
 
#define MOBILE_MP_MASK   0xff00
 Bitmask denoting half of MOBILE::mp_hp devoted to HP.
 
#define MOBILE_HP_DEATH   -10
 Value to set MOBILE::hp to on death but before deactivation.
 

Detailed Description

Details of how the MOBILE::mp_hp field works.

dsekai_mobiles_mp_hp

Access and Modification

These fields are combined to save space in an expected 16-bit struct alignment.

Use mobile_incr_hp() to modify.

Death Handling

Death occurs when the HP half reaches 0.

This value should be set to MOBILE_HP_DEATH on this mobile's death blow. From there, the engine will increment it up to its final value, -1, where the mobile will be deleted.

This allows for a relatively simple "blinking" death animation to occur by hiding frames for mobiles on negative even HP values.