diff --git a/src/r_draw8.c b/src/r_draw8.c
index 9f5ab62cd11a06d5fd7d0807b2e6a4f3177bf9c0..39585f58798dcd6ebd39cdd87d07f1acb90247a6 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;