fix R_MakeSpans accessing spanstart out of bounds when in splitscreen

it gets allocated for viewheight not vid.height!
This commit is contained in:
Alug 2026-02-04 10:57:31 -05:00 committed by NepDisk
parent dfeddbfe86
commit 6b0d4af9a0

View file

@ -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.