From 6f9ee4b60f8a47e0eb2fb97b33ac1e6fde762039 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 12 Apr 2020 07:50:24 +0200 Subject: [PATCH] - store palettes in the palette container. --- source/blood/src/osdcmd.cpp | 9 --- source/blood/src/osdcmds.h | 1 - source/blood/src/screen.cpp | 29 +++----- source/build/include/build.h | 1 - source/build/include/palette.h | 10 ++- source/build/src/defs.cpp | 11 +-- source/build/src/palette.cpp | 85 ++++++++++------------- source/build/src/polymost.cpp | 10 +-- source/common/engine/palettecontainer.cpp | 26 +++++-- source/common/engine/palettecontainer.h | 4 +- source/core/gamecontrol.cpp | 1 - source/duke3d/src/common.cpp | 2 +- source/duke3d/src/game.cpp | 11 --- source/duke3d/src/osdcmds.h | 1 - source/exhumed/src/exhumed.cpp | 1 - source/exhumed/src/light.cpp | 4 -- source/exhumed/src/osdcmds.h | 1 - source/rr/src/common.cpp | 4 +- source/rr/src/game.cpp | 11 --- source/rr/src/osdcmds.h | 1 - source/sw/src/game.cpp | 25 +++---- source/sw/src/osdcmds.h | 1 - 22 files changed, 103 insertions(+), 146 deletions(-) diff --git a/source/blood/src/osdcmd.cpp b/source/blood/src/osdcmd.cpp index 061511107..8d3020a59 100644 --- a/source/blood/src/osdcmd.cpp +++ b/source/blood/src/osdcmd.cpp @@ -211,15 +211,6 @@ static int osdcmd_noclip(CCmdFuncPtr UNUSED(parm)) return OSDCMD_OK; } -void onvideomodechange(int32_t newmode) -{ - UNREFERENCED_PARAMETER(newmode); - - if (newmode) - scrResetPalette(); - UpdateDacs(gLastPal, false); -} - static int osdcmd_activatecheat(CCmdFuncPtr parm) { FString CheatEntry; diff --git a/source/blood/src/osdcmds.h b/source/blood/src/osdcmds.h index b9e696902..41ade289c 100644 --- a/source/blood/src/osdcmds.h +++ b/source/blood/src/osdcmds.h @@ -25,6 +25,5 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. BEGIN_BLD_NS int32_t registerosdcommands(void); -void onvideomodechange(int32_t newmode); END_BLD_NS diff --git a/source/blood/src/screen.cpp b/source/blood/src/screen.cpp index 427485cd9..d013ad9d9 100644 --- a/source/blood/src/screen.cpp +++ b/source/blood/src/screen.cpp @@ -52,12 +52,12 @@ LOADITEM PLU[15] = { { 14, "P4" } }; -LOADITEM PAL[5] = { - { 0, "BLOOD" }, - { 1, "WATER" }, - { 2, "BEAST" }, - { 3, "SEWER" }, - { 4, "INVULN1" } +const char *PAL[5] = { + "BLOOD.PAL", + "WATER.PAL", + "BEAST.PAL", + "SEWER.PAL", + "INVULN1.PAL" }; @@ -66,15 +66,11 @@ static RGB *palTable[5]; static int curPalette; bool gFogMode = false; -void scrResetPalette(void) -{ - paletteSetColorTable(0, (uint8_t*)palTable[0]); -} - void scrLoadPLUs(void) { // 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"); if (!pPlu) ThrowError("%s.PLU not found", PLU[i].name); @@ -120,13 +116,10 @@ void scrLoadPalette(void) Printf("Loading palettes\n"); for (int i = 0; i < 5; i++) { - DICTNODE *pPal = gSysRes.Lookup(PAL[i].name, "PAL"); - if (!pPal) - ThrowError("%s.PAL not found (RFF files may be wrong version)", PAL[i].name); - palTable[PAL[i].id] = (RGB*)gSysRes.Lock(pPal); - paletteSetColorTable(PAL[i].id, (uint8_t*)palTable[PAL[i].id]); + auto pal = fileSystem.LoadFile(PAL[i]); + if (pal.Size() < 768) I_FatalError("%s: file too small", PAL[i]); + paletteSetColorTable(i, pal.Data()); } - memcpy(palette, palTable[0], sizeof(palette)); numshades = 64; paletteloaded |= PALETTE_MAIN; scrLoadPLUs(); diff --git a/source/build/include/build.h b/source/build/include/build.h index 83c5b7ef6..4b8aca091 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -542,7 +542,6 @@ EXTERN int16_t sintable[2048]; EXTERN uint8_t palette[768]; EXTERN int16_t numshades; EXTERN char *lookuptables[MAXPALOOKUPS]; -extern uint8_t *basepaltable[MAXBASEPALS]; EXTERN uint8_t paletteloaded; EXTERN uint8_t whitecol, redcol, blackcol; diff --git a/source/build/include/palette.h b/source/build/include/palette.h index 90cd586a1..3254f7f13 100644 --- a/source/build/include/palette.h +++ b/source/build/include/palette.h @@ -25,6 +25,12 @@ #define NORMALPAL (MAXPALOOKUPS - 4) #define BRIGHTPAL (MAXPALOOKUPS) +enum +{ + Translation_BasePalettes, + Translation_Remap, +}; + extern uint8_t curbasepal; extern uint8_t PaletteIndexFullbrights[32]; @@ -51,9 +57,7 @@ extern palette_t palfadergb; extern unsigned char palfadedelta; 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 paletteFreeColorTable(int32_t id); -void paletteFreeColorTables(); +void paletteSetColorTable(int32_t id, uint8_t const *table, bool notransparency = false); int32_t paletteSetLookupTable(int32_t palnum, const uint8_t *shtab); void paletteFreeLookupTable(int32_t palnum); diff --git a/source/build/src/defs.cpp b/source/build/src/defs.cpp index 9207a9815..08dfdb225 100644 --- a/source/build/src/defs.cpp +++ b/source/build/src/defs.cpp @@ -17,6 +17,7 @@ #include "bitmap.h" #include "m_argv.h" #include "gamecontrol.h" +#include "palettecontainer.h" #ifdef USE_OPENGL # include "hightile.h" @@ -2673,21 +2674,21 @@ static int32_t defsparser(scriptfile *script) break; } - uint8_t const * const sourcetable = basepaltable[source]; - if (EDUKE32_PREDICT_FALSE(sourcetable == NULL)) + auto sourcepal = GPalette.GetTranslation(Translation_BasePalettes, source); + if (sourcepal == NULL) { Printf("Error: basepalette: Source basepal does not exist on line %s:%d\n", script->filename, scriptfile_getlinum(script,cmdtokptr)); break; } - paletteSetColorTable(id, sourcetable); + GPalette.CopyTranslation(TRANSLATION(Translation_BasePalettes, id), TRANSLATION(Translation_BasePalettes, source)); didLoadPal = 1; break; } case T_UNDEF: { - paletteFreeColorTable(id); + GPalette.ClearTranslationSlot(TRANSLATION(Translation_BasePalettes, id)); didLoadPal = 0; if (id == 0) @@ -3325,7 +3326,7 @@ static int32_t defsparser(scriptfile *script) } for (bssize_t i = id0; i <= id1; i++) - paletteFreeColorTable(i); + GPalette.ClearTranslationSlot(TRANSLATION(Translation_BasePalettes, i)); if (id0 == 0) paletteloaded &= ~PALETTE_MAIN; diff --git a/source/build/src/palette.cpp b/source/build/src/palette.cpp index 0ec63cab9..b0a2b6f62 100644 --- a/source/build/src/palette.cpp +++ b/source/build/src/palette.cpp @@ -15,9 +15,12 @@ #include "palette.h" #include "superfasthash.h" #include "common.h" +#include "memarena.h" +#include "palettecontainer.h" #include "../../glbackend/glbackend.h" -uint8_t *basepaltable[MAXBASEPALS] = { palette }; +FMemArena lookuparena; + uint8_t basepalreset=1; uint8_t curbasepal; int32_t globalblend; @@ -50,14 +53,12 @@ int DetermineTranslucency(const uint8_t *table) PalEntry newcolor; PalEntry newcolor2; - index = table[blackcol * 256 + whitecol]; - auto pp = &basepaltable[0][index]; - newcolor = PalEntry(pp[0], pp[1], pp[2]); + index = table[GPalette.BlackIndex * 256 + GPalette.WhiteIndex]; + newcolor = GPalette.BaseColors[index]; - index = table[whitecol * 256 + blackcol]; - pp = &basepaltable[0][index]; - newcolor2 = PalEntry(pp[0], pp[1], pp[2]); - if (newcolor2.r == 255) // if black on white results in white it's either + index = table[GPalette.WhiteIndex * 256 + GPalette.BlackIndex]; + newcolor2 = GPalette.BaseColors[index]; + if (newcolor2.r == 255) // if black on white results in white it's either // fully transparent or additive { return -newcolor.r; @@ -66,6 +67,29 @@ int DetermineTranslucency(const uint8_t *table) 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); 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) { + GPalette.Init(MAXPALOOKUPS + 1); // one slot for each translation, plus a separate one for the base palettes. #ifdef USE_OPENGL for (auto & x : glblend) @@ -116,6 +141,7 @@ void paletteLoadFromDisk(void) for (unsigned char & k : palette) k <<= 2; + paletteSetColorTable(0, palette); paletteloaded |= PALETTE_MAIN; @@ -255,6 +281,7 @@ void palettePostLoadTables(void) if (EDUKE32_PREDICT_FALSE(palookup0[s] != index)) goto PostLoad_NotFullbright; + Printf("%d is fullbright\n", c); SetPaletteIndexFullbright(c); PostLoad_NotFullbright: ; @@ -564,39 +591,6 @@ void paletteMakeLookupTable(int32_t palnum, const char *remapbuf, uint8_t r, uin #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 // @@ -609,13 +603,11 @@ void paletteFreeColorTables() // 32: apply brightness to scene in OpenGL void videoSetPalette(int dabrightness, int dapalid, ESetPalFlags flags) { - if (/*(unsigned)dapalid >= MAXBASEPALS ||*/ basepaltable[dapalid] == NULL) + if (GPalette.GetTranslation(Translation_BasePalettes, dapalid) == nullptr) dapalid = 0; curbasepal = dapalid; basepalreset = 0; - auto dapal = basepaltable[curbasepal]; - // In-scene brightness mode for RR's thunderstorm. This shouldn't affect the global gamma ramp. if ((videoGetRenderMode() >= REND_POLYMOST) && (flags & Pal_SceneBrightness)) { @@ -657,9 +649,4 @@ void paletteFreeAll() Xaligned_free(lookuptables[i]); } Bmemset(lookuptables, 0, sizeof(lookuptables)); - - for (bssize_t i = 1; i < MAXBASEPALS; i++) - Xfree(basepaltable[i]); - Bmemset(basepaltable, 0, sizeof(basepaltable)); - basepaltable[0] = palette; } \ No newline at end of file diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 2c30ef8ce..8fc8feaab 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -18,6 +18,7 @@ Ken Silverman's official web site: http://www.advsys.net/ken #include "gamecvars.h" #include "v_video.h" #include "flatvertices.h" +#include "palettecontainer.h" CVAR(Bool, hw_detailmapping, 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) { - if (!basepaltable[basepalnum]) + auto remap = GPalette.GetTranslation(Translation_BasePalettes, basepalnum); + if (!remap) { return; } @@ -284,9 +286,9 @@ void uploadbasepalette(int32_t basepalnum) uint8_t basepalWFullBrightInfo[4*256]; for (int i = 0; i < 256; ++i) { - basepalWFullBrightInfo[i*4+0] = basepaltable[basepalnum][i*3+2]; - basepalWFullBrightInfo[i*4+1] = basepaltable[basepalnum][i*3+1]; - basepalWFullBrightInfo[i*4+2] = basepaltable[basepalnum][i*3+0]; + basepalWFullBrightInfo[i*4+0] = remap->Palette[i].b; + basepalWFullBrightInfo[i*4+1] = remap->Palette[i].g; + basepalWFullBrightInfo[i*4+2] = remap->Palette[i].r; basepalWFullBrightInfo[i*4+3] = 0-(IsPaletteIndexFullbright(i) != 0); } diff --git a/source/common/engine/palettecontainer.cpp b/source/common/engine/palettecontainer.cpp index 33214f223..e6408197a 100644 --- a/source/common/engine/palettecontainer.cpp +++ b/source/common/engine/palettecontainer.cpp @@ -60,16 +60,28 @@ void PaletteContainer::Init(int numslots) // This cannot be a constructor!!! 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) { - BaseColors[i] = PalEntry(colors[0], colors[1], colors[2]); + BaseColors[i] = PalEntry(255, colors[0], colors[1], colors[2]); 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 - // 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. WhiteIndex = BestColor((uint32_t*)BaseColors, 255, 255, 255, 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)) { - return NULL; + return uniqueRemaps[0]; // this is the identity table. } 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; - if (IndexOutOfRange(start, end)) + if (IndexOutOfRange(start, end-1)) { return false; } @@ -680,7 +692,7 @@ bool FRemapTable::AddColors(int start, int count, const uint8_t*colors) colors += 3; 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]); } return true; diff --git a/source/common/engine/palettecontainer.h b/source/common/engine/palettecontainer.h index 86c87cd5e..b178e0aa4 100644 --- a/source/common/engine/palettecontainer.h +++ b/source/common/engine/palettecontainer.h @@ -18,7 +18,7 @@ struct FRemapTable 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 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 PalEntry Palette[256]; // The ideal palette this maps to @@ -79,7 +79,7 @@ private: TArray> TranslationTables; public: 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(); FRemapTable* AddRemap(FRemapTable* remap); void UpdateTranslation(int trans, FRemapTable* remap); diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index d042c1603..f2a19ce5d 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -428,7 +428,6 @@ int GameMain() GLInterface.Deinit(); I_ShutdownGraphics(); M_DeinitMenus(); - paletteFreeColorTables(); engineUnInit(); if (gi) { diff --git a/source/duke3d/src/common.cpp b/source/duke3d/src/common.cpp index 88c051014..a5513988d 100644 --- a/source/duke3d/src/common.cpp +++ b/source/duke3d/src/common.cpp @@ -133,7 +133,7 @@ void G_LoadLookups(void) for (unsigned char & k : paldata) k <<= 2; - paletteSetColorTable(basepalnum, paldata); + paletteSetColorTable(basepalnum, paldata, basepalnum == DREALMSPAL || basepalnum == ENDINGPAL); } } diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index 58b576441..336cad956 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -5257,17 +5257,6 @@ static inline void G_CheckGametype(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)) paletteSetupDefaultFog(); diff --git a/source/duke3d/src/osdcmds.h b/source/duke3d/src/osdcmds.h index 2df1278c9..b9ebd615e 100644 --- a/source/duke3d/src/osdcmds.h +++ b/source/duke3d/src/osdcmds.h @@ -34,7 +34,6 @@ struct osdcmd_cheatsinfo { extern struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat; int32_t registerosdcommands(void); -void onvideomodechange(int32_t newmode); extern const char *const ConsoleButtons[]; diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 5d8349a51..fc27d0b52 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -1993,7 +1993,6 @@ int GameInterface::app_main() ResetView(); GrabPalette(); - paletteSetColorTable(curbasepal, basepaltable[BASEPAL]); if (bSerialPlay && !InitSerial()) { I_Error("Unable to connect"); diff --git a/source/exhumed/src/light.cpp b/source/exhumed/src/light.cpp index d3eac7b4d..7ac62a6a6 100644 --- a/source/exhumed/src/light.cpp +++ b/source/exhumed/src/light.cpp @@ -246,17 +246,13 @@ void StartFadeIn() int DoFadeIn() { - paletteSetColorTable(curbasepal, basepaltable[BASEPAL]); - videoSetPalette(0, curbasepal, 0); videoNextPage(); return 0; } void FadeIn() { - videoSetPalette(0, BASEPAL, 0); videoNextPage(); - } void FixPalette() diff --git a/source/exhumed/src/osdcmds.h b/source/exhumed/src/osdcmds.h index b028441e1..02a2d63a0 100644 --- a/source/exhumed/src/osdcmds.h +++ b/source/exhumed/src/osdcmds.h @@ -27,7 +27,6 @@ BEGIN_PS_NS int32_t registerosdcommands(void); -void onvideomodechange(int32_t newmode); void GAME_onshowosd(int shown); void GAME_clearbackground(int numcols, int numrows); diff --git a/source/rr/src/common.cpp b/source/rr/src/common.cpp index 4bf20057f..213f8949b 100644 --- a/source/rr/src/common.cpp +++ b/source/rr/src/common.cpp @@ -132,12 +132,12 @@ void G_LoadLookups(void) for (bssize_t k = 0; k < 768; k++) paldata[k] <<= 2; - paletteSetColorTable(basepalnum, paldata); + paletteSetColorTable(basepalnum, paldata, basepalnum == DREALMSPAL || basepalnum == ENDINGPAL); } Bmemcpy(paldata, palette+1, 767); paldata[767] = palette[767]; - paletteSetColorTable(DRUGPAL, paldata); + paletteSetColorTable(DRUGPAL, paldata); // todo: implement this as a shader effect if (RR) { diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index dca1e42e1..e3b377e3e 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -6601,17 +6601,6 @@ static inline void G_CheckGametype(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)) // paletteSetupDefaultFog(); diff --git a/source/rr/src/osdcmds.h b/source/rr/src/osdcmds.h index 4d69bb419..f16aee369 100644 --- a/source/rr/src/osdcmds.h +++ b/source/rr/src/osdcmds.h @@ -33,7 +33,6 @@ struct osdcmd_cheatsinfo { extern struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat; int32_t registerosdcommands(void); -void onvideomodechange(int32_t newmode); // key bindings stuff typedef struct { diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index 2c01b3ee2..2dc38aea3 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -723,6 +723,18 @@ bool InitGame() 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); InitPalette(); @@ -1405,18 +1417,7 @@ void LogoLevel(void) DSPRINTF(ds,"LogoLevel..."); 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); - } - DSPRINTF(ds,"Just read in 3drealms.pal..."); + videoSetPalette(0, DREALMSPAL, Pal_Fullscreen); MONO_PRINT(ds); //FadeOut(0, 0); diff --git a/source/sw/src/osdcmds.h b/source/sw/src/osdcmds.h index 21000a166..6c438e028 100644 --- a/source/sw/src/osdcmds.h +++ b/source/sw/src/osdcmds.h @@ -35,7 +35,6 @@ struct osdcmd_cheatsinfo { extern struct osdcmd_cheatsinfo osdcmd_cheatsinfo_stat; int32_t registerosdcommands(void); -void onvideomodechange(int32_t newmode); extern const char *const ConsoleButtons[];