From d38ba4d88ca9d00b254e4728dd997454994c6847 Mon Sep 17 00:00:00 2001 From: Jaime Passos <lazymyuutsu@gmail.com> Date: Fri, 6 Sep 2019 19:41:29 -0300 Subject: [PATCH] define stuff idk --- src/hardware/hw_cache.c | 4 ++++ src/r_data.c | 7 +++++++ src/r_plane.c | 8 +++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 12e43c0e5e..2b458c9d98 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -664,8 +664,10 @@ static void HWR_GenerateTexture(INT32 texnum, GLTexture_t *grtex) { size_t lumplength = W_LumpLengthPwad(patch->wad, patch->lump); realpatch = W_CacheLumpNumPwad(patch->wad, patch->lump, PU_CACHE); +#ifndef NO_PNG_LUMPS if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength); +#endif HWR_DrawTexturePatchInCache(&grtex->mipmap, blockwidth, blockheight, texture, patch, @@ -892,8 +894,10 @@ static void HWR_LoadPatchFlat(GLMipmap_t *grMipmap, lumpnum_t flatlumpnum) { patch_t *patch = (patch_t *)W_CacheLumpNum(flatlumpnum, PU_STATIC); size_t lumplength = W_LumpLength(flatlumpnum); +#ifndef NO_PNG_LUMPS if (R_IsLumpPNG((UINT8 *)patch, lumplength)) patch = R_PNGToPatch((UINT8 *)patch, lumplength); +#endif grMipmap->width = (UINT16)SHORT(patch->width); grMipmap->height = (UINT16)SHORT(patch->height); diff --git a/src/r_data.c b/src/r_data.c index d37b393151..8c6b4926aa 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -376,8 +376,10 @@ static UINT8 *R_GenerateTexture(size_t texnum) lumpnum = patch->lump; lumplength = W_LumpLengthPwad(wadnum, lumpnum); realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); +#ifndef NO_PNG_LUMPS if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength); +#endif // Check the patch for holes. if (texture->width > SHORT(realpatch->width) || texture->height > SHORT(realpatch->height)) @@ -468,8 +470,10 @@ static UINT8 *R_GenerateTexture(size_t texnum) lumpnum = patch->lump; lumplength = W_LumpLengthPwad(wadnum, lumpnum); realpatch = W_CacheLumpNumPwad(wadnum, lumpnum, PU_CACHE); +#ifndef NO_PNG_LUMPS if (R_IsLumpPNG((UINT8 *)realpatch, lumplength)) realpatch = R_PNGToPatch((UINT8 *)realpatch, lumplength); +#endif x1 = patch->originx; width = SHORT(realpatch->width); @@ -734,6 +738,8 @@ void R_LoadTextures(void) // Set texture properties. M_Memcpy(texture->name, W_CheckNameForNumPwad(wadnum, lumpnum), sizeof(texture->name)); + +#ifndef NO_PNG_LUMPS if (R_IsLumpPNG((UINT8 *)patchlump, lumplength)) { INT16 width, height; @@ -742,6 +748,7 @@ void R_LoadTextures(void) texture->height = height; } else +#endif { texture->width = SHORT(patchlump->width); texture->height = SHORT(patchlump->height); diff --git a/src/r_plane.c b/src/r_plane.c index 57c8079f1c..92b3fe7705 100644 --- a/src/r_plane.c +++ b/src/r_plane.c @@ -963,12 +963,14 @@ void R_DrawSinglePlane(visplane_t *pl) // Check if the flat is actually a wall texture. if (levelflat->texturenum != 0 && levelflat->texturenum != -1) flat = R_GetPatchFlat(levelflat, true, false); - // Maybe it's just a patch, then? - else if (R_CheckIfPatch(levelflat->lumpnum)) - flat = R_GetPatchFlat(levelflat, false, false); +#ifndef NO_PNG_LUMPS // Maybe it's a PNG?! else if (R_IsLumpPNG(ds_source, size)) flat = R_GetPatchFlat(levelflat, false, true); +#endif + // Maybe it's just a patch, then? + else if (R_CheckIfPatch(levelflat->lumpnum)) + flat = R_GetPatchFlat(levelflat, false, false); // It's a raw flat. else { -- GitLab