From dff15fa678ae2c266770956bb3c9a2608f093a1c Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Sun, 31 Jul 2022 15:12:59 +0200 Subject: [PATCH] Fix equation slopes overflow --- src/p_slopes.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/p_slopes.c b/src/p_slopes.c index 7fa51452e..6048f478d 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -94,10 +94,14 @@ static void ReconfigureViaVertexes (pslope_t *slope, const vector3_t v1, const v static void ReconfigureViaConstants (pslope_t *slope, const fixed_t a, const fixed_t b, const fixed_t c, const fixed_t d) { fixed_t m; + fixed_t o = 0; vector3_t *normal = &slope->normal; + if (c) + o = abs(c) <= FRACUNIT ? -FixedMul(d, FixedDiv(FRACUNIT, c)) : -FixedDiv(d, c); + // Set origin. - FV3_Load(&slope->o, 0, 0, c ? -FixedDiv(d, c) : 0); + FV3_Load(&slope->o, 0, 0, o); // Get slope's normal. FV3_Load(normal, a, b, c);