Always use R_DrawRepeatMaskedColumn and R_DrawRepeatFlippedMaskedColumn

This commit is contained in:
Lactozilla 2024-02-24 13:56:47 -03:00
parent 66234d093c
commit a2355fc01e
2 changed files with 19 additions and 27 deletions

View file

@ -741,25 +741,10 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
// Texture must be cached // Texture must be cached
R_CheckTextureCache(texnum); R_CheckTextureCache(texnum);
if (dc_numlights)
{
// If there is a lightlist we can simply use either R_DrawMaskedColumn or R_DrawFlippedMaskedColumn
// since windowtop and windowbottom are used
if (textures[texnum]->flip & 2) // vertically flipped?
colfunc_2s = R_DrawFlippedMaskedColumn;
else
colfunc_2s = R_DrawMaskedColumn;
}
else
{
// If there is no light list, windowtop and windowbottom are not used,
// so R_DrawMaskedColumn or R_DrawFlippedMaskedColumn need to be called
// multiple times for a single column.
if (textures[texnum]->flip & 2) // vertically flipped? if (textures[texnum]->flip & 2) // vertically flipped?
colfunc_2s = R_DrawRepeatFlippedMaskedColumn; colfunc_2s = R_DrawRepeatFlippedMaskedColumn;
else else
colfunc_2s = R_DrawRepeatMaskedColumn; colfunc_2s = R_DrawRepeatMaskedColumn;
}
lengthcol = textures[texnum]->height; lengthcol = textures[texnum]->height;
@ -804,6 +789,8 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
else if (bottom_frac > (INT64)CLAMPMIN) sprbotscreen = windowbottom = (fixed_t)bottom_frac; else if (bottom_frac > (INT64)CLAMPMIN) sprbotscreen = windowbottom = (fixed_t)bottom_frac;
else sprbotscreen = windowbottom = CLAMPMIN; else sprbotscreen = windowbottom = CLAMPMIN;
fixed_t bottomclip = sprbotscreen;
top_frac += top_step; top_frac += top_step;
bottom_frac += bottom_step; bottom_frac += bottom_step;
@ -909,14 +896,14 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
if (lighteffect) if (lighteffect)
dc_colormap = rlight->rcolormap; dc_colormap = rlight->rcolormap;
if (solid && windowtop < bheight) if (solid && windowtop < bheight)
windowtop = bheight; sprtopscreen = windowtop = bheight;
continue; continue;
} }
windowbottom = height; sprbotscreen = windowbottom = height;
if (windowbottom >= sprbotscreen) if (windowbottom >= bottomclip)
{ {
windowbottom = sprbotscreen; sprbotscreen = windowbottom = bottomclip;
// draw the texture // draw the texture
colfunc_2s (col, lengthcol); colfunc_2s (col, lengthcol);
for (i++; i < dc_numlights; i++) for (i++; i < dc_numlights; i++)
@ -934,10 +921,11 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor)
windowtop = bheight; windowtop = bheight;
else else
windowtop = windowbottom + 1; windowtop = windowbottom + 1;
sprtopscreen = windowtop;
if (lighteffect) if (lighteffect)
dc_colormap = rlight->rcolormap; dc_colormap = rlight->rcolormap;
} }
windowbottom = sprbotscreen; sprbotscreen = windowbottom = bottomclip;
// draw the texture, if there is any space left // draw the texture, if there is any space left
if (windowtop < windowbottom) if (windowtop < windowbottom)
colfunc_2s (col, lengthcol); colfunc_2s (col, lengthcol);

View file

@ -628,7 +628,9 @@ void R_DrawMaskedColumn(column_t *column, unsigned lengthcol)
if (windowtop != INT32_MAX && windowbottom != INT32_MAX) if (windowtop != INT32_MAX && windowbottom != INT32_MAX)
{ {
if (windowtop > topscreen)
dc_yl = (windowtop + FRACUNIT - 1)>>FRACBITS; dc_yl = (windowtop + FRACUNIT - 1)>>FRACBITS;
if (windowbottom < bottomscreen)
dc_yh = (windowbottom - 1)>>FRACBITS; dc_yh = (windowbottom - 1)>>FRACBITS;
} }
@ -679,7 +681,9 @@ void R_DrawFlippedMaskedColumn(column_t *column, unsigned lengthcol)
if (windowtop != INT32_MAX && windowbottom != INT32_MAX) if (windowtop != INT32_MAX && windowbottom != INT32_MAX)
{ {
if (windowtop > topscreen)
dc_yl = (windowtop + FRACUNIT - 1)>>FRACBITS; dc_yl = (windowtop + FRACUNIT - 1)>>FRACBITS;
if (windowbottom < bottomscreen)
dc_yh = (windowbottom - 1)>>FRACBITS; dc_yh = (windowbottom - 1)>>FRACBITS;
} }