From 443e8997594ce5b86d7f31961b91d14729102c90 Mon Sep 17 00:00:00 2001 From: Boondorl Date: Thu, 24 Jul 2025 20:03:44 -0400 Subject: [PATCH] Fixed assert in P_GeometryRadiusAttack Clamp the floor to the ceiling so malformed sectors don't break height checking. --- src/playsim/p_destructible.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/playsim/p_destructible.cpp b/src/playsim/p_destructible.cpp index 8e8b94f18..c569de10e 100644 --- a/src/playsim/p_destructible.cpp +++ b/src/playsim/p_destructible.cpp @@ -548,8 +548,8 @@ void P_GeometryRadiusAttack(AActor* bombspot, AActor* bombsource, int bombdamage double z_top1, z_top2, z_bottom1, z_bottom2; // here, z_top1 is closest to the ceiling, and z_bottom1 is closest to the floor. z_top1 = sector->ceilingplane.ZatPoint(to2d); z_top2 = othersector ? othersector->ceilingplane.ZatPoint(to2d) : z_top1; - z_bottom1 = sector->floorplane.ZatPoint(to2d); - z_bottom2 = othersector ? othersector->floorplane.ZatPoint(to2d) : z_bottom1; + z_bottom1 = min(sector->floorplane.ZatPoint(to2d), z_top1); + z_bottom2 = othersector ? min(othersector->floorplane.ZatPoint(to2d), z_top2) : z_bottom1; DVector3 to3d_fullheight(to2d.X, to2d.Y, clamp(bombspot->Z(), z_bottom1, z_top1)); if (ln->health && P_CheckLinedefVulnerable(ln, sd)) @@ -560,7 +560,7 @@ void P_GeometryRadiusAttack(AActor* bombspot, AActor* bombsource, int bombdamage if (!linefullheight) { z_top2 = othersector->ceilingplane.ZatPoint(to2d); - z_bottom2 = othersector->floorplane.ZatPoint(to2d); + z_bottom2 = min(othersector->floorplane.ZatPoint(to2d), z_top2); double bombz = bombspot->Z(); if (z_top2 > z_top1) z_top2 = z_top1;