- palette related fixes.

This commit is contained in:
Christoph Oelckers 2020-04-11 19:18:47 +02:00
parent 940f1dc9a2
commit 1a0ace4f88
8 changed files with 11 additions and 8 deletions

View file

@ -203,7 +203,7 @@ FRemapTable* PaletteContainer::AddRemap(FRemapTable* remap)
for (auto uremap : uniqueRemaps) 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; return uremap;
} }
auto newremap = (FRemapTable*)remapArena.Alloc(sizeof(FRemapTable)); 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) void PaletteContainer::CopyTranslation(int dest, int src)
{ {
TranslationTables[GetTranslationType(dest)][GetTranslationType(src)] = TranslationToTable(src); TranslationTables[GetTranslationType(dest)].SetVal(GetTranslationIndex(dest), TranslationToTable(src));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View file

@ -34,6 +34,7 @@ struct FRemapTable
int Index; int Index;
int NumEntries; // # of elements in this table (usually 256) 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 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: private:
}; };

View file

@ -637,6 +637,7 @@ void FFont::SetDefaultTranslation(uint32_t *othercolors)
FRemapTable remap(ActiveColors); FRemapTable remap(ActiveColors);
remap.Remap[0] = 0; remap.Remap[0] = 0;
remap.Palette[0] = 0; remap.Palette[0] = 0;
remap.ForFont = true;
for (unsigned l = 1; l < myluminosity.Size(); l++) 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; const TranslationParm *parmstart = (const TranslationParm *)ranges;
FRemapTable remap(total_colors); FRemapTable remap(total_colors);
remap.ForFont = true;
// Create different translations for different color ranges // Create different translations for different color ranges
Translations.Clear(); Translations.Clear();
@ -808,6 +810,7 @@ void FFont::BuildTranslations (const double *luminosity, const uint8_t *identity
remap.Remap[0] = 0; remap.Remap[0] = 0;
remap.Palette[0] = 0; remap.Palette[0] = 0;
remap.ForFont = true;
for (j = 1; j < ActiveColors; j++) for (j = 1; j < ActiveColors; j++)
{ {

View file

@ -391,6 +391,7 @@ public:
FRemapTable remap(ActiveColors); FRemapTable remap(ActiveColors);
remap.Remap[0] = 0; remap.Remap[0] = 0;
remap.Palette[0] = 0; remap.Palette[0] = 0;
remap.ForFont = true;
for (unsigned l = 1; l < 18; l++) for (unsigned l = 1; l < 18; l++)
{ {

View file

@ -79,13 +79,13 @@
// PRIVATE FUNCTION PROTOTYPES --------------------------------------------- // PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
static int TranslationMapCompare (const void *a, const void *b); static int TranslationMapCompare (const void *a, const void *b);
void UpdateGenericUI(bool cvar);
// EXTERNAL DATA DECLARATIONS ---------------------------------------------- // EXTERNAL DATA DECLARATIONS ----------------------------------------------
extern int PrintColors[]; extern int PrintColors[];
// PUBLIC DATA DEFINITIONS ------------------------------------------------- // PUBLIC DATA DEFINITIONS -------------------------------------------------
FFont* SmallFont, * SmallFont2, * BigFont, * BigUpper, * ConFont, * IntermissionFont, * NewConsoleFont, * NewSmallFont, * CurrentConsoleFont, * OriginalSmallFont, * AlternativeSmallFont, * OriginalBigFont;
FFont *FFont::FirstFont = nullptr; FFont *FFont::FirstFont = nullptr;
int NumTextColors; int NumTextColors;
@ -826,7 +826,6 @@ void V_InitFonts()
BigFont = OriginalBigFont; BigFont = OriginalBigFont;
} }
AlternativeSmallFont = OriginalSmallFont; AlternativeSmallFont = OriginalSmallFont;
UpdateGenericUI(false);
} }
void V_ClearFonts() void V_ClearFonts()

View file

@ -423,7 +423,7 @@ protected:
public: public:
FTextureBuffer CreateTexBuffer(int translation, int flags = 0); FTextureBuffer CreateTexBuffer(int translation, int flags = 0);
bool GetTranslucency(); virtual bool GetTranslucency();
FMaterial* GetMaterial(int num) FMaterial* GetMaterial(int num)
{ {
return Material[num]; return Material[num];

View file

@ -117,6 +117,7 @@ EXTERN_CVAR(Bool, cl_customizeinvulmap)
void DrawHUD(); void DrawHUD();
void D_DoAnonStats(); void D_DoAnonStats();
void I_DetectOS(); void I_DetectOS();
void UpdateGenericUI(bool cvar);
// MACROS ------------------------------------------------------------------ // MACROS ------------------------------------------------------------------
@ -3070,6 +3071,7 @@ static int D_DoomMain_Internal (void)
StartScreen->Progress(); StartScreen->Progress();
V_InitFonts(); V_InitFonts();
UpdateGenericUI(false);
// [CW] Parse any TEAMINFO lumps. // [CW] Parse any TEAMINFO lumps.
if (!batchrun) Printf ("ParseTeamInfo: Load team definitions.\n"); if (!batchrun) Printf ("ParseTeamInfo: Load team definitions.\n");

View file

@ -167,9 +167,6 @@ public:
int DisplayWidth, DisplayHeight; 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. // [RH] The framebuffer is no longer a mere byte array.
// There's also only one, not four. // There's also only one, not four.
DFrameBuffer *screen; DFrameBuffer *screen;