From df7c8482e494bfab3864ecf0b7ee029a5c92685e Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Mon, 29 Aug 2016 23:21:57 +0100
Subject: [PATCH] If NOT skewing FOF walls, make sure dc_texturemid reverts to
 using unsloped FOF topheight/bottomheight rather than actual left side
 top/bottom heights

---
 src/r_segs.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/r_segs.c b/src/r_segs.c
index 3e525bf336..148d0b8f7e 100644
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -968,45 +968,45 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
 		left_bottom = P_GetZAt(*pfloor->b_slope, ds->leftpos.x, ds->leftpos.y) - viewz;
 	else
 		left_bottom = *pfloor->bottomheight - viewz;
-	dc_texturemid = left_top;
 	skewslope = *pfloor->t_slope; // skew using top slope by default
-#else
-	dc_texturemid = *pfloor->topheight - viewz;
+	if (newline && newline->flags & ML_DONTPEGTOP)
+		slopeskew = true;
+	else if (pfloor->master->flags & ML_DONTPEGTOP)
+		slopeskew = true;
+
+	if (slopeskew)
+		dc_texturemid = left_top;
+	else
 #endif
+	dc_texturemid = *pfloor->topheight - viewz;
 
 	if (newline)
 	{
 		offsetvalue = sides[newline->sidenum[0]].rowoffset;
 		if (newline->flags & ML_DONTPEGBOTTOM)
-#ifdef ESLOPE
 		{
-			dc_texturemid = left_bottom;
-			skewslope = *pfloor->b_slope; // skew using bottom slope
-		}
-#else
-			offsetvalue -= *pfloor->topheight - *pfloor->bottomheight;
-#endif
 #ifdef ESLOPE
-		if (newline->flags & ML_DONTPEGTOP)
-			slopeskew = true;
+			skewslope = *pfloor->b_slope; // skew using bottom slope
+			if (slopeskew)
+				dc_texturemid = left_bottom;
+			else
 #endif
+			offsetvalue -= *pfloor->topheight - *pfloor->bottomheight;
+		}
 	}
 	else
 	{
 		offsetvalue = sides[pfloor->master->sidenum[0]].rowoffset;
 		if (curline->linedef->flags & ML_DONTPEGBOTTOM)
-#ifdef ESLOPE
 		{
-			dc_texturemid = left_bottom;
-			skewslope = *pfloor->b_slope; // skew using bottom slope
-		}
-#else
-			offsetvalue -= *pfloor->topheight - *pfloor->bottomheight;
-#endif
 #ifdef ESLOPE
-		if (pfloor->master->flags & ML_DONTPEGTOP) // use control linedef's flags
-			slopeskew = true;
+			skewslope = *pfloor->b_slope; // skew using bottom slope
+			if (slopeskew)
+				dc_texturemid = left_bottom;
+			else
 #endif
+			offsetvalue -= *pfloor->topheight - *pfloor->bottomheight;
+		}
 	}
 
 #ifdef ESLOPE
-- 
GitLab