mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 14:41:40 +00:00
- let IWAD and PWAD BigFonts override BigUpper for consistency.
This commit is contained in:
parent
805cf6c098
commit
5f6198f4e4
6 changed files with 45 additions and 1 deletions
|
@ -185,6 +185,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
if (FixedWidth > 0)
|
||||
{
|
||||
ReadSheetFont(folderdata, FixedWidth, FontHeight, Scale);
|
||||
Type = Folder;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -211,6 +212,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
}
|
||||
if (lump.isValid())
|
||||
{
|
||||
Type = Multilump;
|
||||
if (position < minchar) minchar = position;
|
||||
if (position > maxchar) maxchar = position;
|
||||
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);
|
||||
tex->SetScale(Scale);
|
||||
charMap.Insert((int)position, tex);
|
||||
Type = Folder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
LoadBMF(lump, data);
|
||||
Type = BMF;
|
||||
}
|
||||
else if (data[0] != 'F' || data[1] != 'O' || data[2] != 'N' ||
|
||||
(data[3] != '1' && data[3] != '2'))
|
||||
|
@ -143,10 +144,12 @@ FSingleLumpFont::FSingleLumpFont (const char *name, int lump) : FFont(lump)
|
|||
{
|
||||
case '1':
|
||||
LoadFON1 (lump, data);
|
||||
Type = Fon1;
|
||||
break;
|
||||
|
||||
case '2':
|
||||
LoadFON2 (lump, data);
|
||||
Type = Fon2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -859,6 +859,12 @@ FFont *V_GetFont(const char *name, const char *fontlumpname)
|
|||
FFont *font = FFont::FindFont (name);
|
||||
if (font == nullptr)
|
||||
{
|
||||
if (!stricmp(name, "BIGUPPER"))
|
||||
{
|
||||
font = FFont::FindFont("BIGFONT");
|
||||
if (font) return font;
|
||||
}
|
||||
|
||||
int lump = -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);
|
||||
}
|
||||
}
|
||||
|
||||
//This must be read before BigFont so that it can be properly substituted.
|
||||
BigUpper = V_GetFont("BigUpper");
|
||||
|
||||
if (!(BigFont = V_GetFont("BigFont")))
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -81,6 +81,18 @@ extern int NumTextColors;
|
|||
class FFont
|
||||
{
|
||||
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);
|
||||
virtual ~FFont ();
|
||||
|
||||
|
@ -119,6 +131,7 @@ protected:
|
|||
|
||||
void ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height, const DVector2 &Scale);
|
||||
|
||||
EFontType Type = EFontType::Unknown;
|
||||
int FirstChar, LastChar;
|
||||
int SpaceWidth;
|
||||
int FontHeight;
|
||||
|
@ -147,6 +160,7 @@ protected:
|
|||
friend struct FontsDeleter;
|
||||
|
||||
friend void V_ClearFonts();
|
||||
friend void V_InitFonts();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "r_data/r_translate.h"
|
||||
#include "c_cvars.h"
|
||||
#include "v_font.h"
|
||||
#include "gi.h"
|
||||
#include "textures/textures.h"
|
||||
|
||||
EXTERN_CVAR(Float, snd_menuvolume)
|
||||
|
@ -207,6 +208,8 @@ public:
|
|||
mScrollTop = 0;
|
||||
mIndent = 0;
|
||||
mDontDim = 0;
|
||||
mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
|
||||
|
||||
}
|
||||
size_t PropagateMark() override;
|
||||
~DOptionMenuDescriptor()
|
||||
|
|
|
@ -948,6 +948,7 @@ static void ParseOptionMenu(FScanner &sc)
|
|||
sc.MustGetString();
|
||||
|
||||
DOptionMenuDescriptor *desc = Create<DOptionMenuDescriptor>();
|
||||
desc->mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
|
||||
desc->mMenuName = sc.String;
|
||||
desc->mSelectedItem = -1;
|
||||
desc->mScrollPos = 0;
|
||||
|
@ -1303,6 +1304,7 @@ static void BuildPlayerclassMenu()
|
|||
DOptionMenuDescriptor *od = Create<DOptionMenuDescriptor>();
|
||||
MenuDescriptors[NAME_Playerclassmenu] = od;
|
||||
od->mMenuName = NAME_Playerclassmenu;
|
||||
od->mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
|
||||
od->mTitle = "$MNU_CHOOSECLASS";
|
||||
od->mSelectedItem = 0;
|
||||
od->mScrollPos = 0;
|
||||
|
@ -1683,6 +1685,7 @@ fail:
|
|||
od = Create<DOptionMenuDescriptor>();
|
||||
MenuDescriptors[NAME_Skillmenu] = od;
|
||||
od->mMenuName = NAME_Skillmenu;
|
||||
od->mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
|
||||
od->mTitle = "$MNU_CHOOSESKILL";
|
||||
od->mSelectedItem = defindex;
|
||||
od->mScrollPos = 0;
|
||||
|
|
Loading…
Reference in a new issue