- preparation work for substituting the menu and intermission screen text graphics for localization

This commit is contained in:
Christoph Oelckers 2019-02-19 01:22:12 +01:00
parent 10a017e104
commit 5e7fb16d05
18 changed files with 161 additions and 61 deletions

View file

@ -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 cannot use any common localization logic because it may not replace user content at all.
// This is only active for those IWADS where the style of these graphics matches the provided BIGFONT for the respective game. // 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) if (gameinfo.flags & GI_IGNORETITLEPATCHES)
{ {
FTextureID *texids[] = { &wminfo.LName0, &wminfo.LName1 }; FTextureID *texids[] = { &wminfo.LName0, &wminfo.LName1 };

View file

@ -59,6 +59,8 @@ DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mBackButton)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenMapNameFont) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenMapNameFont)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenEnteringFont) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenEnteringFont)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, mStatscreenFinishedFont) 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, gibfactor)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, intermissioncounter) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, intermissioncounter)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, statusscreen_single) DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, statusscreen_single)
@ -423,8 +425,8 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_FONT(mStatscreenMapNameFont, "statscreen_mapnamefont") GAMEINFOKEY_FONT(mStatscreenMapNameFont, "statscreen_mapnamefont")
GAMEINFOKEY_FONT(mStatscreenFinishedFont, "statscreen_finishedfont") GAMEINFOKEY_FONT(mStatscreenFinishedFont, "statscreen_finishedfont")
GAMEINFOKEY_FONT(mStatscreenEnteringFont, "statscreen_enteringfont") GAMEINFOKEY_FONT(mStatscreenEnteringFont, "statscreen_enteringfont")
GAMEINFOKEY_PATCH(mStatscreenFinishedFont, "statscreen_finishedpatch") GAMEINFOKEY_PATCH(mStatscreenFinishedPatch, "statscreen_finishedpatch")
GAMEINFOKEY_PATCH(mStatscreenEnteringFont, "statscreen_enteringpatch") GAMEINFOKEY_PATCH(mStatscreenEnteringPatch, "statscreen_enteringpatch")
GAMEINFOKEY_BOOL(norandomplayerclass, "norandomplayerclass") GAMEINFOKEY_BOOL(norandomplayerclass, "norandomplayerclass")
GAMEINFOKEY_BOOL(forcekillscripts, "forcekillscripts") // [JM] Force kill scripts on thing death. (MF7_NOKILLSCRIPTS overrides.) GAMEINFOKEY_BOOL(forcekillscripts, "forcekillscripts") // [JM] Force kill scripts on thing death. (MF7_NOKILLSCRIPTS overrides.)
GAMEINFOKEY_STRING(Dialogue, "dialogue") GAMEINFOKEY_STRING(Dialogue, "dialogue")

View file

@ -190,6 +190,8 @@ struct gameinfo_t
FGIFont mStatscreenMapNameFont; FGIFont mStatscreenMapNameFont;
FGIFont mStatscreenFinishedFont; FGIFont mStatscreenFinishedFont;
FGIFont mStatscreenEnteringFont; FGIFont mStatscreenEnteringFont;
FGIFont mStatscreenFinishedPatch;
FGIFont mStatscreenEnteringPatch;
bool norandomplayerclass; bool norandomplayerclass;
bool forcekillscripts; bool forcekillscripts;
FName statusscreen_single; FName statusscreen_single;

View file

@ -303,6 +303,13 @@ DEFINE_ACTION_FUNCTION_NATIVE(_TexMan, CheckForTexture, CheckForTexture)
ACTION_RETURN_INT(CheckForTexture(name, type, flags)); 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 // FTextureManager :: ListTextures

View file

@ -572,7 +572,8 @@ public:
TEXMAN_ReturnFirst = 4, TEXMAN_ReturnFirst = 4,
TEXMAN_AllowSkins = 8, TEXMAN_AllowSkins = 8,
TEXMAN_ShortNameOnly = 16, TEXMAN_ShortNameOnly = 16,
TEXMAN_DontCreate = 32 TEXMAN_DontCreate = 32,
TEXMAN_Localize = 64
}; };
enum enum

View file

@ -1265,12 +1265,13 @@ DMenuItemBase * CreateOptionMenuItemCommand(const char *label, FName cmd, bool c
return (DMenuItemBase*)p; 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 c = PClass::FindClass("ListMenuItemPatchItem");
auto p = c->CreateNew(); auto p = c->CreateNew();
FString keystr = FString(char(hotkey)); 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<PFunction>(c->FindSymbol("InitDirect", false)); auto f = dyn_cast<PFunction>(c->FindSymbol("InitDirect", false));
VMCall(f->Variants[0].Implementation, params, countof(params), nullptr, 0); VMCall(f->Variants[0].Implementation, params, countof(params), nullptr, 0);
return (DMenuItemBase*)p; return (DMenuItemBase*)p;

View file

@ -352,7 +352,7 @@ DMenuItemBase * CreateOptionMenuItemStaticText(const char *name, int v = -1);
DMenuItemBase * CreateOptionMenuItemSubmenu(const char *label, FName cmd, int center); DMenuItemBase * CreateOptionMenuItemSubmenu(const char *label, FName cmd, int center);
DMenuItemBase * CreateOptionMenuItemControl(const char *label, FName cmd, FKeyBindings *bindings); DMenuItemBase * CreateOptionMenuItemControl(const char *label, FName cmd, FKeyBindings *bindings);
DMenuItemBase * CreateOptionMenuItemJoyConfigMenu(const char *label, IJoystickConfig *joy); 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 * 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); DMenuItemBase * CreateOptionMenuItemCommand(const char *label, FName cmd, bool centered = false);

View file

@ -1121,7 +1121,7 @@ static void BuildEpisodeMenu()
if (AllEpisodes[i].mPicName.IsNotEmpty()) if (AllEpisodes[i].mPicName.IsNotEmpty())
{ {
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName); 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 else
{ {
@ -1627,15 +1627,15 @@ void M_StartupSkillMenu(FGameStartup *gs)
pItemText = skill.MenuNamesForPlayerClass.CheckKey(gs->PlayerClass); 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) if (skill.PicName.Len() != 0 && pItemText == nullptr)
{ {
FTextureID tex = GetMenuTexture(skill.PicName); 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 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]); pItemText? *pItemText : skill.MenuName, ld->mFont, color,ld->mFontColor2, action, SkillIndices[i]);
} }

View file

@ -8858,10 +8858,17 @@ FxExpression *FxVMFunctionCall::Resolve(FCompileContext& ctx)
CallingFunction = ctx.Function; CallingFunction = ctx.Function;
if (ArgList.Size() > 0) 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; bool foundvarargs = false;
PType * type = nullptr; PType * type = nullptr;
int flag = 0; 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()); ScriptPosition.Message(MSG_ERROR, "Too many arguments in call to %s", Function->SymbolName.GetChars());
delete this; delete this;

View file

@ -1310,17 +1310,20 @@ TXT_FREEZEOFF = "Freeze mode off";
TXT_STRANGE = "You feel strange..."; TXT_STRANGE = "You feel strange...";
TXT_STRANGER = "You feel even stranger."; TXT_STRANGER = "You feel even stranger.";
TXT_NOTSTRANGE = "You feel like yourself again."; TXT_NOTSTRANGE = "You feel like yourself again.";
TXT_LEADBOOTSON = "LEAD BOOTS ON"; TXT_LEADBOOTSON = "Lead Boots On";
TXT_LEADBOOTSOFF = "LEAD BOOTS OFF"; TXT_LEADBOOTSOFF = "Lead Boots Off";
TXT_LIGHTER = "You feel lighter"; TXT_LIGHTER = "You feel lighter";
TXT_GRAVITY = "Gravity weighs you down"; TXT_GRAVITY = "Gravity weighs you down";
// Raven intermission // Raven intermission
TXT_IMKILLS = "KILLS"; TXT_IMKILLS = "Kills";
TXT_IMITEMS = "ITEMS"; TXT_IMITEMS = "Items";
TXT_IMSECRETS = "SECRETS"; TXT_IMSECRETS = "Secrets";
TXT_IMTIME = "TIME"; TXT_IMTIME = "Time";
TXT_IMSUCKS = "Sucks";
TXT_IMSCRT = "Scrt";
TXT_IMPAR = "Par";
RAVENQUITMSG = "ARE YOU SURE YOU WANT TO QUIT?"; RAVENQUITMSG = "ARE YOU SURE YOU WANT TO QUIT?";

View file

@ -67,6 +67,8 @@ gameinfo
statscreen_mapnamefont = "BigFont" statscreen_mapnamefont = "BigFont"
statscreen_finishedpatch = "WIF" statscreen_finishedpatch = "WIF"
statscreen_enteringpatch = "WIENTER" statscreen_enteringpatch = "WIENTER"
statscreen_finishedfont = "BigFont", "green"
statscreen_enteringfont = "BigFont", "green"
statscreen_coop = "CoopStatusScreen" statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen" statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "DoomStatusScreen" statscreen_single = "DoomStatusScreen"

View file

@ -67,6 +67,8 @@ gameinfo
statscreen_mapnamefont = "BigFont" statscreen_mapnamefont = "BigFont"
statscreen_finishedpatch = "WIF" statscreen_finishedpatch = "WIF"
statscreen_enteringpatch = "WIENTER" statscreen_enteringpatch = "WIENTER"
statscreen_finishedfont = "BigFont", "red"
statscreen_enteringfont = "BigFont", "red"
statscreen_coop = "CoopStatusScreen" statscreen_coop = "CoopStatusScreen"
statscreen_dm = "DeathmatchStatusScreen" statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "DoomStatusScreen" statscreen_single = "DoomStatusScreen"

View file

@ -55,8 +55,8 @@ gameinfo
defaultendsequence = "Inter_Cast" defaultendsequence = "Inter_Cast"
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt" maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
statscreen_mapnamefont = "BigFont" statscreen_mapnamefont = "BigFont"
statscreen_finishedpatch = "WIF" statscreen_finishedfont = "BigFont"
statscreen_enteringpatch = "WIENTER" statscreen_enteringfont = "BigFont"
messageboxclass = "MessageBoxMenu" messageboxclass = "MessageBoxMenu"
} }

View file

@ -11,11 +11,17 @@
DEFAULTLISTMENU DEFAULTLISTMENU
{ {
Font "BigFont", "Untranslated" Font "BigFont", "Untranslated"
IfGame(Doom)
{
Selector "M_SKULL1", -32, -5
Linespacing 16
Font "BigUpper", "Red"
}
IfGame(Doom, Chex) IfGame(Doom, Chex)
{ {
Selector "M_SKULL1", -32, -5 Selector "M_SKULL1", -32, -5
Linespacing 16 Linespacing 16
Font "BigFont", "Red" Font "BigFont", "Green"
} }
IfGame(Strife) IfGame(Strife)
{ {
@ -68,24 +74,24 @@ LISTMENU "MainMenu"
IfGame(Doom, Strife, Chex) IfGame(Doom, Strife, Chex)
{ {
PatchItem "M_NGAME", "n", "PlayerclassMenu" PatchItem "M_NGAME", "n", "PlayerclassMenu", 0, "$MNU_NEWGAME"
ifOption(SwapMenu) ifOption(SwapMenu)
{ {
PatchItem "M_LOADG", "l", "LoadGameMenu" PatchItem "M_LOADG", "l", "LoadGameMenu", 0, "$MNU_LOADGAME"
PatchItem "M_SAVEG", "s", "SaveGameMenu" PatchItem "M_SAVEG", "s", "SaveGameMenu",0, "$MNU_SAVEGAME"
PatchItem "M_OPTION","o", "OptionsMenu" PatchItem "M_OPTION","o", "OptionsMenu", 0, "$MNU_OPTIONS"
} }
else else
{ {
PatchItem "M_OPTION","o", "OptionsMenu" PatchItem "M_OPTION","o", "OptionsMenu", 0, "$MNU_OPTIONS"
PatchItem "M_LOADG", "l", "LoadGameMenu" PatchItem "M_LOADG", "l", "LoadGameMenu", 0, "$MNU_LOADGAME"
PatchItem "M_SAVEG", "s", "SaveGameMenu" PatchItem "M_SAVEG", "s", "SaveGameMenu", 0, "$MNU_SAVEGAME"
} }
ifOption(ReadThis) 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) IfGame(Heretic, Hexen)

View file

@ -80,7 +80,8 @@ struct TexMan
ReturnFirst = 4, ReturnFirst = 4,
AllowSkins = 8, AllowSkins = 8,
ShortNameOnly = 16, ShortNameOnly = 16,
DontCreate = 32 DontCreate = 32,
Localize = 64
}; };
enum ETexReplaceFlags enum ETexReplaceFlags
@ -104,6 +105,7 @@ struct TexMan
native static Vector2 GetScaledSize(TextureID tex); native static Vector2 GetScaledSize(TextureID tex);
native static Vector2 GetScaledOffset(TextureID tex); native static Vector2 GetScaledOffset(TextureID tex);
native static int CheckRealHeight(TextureID tex); native static int CheckRealHeight(TextureID tex);
native static bool OkForLocalization(TextureID patch);
native static void SetCameraToTexture(Actor viewpoint, String texture, double fov); native static void SetCameraToTexture(Actor viewpoint, String texture, double fov);
} }
@ -372,6 +374,8 @@ struct GameInfoStruct native
native GIFont mStatscreenMapNameFont; native GIFont mStatscreenMapNameFont;
native GIFont mStatscreenEnteringFont; native GIFont mStatscreenEnteringFont;
native GIFont mStatscreenFinishedFont; native GIFont mStatscreenFinishedFont;
native GIFont mStatscreenEnteringPatch;
native GIFont mStatscreenFinishedPatch;
native double gibfactor; native double gibfactor;
native bool intermissioncounter; native bool intermissioncounter;
native Name mSliderColor; native Name mSliderColor;

View file

@ -280,29 +280,53 @@ class ListMenuItemTextItem : ListMenuItemSelectable
class ListMenuItemPatchItem : ListMenuItemSelectable class ListMenuItemPatchItem : ListMenuItemSelectable
{ {
TextureID mTexture; 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); Super.Init(desc.mXpos, desc.mYpos, desc.mLinespacing, child, param);
mHotkey = hotkey.CharCodeAt(0); mHotkey = hotkey.CharCodeAt(0);
mTexture = patch; 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); Super.Init(x, y, height, child, param);
mHotkey = hotkey.CharCodeAt(0); mHotkey = hotkey.CharCodeAt(0);
mTexture = patch; mTexture = patch;
mSubstitute = subst;
mFont = fnt;
mColor = col;
} }
override void Drawer(bool selected) 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() 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)));
}
} }
} }

