From c0847a55f70bd1eb9c8e519caeb4df2ccfda25c0 Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Thu, 23 Jul 2020 21:54:59 -0300 Subject: [PATCH] Fix thick sides sometimes drawing over the floors and ceilings --- src/r_segs.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index 8fa3152d3..265074498 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -1642,6 +1642,9 @@ static void R_RenderSegLoop (void) } else { + INT16 topclip = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1; + INT16 bottomclip = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight; + // two sided line if (toptexture) { @@ -1673,10 +1676,13 @@ static void R_RenderSegLoop (void) ceilingclip[rw_x] = -1; } else if (!rw_ceilingmarked) - ceilingclip[rw_x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1; + ceilingclip[rw_x] = topclip; } else if (markceiling && (!rw_ceilingmarked)) // no top wall - ceilingclip[rw_x] = (yl >= 0) ? ((yl > viewheight) ? (INT16)viewheight : (INT16)((INT16)yl - 1)) : -1; + ceilingclip[rw_x] = topclip; + + // Lactozilla: Set thick side ceiling clip + rw_thickceilingclip[rw_x] = topclip; if (bottomtexture) { @@ -1710,10 +1716,13 @@ static void R_RenderSegLoop (void) floorclip[rw_x] = (INT16)viewheight; } else if (!rw_floormarked) - floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight; + floorclip[rw_x] = bottomclip; } else if (markfloor && (!rw_floormarked)) // no bottom wall - floorclip[rw_x] = (yh < viewheight) ? ((yh < -1) ? -1 : (INT16)((INT16)yh + 1)) : (INT16)viewheight; + floorclip[rw_x] = bottomclip; + + // Lactozilla: Set thick side floor clip + rw_thickfloorclip[rw_x] = bottomclip; } if (maskedtexture || numthicksides)