From 1a0ace4f8860484cbe96e8985af4ba554e1c1e48 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Apr 2020 19:18:47 +0200 Subject: [PATCH] - palette related fixes. --- src/common/engine/palettecontainer.cpp | 4 ++-- src/common/engine/palettecontainer.h | 1 + src/common/fonts/font.cpp | 3 +++ src/common/fonts/hexfont.cpp | 1 + src/common/fonts/v_font.cpp | 3 +-- src/common/textures/textures.h | 2 +- src/d_main.cpp | 2 ++ src/rendering/v_video.cpp | 3 --- 8 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/common/engine/palettecontainer.cpp b/src/common/engine/palettecontainer.cpp index a4ee23b82a..4cd4a28bc1 100644 --- a/src/common/engine/palettecontainer.cpp +++ b/src/common/engine/palettecontainer.cpp @@ -203,7 +203,7 @@ FRemapTable* PaletteContainer::AddRemap(FRemapTable* remap) for (auto uremap : uniqueRemaps) { - if (uremap->crc32 == remap->crc32 && uremap->NumEntries == remap->NumEntries && *uremap == *remap) + if (uremap->crc32 == remap->crc32 && uremap->NumEntries == remap->NumEntries && *uremap == *remap && remap->Inactive == uremap->Inactive) return uremap; } auto newremap = (FRemapTable*)remapArena.Alloc(sizeof(FRemapTable)); @@ -250,7 +250,7 @@ int PaletteContainer::AddTranslation(int slot, FRemapTable* remap, int count) void PaletteContainer::CopyTranslation(int dest, int src) { - TranslationTables[GetTranslationType(dest)][GetTranslationType(src)] = TranslationToTable(src); + TranslationTables[GetTranslationType(dest)].SetVal(GetTranslationIndex(dest), TranslationToTable(src)); } //---------------------------------------------------------------------------- diff --git a/src/common/engine/palettecontainer.h b/src/common/engine/palettecontainer.h index 9cbb5e6d43..c8c5499d3b 100644 --- a/src/common/engine/palettecontainer.h +++ b/src/common/engine/palettecontainer.h @@ -34,6 +34,7 @@ struct FRemapTable int Index; int NumEntries; // # of elements in this table (usually 256) bool Inactive = false; // This table is inactive and should be treated as if it was passed as NULL + bool ForFont = false; // Mark font translations because they may require different handling than the ones for sprites- private: }; diff --git a/src/common/fonts/font.cpp b/src/common/fonts/font.cpp index ba4fbf6d92..dff9cd33e1 100644 --- a/src/common/fonts/font.cpp +++ b/src/common/fonts/font.cpp @@ -637,6 +637,7 @@ void FFont::SetDefaultTranslation(uint32_t *othercolors) FRemapTable remap(ActiveColors); remap.Remap[0] = 0; remap.Palette[0] = 0; + remap.ForFont = true; for (unsigned l = 1; l < myluminosity.Size(); l++) { @@ -773,6 +774,7 @@ void FFont::BuildTranslations (const double *luminosity, const uint8_t *identity const TranslationParm *parmstart = (const TranslationParm *)ranges; FRemapTable remap(total_colors); + remap.ForFont = true; // Create different translations for different color ranges Translations.Clear(); @@ -808,6 +810,7 @@ void FFont::BuildTranslations (const double *luminosity, const uint8_t *identity remap.Remap[0] = 0; remap.Palette[0] = 0; + remap.ForFont = true; for (j = 1; j < ActiveColors; j++) { diff --git a/src/common/fonts/hexfont.cpp b/src/common/fonts/hexfont.cpp index d310fdc019..1b3bca2e41 100644 --- a/src/common/fonts/hexfont.cpp +++ b/src/common/fonts/hexfont.cpp @@ -391,6 +391,7 @@ public: FRemapTable remap(ActiveColors); remap.Remap[0] = 0; remap.Palette[0] = 0; + remap.ForFont = true; for (unsigned l = 1; l < 18; l++) { diff --git a/src/common/fonts/v_font.cpp b/src/common/fonts/v_font.cpp index f3067fea70..8fe004f7f1 100644 --- a/src/common/fonts/v_font.cpp +++ b/src/common/fonts/v_font.cpp @@ -79,13 +79,13 @@ // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- static int TranslationMapCompare (const void *a, const void *b); -void UpdateGenericUI(bool cvar); // EXTERNAL DATA DECLARATIONS ---------------------------------------------- extern int PrintColors[]; // PUBLIC DATA DEFINITIONS ------------------------------------------------- +FFont* SmallFont, * SmallFont2, * BigFont, * BigUpper, * ConFont, * IntermissionFont, * NewConsoleFont, * NewSmallFont, * CurrentConsoleFont, * OriginalSmallFont, * AlternativeSmallFont, * OriginalBigFont; FFont *FFont::FirstFont = nullptr; int NumTextColors; @@ -826,7 +826,6 @@ void V_InitFonts() BigFont = OriginalBigFont; } AlternativeSmallFont = OriginalSmallFont; - UpdateGenericUI(false); } void V_ClearFonts() diff --git a/src/common/textures/textures.h b/src/common/textures/textures.h index 38a80f8d4d..d9bb06f1e9 100644 --- a/src/common/textures/textures.h +++ b/src/common/textures/textures.h @@ -423,7 +423,7 @@ protected: public: FTextureBuffer CreateTexBuffer(int translation, int flags = 0); - bool GetTranslucency(); + virtual bool GetTranslucency(); FMaterial* GetMaterial(int num) { return Material[num]; diff --git a/src/d_main.cpp b/src/d_main.cpp index b74c731d8b..6641282f7c 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -117,6 +117,7 @@ EXTERN_CVAR(Bool, cl_customizeinvulmap) void DrawHUD(); void D_DoAnonStats(); void I_DetectOS(); +void UpdateGenericUI(bool cvar); // MACROS ------------------------------------------------------------------ @@ -3070,6 +3071,7 @@ static int D_DoomMain_Internal (void) StartScreen->Progress(); V_InitFonts(); + UpdateGenericUI(false); // [CW] Parse any TEAMINFO lumps. if (!batchrun) Printf ("ParseTeamInfo: Load team definitions.\n"); diff --git a/src/rendering/v_video.cpp b/src/rendering/v_video.cpp index 3a5fb797f5..f74e65ce53 100644 --- a/src/rendering/v_video.cpp +++ b/src/rendering/v_video.cpp @@ -167,9 +167,6 @@ public: int DisplayWidth, DisplayHeight; -FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *NewSmallFont, *CurrentConsoleFont, *OriginalSmallFont, *AlternativeSmallFont, *OriginalBigFont; - - // [RH] The framebuffer is no longer a mere byte array. // There's also only one, not four. DFrameBuffer *screen;