From 7521b3abd27fa100177fdf6ff43fb0f485129f8b Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 30 May 2026 05:33:35 +0200 Subject: [PATCH] tiny optimize PIT_RadiusAttack in some cases by checking simpler things before distance checks which may avoid two P_AproxDistance/FixedHypot calls --- src/p_map.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index 1befc4933..ee013a2ab 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3544,6 +3544,12 @@ static boolean PIT_RadiusAttack(mobj_t *thing) if (thing->flags & MF_MONITOR) return true; + if (thing->floorz > bombspot->z && bombspot->ceilingz < thing->z) + return true; + + if (thing->ceilingz < bombspot->z && bombspot->floorz > thing->z) + return true; + dx = abs(thing->x - bombspot->x); dy = abs(thing->y - bombspot->y); dz = abs(thing->z + (thing->height>>1) - bombspot->z); @@ -3557,14 +3563,9 @@ static boolean PIT_RadiusAttack(mobj_t *thing) if (dist >= bombdamage) return true; // out of range - if (thing->floorz > bombspot->z && bombspot->ceilingz < thing->z) - return true; - - if (thing->ceilingz < bombspot->z && bombspot->floorz > thing->z) - return true; - + // must be in direct path if (P_CheckSight(thing, bombspot)) - { // must be in direct path + { P_DamageMobj(thing, bombspot, bombsource, 1); // Tails 01-11-2001 }