mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-31 12:30:32 +00:00
- let IWAD and PWAD BigFonts override BigUpper for consistency.
# Conflicts: # src/gamedata/fonts/font.cpp # src/gamedata/fonts/singlelumpfont.cpp # src/gamedata/fonts/v_font.cpp
This commit is contained in:
parent
8ff421104d
commit
da5c1c90dc
4 changed files with 43 additions and 2 deletions
|
@ -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)
|
||||
|
@ -205,6 +206,8 @@ public:
|
|||
mScrollTop = 0;
|
||||
mIndent = 0;
|
||||
mDontDim = 0;
|
||||
mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont;
|
||||
|
||||
}
|
||||
size_t PropagateMark() override;
|
||||
~DOptionMenuDescriptor()
|
||||
|
|
|
@ -958,6 +958,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;
|
||||
|
@ -1295,6 +1296,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;
|
||||
|
@ -1675,6 +1677,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;
|
||||
|
|
|
@ -1056,8 +1056,14 @@ int stripaccent(int code)
|
|||
FFont *V_GetFont(const char *name, const char *fontlumpname)
|
||||
{
|
||||
FFont *font = FFont::FindFont (name);
|
||||
if (font == NULL)
|
||||
if (font == nullptr)
|
||||
{
|
||||
if (!stricmp(name, "BIGUPPER"))
|
||||
{
|
||||
font = FFont::FindFont("BIGFONT");
|
||||
if (font) return font;
|
||||
}
|
||||
|
||||
int lump = -1;
|
||||
int folderfile = -1;
|
||||
|
||||
|
@ -1222,6 +1228,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[lump]);
|
||||
|
@ -1246,6 +1253,7 @@ FFont::FFont (const char *name, const char *nametemplate, const char *filetempla
|
|||
auto tex = TexMan[lump];
|
||||
tex->SetScale(Scale);
|
||||
charMap.Insert((int)position, tex);
|
||||
Type = Folder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3596,6 +3604,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)
|
||||
|
@ -3603,10 +3615,19 @@ 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;
|
||||
}
|
||||
|
||||
if (!(ConFont = V_GetFont("ConsoleFont", "CONFONT")))
|
||||
{
|
||||
ConFont = SmallFont;
|
||||
|
|
14
src/v_font.h
14
src/v_font.h
|
@ -79,6 +79,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 ();
|
||||
|
||||
|
@ -117,6 +129,7 @@ protected:
|
|||
static int SimpleTranslation (uint32_t *colorsused, uint8_t *translation,
|
||||
uint8_t *identity, double **luminosity);
|
||||
|
||||
EFontType Type = EFontType::Unknown;
|
||||
int FirstChar, LastChar;
|
||||
int SpaceWidth;
|
||||
int FontHeight;
|
||||
|
@ -141,6 +154,7 @@ protected:
|
|||
friend struct FontsDeleter;
|
||||
|
||||
friend void V_ClearFonts();
|
||||
friend void V_InitFonts();
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue