- store palettes in the palette container.

This commit is contained in:
Christoph Oelckers 2020-04-12 07:50:24 +02:00
parent 960d4b6ecc
commit 6f9ee4b60f
22 changed files with 103 additions and 146 deletions

View file

@ -211,15 +211,6 @@ static int osdcmd_noclip(CCmdFuncPtr UNUSED(parm))
return OSDCMD_OK; return OSDCMD_OK;
} }
void onvideomodechange(int32_t newmode)
{
UNREFERENCED_PARAMETER(newmode);
if (newmode)
scrResetPalette();
UpdateDacs(gLastPal, false);
}
static int osdcmd_activatecheat(CCmdFuncPtr parm) static int osdcmd_activatecheat(CCmdFuncPtr parm)
{ {
FString CheatEntry; FString CheatEntry;

View file

@ -25,6 +25,5 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
BEGIN_BLD_NS BEGIN_BLD_NS
int32_t registerosdcommands(void); int32_t registerosdcommands(void);
void onvideomodechange(int32_t newmode);
END_BLD_NS END_BLD_NS

View file

@ -52,12 +52,12 @@ LOADITEM PLU[15] = {
{ 14, "P4" } { 14, "P4" }
}; };
LOADITEM PAL[5] = { const char *PAL[5] = {
{ 0, "BLOOD" }, "BLOOD.PAL",
{ 1, "WATER" }, "WATER.PAL",
{ 2, "BEAST" }, "BEAST.PAL",
{ 3, "SEWER" }, "SEWER.PAL",
{ 4, "INVULN1" } "INVULN1.PAL"
}; };
@ -66,15 +66,11 @@ static RGB *palTable[5];
static int curPalette; static int curPalette;
bool gFogMode = false; bool gFogMode = false;
void scrResetPalette(void)
{
paletteSetColorTable(0, (uint8_t*)palTable[0]);
}
void scrLoadPLUs(void) void scrLoadPLUs(void)
{ {
// load default palookups // load default palookups
for (int i = 0; i < 15; i++) { for (int i = 0; i < 15; i++)
{
DICTNODE *pPlu = gSysRes.Lookup(PLU[i].name, "PLU"); DICTNODE *pPlu = gSysRes.Lookup(PLU[i].name, "PLU");
if (!pPlu) if (!pPlu)
ThrowError("%s.PLU not found", PLU[i].name); ThrowError("%s.PLU not found", PLU[i].name);
@ -120,13 +116,10 @@ void scrLoadPalette(void)
Printf("Loading palettes\n"); Printf("Loading palettes\n");
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
{ {
DICTNODE *pPal = gSysRes.Lookup(PAL[i].name, "PAL"); auto pal = fileSystem.LoadFile(PAL[i]);
if (!pPal) if (pal.Size() < 768) I_FatalError("%s: file too small", PAL[i]);
ThrowError("%s.PAL not found (RFF files may be wrong version)", PAL[i].name); paletteSetColorTable(i, pal.Data());
palTable[PAL[i].id] = (RGB*)gSysRes.Lock(pPal);
paletteSetColorTable(PAL[i].id, (uint8_t*)palTable[PAL[i].id]);
} }
memcpy(palette, palTable[0], sizeof(palette));
numshades = 64; numshades = 64;
paletteloaded |= PALETTE_MAIN; paletteloaded |= PALETTE_MAIN;
scrLoadPLUs(); scrLoadPLUs();

View file

@ -542,7 +542,6 @@ EXTERN int16_t sintable[2048];
EXTERN uint8_t palette[768]; EXTERN uint8_t palette[768];
EXTERN int16_t numshades; EXTERN int16_t numshades;
EXTERN char *lookuptables[MAXPALOOKUPS]; EXTERN char *lookuptables[MAXPALOOKUPS];
extern uint8_t *basepaltable[MAXBASEPALS];
EXTERN uint8_t paletteloaded; EXTERN uint8_t paletteloaded;
EXTERN uint8_t whitecol, redcol, blackcol; EXTERN uint8_t whitecol, redcol, blackcol;

View file

@ -25,6 +25,12 @@
#define NORMALPAL (MAXPALOOKUPS - 4) #define NORMALPAL (MAXPALOOKUPS - 4)
#define BRIGHTPAL (MAXPALOOKUPS) #define BRIGHTPAL (MAXPALOOKUPS)
enum
{
Translation_BasePalettes,
Translation_Remap,
};
extern uint8_t curbasepal; extern uint8_t curbasepal;
extern uint8_t PaletteIndexFullbrights[32]; extern uint8_t PaletteIndexFullbrights[32];
@ -51,9 +57,7 @@ extern palette_t palfadergb;
extern unsigned char palfadedelta; extern unsigned char palfadedelta;
void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uint8_t g, uint8_t b, char noFloorPal); void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uint8_t g, uint8_t b, char noFloorPal);
void paletteSetColorTable(int32_t id, uint8_t const *table, bool transient = false); void paletteSetColorTable(int32_t id, uint8_t const *table, bool notransparency = false);
void paletteFreeColorTable(int32_t id);
void paletteFreeColorTables();
int32_t paletteSetLookupTable(int32_t palnum, const uint8_t *shtab); int32_t paletteSetLookupTable(int32_t palnum, const uint8_t *shtab);
void paletteFreeLookupTable(int32_t palnum); void paletteFreeLookupTable(int32_t palnum);

View file

@ -17,6 +17,7 @@
#include "bitmap.h" #include "bitmap.h"
#include "m_argv.h" #include "m_argv.h"
#include "gamecontrol.h" #include "gamecontrol.h"
#include "palettecontainer.h"
#ifdef USE_OPENGL #ifdef USE_OPENGL
# include "hightile.h" # include "hightile.h"
@ -2673,21 +2674,21 @@ static int32_t defsparser(scriptfile *script)
break; break;
} }
uint8_t const * const sourcetable = basepaltable[source]; auto sourcepal = GPalette.GetTranslation(Translation_BasePalettes, source);
if (EDUKE32_PREDICT_FALSE(sourcetable == NULL)) if (sourcepal == NULL)
{ {
Printf("Error: basepalette: Source basepal does not exist on line %s:%d\n", Printf("Error: basepalette: Source basepal does not exist on line %s:%d\n",
script->filename, scriptfile_getlinum(script,cmdtokptr)); script->filename, scriptfile_getlinum(script,cmdtokptr));
break; break;
} }
paletteSetColorTable(id, sourcetable); GPalette.CopyTranslation(TRANSLATION(Translation_BasePalettes, id), TRANSLATION(Translation_BasePalettes, source));
didLoadPal = 1; didLoadPal = 1;
break; break;
} }
case T_UNDEF: case T_UNDEF:
{ {
paletteFreeColorTable(id); GPalette.ClearTranslationSlot(TRANSLATION(Translation_BasePalettes, id));
didLoadPal = 0; didLoadPal = 0;
if (id == 0) if (id == 0)
@ -3325,7 +3326,7 @@ static int32_t defsparser(scriptfile *script)
} }
for (bssize_t i = id0; i <= id1; i++) for (bssize_t i = id0; i <= id1; i++)
paletteFreeColorTable(i); GPalette.ClearTranslationSlot(TRANSLATION(Translation_BasePalettes, i));
if (id0 == 0) if (id0 == 0)
paletteloaded &= ~PALETTE_MAIN; paletteloaded &= ~PALETTE_MAIN;

