mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-03-12 22:26:43 +00:00
Count nullHitlag for inflictor player too
Cancel hitlag of inflictor player too if the inflictor is a constant damage source and the target is invincible.
This commit is contained in:
parent
b2a6ffecf9
commit
622bfa9512
2 changed files with 13 additions and 3 deletions
|
|
@ -641,8 +641,10 @@ struct player_t
|
|||
|
||||
INT16 lastsidehit, lastlinehit;
|
||||
|
||||
// These track how many things tried to damage you, not
|
||||
// whether you actually took damage.
|
||||
// TimesHit tracks how many times something tried to
|
||||
// damage you or how many times you tried to damage
|
||||
// something else. It does not track whether damage was
|
||||
// actually dealt.
|
||||
UINT8 timeshit; // times hit this tic
|
||||
UINT8 timeshitprev; // times hit before
|
||||
// That's TIMES HIT, not TIME SHIT, you doofus! -- in memoriam
|
||||
|
|
|
|||
|
|
@ -2060,6 +2060,7 @@ static void AddNullHitlag(player_t *player, tic_t oldHitlag)
|
|||
boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype)
|
||||
{
|
||||
player_t *player;
|
||||
player_t *playerInflictor;
|
||||
boolean force = false;
|
||||
|
||||
INT32 laglength = 6;
|
||||
|
|
@ -2138,10 +2139,15 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
}
|
||||
|
||||
player = target->player;
|
||||
playerInflictor = inflictor ? inflictor->player : NULL;
|
||||
|
||||
if (playerInflictor)
|
||||
{
|
||||
AddTimesHit(playerInflictor);
|
||||
}
|
||||
|
||||
if (player) // Player is the target
|
||||
{
|
||||
|
||||
AddTimesHit(player);
|
||||
|
||||
if (player->pflags & PF_GODMODE)
|
||||
|
|
@ -2208,11 +2214,13 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
|
|||
if (invincible && type != DMG_STUMBLE)
|
||||
{
|
||||
const INT32 oldHitlag = target->hitlag;
|
||||
const INT32 oldHitlagInflictor = inflictor ? inflictor->hitlag : 0;
|
||||
|
||||
laglength = max(laglength / 2, 1);
|
||||
K_SetHitLagForObjects(target, inflictor, laglength, false);
|
||||
|
||||
AddNullHitlag(player, oldHitlag);
|
||||
AddNullHitlag(playerInflictor, oldHitlagInflictor);
|
||||
|
||||
if (player->timeshit > player->timeshitprev)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue