From 570ee21f52fe5b9fae1bac1644b86f103a6d052c 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 21bad82b9..75abb65bf 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -3545,6 +3545,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); @@ -3558,14 +3564,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 }