View file

@ -15,9 +15,12 @@
#include "palette.h" #include "palette.h"
#include "superfasthash.h" #include "superfasthash.h"
#include "common.h" #include "common.h"
#include "memarena.h"
#include "palettecontainer.h"
#include "../../glbackend/glbackend.h" #include "../../glbackend/glbackend.h"
uint8_t *basepaltable[MAXBASEPALS] = { palette }; FMemArena lookuparena;
uint8_t basepalreset=1; uint8_t basepalreset=1;
uint8_t curbasepal; uint8_t curbasepal;
int32_t globalblend; int32_t globalblend;
@ -50,13 +53,11 @@ int DetermineTranslucency(const uint8_t *table)
PalEntry newcolor; PalEntry newcolor;
PalEntry newcolor2; PalEntry newcolor2;
index = table[blackcol * 256 + whitecol]; index = table[GPalette.BlackIndex * 256 + GPalette.WhiteIndex];
auto pp = &basepaltable[0][index]; newcolor = GPalette.BaseColors[index];
newcolor = PalEntry(pp[0], pp[1], pp[2]);
index = table[whitecol * 256 + blackcol]; index = table[GPalette.WhiteIndex * 256 + GPalette.BlackIndex];
pp = &basepaltable[0][index]; newcolor2 = GPalette.BaseColors[index];
newcolor2 = PalEntry(pp[0], pp[1], pp[2]);
if (newcolor2.r == 255) // if black on white results in white it's either if (newcolor2.r == 255) // if black on white results in white it's either
// fully transparent or additive // fully transparent or additive
{ {
@ -66,6 +67,29 @@ int DetermineTranslucency(const uint8_t *table)
return newcolor.r; return newcolor.r;
} }
void paletteSetColorTable(int32_t id, uint8_t const* table, bool notransparency)
{
if (id == 0)
{
GPalette.SetPalette(table, 255);
}
FRemapTable remap;
remap.AddColors(0, 256, table);
if (!notransparency)
{
remap.Palette[255] = 0;
remap.Remap[255] = 255;
}
GPalette.UpdateTranslation(TRANSLATION(Translation_BasePalettes, id), &remap);
// Todo: remove this once the texture code can use GPalette directly
#ifdef USE_OPENGL
uploadbasepalette(id);
#endif
}
void fullscreen_tint_gl(PalEntry pe); void fullscreen_tint_gl(PalEntry pe);
static void alloc_palookup(int32_t pal) static void alloc_palookup(int32_t pal)
@ -91,6 +115,7 @@ inline bool read_and_test(FileReader& handle, void* buffer, int32_t leng)
// //
void paletteLoadFromDisk(void) void paletteLoadFromDisk(void)
{ {
GPalette.Init(MAXPALOOKUPS + 1); // one slot for each translation, plus a separate one for the base palettes.
#ifdef USE_OPENGL #ifdef USE_OPENGL
for (auto & x : glblend) for (auto & x : glblend)
@ -116,6 +141,7 @@ void paletteLoadFromDisk(void)
for (unsigned char & k : palette) for (unsigned char & k : palette)
k <<= 2; k <<= 2;
paletteSetColorTable(0, palette);
paletteloaded |= PALETTE_MAIN; paletteloaded |= PALETTE_MAIN;
@ -255,6 +281,7 @@ void palettePostLoadTables(void)
if (EDUKE32_PREDICT_FALSE(palookup0[s] != index)) if (EDUKE32_PREDICT_FALSE(palookup0[s] != index))
goto PostLoad_NotFullbright; goto PostLoad_NotFullbright;
Printf("%d is fullbright\n", c);
SetPaletteIndexFullbright(c); SetPaletteIndexFullbright(c);
PostLoad_NotFullbright: ; PostLoad_NotFullbright: ;
@ -564,39 +591,6 @@ void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uin
#endif #endif
} }
//
// setbasepal
//
void paletteSetColorTable(int32_t id, uint8_t const * const table, bool transient)
{
if (basepaltable[id] == NULL)
basepaltable[id] = (uint8_t *) Xmalloc(768);
Bmemcpy(basepaltable[id], table, 768);
#ifdef USE_OPENGL
if (videoGetRenderMode() >= REND_POLYMOST)
{
uploadbasepalette(id);
}
#endif
}
void paletteFreeColorTable(int32_t const id)
{
if (id == 0)
Bmemset(basepaltable[id], 0, 768);
else
DO_FREE_AND_NULL(basepaltable[id]);
}
void paletteFreeColorTables()
{
for (int i = 0; i < countof(basepaltable); i++)
{
paletteFreeColorTable(i);
}
}
// //
// setbrightness // setbrightness
// //
@ -609,13 +603,11 @@ void paletteFreeColorTables()
// 32: apply brightness to scene in OpenGL // 32: apply brightness to scene in OpenGL
void videoSetPalette(int dabrightness, int dapalid, ESetPalFlags flags) void videoSetPalette(int dabrightness, int dapalid, ESetPalFlags flags)
{ {
if (/*(unsigned)dapalid >= MAXBASEPALS ||*/ basepaltable[dapalid] == NULL) if (GPalette.GetTranslation(Translation_BasePalettes, dapalid) == nullptr)
dapalid = 0; dapalid = 0;
curbasepal = dapalid; curbasepal = dapalid;
basepalreset = 0; basepalreset = 0;
auto dapal = basepaltable[curbasepal];
// In-scene brightness mode for RR's thunderstorm. This shouldn't affect the global gamma ramp. // In-scene brightness mode for RR's thunderstorm. This shouldn't affect the global gamma ramp.
if ((videoGetRenderMode() >= REND_POLYMOST) && (flags & Pal_SceneBrightness)) if ((videoGetRenderMode() >= REND_POLYMOST) && (flags & Pal_SceneBrightness))
{ {
@ -657,9 +649,4 @@ void paletteFreeAll()
Xaligned_free(lookuptables[i]); Xaligned_free(lookuptables[i]);
} }
Bmemset(lookuptables, 0, sizeof(lookuptables)); Bmemset(lookuptables, 0, sizeof(lookuptables));
for (bssize_t i = 1; i < MAXBASEPALS; i++)
Xfree(basepaltable[i]);
Bmemset(basepaltable, 0, sizeof(basepaltable));
basepaltable[0] = palette;
} }

View file

@ -18,6 +18,7 @@ Ken Silverman's official web site: http://www.advsys.net/ken
#include "gamecvars.h" #include "gamecvars.h"
#include "v_video.h" #include "v_video.h"
#include "flatvertices.h" #include "flatvertices.h"
#include "palettecontainer.h"
CVAR(Bool, hw_detailmapping, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, hw_detailmapping, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
CVAR(Bool, hw_glowmapping, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) CVAR(Bool, hw_glowmapping, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
@ -276,7 +277,8 @@ static void resizeglcheck(void)
void uploadbasepalette(int32_t basepalnum) void uploadbasepalette(int32_t basepalnum)
{ {
if (!basepaltable[basepalnum]) auto remap = GPalette.GetTranslation(Translation_BasePalettes, basepalnum);
if (!remap)
{ {
return; return;
} }
@ -284,9 +286,9 @@ void uploadbasepalette(int32_t basepalnum)
uint8_t basepalWFullBrightInfo[4*256]; uint8_t basepalWFullBrightInfo[4*256];
for (int i = 0; i < 256; ++i) for (int i = 0; i < 256; ++i)
{ {
basepalWFullBrightInfo[i*4+0] = basepaltable[basepalnum][i*3+2]; basepalWFullBrightInfo[i*4+0] = remap->Palette[i].b;
basepalWFullBrightInfo[i*4+1] = basepaltable[basepalnum][i*3+1]; basepalWFullBrightInfo[i*4+1] = remap->Palette[i].g;
basepalWFullBrightInfo[i*4+2] = basepaltable[basepalnum][i*3+0]; basepalWFullBrightInfo[i*4+2] = remap->Palette[i].r;
basepalWFullBrightInfo[i*4+3] = 0-(IsPaletteIndexFullbright(i) != 0); basepalWFullBrightInfo[i*4+3] = 0-(IsPaletteIndexFullbright(i) != 0);
} }

View file

@ -60,16 +60,28 @@ void PaletteContainer::Init(int numslots) // This cannot be a constructor!!!
TranslationTables.Resize(numslots); TranslationTables.Resize(numslots);
} }
void PaletteContainer::SetPalette(const uint8_t* colors) void PaletteContainer::SetPalette(const uint8_t* colors, int transparent_index)
{ {
// At this point we do not care about the transparent index yet.
for (int i = 0; i < 256; i++, colors += 3) for (int i = 0; i < 256; i++, colors += 3)
{ {
BaseColors[i] = PalEntry(colors[0], colors[1], colors[2]); BaseColors[i] = PalEntry(255, colors[0], colors[1], colors[2]);
Remap[i] = i; Remap[i] = i;
} }
uniqueRemaps[0]->MakeIdentity(); // update the identity remap.
if (transparent_index >= 0 && transparent_index <= 255)
{
BaseColors[transparent_index] = 0;
uniqueRemaps[0]->Palette[transparent_index] = 0;
}
uniqueRemaps[0]->crc32 = CalcCRC32((uint8_t*)uniqueRemaps[0]->Palette, sizeof(uniqueRemaps[0]->Palette));
// Find white and black from the original palette so that they can be // Find white and black from the original palette so that they can be
// used to make an educated guess of the translucency % for a BOOM // used to make an educated guess of the translucency % for a
// translucency map. // translucency map.
WhiteIndex = BestColor((uint32_t*)BaseColors, 255, 255, 255, 0, 255); WhiteIndex = BestColor((uint32_t*)BaseColors, 255, 255, 255, 0, 255);
BlackIndex = BestColor((uint32_t*)BaseColors, 0, 0, 0, 0, 255); BlackIndex = BestColor((uint32_t*)BaseColors, 0, 0, 0, 0, 255);
@ -166,7 +178,7 @@ FRemapTable *PaletteContainer::TranslationToTable(int translation)
if (type <= 0 || type >= TranslationTables.Size() || index >= NumTranslations(type)) if (type <= 0 || type >= TranslationTables.Size() || index >= NumTranslations(type))
{ {
return NULL; return uniqueRemaps[0]; // this is the identity table.
} }
return GetTranslation(type, index); return GetTranslation(type, index);
} }
@ -664,10 +676,10 @@ bool FRemapTable::AddToTranslation(const char *range)
// //
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool FRemapTable::AddColors(int start, int count, const uint8_t*colors) bool FRemapTable::AddColors(int start, int count, const uint8_t*colors, int trans_color)
{ {
int end = start + count; int end = start + count;
if (IndexOutOfRange(start, end)) if (IndexOutOfRange(start, end-1))
{ {
return false; return false;
} }
@ -680,7 +692,7 @@ bool FRemapTable::AddColors(int start, int count, const uint8_t*colors)
colors += 3; colors += 3;
int j = GPalette.Remap[i]; int j = GPalette.Remap[i];
Palette[j] = PalEntry(j == 0 ? 0 : 255, br, bg, bb); Palette[j] = PalEntry(j == trans_color ? 0 : 255, br, bg, bb);
Remap[j] = ColorMatcher.Pick(Palette[j]); Remap[j] = ColorMatcher.Pick(Palette[j]);
} }
return true; return true;

View file

@ -18,7 +18,7 @@ struct FRemapTable
bool AddColourisation(int start, int end, int r, int g, int b); bool AddColourisation(int start, int end, int r, int g, int b);
bool AddTint(int start, int end, int r, int g, int b, int amount); bool AddTint(int start, int end, int r, int g, int b, int amount);
bool AddToTranslation(const char* range); bool AddToTranslation(const char* range);
bool AddColors(int start, int count, const uint8_t*); bool AddColors(int start, int count, const uint8_t*, int trans_color = 0);
uint8_t Remap[256]; // For the software renderer uint8_t Remap[256]; // For the software renderer
PalEntry Palette[256]; // The ideal palette this maps to PalEntry Palette[256]; // The ideal palette this maps to
@ -79,7 +79,7 @@ private:
TArray<TAutoGrowArray<FRemapTablePtr, FRemapTable*>> TranslationTables; TArray<TAutoGrowArray<FRemapTablePtr, FRemapTable*>> TranslationTables;
public: public:
void Init(int numslots); // This cannot be a constructor!!! void Init(int numslots); // This cannot be a constructor!!!
void SetPalette(const uint8_t* colors); void SetPalette(const uint8_t* colors, int transparent_index = -1);
void Clear(); void Clear();
FRemapTable* AddRemap(FRemapTable* remap); FRemapTable* AddRemap(FRemapTable* remap);
void UpdateTranslation(int trans, FRemapTable* remap); void UpdateTranslation(int trans, FRemapTable* remap);

View file

@ -428,7 +428,6 @@ int GameMain()
GLInterface.Deinit(); GLInterface.Deinit();
I_ShutdownGraphics(); I_ShutdownGraphics();
M_DeinitMenus(); M_DeinitMenus();
paletteFreeColorTables();
engineUnInit(); engineUnInit();
if (gi) if (gi)
{ {

View file

@ -133,7 +133,7 @@ void G_LoadLookups(void)
for (unsigned char & k : paldata) for (unsigned char & k : paldata)
k <<= 2; k <<= 2;
paletteSetColorTable(basepalnum, paldata); paletteSetColorTable(basepalnum, paldata, basepalnum == DREALMSPAL || basepalnum == ENDINGPAL);
} }
} }

