From da0f8fa98f2049f049c45af25fc2765a8674f0ff Mon Sep 17 00:00:00 2001 From: NepDisk Date: Mon, 10 Feb 2025 00:52:18 -0500 Subject: [PATCH] Fix equation slopes breaking with slopes farther than 32k FU away from the map center https://git.do.srb2.org/STJr/SRB2/-/merge_requests/2397 --- src/p_slopes.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index f0738e535..22571b188 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -894,10 +894,11 @@ void P_InitSlopes(void) // Returns the height of the sloped plane at (x, y) as a fixed_t fixed_t P_GetSlopeZAt(const pslope_t *slope, fixed_t x, fixed_t y) { - fixed_t dist = FixedMul(x - slope->o.x, slope->d.x) + - FixedMul(y - slope->o.y, slope->d.y); + fixed_t dist = FixedMul(x - slope->o.x, slope->d.x) / 2 + + FixedMul(y - slope->o.y, slope->d.y) / 2; - return slope->o.z + FixedMul(dist, slope->zdelta); + + return slope->o.z + FixedMul(dist, slope->zdelta) * 2; } // Like P_GetSlopeZAt but falls back to z if slope is NULL