diff --git a/src/c_console.cpp b/src/c_console.cpp index abd7679509..eccca78fba 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -599,9 +599,15 @@ CUSTOM_CVAR (Int, msgmidcolor2, 4, CVAR_ARCHIVE) EColorRange C_GetDefaultFontColor() { // Ideally this should analyze the SmallFont and pick a matching color. + if (!generic_hud) return CR_UNTRANSLATED; return gameinfo.gametype == GAME_Doom ? CR_RED : gameinfo.gametype == GAME_Chex ? CR_GREEN : gameinfo.gametype == GAME_Strife ? CR_GOLD : CR_GRAY; } +FFont * C_GetDefaultHUDFont() +{ + return generic_hud? NewSmallFont : SmallFont; +} + void C_InitConback() { conback = TexMan.CheckForTexture ("CONBACK", ETextureType::MiscPatch); @@ -1103,7 +1109,7 @@ void FNotifyBuffer::Draw() else color = PrintColors[notify.PrintLevel]; - if (color == CR_UNTRANSLATED && hud_generic) + if (color == CR_UNTRANSLATED) { color = C_GetDefaultFontColor(); } diff --git a/src/d_main.cpp b/src/d_main.cpp index 856a4152bf..7cf6cbd8f2 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -858,9 +858,10 @@ void D_Display () screen->DrawTexture (tex, x, 4, DTA_CleanNoMove, true, TAG_DONE); if (paused && multiplayer) { + FFont *font = generic_hud? NewSmallFont : SmallFont; pstring << ' ' << players[paused - 1].userinfo.GetName(); - screen->DrawText(SmallFont, CR_RED, - (screen->GetWidth() - SmallFont->StringWidth(pstring)*CleanXfac) / 2, + screen->DrawText(font, CR_RED, + (screen->GetWidth() - font->StringWidth(pstring)*CleanXfac) / 2, (tex->GetDisplayHeight() * CleanYfac) + 4, pstring, DTA_CleanNoMove, true, TAG_DONE); } } diff --git a/src/doomstat.h b/src/doomstat.h index 4a895186c6..b885c8a6a9 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -255,4 +255,5 @@ extern FString LumpFilterIWAD; // These control whether certain items use generic text output instead of game-specific one. extern bool generic_hud, generic_ui; + #endif diff --git a/src/g_statusbar/hudmessages.cpp b/src/g_statusbar/hudmessages.cpp index 8c8effccce..14e70e848e 100644 --- a/src/g_statusbar/hudmessages.cpp +++ b/src/g_statusbar/hudmessages.cpp @@ -42,8 +42,6 @@ #include "doomstat.h" #include "vm.h" -EColorRange C_GetDefaultFontColor(); - EXTERN_CVAR(Int, con_scaletext) IMPLEMENT_CLASS(DHUDMessageBase, false, true) diff --git a/src/g_statusbar/shared_sbar.cpp b/src/g_statusbar/shared_sbar.cpp index 7f8bb20a1c..3faa36e36a 100644 --- a/src/g_statusbar/shared_sbar.cpp +++ b/src/g_statusbar/shared_sbar.cpp @@ -1043,15 +1043,16 @@ void DBaseStatusBar::DrawLog () if (CPlayer->LogText.IsNotEmpty()) { // This uses the same scaling as regular HUD messages - auto scale = active_con_scaletext(); + auto scale = active_con_scaletext(generic_hud); hudwidth = SCREENWIDTH / scale; hudheight = SCREENHEIGHT / scale; + FFont *font = C_GetDefaultHUDFont(); int linelen = hudwidth<640? Scale(hudwidth,9,10)-40 : 560; - auto lines = V_BreakLines (SmallFont, linelen, GStrings(CPlayer->LogText)); + auto lines = V_BreakLines (font, linelen, CPlayer->LogText[0] == '$'? GStrings(CPlayer->LogText.GetChars()+1) : CPlayer->LogText.GetChars()); int height = 20; - for (unsigned i = 0; i < lines.Size(); i++) height += SmallFont->GetHeight () + 1; + for (unsigned i = 0; i < lines.Size(); i++) height += font->GetHeight (); int x,y,w; @@ -1074,10 +1075,10 @@ void DBaseStatusBar::DrawLog () y+=10; for (const FBrokenLines &line : lines) { - screen->DrawText (SmallFont, CR_UNTRANSLATED, x, y, line.Text, + screen->DrawText (font, C_GetDefaultFontColor(), x, y, line.Text, DTA_KeepRatio, true, DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, TAG_DONE); - y += SmallFont->GetHeight ()+1; + y += font->GetHeight (); } } } diff --git a/src/gamedata/fonts/v_font.h b/src/gamedata/fonts/v_font.h index a26b72044d..cb13764077 100644 --- a/src/gamedata/fonts/v_font.h +++ b/src/gamedata/fonts/v_font.h @@ -174,4 +174,8 @@ EColorRange V_ParseFontColor (const uint8_t *&color_value, int normalcolor, int FFont *V_GetFont(const char *fontname, const char *fontlumpname = nullptr); void V_InitFontColors(); +EColorRange C_GetDefaultFontColor(); +FFont * C_GetDefaultHUDFont(); + + #endif //__V_FONT_H__ diff --git a/src/v_video.cpp b/src/v_video.cpp index cf27d3f397..177caf3841 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -922,3 +922,5 @@ DEFINE_GLOBAL(CleanXfac_1) DEFINE_GLOBAL(CleanYfac_1) DEFINE_GLOBAL(CleanWidth_1) DEFINE_GLOBAL(CleanHeight_1) +DEFINE_GLOBAL(generic_hud) +DEFINE_GLOBAL(generic_ui) diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs index ad01ca9a0f..aeeadc6034 100644 --- a/wadsrc/static/zscript/base.zs +++ b/wadsrc/static/zscript/base.zs @@ -45,6 +45,8 @@ struct _ native // These are the global variables, the struct is only here to av deprecated("3.8") native readonly bool globalfreeze; native int LocalViewPitch; native readonly @MusPlayingInfo musplaying; + native readonly bool generic_hud; + native readonly bool generic_ui; // sandbox state in multi-level setups: diff --git a/wadsrc/static/zscript/ui/statusbar/strife_sbar.zs b/wadsrc/static/zscript/ui/statusbar/strife_sbar.zs index e10e9f2ab5..117215259e 100644 --- a/wadsrc/static/zscript/ui/statusbar/strife_sbar.zs +++ b/wadsrc/static/zscript/ui/statusbar/strife_sbar.zs @@ -109,7 +109,7 @@ class StrifeStatusBar : BaseStatusBar override void ShowPop (int popnum) { Super.ShowPop(popnum); - if (popnum == CurrentPop) + if (popnum == CurrentPop || (popnum == POP_LOG && generic_hud)) { if (popnum == POP_Keys) { @@ -146,7 +146,7 @@ class StrifeStatusBar : BaseStatusBar override bool MustDrawLog(int state) { // Tell the base class to draw the log if the pop screen won't be displayed. - return false; + return !generic_hud; } void Reset ()