Stash changes

This commit is contained in:
Arthur 2024-02-16 11:46:37 -05:00
parent 398b5a1840
commit 5e29cd84a2
3 changed files with 12 additions and 10 deletions

View file

@ -3280,13 +3280,21 @@ static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, IN
}
//
// P_PlayerCanHurtPlayer
// P_CanPlayerHurtPlayer
//
// Is it permissible for a player to hurt another player?
// This should be the definitive global function to determine if pain is allowed. :)
//
boolean P_PlayerCanHurtPlayer(player_t *target, mobj_t *inflictor, player_t *source, UINT8 damagetype)
boolean P_CanPlayerHurtPlayer(player_t *target, mobj_t *inflictor, player_t *source, UINT8 damagetype)
{
I_Assert(target != NULL);
I_Assert(source != NULL);
I_Assert(inflictor != NULL);
// MT_LHRT should return true here, because we want it to go through the 'damage' process
if (inflictor->type == MT_LHRT)
return true;
if (!(damagetype & DMG_CANHURTSELF))
{
// You can't kill yourself, idiot...
@ -3319,9 +3327,6 @@ boolean P_PlayerCanHurtPlayer(player_t *target, mobj_t *inflictor, player_t *sou
if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) && (target->pflags & PF_TAGIT) == (source->pflags & PF_TAGIT))
return false;
if (inflictor->type == MT_LHRT)
return false;
return true;
}
else if (damagetype & DMG_CANHURTSELF)
@ -3334,9 +3339,6 @@ boolean P_PlayerCanHurtPlayer(player_t *target, mobj_t *inflictor, player_t *sou
return false;
}
if (inflictor->type == MT_LHRT)
return false;
return true;
}

View file

@ -506,7 +506,7 @@ void P_RemoveShield(player_t *player);
void P_SpecialStageDamage(player_t *player, mobj_t *inflictor, mobj_t *source);
boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype);
void P_KillMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, UINT8 damagetype);
boolean P_PlayerCanHurtPlayer(player_t *target, mobj_t *inflictor, player_t *source, UINT8 damagetype);
boolean P_CanPlayerHurtPlayer(player_t *target, mobj_t *inflictor, player_t *source, UINT8 damagetype);
void P_PlayerRingBurst(player_t *player, INT32 num_rings); /// \todo better fit in p_user.c
void P_PlayerWeaponPanelBurst(player_t *player);
void P_PlayerWeaponAmmoBurst(player_t *player);

View file

@ -1279,7 +1279,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing)
if (tmthing->type != MT_SHELL && tmthing->target && tmthing->target->type == thing->type)
{
// Don't hit yourself, and if a player, don't hit bots
if (thing->player && tmthing->target->player && !P_PlayerCanHurtPlayer(thing->player, tmthing, tmthing->target->player, 0))
if (thing->player && tmthing->target->player && !P_CanPlayerHurtPlayer(thing->player, tmthing, tmthing->target->player, 0))
return CHECKTHING_IGNORE;
if (thing->type != MT_PLAYER)