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
This commit is contained in:
hendricks266 2015-12-20 05:18:53 +00:00
parent 1b8c79b0d8
commit 00bc250811
3 changed files with 27 additions and 14 deletions

View file

@ -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();

View file

@ -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();
}

View file

@ -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;