R_StoreWallRange: do not render textures with holes

- Holey textures are ones where the column height may not
  match the texture height.
- R_DrawColumn cannot cope with this directly and it may
  lead to a read out bounds.
- Transparency would not render for true wall textures
  anyway since these are not masked midtextures, so just
  don't render the texture in this case.
This commit is contained in:
James R 2024-02-03 18:38:51 -08:00
parent 057001a66f
commit 9bb6031a4e

View file

@ -2049,11 +2049,17 @@ void R_StoreWallRange(INT32 start, INT32 stop)
ceilingbackslide = FixedMul(backsector->c_slope->zdelta, FINECOSINE((lineangle-backsector->c_slope->xydirection)>>ANGLETOFINESHIFT)); ceilingbackslide = FixedMul(backsector->c_slope->zdelta, FINECOSINE((lineangle-backsector->c_slope->xydirection)>>ANGLETOFINESHIFT));
} }
auto get_flat_tex = [](INT32 texnum)
{
texnum = R_GetTextureNum(texnum);
return textures[texnum]->holes ? 0 : texnum; // R_DrawWallColumn cannot render holey textures
};
if (!backsector) if (!backsector)
{ {
fixed_t texheight; fixed_t texheight;
// single sided line // single sided line
midtexture = R_GetTextureNum(sidedef->midtexture); midtexture = get_flat_tex(sidedef->midtexture);
midbrightmapped = R_TextureHasBrightmap(midtexture); midbrightmapped = R_TextureHasBrightmap(midtexture);
midremap = wantremap && R_TextureCanRemap(sidedef->midtexture); midremap = wantremap && R_TextureCanRemap(sidedef->midtexture);
texheight = textureheight[midtexture]; texheight = textureheight[midtexture];
@ -2246,7 +2252,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
{ {
fixed_t texheight; fixed_t texheight;
// top texture // top texture
toptexture = R_GetTextureNum(sidedef->toptexture); toptexture = get_flat_tex(sidedef->toptexture);
topbrightmapped = R_TextureHasBrightmap(toptexture); topbrightmapped = R_TextureHasBrightmap(toptexture);
topremap = wantremap && R_TextureCanRemap(sidedef->toptexture); topremap = wantremap && R_TextureCanRemap(sidedef->toptexture);
texheight = textureheight[toptexture]; texheight = textureheight[toptexture];
@ -2276,7 +2282,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
&& (worldlow > worldbottom || worldlowslope > worldbottomslope)) // Only if VISIBLE!!! && (worldlow > worldbottom || worldlowslope > worldbottomslope)) // Only if VISIBLE!!!
{ {
// bottom texture // bottom texture
bottomtexture = R_GetTextureNum(sidedef->bottomtexture); bottomtexture = get_flat_tex(sidedef->bottomtexture);
bottombrightmapped = R_TextureHasBrightmap(bottomtexture); bottombrightmapped = R_TextureHasBrightmap(bottomtexture);
bottomremap = wantremap && R_TextureCanRemap(sidedef->bottomtexture); bottomremap = wantremap && R_TextureCanRemap(sidedef->bottomtexture);