From ae748d6d5ca8ef85bfbc16047cd6a12cd3a5055d Mon Sep 17 00:00:00 2001 From: Jaime Passos Date: Tue, 7 Jan 2020 19:00:57 -0300 Subject: [PATCH] Fix patch generation --- src/hardware/hw_cache.c | 3 ++- src/r_picformats.c | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index c81c4bd4a..59504be73 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -708,7 +708,8 @@ void HWR_MakePatch (const patch_t *patch, GLPatch_t *grPatch, GLMipmap_t *grMipm { // Dummy variables. INT32 pngwidth, pngheight; - patch = (patch_t *)Picture_PNGConvert((const UINT8 *)patch, PICFMT_PATCH, &pngwidth, &pngheight, NULL, NULL, len, NULL, 0); + INT16 topoffset, leftoffset; + patch = (patch_t *)Picture_PNGConvert((const UINT8 *)patch, PICFMT_PATCH, &pngwidth, &pngheight, &topoffset, &leftoffset, len, NULL, 0); } #endif diff --git a/src/r_picformats.c b/src/r_picformats.c index 9cac5384d..27d4c010f 100644 --- a/src/r_picformats.c +++ b/src/r_picformats.c @@ -1478,6 +1478,15 @@ void R_CacheRotSprite(spritenum_t sprnum, UINT8 frame, spriteinfo_t *sprinfo, sp patch = (patch_t *)W_CacheLumpNum(lump, PU_STATIC); lumplength = W_LumpLength(lump); +#ifndef NO_PNG_LUMPS + if (Picture_IsLumpPNG((const UINT8 *)patch, lumplength)) + { + INT32 pngwidth, pngheight; + INT16 topoffset, leftoffset; + patch = (patch_t *)Picture_PNGConvert((const UINT8 *)patch, PICFMT_PATCH, &pngwidth, &pngheight, &topoffset, &leftoffset, lumplength, NULL, 0); + } + else +#endif // Because there's something wrong with SPR_DFLM, I guess if (!Picture_CheckIfPatch(patch, lumplength)) return;