Commit 9c9518fd authored by Dino Bollinger's avatar Dino Bollinger Committed by Richard Gobeille
Browse files

Duke3D: Introduce actor event 'EVENT_PREACTORDAMAGE'

This event is executed when an actor runs A_IncurDamage(), and is
placed just before subtracting 'htextra' from 'extra' and updating
the actor's owner (i.e. just before damage is applied to the actor).

For useractors, this normally occurs when ifhitweapon is called.

Set RETURN to a nonzero value to skip applying the damage. This
will also cause the 'ifhitweapon' conditional to skip the branch.
Note that doing so will not automatically reset htextra to 0.
parent 2e5741cc
......@@ -1259,6 +1259,12 @@ int A_IncurDamage(int const spriteNum)
if (pActor->htextra == 0 && STANDALONE_EVAL(false, pActor->htpicnum == SHRINKSPARK) && pSprite->xrepeat < 24)
return -1;
int32_t playerDist;
int playerNum = A_FindPlayer(pSprite, &playerDist);
if (VM_OnEvent(EVENT_PREACTORDAMAGE, spriteNum, playerNum, playerDist, 0))
return -1;
pSprite->extra -= pActor->htextra;
if ((unsigned)pSprite->owner < MAXSPRITES && sprite[pSprite->owner].statnum < MAXSTATUS && STANDALONE_EVAL(true, pSprite->picnum != RECON))
......@@ -165,6 +165,7 @@ enum GameEvent_t {
......@@ -1036,6 +1036,7 @@ const char *EventNames[MAXEVENTS] =
uint8_t *bitptr; // pointer to bitmap of which bytecode positions contain pointers
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment