From 9a75ef18c388b7e5d1aab13c201695944153945a Mon Sep 17 00:00:00 2001 From: Arthur <spaddlewit@gmail.com> Date: Sat, 17 Feb 2024 10:04:34 -0500 Subject: [PATCH] Sometimes simple is better..? --- src/p_inter.c | 63 --------------------------------------------------- src/p_local.h | 1 - src/p_map.c | 2 +- 3 files changed, 1 insertion(+), 65 deletions(-) diff --git a/src/p_inter.c b/src/p_inter.c index 77604208fb..82169bc543 100644 --- a/src/p_inter.c +++ b/src/p_inter.c @@ -3279,69 +3279,6 @@ static boolean P_TagDamage(mobj_t *target, mobj_t *inflictor, mobj_t *source, IN return true; } -// -// 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_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... - if (source == target) - return false; - - // In COOP/RACE, you can't hurt other players unless cv_friendlyfire is on - if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && (gametyperules & GTR_FRIENDLY)) - return false; - } - - // Tag handling - if (G_TagGametype()) - { - // If flashing or invulnerable, ignore the tag, - if (target->powers[pw_flashing] || target->powers[pw_invulnerability]) - return false; - - // Don't allow any damage before the round starts. - if (leveltime <= hidetime * TICRATE) - return false; - - // Ignore IT players shooting each other, unless friendlyfire is on. - if ((target->pflags & PF_TAGIT && !((cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) - && source->pflags & PF_TAGIT))) - return false; - - // Don't allow players on the same team to hurt one another, - // unless cv_friendlyfire is on. - if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE) || (damagetype & DMG_CANHURTSELF)) && (target->pflags & PF_TAGIT) == (source->pflags & PF_TAGIT)) - return false; - - return true; - } - else if (damagetype & DMG_CANHURTSELF) - return true; - else if (G_GametypeHasTeams()) // CTF + Team Match - { - // Don't allow players on the same team to hurt one another, - // unless cv_friendlyfire is on. - if (!(cv_friendlyfire.value || (gametyperules & GTR_FRIENDLYFIRE)) && target->ctfteam == source->ctfteam) - return false; - } - - return true; -} - static boolean P_PlayerHitsPlayer(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 damage, UINT8 damagetype) { player_t *player = target->player; diff --git a/src/p_local.h b/src/p_local.h index 136b7df286..9644e7a244 100644 --- a/src/p_local.h +++ b/src/p_local.h @@ -506,7 +506,6 @@ 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_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 d4083cfd7f..32428208b9 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -1280,7 +1280,7 @@ static unsigned PIT_DoCheckThing(mobj_t *thing) { // Don't hit yourself, and if a player, don't hit bots if (thing == tmthing->target - || (thing->player && tmthing->target->player && !P_CanPlayerHurtPlayer(thing->player, tmthing, tmthing->target->player, 0))) + || (thing->player && tmthing->target->player && (thing->player->bot == BOT_2PAI || thing->player->bot == BOT_2PHUMAN))) return CHECKTHING_IGNORE; if (thing->type != MT_PLAYER) -- GitLab