From 7a6de57a99569be54ce1a281e22b87e1410414cf Mon Sep 17 00:00:00 2001 From: GenericHeroGuy Date: Sat, 25 Jan 2025 22:49:38 +0100 Subject: [PATCH] Palremap extras 2 (#16) Kartchar support, initialize compatmode --- src/r_textures.c | 10 ++++++++++ src/w_wad.c | 1 + 2 files changed, 11 insertions(+) diff --git a/src/r_textures.c b/src/r_textures.c index c8a32f8e9..3dc4fb77e 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -300,9 +300,19 @@ void R_DoPaletteRemapPatch(softwarepatch_t *patch, size_t size) if (!Picture_CheckIfDoomPatch(patch, size)) return; + // thanks to my very own ingenious patch-compression technology, + // i now have to make sure i don't accidentally remap a column twice. cool! + // yes, it assumes all columns are sequential in the patch, + // but it's efficient so who cares + UINT8 *last = 0; + for (INT16 i = 0; i < patch->width; i++) { UINT8 *p = (UINT8 *)patch + patch->columnofs[i]; + if (p <= last) + continue; + else + last = p; while (*p++ != 0xff) // topdelta { int length = *p++; diff --git a/src/w_wad.c b/src/w_wad.c index f7e476882..b94e39c7e 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -891,6 +891,7 @@ UINT16 W_InitFile(const char *filename, boolean mainfile, boolean startup, wadco wadfile->compatmode = CheckCompatZip(numwadfiles - 1); break; default: + wadfile->compatmode = false; break; }