mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
R_DrawColumn_Template: fix non-po2 column drawing
- Fix for efd017085
- To preserve tutti-frutti fix, offset drawing with
texheight, but detect po2 with sourcelength
This commit is contained in:
parent
6b831a0fa2
commit
27b4013c18
4 changed files with 8 additions and 20 deletions
|
|
@ -221,24 +221,13 @@ static void R_DrawColumnTemplate(drawcolumndata_t *dc)
|
|||
|
||||
// Inner loop that does the actual texture mapping, e.g. a DDA-like scaling.
|
||||
// This is as fast as it gets.
|
||||
heightmask = dc->texheight-1;
|
||||
if (dc->sourcelength <= 0)
|
||||
{
|
||||
// Note: we need to unconditionally clamp in npow2 draw loop to avoid a CPU branch
|
||||
// This is to just render it effectively the identity function.
|
||||
npow2min = INT32_MIN;
|
||||
npow2max = INT32_MAX;
|
||||
}
|
||||
else
|
||||
{
|
||||
npow2min = -1;
|
||||
npow2max = dc->sourcelength;
|
||||
}
|
||||
heightmask = dc->sourcelength-1;
|
||||
npow2min = -1;
|
||||
npow2max = dc->sourcelength;
|
||||
|
||||
if (dc->texheight & heightmask) // not a power of 2 -- killough
|
||||
if (dc->sourcelength & heightmask) // not a power of 2 -- killough
|
||||
{
|
||||
heightmask++;
|
||||
heightmask <<= FRACBITS;
|
||||
heightmask = dc->texheight << FRACBITS;
|
||||
|
||||
if (frac < 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -707,6 +707,7 @@ static void R_DrawSkyPlane(visplane_t *pl, void(*colfunc)(drawcolumndata_t*), bo
|
|||
dc.texturemid = skytexturemid;
|
||||
dc.texheight = textureheight[skytexture]
|
||||
>>FRACBITS;
|
||||
dc.sourcelength = dc.texheight;
|
||||
|
||||
x = pl->minx;
|
||||
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ static void R_Render2sidedMultiPatchColumn(drawcolumndata_t* dc, column_t *colum
|
|||
if (dc->yl <= dc->yh && dc->yh < vid.height && dc->yh > 0)
|
||||
{
|
||||
dc->source = (UINT8 *)column + 3;
|
||||
dc->sourcelength = 0;
|
||||
dc->sourcelength = lengthcol;
|
||||
if (brightmap != NULL)
|
||||
{
|
||||
dc->brightmap = (UINT8 *)brightmap + 3;
|
||||
|
|
@ -1378,7 +1378,7 @@ static void R_DrawWallColumn(drawcolumndata_t* dc, INT32 yl, INT32 yh, fixed_t m
|
|||
dc->source = R_GetColumn(texture, texturecolumn);
|
||||
dc->brightmap = (brightmapped ? R_GetBrightmapColumn(texture, texturecolumn) : NULL);
|
||||
dc->texheight = textureheight[texture] >> FRACBITS;
|
||||
dc->sourcelength = 0;
|
||||
dc->sourcelength = dc->texheight;
|
||||
R_SetColumnFunc(colfunctype, dc->brightmap != NULL);
|
||||
coldrawfunc_t* colfunccopy = colfunc;
|
||||
drawcolumndata_t dc_copy = *dc;
|
||||
|
|
|
|||
|
|
@ -689,7 +689,6 @@ void R_DrawMaskedColumn(drawcolumndata_t* dc, column_t *column, column_t *bright
|
|||
{
|
||||
dc->source = (UINT8 *)column + 3;
|
||||
dc->sourcelength = column->length;
|
||||
dc->texheight = column->length;
|
||||
if (brightmap != NULL)
|
||||
{
|
||||
dc->brightmap = (UINT8 *)brightmap + 3;
|
||||
|
|
@ -776,7 +775,6 @@ void R_DrawFlippedMaskedColumn(drawcolumndata_t* dc, column_t *column, column_t
|
|||
{
|
||||
dc->source = static_cast<UINT8*>(ZZ_Alloc(column->length));
|
||||
dc->sourcelength = column->length;
|
||||
dc->texheight = column->length;
|
||||
for (s = (UINT8 *)column+2+column->length, d = dc->source; d < dc->source+column->length; --s)
|
||||
*d++ = *s;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue