From e8cd336f8626e51fcaa3fe4768f654cc6282dc79 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 29 Sep 2020 22:20:25 +0200 Subject: [PATCH] - same procedure for Blood. This time there were 3 additional texts and the notify display, though, except for multiplayer content that wasn't touched yet. The result is the same: No need to extend the tiny font with international characters --- source/blood/src/d_menu.cpp | 2 +- source/blood/src/endgame.cpp | 17 ++++++++++++++--- source/blood/src/sbar.cpp | 10 +++++++++- source/core/console/c_console.cpp | 13 ++++++++++++- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/source/blood/src/d_menu.cpp b/source/blood/src/d_menu.cpp index c2ee4cc57..d03e98d81 100644 --- a/source/blood/src/d_menu.cpp +++ b/source/blood/src/d_menu.cpp @@ -209,7 +209,7 @@ void GameInterface::DrawNativeMenuText(int fontnum, int state, double xpos, doub int shade = (state != NIT_InactiveState) ? 32 : 48; int pal = (state != NIT_InactiveState) ? 5 : 5; if (state == NIT_SelectedState) shade = 32 - (I_GetBuildTime() & 63); - auto gamefont = fontnum == NIT_BigFont ? BigFont : fontnum == NIT_SmallFont ? SmallFont : SmallFont2; + auto gamefont = fontnum == NIT_BigFont ? BigFont : SmallFont; if (flags & LMF_Centered) { diff --git a/source/blood/src/endgame.cpp b/source/blood/src/endgame.cpp index 4a62ce0c2..96e4544fa 100644 --- a/source/blood/src/endgame.cpp +++ b/source/blood/src/endgame.cpp @@ -144,7 +144,10 @@ class DBloodSummaryScreen : public DScreenJob DrawMenuCaption(GStrings("TXTB_LEVELSTATS")); if (bPlayerCheated) { - viewDrawText(3, GStrings("TXTB_CHEATED"), 160, 32, -128, 0, 1, 1); + auto text = GStrings("TXTB_CHEATED"); + int font = 3; + if (!SmallFont2->CanPrint(text)) font = 0; + viewDrawText(font, text, 160, 32, -128, 0, 1, font == 3); } DrawKills(); DrawSecrets(); @@ -157,7 +160,10 @@ class DBloodSummaryScreen : public DScreenJob int myclock = int(clock * 120 / 1'000'000'000); if ((myclock & 32)) { - viewDrawText(3, GStrings("PRESSKEY"), 160, 134, -128, 0, 1, 1); + auto text = GStrings("PRESSKEY"); + int font = 3; + if (!SmallFont2->CanPrint(text)) font = 0; + viewDrawText(font, text, 160, 134, -128, 0, 1, font == 3); } return skiprequest ? -1 : 1; } @@ -297,7 +303,12 @@ public: drawTextScreenBackground(); DrawMenuCaption(pzLoadingScreenText1); viewDrawText(1, rec->DisplayName(), 160, 50, -128, 0, 1, 1); - viewDrawText(3, GStrings("TXTB_PLSWAIT"), 160, 134, -128, 0, 1, 1); + + auto text = GStrings("TXTB_PLSWAIT"); + int font = 3; + if (!SmallFont2->CanPrint(text)) font = 0; + + viewDrawText(font, GStrings("TXTB_PLSWAIT"), 160, 134, -128, 0, 1, font == 3); return 0; } }; diff --git a/source/blood/src/sbar.cpp b/source/blood/src/sbar.cpp index e580efb8c..6fd4cd610 100644 --- a/source/blood/src/sbar.cpp +++ b/source/blood/src/sbar.cpp @@ -226,13 +226,21 @@ private: if (automapMode == am_full) { + bool textfont = am_textfont; if (!am_textfont) + { + // For non-English languages force use of the text font. The tiny one is simply too small to ever add localized characters to it. + auto p = GStrings["REQUIRED_CHARACTERS"]; + if (p && *p) textfont = true; + } + + if (!textfont) { stats.font = SmallFont2; stats.spacing = 6; } if (hud_size <= Hud_StbarOverlay) stats.screenbottomspace = 56; - DBaseStatusBar::PrintAutomapInfo(stats); + DBaseStatusBar::PrintAutomapInfo(stats, textfont); } if (automapMode == am_off && hud_stats) { diff --git a/source/core/console/c_console.cpp b/source/core/console/c_console.cpp index 195b6eb0a..87f626de6 100644 --- a/source/core/console/c_console.cpp +++ b/source/core/console/c_console.cpp @@ -64,6 +64,7 @@ #include "g_input.h" #include "menu.h" #include "raze_music.h" +#include "gstrings.h" #define LEFTMARGIN 8 #define RIGHTMARGIN 8 @@ -1143,12 +1144,22 @@ void FNotifyBuffer::DrawNative() } } +static bool printNative() +{ + // Blood originally uses its tiny font for the notify display which does not play along well with localization because it is too small + if (con_notify_advanced) return false; + if (!(g_gameType & GAMEFLAG_BLOOD)) return true; + auto p = GStrings["REQUIRED_CHARACTERS"]; + if (p && *p) return false; + return true; +} + void FNotifyBuffer::Draw() { if (gamestate == GS_FULLCONSOLE || gamestate == GS_MENUSCREEN) return; - if (!con_notify_advanced) + if (printNative()) { DrawNative(); return;