- allow setting the font used for the status screen's content text.

This was needed to give Hacx's screen the proper colors.
This commit is contained in:
Christoph Oelckers 2019-07-14 09:08:19 +02:00
parent f4f53a7943
commit 2fd170b06e
12 changed files with 33 additions and 18 deletions

View file

@ -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")

View file

@ -191,6 +191,7 @@ struct gameinfo_t
FGIFont mStatscreenMapNameFont;
FGIFont mStatscreenFinishedFont;
FGIFont mStatscreenEnteringFont;
FGIFont mStatscreenContentFont;
bool norandomplayerclass;
bool forcekillscripts;
FName statusscreen_single;

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -57,6 +57,7 @@ gameinfo
statscreen_mapnamefont = "*BigFont"
statscreen_finishedfont = "*BigFont"
statscreen_enteringfont = "*BigFont"
statscreen_contentfont = "*BigFont"
messageboxclass = "MessageBoxMenu"
}

View file

@ -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"

View file

@ -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;

View file

@ -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

View file

@ -146,11 +146,12 @@ class DoomStatusScreen : StatusScreen
&& 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);
}
}
}

View file

@ -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