From 9f5b0001fe43096a7c4fc71a15f1f911e58f6704 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 11 Apr 2019 02:00:51 +0200 Subject: [PATCH] - handle generic fonts on the summary screen. --- wadsrc/static/mapinfo/chex.txt | 6 ++-- wadsrc/static/mapinfo/doomcommon.txt | 6 ++-- wadsrc/static/mapinfo/heretic.txt | 6 ++-- wadsrc/static/mapinfo/hexen.txt | 6 ++-- wadsrc/static/mapinfo/mindefaults.txt | 6 ++-- wadsrc/static/mapinfo/strife.txt | 6 ++-- .../zscript/ui/statscreen/statscreen.zs | 14 +++++++++- .../zscript/ui/statscreen/statscreen_sp.zs | 28 ++++++++++--------- 8 files changed, 46 insertions(+), 32 deletions(-) diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index 01782eedd..6213e4c44 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -64,9 +64,9 @@ gameinfo textscreeny = 10 defaultendsequence = "Inter_Pic1" maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt" - statscreen_mapnamefont = "BigFont" - statscreen_finishedfont = "BigFont", "green" - statscreen_enteringfont = "BigFont", "green" + statscreen_mapnamefont = "*BigFont" + statscreen_finishedfont = "*BigFont", "green" + statscreen_enteringfont = "*BigFont", "green" statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "DoomStatusScreen" diff --git a/wadsrc/static/mapinfo/doomcommon.txt b/wadsrc/static/mapinfo/doomcommon.txt index eaa31d18a..feb9c4b79 100644 --- a/wadsrc/static/mapinfo/doomcommon.txt +++ b/wadsrc/static/mapinfo/doomcommon.txt @@ -64,9 +64,9 @@ gameinfo textscreeny = 10 defaultendsequence = "Inter_Cast" maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt" - statscreen_mapnamefont = "BigFont" - statscreen_finishedfont = "BigFont", "red" - statscreen_enteringfont = "BigFont", "red" + statscreen_mapnamefont = "*BigFont" + statscreen_finishedfont = "*BigFont", "red" + statscreen_enteringfont = "*BigFont", "red" statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "DoomStatusScreen" diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index 07e5e3336..377143f4f 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -63,9 +63,9 @@ gameinfo textscreeny = 5 defaultendsequence = "Inter_Pic1" maparrow = "maparrows/dagger.txt" - statscreen_mapnamefont = "BigFont" - statscreen_finishedfont = "SmallFont" - statscreen_enteringfont = "SmallFont" + statscreen_mapnamefont = "*BigFont" + statscreen_finishedfont = "*SmallFont" + statscreen_enteringfont = "*SmallFont" statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "RavenStatusScreen" diff --git a/wadsrc/static/mapinfo/hexen.txt b/wadsrc/static/mapinfo/hexen.txt index 5dfa50c0d..400822019 100644 --- a/wadsrc/static/mapinfo/hexen.txt +++ b/wadsrc/static/mapinfo/hexen.txt @@ -61,9 +61,9 @@ gameinfo textscreeny = 5 defaultendsequence = "Inter_Chess" maparrow = "maparrows/dagger.txt" - statscreen_mapnamefont = "BigFont" - statscreen_finishedfont = "SmallFont" - statscreen_enteringfont = "SmallFont" + statscreen_mapnamefont = "*BigFont" + statscreen_finishedfont = "*SmallFont" + statscreen_enteringfont = "*SmallFont" statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "RavenStatusScreen" diff --git a/wadsrc/static/mapinfo/mindefaults.txt b/wadsrc/static/mapinfo/mindefaults.txt index 80d5623f1..ea2fd814c 100644 --- a/wadsrc/static/mapinfo/mindefaults.txt +++ b/wadsrc/static/mapinfo/mindefaults.txt @@ -54,9 +54,9 @@ gameinfo textscreeny = 10 defaultendsequence = "Inter_Cast" maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt" - statscreen_mapnamefont = "BigFont" - statscreen_finishedfont = "BigFont" - statscreen_enteringfont = "BigFont" + statscreen_mapnamefont = "*BigFont" + statscreen_finishedfont = "*BigFont" + statscreen_enteringfont = "*BigFont" messageboxclass = "MessageBoxMenu" } diff --git a/wadsrc/static/mapinfo/strife.txt b/wadsrc/static/mapinfo/strife.txt index d38f742e6..9f5dcb4fe 100644 --- a/wadsrc/static/mapinfo/strife.txt +++ b/wadsrc/static/mapinfo/strife.txt @@ -62,9 +62,9 @@ gameinfo textscreeny = 10 defaultendsequence = "Inter_Strife" maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt" - statscreen_mapnamefont = "BigFont" - statscreen_finishedfont = "BigFont", "white" - statscreen_enteringfont = "BigFont", "white" + statscreen_mapnamefont = "*BigFont" + statscreen_finishedfont = "*BigFont", "white" + statscreen_enteringfont = "*BigFont", "white" statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "RavenStatusScreen" diff --git a/wadsrc/static/zscript/ui/statscreen/statscreen.zs b/wadsrc/static/zscript/ui/statscreen/statscreen.zs index fe9becad9..2c592d21c 100644 --- a/wadsrc/static/zscript/ui/statscreen/statscreen.zs +++ b/wadsrc/static/zscript/ui/statscreen/statscreen.zs @@ -17,7 +17,19 @@ struct PatchInfo play version("2.5") void Init(GIFont gifont) { - mFont = Font.GetFont(gifont.fontname); + // Replace with the VGA-Unicode font if needed. + // The default settings for this are marked with a *. + // If some mod changes this it is assumed that it doesn't provide any localization for the map name in a language not supported by the font. + String s = gifont.fontname; + if (s.CharAt(0) != "*") + mFont = Font.GetFont(gifont.fontname); + else if (generic_ui) + mFont = NewSmallFont; + else + { + s = s.Mid(1); + mFont = Font.GetFont(s); + } mColor = Font.FindFontColor(gifont.color); if (mFont == NULL) { diff --git a/wadsrc/static/zscript/ui/statscreen/statscreen_sp.zs b/wadsrc/static/zscript/ui/statscreen/statscreen_sp.zs index 04e28e658..479c2e5ab 100644 --- a/wadsrc/static/zscript/ui/statscreen/statscreen_sp.zs +++ b/wadsrc/static/zscript/ui/statscreen/statscreen_sp.zs @@ -150,7 +150,7 @@ class DoomStatusScreen : StatusScreen let tcolor = useGfx? Font.CR_UNTRANSLATED : Font.CR_RED; Font printFont; - + Font textFont = generic_ui? NewSmallFont : BigFont; if (useGfx) { printFont = IntermissionFont; @@ -162,12 +162,12 @@ class DoomStatusScreen : StatusScreen } else { - printFont = BigFont; - screen.DrawText (BigFont, tcolor, SP_STATSX, SP_STATSY, "$TXT_IMKILLS", DTA_Clean, true); - screen.DrawText (BigFont, tcolor, SP_STATSX, SP_STATSY+lh, "$TXT_IMITEMS", DTA_Clean, true); - screen.DrawText (BigFont, tcolor, SP_STATSX, SP_STATSY+2*lh, "$TXT_IMSECRETS", DTA_Clean, true); - screen.DrawText (BigFont, tcolor, SP_TIMEX, SP_TIMEY, "$TXT_IMTIME", DTA_Clean, true); - if (wbs.partime) screen.DrawText (BigFont, tcolor, 160 + SP_TIMEX, SP_TIMEY, "$TXT_IMPAR", DTA_Clean, true); + printFont = generic_ui? IntermissionFont : BigFont; + screen.DrawText (textFont, tcolor, SP_STATSX, SP_STATSY, "$TXT_IMKILLS", DTA_Clean, true); + screen.DrawText (textFont, tcolor, SP_STATSX, SP_STATSY+lh, "$TXT_IMITEMS", DTA_Clean, true); + screen.DrawText (textFont, tcolor, SP_STATSX, SP_STATSY+2*lh, "$TXT_IMSECRETS", DTA_Clean, true); + screen.DrawText (textFont, tcolor, SP_TIMEX, SP_TIMEY, "$TXT_IMTIME", DTA_Clean, true); + if (wbs.partime) screen.DrawText (textFont, tcolor, 160 + SP_TIMEX, SP_TIMEY, "$TXT_IMPAR", DTA_Clean, true); } drawPercent (printFont, 320 - SP_STATSX, SP_STATSY, cnt_kills[0], wbs.maxkills, true, tcolor); @@ -189,7 +189,7 @@ class DoomStatusScreen : StatusScreen } else { - screen.DrawText (printFont, Font.CR_UNTRANSLATED, x - printFont.StringWidth("$TXT_IMSUCKS"), y - printFont.GetHeight() - 2, "$TXT_IMSUCKS", DTA_Clean, true); + screen.DrawText (textFont, Font.CR_UNTRANSLATED, x - printFont.StringWidth("$TXT_IMSUCKS"), y - printFont.GetHeight() - 2, "$TXT_IMSUCKS", DTA_Clean, true); } } @@ -209,10 +209,12 @@ class RavenStatusScreen : DoomStatusScreen int lh = IntermissionFont.GetHeight() * 3 / 2; drawLF(); - - screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 50, 65, "$TXT_IMKILLS", DTA_Clean, true, DTA_Shadow, true); - screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 50, 90, "$TXT_IMITEMS", DTA_Clean, true, DTA_Shadow, true); - screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 50, 115, "$TXT_IMSECRETS", DTA_Clean, true, DTA_Shadow, true); + + Font textFont = generic_ui? NewSmallFont : BigFont; + + screen.DrawText (textFont, Font.CR_UNTRANSLATED, 50, 65, "$TXT_IMKILLS", DTA_Clean, true, DTA_Shadow, true); + screen.DrawText (textFont, Font.CR_UNTRANSLATED, 50, 90, "$TXT_IMITEMS", DTA_Clean, true, DTA_Shadow, true); + screen.DrawText (textFont, Font.CR_UNTRANSLATED, 50, 115, "$TXT_IMSECRETS", DTA_Clean, true, DTA_Shadow, true); int countpos = gameinfo.gametype==GAME_Strife? 285:270; if (sp_state >= 2) @@ -229,7 +231,7 @@ class RavenStatusScreen : DoomStatusScreen } if (sp_state >= 8) { - screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 85, 160, "$TXT_IMTIME", DTA_Clean, true, DTA_Shadow, true); + screen.DrawText (textFont, Font.CR_UNTRANSLATED, 85, 160, "$TXT_IMTIME", DTA_Clean, true, DTA_Shadow, true); drawTime (249, 160, cnt_time); if (wi_showtotaltime) {