- fixed the internal name of the original SmallFont to be different from the real SmallFont. This necessitated creating a separate font object, even if it has the same contents.

- added an OriginalBigFont as well.
This commit is contained in:
Christoph Oelckers 2019-04-23 09:34:28 +02:00
parent e0d57e5464
commit 5122aa0571
4 changed files with 34 additions and 18 deletions

View file

@ -915,7 +915,7 @@ int stripaccent(int code)
FFont *V_GetFont(const char *name, const char *fontlumpname)
{
if (!stricmp(name, "DBIGFONT")) name = "BigFont"; // several mods have used the name CONFONT directly and effectively duplicated the font.
if (!stricmp(name, "DBIGFONT")) name = "BigFont";
else if (!stricmp(name, "CONFONT")) name = "ConsoleFont"; // several mods have used the name CONFONT directly and effectively duplicated the font.
FFont *font = FFont::FindFont (name);
if (font == nullptr)
@ -1506,15 +1506,14 @@ void V_InitFonts()
// The font has been replaced, so we need to create a copy of the original as well.
SmallFont = new FFont("SmallFont", "FONTA%02u", nullptr, HU_FONTSTART, HU_FONTSIZE, 1, -1);
SmallFont->SetCursor('[');
OriginalSmallFont = new FFont("SmallFont", "FONTA%02u", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, 1, -1, -1, false, true);
OriginalSmallFont->SetCursor('[');
}
else
{
SmallFont = new FFont("SmallFont", "FONTA%02u", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, 1, -1);
SmallFont->SetCursor('[');
}
OriginalSmallFont = new FFont("OriginalSmallFont", "FONTA%02u", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, 1, -1, -1, false, true);
OriginalSmallFont->SetCursor('[');
}
else if (Wads.CheckNumForName("STCFN033", ns_graphics) >= 0)
{
@ -1525,18 +1524,21 @@ void V_InitFonts()
{
// The font has been replaced, so we need to create a copy of the original as well.
SmallFont = new FFont("SmallFont", "STCFN%.3d", nullptr, HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1);
OriginalSmallFont = new FFont("SmallFont", "STCFN%.3d", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1, -1, false, true);
}
else
{
SmallFont = new FFont("SmallFont", "STCFN%.3d", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1);
}
OriginalSmallFont = new FFont("OriginalSmallFont", "STCFN%.3d", "defsmallfont", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1, -1, false, true);
}
}
uint32_t colors[256] = {};
SmallFont->RecordAllTextureColors(colors);
if (OriginalSmallFont != nullptr) OriginalSmallFont->SetDefaultTranslation(colors);
NewSmallFont->SetDefaultTranslation(colors);
if (SmallFont)
{
uint32_t colors[256] = {};
SmallFont->RecordAllTextureColors(colors);
if (OriginalSmallFont != nullptr) OriginalSmallFont->SetDefaultTranslation(colors);
NewSmallFont->SetDefaultTranslation(colors);
}
if (!(SmallFont2 = V_GetFont("SmallFont2"))) // Only used by Strife
{
@ -1557,6 +1559,22 @@ void V_InitFonts()
}
}
if (gameinfo.gametype & GAME_Raven)
{
OriginalBigFont = new FFont("OriginalBigFont", "FONTB%02u", "defbigfont", HU_FONTSTART, HU_FONTSIZE, 1, -1, -1, false, true);
}
else
{
OriginalBigFont = new FFont("OriginalBigFont", nullptr, "bigfont", HU_FONTSTART, HU_FONTSIZE, 1, -1, -1, false, true);
}
if (BigFont)
{
uint32_t colors[256] = {};
BigFont->RecordAllTextureColors(colors);
if (OriginalBigFont != nullptr) OriginalBigFont->SetDefaultTranslation(colors);
}
// let PWAD BIGFONTs override the stock BIGUPPER font. (This check needs to be made smarter.)
if (BigUpper && BigFont->Type != FFont::Folder && BigUpper->Type == FFont::Folder)
{
@ -1591,7 +1609,7 @@ void V_InitFonts()
// SmallFont and SmallFont2 have no default provided by the engine. BigFont only has in non-Raven games.
if (SmallFont == nullptr)
{
SmallFont = ConFont;
SmallFont = OriginalSmallFont;
}
if (SmallFont2 == nullptr)
{
@ -1599,11 +1617,7 @@ void V_InitFonts()
}
if (BigFont == nullptr)
{
BigFont = NewSmallFont;
}
if (OriginalSmallFont == nullptr)
{
OriginalSmallFont = SmallFont;
BigFont = OriginalBigFont;
}
AlternativeSmallFont = OriginalSmallFont;
UpdateGenericUI(false);

View file

@ -175,7 +175,7 @@ protected:
};
extern FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *NewSmallFont, *CurrentConsoleFont, *OriginalSmallFont, *AlternativeSmallFont;
extern FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *NewSmallFont, *CurrentConsoleFont, *OriginalSmallFont, *AlternativeSmallFont, *OriginalBigFont;
void V_InitFonts();
void V_ClearFonts();

View file

@ -108,7 +108,7 @@ CUSTOM_CVAR(Int, vid_rendermode, 4, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOIN
// No further checks needed. All this changes now is which scene drawer the render backend calls.
}
CUSTOM_CVAR(Int, vid_enablevulkan, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
CUSTOM_CVAR(Int, vid_enablevulkan, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
{
// [SP] This may seem pointless - but I don't want to implement live switching just
// yet - I'm pretty sure it's going to require a lot of reinits and destructions to
@ -149,7 +149,7 @@ public:
int DisplayWidth, DisplayHeight;
FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *NewSmallFont, *CurrentConsoleFont, *OriginalSmallFont, *AlternativeSmallFont;
FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont, *NewConsoleFont, *NewSmallFont, *CurrentConsoleFont, *OriginalSmallFont, *AlternativeSmallFont, *OriginalBigFont;
uint32_t Col2RGB8[65][256];
uint32_t *Col2RGB8_LessPrecision[65];
@ -919,6 +919,7 @@ DEFINE_GLOBAL(NewConsoleFont)
DEFINE_GLOBAL(NewSmallFont)
DEFINE_GLOBAL(AlternativeSmallFont)
DEFINE_GLOBAL(OriginalSmallFont)
DEFINE_GLOBAL(OriginalBigFont)
DEFINE_GLOBAL(IntermissionFont)
DEFINE_GLOBAL(CleanXfac)
DEFINE_GLOBAL(CleanYfac)

View file

@ -26,6 +26,7 @@ struct _ native // These are the global variables, the struct is only here to av
native readonly Font NewSmallFont;
native readonly Font AlternativeSmallFont;
native readonly Font OriginalSmallFont;
native readonly Font OriginalBigFont;
native readonly Font intermissionfont;
native readonly int CleanXFac;
native readonly int CleanYFac;