0
0
Fork 0
mirror of https://github.com/ZDoom/qzdoom.git synced 2025-02-28 14:51:23 +00:00

- let IWAD and PWAD BigFonts override BigUpper for consistency.

This commit is contained in:
Christoph Oelckers 2019-03-02 12:54:46 +01:00
parent 805cf6c098
commit 5f6198f4e4
6 changed files with 45 additions and 1 deletions

View file

@ -185,6 +185,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
if (FixedWidth > 0) if (FixedWidth > 0)
{ {
ReadSheetFont(folderdata, FixedWidth, FontHeight, Scale); ReadSheetFont(folderdata, FixedWidth, FontHeight, Scale);
Type = Folder;
} }
else else
{ {
@ -211,6 +212,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
} }
if (lump.isValid()) if (lump.isValid())
{ {
Type = Multilump;
if (position < minchar) minchar = position; if (position < minchar) minchar = position;
if (position > maxchar) maxchar = position; if (position > maxchar) maxchar = position;
charMap.Insert(position, TexMan.GetTexture(lump)); charMap.Insert(position, TexMan.GetTexture(lump));
@ -235,6 +237,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
auto tex = TexMan.GetTexture(lump); auto tex = TexMan.GetTexture(lump);
tex->SetScale(Scale); tex->SetScale(Scale);
charMap.Insert((int)position, tex); charMap.Insert((int)position, tex);
Type = Folder;
} }
} }
} }

View file

@ -131,6 +131,7 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump)
if (data[0] == 0xE1 && data[1] == 0xE6 && data[2] == 0xD5 && data[3] == 0x1A) if (data[0] == 0xE1 && data[1] == 0xE6 && data[2] == 0xD5 && data[3] == 0x1A)
{ {
LoadBMF(lump, data); LoadBMF(lump, data);
Type = BMF;
} }
else if (data[0] != 'F' || data[1] != 'O' || data[2] != 'N' || else if (data[0] != 'F' || data[1] != 'O' || data[2] != 'N' ||
(data[3] != '1' && data[3] != '2')) (data[3] != '1' && data[3] != '2'))
@ -143,10 +144,12 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump)
{ {
case '1': case '1':
LoadFON1 (lump, data); LoadFON1 (lump, data);
Type = Fon1;
break; break;
case '2': case '2':
LoadFON2 (lump, data); LoadFON2 (lump, data);
Type = Fon2;
break; break;
} }
} }

View file

@ -859,6 +859,12 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
FFont *font = FFont::FindFont (name); FFont *font = FFont::FindFont (name);
if (font == nullptr) if (font == nullptr)
{ {
if (!stricmp(name, "BIGUPPER"))
{
font = FFont::FindFont("BIGFONT");
if (font) return font;
}
int lump = -1; int lump = -1;
int folderfile = -1; int folderfile = -1;
@ -1446,6 +1452,10 @@ void V_InitFonts()
SmallFont2 = new FFont("SmallFont2", "STBFN%.3d", "defsmallfont2", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1); SmallFont2 = new FFont("SmallFont2", "STBFN%.3d", "defsmallfont2", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART, -1);
} }
} }
//This must be read before BigFont so that it can be properly substituted.
BigUpper = V_GetFont("BigUpper");
if (!(BigFont = V_GetFont("BigFont"))) if (!(BigFont = V_GetFont("BigFont")))
{ {
if (gameinfo.gametype & GAME_Raven) if (gameinfo.gametype & GAME_Raven)
@ -1453,7 +1463,15 @@ void V_InitFonts()
BigFont = new FFont("BigFont", "FONTB%02u", "defbigfont", HU_FONTSTART, HU_FONTSIZE, 1, -1); BigFont = new FFont("BigFont", "FONTB%02u", "defbigfont", HU_FONTSTART, HU_FONTSIZE, 1, -1);
} }
} }
if (!(BigUpper = V_GetFont("BigUpper")))
// 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)
{
delete BigUpper;
BigUpper = BigFont;
}
if (BigUpper == nullptr)
{ {
BigUpper = BigFont; BigUpper = BigFont;
} }

