From 18a2e87093542c95c98ea95b5414f136fce93aee Mon Sep 17 00:00:00 2001
From: James R <justsomejames2@gmail.com>
Date: Mon, 26 Oct 2020 14:00:54 -0700
Subject: [PATCH] Check maxstep is not disabled before stepping up

Fixes infinite step up when it should be no step up.
---
 src/p_map.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/p_map.c b/src/p_map.c
index 0a9107ee54..2715d23776 100644
--- a/src/p_map.c
+++ b/src/p_map.c
@@ -2735,7 +2735,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
 			// Step up
 			if (thing->z < tmfloorz)
 			{
-				if (tmfloorz - thing->z <= maxstep)
+				if (maxstep > 0 && tmfloorz - thing->z <= maxstep)
 				{
 					thing->z = thing->floorz = tmfloorz;
 					thing->floorrover = tmfloorrover;
@@ -2748,7 +2748,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff)
 			}
 			else if (tmceilingz < thingtop)
 			{
-				if (thingtop - tmceilingz <= maxstep)
+				if (maxstep > 0 && thingtop - tmceilingz <= maxstep)
 				{
 					thing->z = ( thing->ceilingz = tmceilingz ) - thing->height;
 					thing->ceilingrover = tmceilingrover;
-- 
GitLab