fix non-power-of-two wide sky textures (#1323)

This commit is contained in:
Fabian Greffrath 2023-12-12 13:35:17 +01:00 committed by GitHub
parent 915db28d5e
commit 932fcaabc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View File

@ -504,6 +504,23 @@ byte *R_GetColumnMod(int tex, int col)
return texturecomposite[tex] + ofs;
}
// [FG] wrapping column getter function for non-power-of-two wide sky textures
byte *R_GetColumnMod2(int tex, int col)
{
int ofs;
while (col < 0)
col += texturewidth[tex];
col %= texturewidth[tex];
ofs = texturecolumnofs2[tex][col];
if (!texturecomposite2[tex])
R_GenerateComposite(tex);
return texturecomposite2[tex] + ofs;
}
//
// R_InitTextures
// Initializes the texture list

View File

@ -31,6 +31,7 @@
// Retrieve column data for span blitting.
byte *R_GetColumn(int tex, int col);
byte *R_GetColumnMod(int tex, int col);
byte *R_GetColumnMod2(int tex, int col);
// I/O, setting up the stuff.
void R_InitData (void);

View File

@ -423,7 +423,7 @@ static void do_draw_plane(visplane_t *pl)
for (x = pl->minx; (dc_x = x) <= pl->maxx; x++)
if ((dc_yl = pl->top[x]) != USHRT_MAX && dc_yl <= (dc_yh = pl->bottom[x]))
{
dc_source = R_GetColumnMod(texture, ((an + xtoskyangle[x])^flip) >>
dc_source = R_GetColumnMod2(texture, ((an + xtoskyangle[x])^flip) >>
ANGLETOSKYSHIFT);
colfunc();
}