From cad2f49ceb588a41498944923e135a8631d0c676 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 28 Feb 2019 22:19:53 +0100 Subject: [PATCH] - use BigUpper font for option menu captions. --- src/gamedata/fonts/v_font.cpp | 4 ++++ src/gamedata/fonts/v_font.h | 2 +- src/intermission/intermission.cpp | 2 +- src/menu/menu.cpp | 1 + src/menu/menu.h | 1 + src/menu/menudef.cpp | 1 + src/v_video.cpp | 2 +- wadsrc/static/zscript/ui/menu/optionmenu.zs | 13 +++++++------ 8 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/gamedata/fonts/v_font.cpp b/src/gamedata/fonts/v_font.cpp index d715ecf4b..d7ec9c0ac 100644 --- a/src/gamedata/fonts/v_font.cpp +++ b/src/gamedata/fonts/v_font.cpp @@ -1453,6 +1453,10 @@ void V_InitFonts() BigFont = new FFont("BigFont", "FONTB%02u", "defbigfont", HU_FONTSTART, HU_FONTSIZE, 1, -1); } } + if (!(BigUpper = V_GetFont("BigUpper"))) + { + BigUpper = BigFont; + } if (!(ConFont = V_GetFont("ConsoleFont", "CONFONT"))) { ConFont = SmallFont; diff --git a/src/gamedata/fonts/v_font.h b/src/gamedata/fonts/v_font.h index 9495cf5e6..94028589e 100644 --- a/src/gamedata/fonts/v_font.h +++ b/src/gamedata/fonts/v_font.h @@ -150,7 +150,7 @@ protected: }; -extern FFont *SmallFont, *SmallFont2, *BigFont, *ConFont, *IntermissionFont; +extern FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont; void V_InitFonts(); void V_ClearFonts(); diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 8c6bc5afd..33b09bf2b 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -248,12 +248,12 @@ void DIntermissionScreenFader::Drawer () void DIntermissionScreenText::Init(FIntermissionAction *desc, bool first) { - bool usesDefault = mTextX < 0; Super::Init(desc, first); mText = static_cast(desc)->mText; if (mText[0] == '$') mText = GStrings(&mText[1]); mTextSpeed = static_cast(desc)->mTextSpeed; mTextX = static_cast(desc)->mTextX; + bool usesDefault = mTextX < 0; if (mTextX < 0) mTextX =gameinfo.TextScreenX; mTextY = static_cast(desc)->mTextY; if (mTextY < 0) mTextY =gameinfo.TextScreenY; diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index 03b66986d..6e2339d11 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -1231,6 +1231,7 @@ DEFINE_FIELD(DOptionMenuDescriptor, mScrollPos) DEFINE_FIELD(DOptionMenuDescriptor, mIndent) DEFINE_FIELD(DOptionMenuDescriptor, mPosition) DEFINE_FIELD(DOptionMenuDescriptor, mDontDim) +DEFINE_FIELD(DOptionMenuDescriptor, mFont) DEFINE_FIELD(FOptionMenuSettings, mTitleColor) DEFINE_FIELD(FOptionMenuSettings, mFontColor) diff --git a/src/menu/menu.h b/src/menu/menu.h index ae7894082..758ca253e 100644 --- a/src/menu/menu.h +++ b/src/menu/menu.h @@ -196,6 +196,7 @@ public: int mIndent; int mPosition; bool mDontDim; + FFont *mFont; void CalcIndent(); DMenuItemBase *GetItem(FName name); diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index 26a42d539..e096b4718 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -1168,6 +1168,7 @@ void M_StartupEpisodeMenu(FGameStartup *gs) DOptionMenuDescriptor *od = Create(); MenuDescriptors[NAME_Episodemenu] = od; od->mMenuName = NAME_Episodemenu; + od->mFont = gameinfo.gametype == GAME_Doom ? BigUpper : BigFont; od->mTitle = "$MNU_EPISODE"; od->mSelectedItem = 0; od->mScrollPos = 0; diff --git a/src/v_video.cpp b/src/v_video.cpp index 1d913d180..d82d18eb9 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -145,7 +145,7 @@ public: int DisplayWidth, DisplayHeight; -FFont *SmallFont, *SmallFont2, *BigFont, *ConFont, *IntermissionFont; +FFont *SmallFont, *SmallFont2, *BigFont, *BigUpper, *ConFont, *IntermissionFont; uint32_t Col2RGB8[65][256]; uint32_t *Col2RGB8_LessPrecision[65]; diff --git a/wadsrc/static/zscript/ui/menu/optionmenu.zs b/wadsrc/static/zscript/ui/menu/optionmenu.zs index 659830827..c06abf723 100644 --- a/wadsrc/static/zscript/ui/menu/optionmenu.zs +++ b/wadsrc/static/zscript/ui/menu/optionmenu.zs @@ -55,6 +55,7 @@ class OptionMenuDescriptor : MenuDescriptor native native int mIndent; native int mPosition; native bool mDontDim; + native Font mFont; void Reset() { @@ -224,9 +225,9 @@ class OptionMenu : Menu if (y <= 0) { - if (BigFont && mDesc.mTitle.Length() > 0) + if (mDesc.mFont && mDesc.mTitle.Length() > 0) { - y = -y + BigFont.GetHeight(); + y = -y + mDesc.mFont.GetHeight(); } else { @@ -415,13 +416,13 @@ class OptionMenu : Menu if (y <= 0) { - if (BigFont && mDesc.mTitle.Length() > 0) + if (mDesc.mFont && mDesc.mTitle.Length() > 0) { let tt = Stringtable.Localize(mDesc.mTitle); - screen.DrawText (BigFont, OptionMenuSettings.mTitleColor, - (screen.GetWidth() - BigFont.StringWidth(tt) * CleanXfac_1) / 2, 10*CleanYfac_1, + screen.DrawText (mDesc.mFont, OptionMenuSettings.mTitleColor, + (screen.GetWidth() - mDesc.mFont.StringWidth(tt) * CleanXfac_1) / 2, 10*CleanYfac_1, tt, DTA_CleanNoMove_1, true); - y = -y + BigFont.GetHeight(); + y = -y + mDesc.mFont.GetHeight(); } else {