From 6b0d4af9a0a621336b31ad76ce74de5ea1b50f43 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 4 Feb 2026 10:57:31 -0500 Subject: [PATCH] fix R_MakeSpans accessing spanstart out of bounds when in splitscreen it gets allocated for viewheight not vid.height! --- src/r_plane.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/r_plane.cpp b/src/r_plane.cpp index 11c6e4209..d758e3138 100644 --- a/src/r_plane.cpp +++ b/src/r_plane.cpp @@ -568,14 +568,13 @@ void R_ExpandPlane(visplane_t *pl, INT32 start, INT32 stop) static void R_MakeSpans(void (*mapfunc)(drawspandata_t* ds, void(*spanfunc)(drawspandata_t*), INT32, INT32, INT32, boolean), spandrawfunc_t* spanfunc, drawspandata_t* ds, INT32 x, INT32 t1, INT32 b1, INT32 t2, INT32 b2, boolean allow_parallel) { ZoneScoped; - const INT32 vidheight = vid.height; - const INT32 vidwidth = vid.width; + // Alam: from r_splats's R_RasterizeFloorSplat - if (t1 >= vidheight) t1 = vidheight-1; - if (b1 >= vidheight) b1 = vidheight-1; - if (t2 >= vidheight) t2 = vidheight-1; - if (b2 >= vidheight) b2 = vidheight-1; - if (x-1 >= vidwidth) x = vidwidth; + if (t1 >= viewheight) t1 = viewheight-1; + if (b1 >= viewheight) b1 = viewheight-1; + if (t2 >= viewheight) t2 = viewheight-1; + if (b2 >= viewheight) b2 = viewheight-1; + if (x-1 >= viewwidth) x = viewwidth; // We want to draw N spans per subtask to ensure the work is // coarse enough to not be too slow due to task scheduling overhead.