Skip to content

First texture index will never be drawn, causes HOM

If you set a wall texture to index 0 of the textures array, then it is never drawn. Currently, that is AGZFLR01 (due to wallflats).

This is because R_RenderSegLoop() checks if a texture index is valid before rendering it. Its validity check is simply checking for nonzero.

The texture index is retrieved from R_GetTextureNum(), which returns 0 if the texture is not valid.

INT32 midtexture = R_GetTextureNum(sidedef->midtexture);

// draw the wall tiers
if (midtexture)
{
    ...
}

The lazy solution: Keep index 0 of textures[] empty, start loading textures at index 1.

The correct (?) solution: Modify R_GetTextureNum() to return -1 if invalid, then modify all uses to account for the new "invalid" value.

test-texture.wad (MAP01)