From 2fd170b06e3ccc33d11660e39884c0994d7bbe66 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 14 Jul 2019 09:08:19 +0200 Subject: [PATCH] - allow setting the font used for the status screen's content text. This was needed to give Hacx's screen the proper colors. --- src/gamedata/gi.cpp | 2 ++ src/gamedata/gi.h | 1 + wadsrc/static/mapinfo/chex.txt | 5 +-- wadsrc/static/mapinfo/doomcommon.txt | 1 + wadsrc/static/mapinfo/heretic.txt | 1 + wadsrc/static/mapinfo/hexen.txt | 1 + wadsrc/static/mapinfo/mindefaults.txt | 1 + wadsrc/static/mapinfo/strife.txt | 1 + wadsrc/static/zscript/base.zs | 1 + .../zscript/ui/statscreen/statscreen.zs | 2 ++ .../zscript/ui/statscreen/statscreen_sp.zs | 32 ++++++++++--------- wadsrc_hacxextra/static/zmapinfo.txt | 3 +- 12 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/gamedata/gi.cpp b/src/gamedata/gi.cpp index f80d80749..2d168b5e8 100644 --- a/src/gamedata/gi.cpp +++ b/src/gamedata/gi.cpp @@ -59,6 +59,7 @@ DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mBackButton) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenMapNameFont) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenEnteringFont) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenFinishedFont) +DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenContentFont) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, gibfactor) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, intermissioncounter) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, statusscreen_single) @@ -425,6 +426,7 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_FONT(mStatscreenMapNameFont, "statscreen_mapnamefont") GAMEINFOKEY_FONT(mStatscreenFinishedFont, "statscreen_finishedfont") GAMEINFOKEY_FONT(mStatscreenEnteringFont, "statscreen_enteringfont") + GAMEINFOKEY_FONT(mStatscreenContentFont, "statscreen_contentfont") GAMEINFOKEY_BOOL(norandomplayerclass, "norandomplayerclass") GAMEINFOKEY_BOOL(forcekillscripts, "forcekillscripts") // [JM] Force kill scripts on thing death. (MF7_NOKILLSCRIPTS overrides.) GAMEINFOKEY_STRING(Dialogue, "dialogue") diff --git a/src/gamedata/gi.h b/src/gamedata/gi.h index 162bad298..d66ea00ff 100644 --- a/src/gamedata/gi.h +++ b/src/gamedata/gi.h @@ -191,6 +191,7 @@ struct gameinfo_t FGIFont mStatscreenMapNameFont; FGIFont mStatscreenFinishedFont; FGIFont mStatscreenEnteringFont; + FGIFont mStatscreenContentFont; bool norandomplayerclass; bool forcekillscripts; FName statusscreen_single; diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index 5839ad150..50f896fd3 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -65,8 +65,9 @@ gameinfo defaultendsequence = "Inter_Pic1" maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt" statscreen_mapnamefont = "*BigFont" - statscreen_finishedfont = "*BigFont", "green" - statscreen_enteringfont = "*BigFont", "green" + statscreen_finishedfont = "*BigFont" + statscreen_enteringfont = "*BigFont" + statscreen_contentfont = "*BigFont" statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "DoomStatusScreen" diff --git a/wadsrc/static/mapinfo/doomcommon.txt b/wadsrc/static/mapinfo/doomcommon.txt index feb9c4b79..018183c58 100644 --- a/wadsrc/static/mapinfo/doomcommon.txt +++ b/wadsrc/static/mapinfo/doomcommon.txt @@ -67,6 +67,7 @@ gameinfo statscreen_mapnamefont = "*BigFont" statscreen_finishedfont = "*BigFont", "red" statscreen_enteringfont = "*BigFont", "red" + statscreen_contentfont = "*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 a936c468c..63a636bc7 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -66,6 +66,7 @@ gameinfo statscreen_mapnamefont = "*BigFont" statscreen_finishedfont = "*SmallFont" statscreen_enteringfont = "*SmallFont" + statscreen_contentfont = "*BigFont" statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "RavenStatusScreen" diff --git a/wadsrc/static/mapinfo/hexen.txt b/wadsrc/static/mapinfo/hexen.txt index 400822019..9cb767726 100644 --- a/wadsrc/static/mapinfo/hexen.txt +++ b/wadsrc/static/mapinfo/hexen.txt @@ -64,6 +64,7 @@ gameinfo statscreen_mapnamefont = "*BigFont" statscreen_finishedfont = "*SmallFont" statscreen_enteringfont = "*SmallFont" + statscreen_contentfont = "*BigFont" statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "RavenStatusScreen" diff --git a/wadsrc/static/mapinfo/mindefaults.txt b/wadsrc/static/mapinfo/mindefaults.txt index ea2fd814c..4af996203 100644 --- a/wadsrc/static/mapinfo/mindefaults.txt +++ b/wadsrc/static/mapinfo/mindefaults.txt @@ -57,6 +57,7 @@ gameinfo statscreen_mapnamefont = "*BigFont" statscreen_finishedfont = "*BigFont" statscreen_enteringfont = "*BigFont" + statscreen_contentfont = "*BigFont" messageboxclass = "MessageBoxMenu" } diff --git a/wadsrc/static/mapinfo/strife.txt b/wadsrc/static/mapinfo/strife.txt index 4eee2d001..72cd8b9b2 100644 --- a/wadsrc/static/mapinfo/strife.txt +++ b/wadsrc/static/mapinfo/strife.txt @@ -65,6 +65,7 @@ gameinfo statscreen_mapnamefont = "*BigFont" statscreen_finishedfont = "*BigFont", "white" statscreen_enteringfont = "*BigFont", "white" + statscreen_contentfont = "*BigFont" statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "RavenStatusScreen" diff --git a/wadsrc/static/zscript/base.zs b/wadsrc/static/zscript/base.zs index 792f105f5..0e2f0708b 100644 --- a/wadsrc/static/zscript/base.zs +++ b/wadsrc/static/zscript/base.zs @@ -401,6 +401,7 @@ struct GameInfoStruct native native GIFont mStatscreenMapNameFont; native GIFont mStatscreenEnteringFont; native GIFont mStatscreenFinishedFont; + native GIFont mStatscreenContentFont; native double gibfactor; native bool intermissioncounter; native Name mSliderColor; diff --git a/wadsrc/static/zscript/ui/statscreen/statscreen.zs b/wadsrc/static/zscript/ui/statscreen/statscreen.zs index c66d56050..7cd776062 100644 --- a/wadsrc/static/zscript/ui/statscreen/statscreen.zs +++ b/wadsrc/static/zscript/ui/statscreen/statscreen.zs @@ -106,6 +106,7 @@ class StatusScreen abstract play version("2.5") PatchInfo mapname; PatchInfo finished; PatchInfo entering; + PatchInfo content; TextureID p_secret; TextureID kills; @@ -754,6 +755,7 @@ class StatusScreen abstract play version("2.5") entering.Init(gameinfo.mStatscreenEnteringFont); finished.Init(gameinfo.mStatscreenFinishedFont); mapname.Init(gameinfo.mStatscreenMapNameFont); + content.Init(gameinfo.mStatscreenContentFont); Kills = TexMan.CheckForTexture("WIOSTK", TexMan.Type_MiscPatch); // "kills" Secret = TexMan.CheckForTexture("WIOSTS", TexMan.Type_MiscPatch); // "scrt", not used diff --git a/wadsrc/static/zscript/ui/statscreen/statscreen_sp.zs b/wadsrc/static/zscript/ui/statscreen/statscreen_sp.zs index 73bc433e4..a0e17d469 100644 --- a/wadsrc/static/zscript/ui/statscreen/statscreen_sp.zs +++ b/wadsrc/static/zscript/ui/statscreen/statscreen_sp.zs @@ -145,12 +145,13 @@ class DoomStatusScreen : StatusScreen && TexMan.OkForLocalization(P_secret, "$TXT_IMSECRETS") && TexMan.OkForLocalization(Timepic, "$TXT_IMTIME") && (!wbs.partime || TexMan.OkForLocalization(Par, "$TXT_IMPAR")); - - // Fixme: This should try to retrieve the color from the intermission font and use the best approximation here - let tcolor = useGfx? Font.CR_UNTRANSLATED : Font.CR_RED; + + // The font color may only be used when the entire screen is printed as text. + // Otherwise the text based parts should not be translated to match the other graphics patches. + let tcolor = useGfx? Font.CR_UNTRANSLATED : content.mColor; Font printFont; - Font textFont = generic_ui? NewSmallFont : BigFont; + Font textFont = generic_ui? NewSmallFont : content.mFont; if (useGfx) { printFont = IntermissionFont; @@ -189,7 +190,7 @@ class DoomStatusScreen : StatusScreen } else { - screen.DrawText (textFont, Font.CR_UNTRANSLATED, x - printFont.StringWidth("$TXT_IMSUCKS"), y - printFont.GetHeight() - 2, "$TXT_IMSUCKS", DTA_Clean, true); + screen.DrawText (textFont, tColor, x - printFont.StringWidth("$TXT_IMSUCKS"), y - printFont.GetHeight() - 2, "$TXT_IMSUCKS", DTA_Clean, true); } } @@ -214,32 +215,33 @@ class RavenStatusScreen : DoomStatusScreen drawLF(); - Font textFont = generic_ui? NewSmallFont : BigFont; + Font textFont = generic_ui? NewSmallFont : content.mFont; + let tcolor = content.mColor; - 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); + screen.DrawText (textFont, tcolor, 50, 65, "$TXT_IMKILLS", DTA_Clean, true, DTA_Shadow, true); + screen.DrawText (textFont, tcolor, 50, 90, "$TXT_IMITEMS", DTA_Clean, true, DTA_Shadow, true); + screen.DrawText (textFont, tcolor, 50, 115, "$TXT_IMSECRETS", DTA_Clean, true, DTA_Shadow, true); int countpos = gameinfo.gametype==GAME_Strife? 285:270; if (sp_state >= 2) { - drawPercent (IntermissionFont, countpos, 65, cnt_kills[0], wbs.maxkills); + drawPercent (IntermissionFont, countpos, 65, cnt_kills[0], wbs.maxkills, true, tcolor); } if (sp_state >= 4) { - drawPercent (IntermissionFont, countpos, 90, cnt_items[0], wbs.maxitems); + drawPercent (IntermissionFont, countpos, 90, cnt_items[0], wbs.maxitems, true, tcolor); } if (sp_state >= 6) { - drawPercent (IntermissionFont, countpos, 115, cnt_secret[0], wbs.maxsecret); + drawPercent (IntermissionFont, countpos, 115, cnt_secret[0], wbs.maxsecret, true, tcolor); } if (sp_state >= 8) { - screen.DrawText (textFont, Font.CR_UNTRANSLATED, 85, 160, "$TXT_IMTIME", DTA_Clean, true, DTA_Shadow, true); - drawTime (249, 160, cnt_time); + screen.DrawText (textFont, tcolor, 85, 160, "$TXT_IMTIME", DTA_Clean, true, DTA_Shadow, true); + drawTimeFont (textFont, 249, 160, cnt_time, tcolor); if (wi_showtotaltime) { - drawTime (249, 180, cnt_total_time); + drawTimeFont (textFont, 249, 180, cnt_total_time, tcolor); } } } diff --git a/wadsrc_hacxextra/static/zmapinfo.txt b/wadsrc_hacxextra/static/zmapinfo.txt index 11c00ce66..5cb9c17dd 100644 --- a/wadsrc_hacxextra/static/zmapinfo.txt +++ b/wadsrc_hacxextra/static/zmapinfo.txt @@ -4,7 +4,8 @@ defaultmap nojump nocrouch } - gameinfo { forcenogfxsubstitution = false statscreen_finishedfont = "*BigFont", "untranslated" statscreen_enteringfont = "*BigFont", "untranslated" } // Edited MAPINFO for localization: // Literal map names have been replaced with labels. // Titlepatches have been disabled to allow using the font. + gameinfo { forcenogfxsubstitution = false statscreen_finishedfont = "*BigFont" statscreen_enteringfont = "*BigFont" statscreen_contentfont = "*BigFont" +} // Edited MAPINFO for localization: // Literal map names have been replaced with labels. // Titlepatches have been disabled to allow using the font. map MAP01 lookup "TXT_HACXMAP01" { //titlepatch = CWILV00