From 5d2aebc269acdba74996eeec22405bb10632670d Mon Sep 17 00:00:00 2001 From: Alug Date: Fri, 4 Apr 2025 00:28:16 +0200 Subject: [PATCH] fix oopsie in R_Render2sidedMultiPatchColumn --- src/r_segs.c | 7 +++---- src/r_things.c | 8 ++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/r_segs.c b/src/r_segs.c index e3f464ab8..41d22e56d 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -248,14 +248,13 @@ static void R_DrawWallSplats(void) // way we don't have to store extra post_t info with each column for // multi-patch textures. They are not normally needed as multi-patch // textures don't have holes in it. At least not for now. -static INT32 column2s_length; // column->length : for multi-patch on 2sided wall = texture->height static void R_Render2sidedMultiPatchColumn(column_t *column) { INT32 topscreen, bottomscreen; topscreen = sprtopscreen; // + spryscale*column->topdelta; topdelta is 0 for the wall - bottomscreen = topscreen + spryscale * column2s_length; + bottomscreen = topscreen + spryscale * lengthcol; dc_yl = (sprtopscreen+FRACUNIT-1)>>FRACBITS; dc_yh = (bottomscreen-1)>>FRACBITS; @@ -388,7 +387,7 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) else { colfunc_2s = R_Render2sidedMultiPatchColumn; // render multipatch with no holes (no post_t info) - column2s_length = textures[texnum]->height; + lengthcol = textures[texnum]->height; } // Setup lighting based on the presence/lack-of 3D floors. @@ -959,7 +958,7 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) else { colfunc_2s = R_Render2sidedMultiPatchColumn; //render multipatch with no holes (no post_t info) - column2s_length = textures[texnum]->height; + lengthcol = textures[texnum]->height; } // Set heights according to plane, or slope, whichever diff --git a/src/r_things.c b/src/r_things.c index 4ee2dfad3..00ab3d45d 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -689,13 +689,13 @@ static void R_DrawFlippedMaskedColumn(column_t *column) dc_yl = mceilingclip[dc_x]+1; if (dc_yl < 0) dc_yl = 0; - if (dc_yh >= vid.height) + if (dc_yh >= vid.height) // dc_yl must be < vid.height, so reduces number of checks in tight loop dc_yh = vid.height - 1; if (dc_yl <= dc_yh && dc_yh > 0 && column->length != 0) { dc_source = ZZ_Alloc(column->length); - dc_sourcelength = column->length; + dc_sourcelength = dc_texheight = column->length; for (s = (UINT8 *)column+2+column->length, d = dc_source; d < dc_source+column->length; --s) *d++ = *s; @@ -704,6 +704,10 @@ static void R_DrawFlippedMaskedColumn(column_t *column) // Still drawn by R_DrawColumn. if (ylookup[dc_yl]) colfunc(); +#ifdef PARANOIA + else + I_Error("R_DrawMaskedColumn: Invalid ylookup for dc_yl %d", dc_yl); +#endif Z_Free(dc_source); } column = (column_t *)((UINT8 *)column + column->length + 4);