View file

@ -14,15 +14,15 @@ struct PatchInfo play version("2.5")
TextureID mPatch; TextureID mPatch;
int mColor; 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; mColor = mPatch.isValid() ? Font.CR_UNTRANSLATED : Font.CR_UNDEFINED;
mFont = NULL; mFont = NULL;
} }
else if (!mPatch.isValid())
{ {
mFont = Font.GetFont(gifont.fontname); mFont = Font.GetFont(gifont.fontname);
mColor = Font.FindFontColor(gifont.color); mColor = Font.FindFontColor(gifont.color);
@ -368,7 +368,7 @@ class StatusScreen abstract play version("2.5")
} }
else 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; me = wbs.pnum;
for (int i = 0; i < MAXPLAYERS; i++) Plrs[i] = wbs.plyr[i]; for (int i = 0; i < MAXPLAYERS; i++) Plrs[i] = wbs.plyr[i];
entering.Init(gameinfo.mStatscreenEnteringFont); entering.Init(gameinfo.mStatscreenEnteringFont, gameinfo.mStatscreenEnteringPatch);
finished.Init(gameinfo.mStatscreenFinishedFont); finished.Init(gameinfo.mStatscreenFinishedFont, gameinfo.mStatscreenFinishedPatch);
mapname.Init(gameinfo.mStatscreenMapNameFont); mapname.Init(gameinfo.mStatscreenMapNameFont);
Kills = TexMan.CheckForTexture("WIOSTK", TexMan.Type_MiscPatch); // "kills" Kills = TexMan.CheckForTexture("WIOSTK", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "kills"
Secret = TexMan.CheckForTexture("WIOSTS", TexMan.Type_MiscPatch); // "scrt" Secret = TexMan.CheckForTexture("WIOSTS", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "scrt", not used
P_secret = TexMan.CheckForTexture("WISCRT2", TexMan.Type_MiscPatch); // "secret" P_secret = TexMan.CheckForTexture("WISCRT2", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "secret"
Items = TexMan.CheckForTexture("WIOSTI", TexMan.Type_MiscPatch); // "items" Items = TexMan.CheckForTexture("WIOSTI", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "items"
Timepic = TexMan.CheckForTexture("WITIME", TexMan.Type_MiscPatch); // "time" Timepic = TexMan.CheckForTexture("WITIME", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "time"
Sucks = TexMan.CheckForTexture("WISUCKS", TexMan.Type_MiscPatch); // "sucks" Sucks = TexMan.CheckForTexture("WISUCKS", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "sucks"
Par = TexMan.CheckForTexture("WIPAR", TexMan.Type_MiscPatch); // "par" Par = TexMan.CheckForTexture("WIPAR", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "par"
lnametexts[0] = wbstartstruct.thisname; lnametexts[0] = wbstartstruct.thisname;
lnametexts[1] = wbstartstruct.nextname; lnametexts[1] = wbstartstruct.nextname;

View file

@ -138,16 +138,47 @@ class DoomStatusScreen : StatusScreen
drawLF(); 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); 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); 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); 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); drawTime (160 - SP_TIMEX, SP_TIMEY, cnt_time);
if (wi_showtotaltime) if (wi_showtotaltime)
{ {
@ -156,7 +187,14 @@ class DoomStatusScreen : StatusScreen
if (wbs.partime) 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); drawTime (320 - SP_TIMEX, SP_TIMEY, cnt_par);
} }
} }
@ -171,9 +209,9 @@ class RavenStatusScreen : DoomStatusScreen
drawLF(); 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, 65, "$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, 90, "$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, 115, "$TXT_IMSECRETS", DTA_Clean, true, DTA_Shadow, true);
int countpos = gameinfo.gametype==GAME_Strife? 285:270; int countpos = gameinfo.gametype==GAME_Strife? 285:270;
if (sp_state >= 2) if (sp_state >= 2)
@ -190,7 +228,7 @@ class RavenStatusScreen : DoomStatusScreen
} }
if (sp_state >= 8) 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); drawTime (249, 160, cnt_time);
if (wi_showtotaltime) if (wi_showtotaltime)
{ {