From 00bc25081130c8aa3f1b3ff857b0bcfd823c9642 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sun, 20 Dec 2015 05:18:53 +0000 Subject: [PATCH] Duke3D: Add globalgameflag 4, DUKE3D_NO_PALETTE_CHANGES. This disallows the game from performing its usual modification to palette data after loading it, mainly the transparent color. If you use this flag, make sure your transparent color it set exactly as you would like it to be used in cases like those presented in the previous commit. git-svn-id: https://svn.eduke32.com/eduke32@5468 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/astub.c | 15 ++++++++++----- polymer/eduke32/source/game.c | 22 ++++++++++++++-------- polymer/eduke32/source/global.h | 4 +++- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 2792f6756..3e6e0a2b2 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -127,8 +127,10 @@ static uint32_t templenrepquot=1; static int32_t duke3d_m32_globalflags; -enum { +// KEEPINSYNC global.h (used values only) +enum DUKE3D_GLOBALFLAGS { DUKE3D_NO_HARDCODED_FOGPALS = 1<<1, + DUKE3D_NO_PALETTE_CHANGES = 1<<2, }; //////////////////// Key stuff //////////////////// @@ -9976,10 +9978,13 @@ void ExtPostInit(void) { InitCustomColors(); - // Make base shade table at shade 0 into the identity map. - // (In the shade table of Duke3D's PALETTE.DAT, palookup[0][239]==143.) - // This makes it possible to sensibly use Lunatic's engine.saveLookupDat(). - palookup[0][239] = 239; + if (!(duke3d_m32_globalflags & DUKE3D_NO_PALETTE_CHANGES)) + { + // Make base shade table at shade 0 into the identity map. + // (In the shade table of Duke3D's PALETTE.DAT, palookup[0][239]==143.) + // This makes it possible to sensibly use Lunatic's engine.saveLookupDat(). + palookup[0][239] = 239; + } if (!(duke3d_m32_globalflags & DUKE3D_NO_HARDCODED_FOGPALS)) generatefogpals(); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 0febae843..e5a2ae4c2 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -11002,18 +11002,24 @@ static inline void G_CheckGametype(void) static void G_PostLoadPalette(void) { - // Make color index 255 of default/water/slime palette black. - if (basepaltable[BASEPAL] != NULL) - Bmemset(&basepaltable[BASEPAL][255*3], 0, 3); - if (basepaltable[WATERPAL] != NULL) - Bmemset(&basepaltable[WATERPAL][255*3], 0, 3); - if (basepaltable[SLIMEPAL] != NULL) - Bmemset(&basepaltable[SLIMEPAL][255*3], 0, 3); + if (!(duke3d_globalflags & DUKE3D_NO_PALETTE_CHANGES)) + { + // Make color index 255 of default/water/slime palette black. + if (basepaltable[BASEPAL] != NULL) + Bmemset(&basepaltable[BASEPAL][255*3], 0, 3); + if (basepaltable[WATERPAL] != NULL) + Bmemset(&basepaltable[WATERPAL][255*3], 0, 3); + if (basepaltable[SLIMEPAL] != NULL) + Bmemset(&basepaltable[SLIMEPAL][255*3], 0, 3); + } if (!(duke3d_globalflags & DUKE3D_NO_HARDCODED_FOGPALS)) generatefogpals(); - E_ReplaceTransparentColorWithBlack(); + if (!(duke3d_globalflags & DUKE3D_NO_PALETTE_CHANGES)) + { + E_ReplaceTransparentColorWithBlack(); + } fillemptylookups(); } diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index 9d2d2f4fe..252ca353c 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -57,9 +57,11 @@ extern "C" { G_EXTERN int32_t duke3d_globalflags; -enum { +// KEEPINSYNC astub.c (used values only) +enum DUKE3D_GLOBALFLAGS { DUKE3D_NO_WIDESCREEN_PINNING = 1<<0, DUKE3D_NO_HARDCODED_FOGPALS = 1<<1, + DUKE3D_NO_PALETTE_CHANGES = 1<<2, }; G_EXTERN DukeStatus_t sbar;