From 86eda4f35896a18c0c76dcc89d675c06d75895f6 Mon Sep 17 00:00:00 2001 From: Indev Date: Wed, 3 Sep 2025 18:51:35 +0300 Subject: [PATCH] Revert "wonky: cache and reuse our testpoint subsector for sloped mobj z checks" This reverts commit 6f93299aaf1a28353759a508e799e7b188dfa9a6. --- src/p_mobj.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 4813ad1e1..6f538dee9 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -572,8 +572,6 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t if (sector->f_slope) { fixed_t testx, testy; - static fixed_t oldtestx = 0, oldtesty = 0; - static subsector_t *subsec = NULL; pslope_t *slope = sector->f_slope; // Get the corner of the object that should be the highest on the slope @@ -596,14 +594,8 @@ fixed_t P_MobjFloorZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed_t testx += x; testy += y; - if (oldtestx != testx || oldtesty != testy) - subsec = R_PointInSubsector(testx, testy); - - oldtestx = testx; - oldtesty = testy; - // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (subsec->sector == (boundsec ? boundsec : sector)) + if (R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector)) return P_GetSlopeZAt(slope, testx, testy); // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point @@ -667,8 +659,6 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed if (sector->c_slope) { fixed_t testx, testy; - static fixed_t oldtestx = 0, oldtesty = 0; - static subsector_t *subsec = NULL; pslope_t *slope = sector->c_slope; // Get the corner of the object that should be the highest on the slope @@ -691,14 +681,8 @@ fixed_t P_MobjCeilingZ(mobj_t *mobj, sector_t *sector, sector_t *boundsec, fixed testx += x; testy += y; - if (oldtestx != testx || oldtesty != testy) - subsec = R_PointInSubsector(testx, testy); - - oldtestx = testx; - oldtesty = testy; - // If the highest point is in the sector, then we have it easy! Just get the Z at that point - if (subsec->sector == (boundsec ? boundsec : sector)) + if (R_PointInSubsector(testx, testy)->sector == (boundsec ? boundsec : sector)) return P_GetSlopeZAt(slope, testx, testy); // If boundsec is set, we're looking for specials. In that case, iterate over every line in this sector to find the TRUE highest/lowest point