From dc765cde2c2d72d63b89cbd5e7154dbfacfe5350 Mon Sep 17 00:00:00 2001
From: Monster Iestyn <iestynjealous@ntlworld.com>
Date: Sun, 24 Jul 2016 18:54:01 +0100
Subject: [PATCH] Fix R_DrawColumnShadowed_8 crash encountered in FuriousFox's
 map

If you want more specifics, sloped FOFs are to blame it turns out: sometimes the bottom of an FOF wall blocking a segment of an in-level wall column can be considered ABOVE the top part of the FOF there (yikes), and then the dc_y* values go offscreen, and then BOOM
---
 src/r_draw8.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/r_draw8.c b/src/r_draw8.c
index 9f5ab62cd1..39585f5879 100644
--- a/src/r_draw8.c
+++ b/src/r_draw8.c
@@ -1363,7 +1363,19 @@ void R_DrawColumnShadowed_8(void)
 
 		height = dc_lightlist[i].height >> LIGHTSCALESHIFT;
 		if (solid)
+		{
 			bheight = dc_lightlist[i].botheight >> LIGHTSCALESHIFT;
+			if (bheight < height)
+			{
+				// confounded slopes sometimes allow partial invertedness,
+				// even including cases where the top and bottom heights
+				// should actually be the same!
+				// swap the height values as a workaround for this quirk
+				INT32 temp = height;
+				height = bheight;
+				bheight = temp;
+			}
+		}
 		if (height <= dc_yl)
 		{
 			dc_colormap = dc_lightlist[i].rcolormap;
-- 
GitLab