From 5e7fb16d05f0858a8e6a8d942c7cfba12ada2634 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 19 Feb 2019 01:22:12 +0100 Subject: [PATCH] - preparation work for substituting the menu and intermission screen text graphics for localization --- src/g_level.cpp | 5 +- src/gamedata/gi.cpp | 6 +- src/gamedata/gi.h | 2 + src/gamedata/textures/texturemanager.cpp | 7 +++ src/gamedata/textures/textures.h | 3 +- src/menu/menu.cpp | 5 +- src/menu/menu.h | 2 +- src/menu/menudef.cpp | 10 ++-- src/scripting/backend/codegen.cpp | 9 ++- wadsrc/static/language.enu | 15 +++-- wadsrc/static/mapinfo/chex.txt | 2 + wadsrc/static/mapinfo/doomcommon.txt | 2 + wadsrc/static/mapinfo/mindefaults.txt | 4 +- wadsrc/static/menudef.txt | 26 +++++---- wadsrc/static/zscript/base.txt | 6 +- wadsrc/static/zscript/menu/listmenuitems.txt | 32 ++++++++-- .../static/zscript/statscreen/statscreen.txt | 28 ++++----- .../zscript/statscreen/statscreen_sp.txt | 58 +++++++++++++++---- 18 files changed, 161 insertions(+), 61 deletions(-) diff --git a/src/g_level.cpp b/src/g_level.cpp index 8d30c05385..991849e560 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -841,8 +841,9 @@ bool FLevelLocals::DoCompleted (FString nextlevel, wbstartstruct_t &wminfo) } } - // Ignore the (C)WILVxx lumps from the original Doom IWADs so that the name can be localized properly, if the retrieved text does not come from the default table. - // This is only active for those IWADS where the style of these graphics matches the provided BIGFONT for the respective game. + // This cannot use any common localization logic because it may not replace user content at all. + // Unlike the menus, replacements here do not merely change the style but also the content. + // On the other hand, the IWAD lumps may always be replaced with text, because they are the same style as the BigFont. if (gameinfo.flags & GI_IGNORETITLEPATCHES) { FTextureID *texids[] = { &wminfo.LName0, &wminfo.LName1 }; diff --git a/src/gamedata/gi.cpp b/src/gamedata/gi.cpp index efcfe74dae..2c639d3c9f 100644 --- a/src/gamedata/gi.cpp +++ b/src/gamedata/gi.cpp @@ -59,6 +59,8 @@ 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, mStatscreenEnteringPatch) +DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenFinishedPatch) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, gibfactor) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, intermissioncounter) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, statusscreen_single) @@ -423,8 +425,8 @@ void FMapInfoParser::ParseGameInfo() GAMEINFOKEY_FONT(mStatscreenMapNameFont, "statscreen_mapnamefont") GAMEINFOKEY_FONT(mStatscreenFinishedFont, "statscreen_finishedfont") GAMEINFOKEY_FONT(mStatscreenEnteringFont, "statscreen_enteringfont") - GAMEINFOKEY_PATCH(mStatscreenFinishedFont, "statscreen_finishedpatch") - GAMEINFOKEY_PATCH(mStatscreenEnteringFont, "statscreen_enteringpatch") + GAMEINFOKEY_PATCH(mStatscreenFinishedPatch, "statscreen_finishedpatch") + GAMEINFOKEY_PATCH(mStatscreenEnteringPatch, "statscreen_enteringpatch") 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 4f27a6969b..77f45d1cf1 100644 --- a/src/gamedata/gi.h +++ b/src/gamedata/gi.h @@ -190,6 +190,8 @@ struct gameinfo_t FGIFont mStatscreenMapNameFont; FGIFont mStatscreenFinishedFont; FGIFont mStatscreenEnteringFont; + FGIFont mStatscreenFinishedPatch; + FGIFont mStatscreenEnteringPatch; bool norandomplayerclass; bool forcekillscripts; FName statusscreen_single; diff --git a/src/gamedata/textures/texturemanager.cpp b/src/gamedata/textures/texturemanager.cpp index 98b8197bce..c26d36765f 100644 --- a/src/gamedata/textures/texturemanager.cpp +++ b/src/gamedata/textures/texturemanager.cpp @@ -303,6 +303,13 @@ DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, CheckForTexture, CheckForTexture) ACTION_RETURN_INT(CheckForTexture(name, type, flags)); } +DEFINE_ACTION_FUNCTION(_TexMan, OkForLocalization) +{ + PARAM_PROLOGUE; + PARAM_INT(name); + ACTION_RETURN_INT(true); // work for later. We need the definition to implement the language support +} + //========================================================================== // // FTextureManager :: ListTextures diff --git a/src/gamedata/textures/textures.h b/src/gamedata/textures/textures.h index 7ecb806219..8005be330e 100644 --- a/src/gamedata/textures/textures.h +++ b/src/gamedata/textures/textures.h @@ -572,7 +572,8 @@ public: TEXMAN_ReturnFirst = 4, TEXMAN_AllowSkins = 8, TEXMAN_ShortNameOnly = 16, - TEXMAN_DontCreate = 32 + TEXMAN_DontCreate = 32, + TEXMAN_Localize = 64 }; enum diff --git a/src/menu/menu.cpp b/src/menu/menu.cpp index 6689f771b4..19cb91557c 100644 --- a/src/menu/menu.cpp +++ b/src/menu/menu.cpp @@ -1265,12 +1265,13 @@ DMenuItemBase * CreateOptionMenuItemCommand(const char *label, FName cmd, bool c return (DMenuItemBase*)p; } -DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param) +DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param, const char *label, FFont *font, int color) { auto c = PClass::FindClass("ListMenuItemPatchItem"); auto p = c->CreateNew(); FString keystr = FString(char(hotkey)); - VMValue params[] = { p, x, y, height, tex.GetIndex(), &keystr, command.GetIndex(), param }; + FString labelstr = label; + VMValue params[] = { p, x, y, height, tex.GetIndex(), &keystr, command.GetIndex(), param, &labelstr, font, color }; auto f = dyn_cast(c->FindSymbol("InitDirect", false)); VMCall(f->Variants[0].Implementation, params, countof(params), nullptr, 0); return (DMenuItemBase*)p; diff --git a/src/menu/menu.h b/src/menu/menu.h index 83f4f66da5..0ac367d1f7 100644 --- a/src/menu/menu.h +++ b/src/menu/menu.h @@ -352,7 +352,7 @@ DMenuItemBase * CreateOptionMenuItemStaticText(const char *name, int v = -1); DMenuItemBase * CreateOptionMenuItemSubmenu(const char *label, FName cmd, int center); DMenuItemBase * CreateOptionMenuItemControl(const char *label, FName cmd, FKeyBindings *bindings); DMenuItemBase * CreateOptionMenuItemJoyConfigMenu(const char *label, IJoystickConfig *joy); -DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param); +DMenuItemBase * CreateListMenuItemPatch(double x, double y, int height, int hotkey, FTextureID tex, FName command, int param, const char *label, FFont *font, int color); DMenuItemBase * CreateListMenuItemText(double x, double y, int height, int hotkey, const char *text, FFont *font, PalEntry color1, PalEntry color2, FName command, int param); DMenuItemBase * CreateOptionMenuItemCommand(const char *label, FName cmd, bool centered = false); diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index 2b6301653d..fbfa21e9fc 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -1121,7 +1121,7 @@ static void BuildEpisodeMenu() if (AllEpisodes[i].mPicName.IsNotEmpty()) { FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName); - it = CreateListMenuItemPatch(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut, tex, NAME_Skillmenu, i); + it = CreateListMenuItemPatch(ld->mXpos, posy, ld->mLinespacing, AllEpisodes[i].mShortcut, tex, NAME_Skillmenu, i, AllEpisodes[i].mEpisodeName, ld->mFont, ld->mFontColor); } else { @@ -1627,16 +1627,16 @@ void M_StartupSkillMenu(FGameStartup *gs) pItemText = skill.MenuNamesForPlayerClass.CheckKey(gs->PlayerClass); } + EColorRange color = (EColorRange)skill.GetTextColor(); + if (color == CR_UNTRANSLATED) color = ld->mFontColor; if (skill.PicName.Len() != 0 && pItemText == nullptr) { FTextureID tex = GetMenuTexture(skill.PicName); - li = CreateListMenuItemPatch(ld->mXpos, y, ld->mLinespacing, skill.Shortcut, tex, action, SkillIndices[i]); + li = CreateListMenuItemPatch(ld->mXpos, y, ld->mLinespacing, skill.Shortcut, tex, action, SkillIndices[i], skill.MenuName, ld->mFont, color); } else { - EColorRange color = (EColorRange)skill.GetTextColor(); - if (color == CR_UNTRANSLATED) color = ld->mFontColor; - li = CreateListMenuItemText(x, y, ld->mLinespacing, skill.Shortcut, + li = CreateListMenuItemText(x, y, ld->mLinespacing, skill.Shortcut, pItemText? *pItemText : skill.MenuName, ld->mFont, color,ld->mFontColor2, action, SkillIndices[i]); } ld->mItems.Push(li); diff --git a/src/scripting/backend/codegen.cpp b/src/scripting/backend/codegen.cpp index 98ff002033..3e9b6be0df 100644 --- a/src/scripting/backend/codegen.cpp +++ b/src/scripting/backend/codegen.cpp @@ -8858,10 +8858,17 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx) CallingFunction = ctx.Function; if (ArgList.Size() > 0) { + if (argtypes.Size() == 0) + { + ScriptPosition.Message(MSG_ERROR, "Too many arguments in call to %s", Function->SymbolName.GetChars()); + delete this; + return nullptr; + } + bool foundvarargs = false; PType * type = nullptr; int flag = 0; - if (argtypes.Last() != nullptr && ArgList.Size() + implicit > argtypes.Size()) + if (argtypes.Size() > 0 && argtypes.Last() != nullptr && ArgList.Size() + implicit > argtypes.Size()) { ScriptPosition.Message(MSG_ERROR, "Too many arguments in call to %s", Function->SymbolName.GetChars()); delete this; diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index cf4fa12702..c6d0eea82b 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -1310,17 +1310,20 @@ TXT_FREEZEOFF = "Freeze mode off"; TXT_STRANGE = "You feel strange..."; TXT_STRANGER = "You feel even stranger."; TXT_NOTSTRANGE = "You feel like yourself again."; -TXT_LEADBOOTSON = "LEAD BOOTS ON"; -TXT_LEADBOOTSOFF = "LEAD BOOTS OFF"; +TXT_LEADBOOTSON = "Lead Boots On"; +TXT_LEADBOOTSOFF = "Lead Boots Off"; TXT_LIGHTER = "You feel lighter"; TXT_GRAVITY = "Gravity weighs you down"; // Raven intermission -TXT_IMKILLS = "KILLS"; -TXT_IMITEMS = "ITEMS"; -TXT_IMSECRETS = "SECRETS"; -TXT_IMTIME = "TIME"; +TXT_IMKILLS = "Kills"; +TXT_IMITEMS = "Items"; +TXT_IMSECRETS = "Secrets"; +TXT_IMTIME = "Time"; +TXT_IMSUCKS = "Sucks"; +TXT_IMSCRT = "Scrt"; +TXT_IMPAR = "Par"; RAVENQUITMSG = "ARE YOU SURE YOU WANT TO QUIT?"; diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index 05ac7adf56..9027065e87 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -67,6 +67,8 @@ gameinfo statscreen_mapnamefont = "BigFont" statscreen_finishedpatch = "WIF" statscreen_enteringpatch = "WIENTER" + 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 95bd5ab4cf..b3541b91a9 100644 --- a/wadsrc/static/mapinfo/doomcommon.txt +++ b/wadsrc/static/mapinfo/doomcommon.txt @@ -67,6 +67,8 @@ gameinfo statscreen_mapnamefont = "BigFont" statscreen_finishedpatch = "WIF" statscreen_enteringpatch = "WIENTER" + statscreen_finishedfont = "BigFont", "red" + statscreen_enteringfont = "BigFont", "red" statscreen_coop = "CoopStatusScreen" statscreen_dm = "DeathmatchStatusScreen" statscreen_single = "DoomStatusScreen" diff --git a/wadsrc/static/mapinfo/mindefaults.txt b/wadsrc/static/mapinfo/mindefaults.txt index 6df82ab82d..80d5623f10 100644 --- a/wadsrc/static/mapinfo/mindefaults.txt +++ b/wadsrc/static/mapinfo/mindefaults.txt @@ -55,8 +55,8 @@ gameinfo defaultendsequence = "Inter_Cast" maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt" statscreen_mapnamefont = "BigFont" - statscreen_finishedpatch = "WIF" - statscreen_enteringpatch = "WIENTER" + statscreen_finishedfont = "BigFont" + statscreen_enteringfont = "BigFont" messageboxclass = "MessageBoxMenu" } diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index f24b139fc3..874306c931 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -11,11 +11,17 @@ DEFAULTLISTMENU { Font "BigFont", "Untranslated" + IfGame(Doom) + { + Selector "M_SKULL1", -32, -5 + Linespacing 16 + Font "BigUpper", "Red" + } IfGame(Doom, Chex) { Selector "M_SKULL1", -32, -5 Linespacing 16 - Font "BigFont", "Red" + Font "BigFont", "Green" } IfGame(Strife) { @@ -68,24 +74,24 @@ LISTMENU "MainMenu" IfGame(Doom, Strife, Chex) { - PatchItem "M_NGAME", "n", "PlayerclassMenu" + PatchItem "M_NGAME", "n", "PlayerclassMenu", 0, "$MNU_NEWGAME" ifOption(SwapMenu) { - PatchItem "M_LOADG", "l", "LoadGameMenu" - PatchItem "M_SAVEG", "s", "SaveGameMenu" - PatchItem "M_OPTION","o", "OptionsMenu" + PatchItem "M_LOADG", "l", "LoadGameMenu", 0, "$MNU_LOADGAME" + PatchItem "M_SAVEG", "s", "SaveGameMenu",0, "$MNU_SAVEGAME" + PatchItem "M_OPTION","o", "OptionsMenu", 0, "$MNU_OPTIONS" } else { - PatchItem "M_OPTION","o", "OptionsMenu" - PatchItem "M_LOADG", "l", "LoadGameMenu" - PatchItem "M_SAVEG", "s", "SaveGameMenu" + PatchItem "M_OPTION","o", "OptionsMenu", 0, "$MNU_OPTIONS" + PatchItem "M_LOADG", "l", "LoadGameMenu", 0, "$MNU_LOADGAME" + PatchItem "M_SAVEG", "s", "SaveGameMenu", 0, "$MNU_SAVEGAME" } ifOption(ReadThis) { - PatchItem "M_RDTHIS","r", "ReadThisMenu" + PatchItem "M_RDTHIS","r", "ReadThisMenu", 0, "$MNU_INFO" } - PatchItem "M_QUITG", "q", "QuitMenu" + PatchItem "M_QUITG", "q", "QuitMenu", 0, "$MNU_QUITGAME" } IfGame(Heretic, Hexen) diff --git a/wadsrc/static/zscript/base.txt b/wadsrc/static/zscript/base.txt index a6c52d03f0..c65dfb9bfa 100644 --- a/wadsrc/static/zscript/base.txt +++ b/wadsrc/static/zscript/base.txt @@ -80,7 +80,8 @@ struct TexMan ReturnFirst = 4, AllowSkins = 8, ShortNameOnly = 16, - DontCreate = 32 + DontCreate = 32, + Localize = 64 }; enum ETexReplaceFlags @@ -104,6 +105,7 @@ struct TexMan native static Vector2 GetScaledSize(TextureID tex); native static Vector2 GetScaledOffset(TextureID tex); native static int CheckRealHeight(TextureID tex); + native static bool OkForLocalization(TextureID patch); native static void SetCameraToTexture(Actor viewpoint, String texture, double fov); } @@ -372,6 +374,8 @@ struct GameInfoStruct native native GIFont mStatscreenMapNameFont; native GIFont mStatscreenEnteringFont; native GIFont mStatscreenFinishedFont; + native GIFont mStatscreenEnteringPatch; + native GIFont mStatscreenFinishedPatch; native double gibfactor; native bool intermissioncounter; native Name mSliderColor; diff --git a/wadsrc/static/zscript/menu/listmenuitems.txt b/wadsrc/static/zscript/menu/listmenuitems.txt index 59bff9f61e..99050e1c95 100644 --- a/wadsrc/static/zscript/menu/listmenuitems.txt +++ b/wadsrc/static/zscript/menu/listmenuitems.txt @@ -280,29 +280,53 @@ class ListMenuItemTextItem : ListMenuItemSelectable class ListMenuItemPatchItem : ListMenuItemSelectable { TextureID mTexture; + String mSubstitute; + Font mFont; + int mColor; - void Init(ListMenuDescriptor desc, TextureID patch, String hotkey, Name child, int param = 0) + void Init(ListMenuDescriptor desc, TextureID patch, String hotkey, Name child, int param = 0, String subst = "") { Super.Init(desc.mXpos, desc.mYpos, desc.mLinespacing, child, param); mHotkey = hotkey.CharCodeAt(0); mTexture = patch; + mSubstitute = subst; + mFont = desc.mFont; + mColor = desc.mFontColor; } - void InitDirect(double x, double y, int height, TextureID patch, String hotkey, Name child, int param = 0) + void InitDirect(double x, double y, int height, TextureID patch, String hotkey, Name child, int param = 0, String subst = "", Font fnt = null, int col = Font.CR_UNTRANSLATED) { Super.Init(x, y, height, child, param); mHotkey = hotkey.CharCodeAt(0); mTexture = patch; + mSubstitute = subst; + mFont = fnt; + mColor = col; } override void Drawer(bool selected) { - screen.DrawTexture (mTexture, true, mXpos, mYpos, DTA_Clean, true); + if (mSubstitute == "" || TexMan.OkForLocalization(mTexture)) + { + screen.DrawTexture (mTexture, true, mXpos, mYpos, DTA_Clean, true); + } + else + { + screen.DrawText(mFont, mColor, mXpos, mYpos, mSubstitute, DTA_Clean, true); + } + } override int GetWidth() { - return TexMan.GetSize(mTexture); + if (mSubstitute == "" || TexMan.OkForLocalization(mTexture)) + { + return TexMan.GetSize(mTexture); + } + else + { + return max(1, mFont.StringWidth(StringTable.Localize(mSubstitute))); + } } } diff --git a/wadsrc/static/zscript/statscreen/statscreen.txt b/wadsrc/static/zscript/statscreen/statscreen.txt index 0903299abb..0e4d243dc1 100644 --- a/wadsrc/static/zscript/statscreen/statscreen.txt +++ b/wadsrc/static/zscript/statscreen/statscreen.txt @@ -14,15 +14,15 @@ struct PatchInfo play version("2.5") TextureID mPatch; int mColor; - void Init(GIFont gifont) + void Init(GIFont gifont, GIFont gipatch = null) { - if (gifont.color == 'Null') + if (gipatch != null) { - mPatch = TexMan.CheckForTexture(gifont.fontname, TexMan.Type_MiscPatch); + mPatch = TexMan.CheckForTexture(gipatch.fontname, TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); mColor = mPatch.isValid() ? Font.CR_UNTRANSLATED : Font.CR_UNDEFINED; mFont = NULL; } - else + if (!mPatch.isValid()) { mFont = Font.GetFont(gifont.fontname); mColor = Font.FindFontColor(gifont.color); @@ -368,7 +368,7 @@ class StatusScreen abstract play version("2.5") } else { - screen.DrawText (BigFont, Font.CR_UNTRANSLATED, x - BigFont.StringWidth("SUCKS"), y - IntermissionFont.GetHeight() - 2, "SUCKS", DTA_Clean, true); + screen.DrawText (BigFont, Font.CR_UNTRANSLATED, x - BigFont.StringWidth("$TXT_IMSUCKS"), y - IntermissionFont.GetHeight() - 2, "$TXT_IMSUCKS", DTA_Clean, true); } } @@ -693,17 +693,17 @@ class StatusScreen abstract play version("2.5") me = wbs.pnum; for (int i = 0; i < MAXPLAYERS; i++) Plrs[i] = wbs.plyr[i]; - entering.Init(gameinfo.mStatscreenEnteringFont); - finished.Init(gameinfo.mStatscreenFinishedFont); + entering.Init(gameinfo.mStatscreenEnteringFont, gameinfo.mStatscreenEnteringPatch); + finished.Init(gameinfo.mStatscreenFinishedFont, gameinfo.mStatscreenFinishedPatch); mapname.Init(gameinfo.mStatscreenMapNameFont); - Kills = TexMan.CheckForTexture("WIOSTK", TexMan.Type_MiscPatch); // "kills" - Secret = TexMan.CheckForTexture("WIOSTS", TexMan.Type_MiscPatch); // "scrt" - P_secret = TexMan.CheckForTexture("WISCRT2", TexMan.Type_MiscPatch); // "secret" - Items = TexMan.CheckForTexture("WIOSTI", TexMan.Type_MiscPatch); // "items" - Timepic = TexMan.CheckForTexture("WITIME", TexMan.Type_MiscPatch); // "time" - Sucks = TexMan.CheckForTexture("WISUCKS", TexMan.Type_MiscPatch); // "sucks" - Par = TexMan.CheckForTexture("WIPAR", TexMan.Type_MiscPatch); // "par" + Kills = TexMan.CheckForTexture("WIOSTK", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "kills" + Secret = TexMan.CheckForTexture("WIOSTS", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "scrt", not used + P_secret = TexMan.CheckForTexture("WISCRT2", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "secret" + Items = TexMan.CheckForTexture("WIOSTI", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "items" + Timepic = TexMan.CheckForTexture("WITIME", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "time" + Sucks = TexMan.CheckForTexture("WISUCKS", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "sucks" + Par = TexMan.CheckForTexture("WIPAR", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "par" lnametexts[0] = wbstartstruct.thisname; lnametexts[1] = wbstartstruct.nextname; diff --git a/wadsrc/static/zscript/statscreen/statscreen_sp.txt b/wadsrc/static/zscript/statscreen/statscreen_sp.txt index f4def35695..63af009656 100644 --- a/wadsrc/static/zscript/statscreen/statscreen_sp.txt +++ b/wadsrc/static/zscript/statscreen/statscreen_sp.txt @@ -137,17 +137,48 @@ class DoomStatusScreen : StatusScreen int lh = IntermissionFont.GetHeight() * 3 / 2; drawLF(); - - screen.DrawTexture (Kills, true, SP_STATSX, SP_STATSY, DTA_Clean, true); + + // Fixme: This should try to retrieve the color from the intermission font and use the best approximation here + let tcolor = Font.CR_RED; + + if (Kills.isValid()) + { + screen.DrawTexture (Kills, true, SP_STATSX, SP_STATSY, DTA_Clean, true); + } + else + { + screen.DrawText (BigFont, tcolor, SP_STATSX, SP_STATSY, "$TXT_IMKILLS", DTA_Clean, true); + } drawPercent (IntermissionFont, 320 - SP_STATSX, SP_STATSY, cnt_kills[0], wbs.maxkills); - screen.DrawTexture (Items, true, SP_STATSX, SP_STATSY+lh, DTA_Clean, true); + if (Items.isValid()) + { + screen.DrawTexture (Items, true, SP_STATSX, SP_STATSY+lh, DTA_Clean, true); + } + else + { + screen.DrawText (BigFont, tcolor, SP_STATSX, SP_STATSY+lh, "$TXT_IMITEMS", DTA_Clean, true); + } drawPercent (IntermissionFont, 320 - SP_STATSX, SP_STATSY+lh, cnt_items[0], wbs.maxitems); - screen.DrawTexture (P_secret, true, SP_STATSX, SP_STATSY+2*lh, DTA_Clean, true); + if (P_secret.IsValid()) + { + screen.DrawTexture (P_secret, true, SP_STATSX, SP_STATSY+2*lh, DTA_Clean, true); + } + else + { + screen.DrawText (BigFont, tcolor, SP_STATSX, SP_STATSY+2*lh, "$TXT_IMSECRETS", DTA_Clean, true); + } drawPercent (IntermissionFont, 320 - SP_STATSX, SP_STATSY+2*lh, cnt_secret[0], wbs.maxsecret); - screen.DrawTexture (Timepic, true, SP_TIMEX, SP_TIMEY, DTA_Clean, true); + if (Timepic.IsValid()) + { + screen.DrawTexture (Timepic, true, SP_TIMEX, SP_TIMEY, DTA_Clean, true); + } + else + { + screen.DrawText (BigFont, tcolor, SP_TIMEX, SP_TIMEY, "$TXT_IMTIME", DTA_Clean, true); + } drawTime (160 - SP_TIMEX, SP_TIMEY, cnt_time); if (wi_showtotaltime) { @@ -156,7 +187,14 @@ class DoomStatusScreen : StatusScreen if (wbs.partime) { - screen.DrawTexture (Par, true, 160 + SP_TIMEX, SP_TIMEY, DTA_Clean, true); + if (Par.IsValid()) + { + screen.DrawTexture (Par, true, 160 + SP_TIMEX, SP_TIMEY, DTA_Clean, true); + } + else + { + screen.DrawText (BigFont, tcolor, SP_TIMEX, SP_TIMEY, "$TXT_IMPAR", DTA_Clean, true); + } drawTime (320 - SP_TIMEX, SP_TIMEY, cnt_par); } } @@ -171,9 +209,9 @@ class RavenStatusScreen : DoomStatusScreen drawLF(); - screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 50, 65, Stringtable.Localize("$TXT_IMKILLS"), DTA_Clean, true, DTA_Shadow, true); - screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 50, 90, Stringtable.Localize("$TXT_IMITEMS"), DTA_Clean, true, DTA_Shadow, true); - screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 50, 115, Stringtable.Localize("$TXT_IMSECRETS"), DTA_Clean, true, DTA_Shadow, true); + 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); int countpos = gameinfo.gametype==GAME_Strife? 285:270; if (sp_state >= 2) @@ -190,7 +228,7 @@ class RavenStatusScreen : DoomStatusScreen } if (sp_state >= 8) { - screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 85, 160, Stringtable.Localize("$TXT_IMTIME"), DTA_Clean, true, DTA_Shadow, true); + screen.DrawText (BigFont, Font.CR_UNTRANSLATED, 85, 160, "$TXT_IMTIME", DTA_Clean, true, DTA_Shadow, true); drawTime (249, 160, cnt_time); if (wi_showtotaltime) {