From 8e56582728e02176b32890c89fc105df2a0bd0f3 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Sat, 17 Dec 2016 19:59:54 +0000 Subject: [PATCH] Created R_CheckTextureCache to make sure midtexture/FOF walls cache their textures before choosing colfunc_2s, for software mode --- src/r_data.c | 12 ++++++++++++ src/r_data.h | 1 + src/r_segs.c | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/src/r_data.c b/src/r_data.c index c24cca91..bb12f916 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -317,6 +317,18 @@ INT32 R_GetTextureNum(INT32 texnum) return texturetranslation[texnum]; } +// +// R_CheckTextureCache +// +// Use this if you need to make sure the texture is cached before R_GetColumn calls +// e.g.: midtextures and FOF walls +// +void R_CheckTextureCache(INT32 tex) +{ + if (!texturecache[tex]) + R_GenerateTexture(tex); +} + // // R_GetColumn // diff --git a/src/r_data.h b/src/r_data.h index 68af0325..1e9e0eb5 100644 --- a/src/r_data.h +++ b/src/r_data.h @@ -66,6 +66,7 @@ void R_LoadTextures(void); void R_FlushTextureCache(void); INT32 R_GetTextureNum(INT32 texnum); +void R_CheckTextureCache(INT32 tex); // Retrieve column data for span blitting. UINT8 *R_GetColumn(fixed_t tex, INT32 col); diff --git a/src/r_segs.c b/src/r_segs.c index e0a08137..ab501082 100644 --- a/src/r_segs.c +++ b/src/r_segs.c @@ -344,6 +344,9 @@ void R_RenderMaskedSegRange(drawseg_t *ds, INT32 x1, INT32 x2) rw_scalestep = ds->scalestep; spryscale = ds->scale1 + (x1 - ds->x1)*rw_scalestep; + // Texture must be cached before setting colfunc_2s, + // otherwise texture[texnum]->holes may be false when it shouldn't be + R_CheckTextureCache(texnum); // handle case where multipatch texture is drawn on a 2sided wall, multi-patch textures // are not stored per-column with post info in SRB2 if (textures[texnum]->holes) @@ -968,6 +971,9 @@ void R_RenderThickSideRange(drawseg_t *ds, INT32 x1, INT32 x2, ffloor_t *pfloor) dc_texturemid += offsetvalue; + // Texture must be cached before setting colfunc_2s, + // otherwise texture[texnum]->holes may be false when it shouldn't be + R_CheckTextureCache(texnum); //faB: handle case where multipatch texture is drawn on a 2sided wall, multi-patch textures // are not stored per-column with post info anymore in Doom Legacy if (textures[texnum]->holes)