View file

@ -5257,17 +5257,6 @@ static inline void G_CheckGametype(void)
static void G_PostLoadPalette(void) static void G_PostLoadPalette(void)
{ {
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)) if (!(duke3d_globalflags & DUKE3D_NO_HARDCODED_FOGPALS))
paletteSetupDefaultFog(); paletteSetupDefaultFog();

View file

@ -34,7 +34,6 @@ struct osdcmd_cheatsinfo {
extern struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat; extern struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat;
int32_t registerosdcommands(void); int32_t registerosdcommands(void);
void onvideomodechange(int32_t newmode);
extern const char *const ConsoleButtons[]; extern const char *const ConsoleButtons[];

View file

@ -1993,7 +1993,6 @@ int GameInterface::app_main()
ResetView(); ResetView();
GrabPalette(); GrabPalette();
paletteSetColorTable(curbasepal, basepaltable[BASEPAL]);
if (bSerialPlay && !InitSerial()) { if (bSerialPlay && !InitSerial()) {
I_Error("Unable to connect"); I_Error("Unable to connect");

View file

@ -246,17 +246,13 @@ void StartFadeIn()
int DoFadeIn() int DoFadeIn()
{ {
paletteSetColorTable(curbasepal, basepaltable[BASEPAL]);
videoSetPalette(0, curbasepal, 0);
videoNextPage(); videoNextPage();
return 0; return 0;
} }
void FadeIn() void FadeIn()
{ {
videoSetPalette(0, BASEPAL, 0);
videoNextPage(); videoNextPage();
} }
void FixPalette() void FixPalette()

View file

@ -27,7 +27,6 @@ BEGIN_PS_NS
int32_t registerosdcommands(void); int32_t registerosdcommands(void);
void onvideomodechange(int32_t newmode);
void GAME_onshowosd(int shown); void GAME_onshowosd(int shown);
void GAME_clearbackground(int numcols, int numrows); void GAME_clearbackground(int numcols, int numrows);

View file

@ -132,12 +132,12 @@ void G_LoadLookups(void)
for (bssize_t k = 0; k < 768; k++) for (bssize_t k = 0; k < 768; k++)
paldata[k] <<= 2; paldata[k] <<= 2;
paletteSetColorTable(basepalnum, paldata); paletteSetColorTable(basepalnum, paldata, basepalnum == DREALMSPAL || basepalnum == ENDINGPAL);
} }
Bmemcpy(paldata, palette+1, 767); Bmemcpy(paldata, palette+1, 767);
paldata[767] = palette[767]; paldata[767] = palette[767];
paletteSetColorTable(DRUGPAL, paldata); paletteSetColorTable(DRUGPAL, paldata); // todo: implement this as a shader effect
if (RR) if (RR)
{ {

View file

@ -6601,17 +6601,6 @@ static inline void G_CheckGametype(void)
static void G_PostLoadPalette(void) static void G_PostLoadPalette(void)
{ {
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)) //if (!(duke3d_globalflags & DUKE3D_NO_HARDCODED_FOGPALS))
// paletteSetupDefaultFog(); // paletteSetupDefaultFog();

View file

@ -33,7 +33,6 @@ struct osdcmd_cheatsinfo {
extern struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat; extern struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat;
int32_t registerosdcommands(void); int32_t registerosdcommands(void);
void onvideomodechange(int32_t newmode);
// key bindings stuff // key bindings stuff
typedef struct { typedef struct {

View file

@ -723,6 +723,18 @@ bool InitGame()
InitAutoNet(); InitAutoNet();
{
auto pal = fileSystem.LoadFile("3drealms.pal", 0);
if (pal.Size() >= 768)
{
for (auto& c : pal)
c <<= 2;
paletteSetColorTable(DREALMSPAL, pal.Data(), true);
}
}
timerInit(120); timerInit(120);
InitPalette(); InitPalette();
@ -1405,18 +1417,7 @@ void LogoLevel(void)
DSPRINTF(ds,"LogoLevel..."); DSPRINTF(ds,"LogoLevel...");
MONO_PRINT(ds); MONO_PRINT(ds);
auto pal = fileSystem.LoadFile("3drealms.pal", 0);
if (pal.Size() >= 768)
{
for (auto & c : pal)
c <<= 2;
paletteSetColorTable(DREALMSPAL, pal.Data());
videoSetPalette(0, DREALMSPAL, Pal_Fullscreen); videoSetPalette(0, DREALMSPAL, Pal_Fullscreen);
}
DSPRINTF(ds,"Just read in 3drealms.pal...");
MONO_PRINT(ds); MONO_PRINT(ds);
//FadeOut(0, 0); //FadeOut(0, 0);

View file

@ -35,7 +35,6 @@ struct osdcmd_cheatsinfo {
extern struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat; extern struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat;
int32_t registerosdcommands(void); int32_t registerosdcommands(void);
void onvideomodechange(int32_t newmode);
extern const char *const ConsoleButtons[]; extern const char *const ConsoleButtons[];