diff --git a/src/p_inter.c b/src/p_inter.c index afcdd5217..77604208f 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -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; } diff --git a/src/p_local.h b/src/p_local.h index d4b32b005..136b7df28 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -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); diff --git a/src/p_map.c b/src/p_map.c index cdd66a12d..b18f0d1c1 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -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)