From 8a00b47b38903a2f004f193853cba26684d0a098 Mon Sep 17 00:00:00 2001
From: Snu <coolzach5@gmail.com>
Date: Wed, 30 Sep 2020 08:40:21 +0100
Subject: [PATCH] Make the function ACTUALLY work

---
 src/p_map.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/p_map.c b/src/p_map.c
index d26b1707d3..c2e0284725 100644
--- a/src/p_map.c
+++ b/src/p_map.c
@@ -5024,9 +5024,9 @@ fixed_t P_CeilingzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
 
 			if (rover->flags & FF_QUICKSAND)
 			{
-				if (z < topheight && bottomheight < thingtop)
+				if (thingtop > bottomheight && topheight > z)
 				{
-					if (ceilingz < z)
+					if (ceilingz > z)
 						ceilingz = z;
 				}
 				continue;
@@ -5034,7 +5034,7 @@ fixed_t P_CeilingzAtPos(fixed_t x, fixed_t y, fixed_t z, fixed_t height)
 
 			delta1 = z - (bottomheight + ((topheight - bottomheight)/2));
 			delta2 = thingtop - (bottomheight + ((topheight - bottomheight)/2));
-			if (bottomheight > ceilingz && abs(delta1) < abs(delta2))
+			if (bottomheight < ceilingz && abs(delta1) > abs(delta2))
 				ceilingz = bottomheight;
 		}
 	}
-- 
GitLab