View file

@ -81,6 +81,18 @@ extern int NumTextColors;
class FFont class FFont
{ {
public: public:
enum EFontType
{
Unknown,
Folder,
Multilump,
Fon1,
Fon2,
BMF,
Custom
};
FFont (const char *fontname, const char *nametemplate, const char *filetemplate, int first, int count, int base, int fdlump, int spacewidth=-1, bool notranslate = false); FFont (const char *fontname, const char *nametemplate, const char *filetemplate, int first, int count, int base, int fdlump, int spacewidth=-1, bool notranslate = false);
virtual ~FFont (); virtual ~FFont ();
@ -119,6 +131,7 @@ protected:
void ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height, const DVector2 &Scale); void ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height, const DVector2 &Scale);
EFontType Type = EFontType::Unknown;
int FirstChar, LastChar; int FirstChar, LastChar;
int SpaceWidth; int SpaceWidth;
int FontHeight; int FontHeight;
@ -147,6 +160,7 @@ protected:
friend struct FontsDeleter; friend struct FontsDeleter;
friend void V_ClearFonts(); friend void V_ClearFonts();
friend void V_InitFonts();
}; };

View file

@ -9,6 +9,7 @@
#include "r_data/r_translate.h" #include "r_data/r_translate.h"
#include "c_cvars.h" #include "c_cvars.h"
#include "v_font.h" #include "v_font.h"
#include "gi.h"
#include "textures/textures.h" #include "textures/textures.h"
EXTERN_CVAR(Float, snd_menuvolume) EXTERN_CVAR(Float, snd_menuvolume)
@ -207,6 +208,8 @@ public:
mScrollTop = 0; mScrollTop = 0;
mIndent = 0; mIndent = 0;
mDontDim = 0; mDontDim = 0;
mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
} }
size_t PropagateMark() override; size_t PropagateMark() override;
~DOptionMenuDescriptor() ~DOptionMenuDescriptor()

View file

@ -948,6 +948,7 @@ static void ParseOptionMenu(FScanner &sc)
sc.MustGetString(); sc.MustGetString();
DOptionMenuDescriptor *desc = Create<DOptionMenuDescriptor>(); DOptionMenuDescriptor *desc = Create<DOptionMenuDescriptor>();
desc->mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
desc->mMenuName = sc.String; desc->mMenuName = sc.String;
desc->mSelectedItem = -1; desc->mSelectedItem = -1;
desc->mScrollPos = 0; desc->mScrollPos = 0;
@ -1303,6 +1304,7 @@ static void BuildPlayerclassMenu()
DOptionMenuDescriptor *od = Create<DOptionMenuDescriptor>(); DOptionMenuDescriptor *od = Create<DOptionMenuDescriptor>();
MenuDescriptors[NAME_Playerclassmenu] = od; MenuDescriptors[NAME_Playerclassmenu] = od;
od->mMenuName = NAME_Playerclassmenu; od->mMenuName = NAME_Playerclassmenu;
od->mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
od->mTitle = "$MNU_CHOOSECLASS"; od->mTitle = "$MNU_CHOOSECLASS";
od->mSelectedItem = 0; od->mSelectedItem = 0;
od->mScrollPos = 0; od->mScrollPos = 0;
@ -1683,6 +1685,7 @@ fail:
od = Create<DOptionMenuDescriptor>(); od = Create<DOptionMenuDescriptor>();
MenuDescriptors[NAME_Skillmenu] = od; MenuDescriptors[NAME_Skillmenu] = od;
od->mMenuName = NAME_Skillmenu; od->mMenuName = NAME_Skillmenu;
od->mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
od->mTitle = "$MNU_CHOOSESKILL"; od->mTitle = "$MNU_CHOOSESKILL";
od->mSelectedItem = defindex; od->mSelectedItem = defindex;
od->mScrollPos = 0; od->mScrollPos = 0;