From a6a091c83afdaf7c3d24cd597724c25ef3337dbd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 20 Feb 2019 00:44:17 +0100 Subject: [PATCH] - reworked summary screen to use consistent contents, either all patches or all text but not mixed --- .../static/zscript/statscreen/statscreen.txt | 63 +++++++-------- .../zscript/statscreen/statscreen_sp.txt | 77 +++++++++---------- 2 files changed, 65 insertions(+), 75 deletions(-) diff --git a/wadsrc/static/zscript/statscreen/statscreen.txt b/wadsrc/static/zscript/statscreen/statscreen.txt index 0e4d243dc..1fb36558c 100644 --- a/wadsrc/static/zscript/statscreen/statscreen.txt +++ b/wadsrc/static/zscript/statscreen/statscreen.txt @@ -18,9 +18,13 @@ struct PatchInfo play version("2.5") { if (gipatch != null) { - mPatch = TexMan.CheckForTexture(gipatch.fontname, TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); - mColor = mPatch.isValid() ? Font.CR_UNTRANSLATED : Font.CR_UNDEFINED; - mFont = NULL; + mPatch = TexMan.CheckForTexture(gipatch.fontname, TexMan.Type_MiscPatch); + if (TexMan.OkForLocalization(mPatch)) + { + mColor = mPatch.isValid() ? Font.CR_UNTRANSLATED : Font.CR_UNDEFINED; + mFont = NULL; + } + else mPatch.setInvalid(); } if (!mPatch.isValid()) { @@ -190,8 +194,7 @@ class StatusScreen abstract play version("2.5") if (pinfo.mPatch.isValid()) { - let size = TexMan.GetScaledSize(pinfo.mPatch); - screen.DrawTexture(pinfo.mPatch, true, midx - size.X * CleanXfac/2, y, DTA_CleanNoMove, true); + screen.DrawTexture(pinfo.mPatch, true, midx, y, DTA_CleanNoMove, true, DTA_CenterXOffset, true); return y + int(size.Y * CleanYfac); } else @@ -350,28 +353,13 @@ class StatusScreen abstract play version("2.5") // //==================================================================== - void drawTime (int x, int y, int t, bool no_sucks=false) + void drawTimeFont (Font printFont, int x, int y, int t) { bool sucky; if (t < 0) return; - sucky = !no_sucks && t >= wbs.sucktime * 60 * 60 && wbs.sucktime > 0; - - if (sucky) - { // "sucks" - if (Sucks.isValid()) - { - let size = TexMan.GetScaledSize(Sucks); - screen.DrawTexture (Sucks, true, x - size.X, y - size.Y - 2, DTA_Clean, true); - } - else - { - screen.DrawText (BigFont, Font.CR_UNTRANSLATED, x - BigFont.StringWidth("$TXT_IMSUCKS"), y - IntermissionFont.GetHeight() - 2, "$TXT_IMSUCKS", DTA_Clean, true); - } - } - int hours = t / 3600; t -= hours * 3600; int minutes = t / 60; @@ -380,19 +368,24 @@ class StatusScreen abstract play version("2.5") // Why were these offsets hard coded? Half the WADs with custom patches // I tested screwed up miserably in this function! - int num_spacing = IntermissionFont.GetCharWidth("3"); - int colon_spacing = IntermissionFont.GetCharWidth(":"); + int num_spacing = printFont.GetCharWidth("3"); + int colon_spacing = printFont.GetCharWidth(":"); - x = drawNum (IntermissionFont, x, y, seconds, 2) - 1; - DrawCharPatch (IntermissionFont, ":", x -= colon_spacing, y); - x = drawNum (IntermissionFont, x, y, minutes, 2, hours!=0); + x = drawNum (printFont, x, y, seconds, 2) - 1; + DrawCharPatch (printFont, ":", x -= colon_spacing, y); + x = drawNum (printFont, x, y, minutes, 2, hours!=0); if (hours) { - DrawCharPatch (IntermissionFont, ":", x -= colon_spacing, y); - drawNum (IntermissionFont, x, y, hours, 2); + DrawCharPatch (printFont, ":", x -= colon_spacing, y); + drawNum (printFont, x, y, hours, 2); } } + void drawTime (int x, int y, int t, bool no_sucks=false) + { + drawTimeFont(IntermissionFont, x, y, t); + } + //==================================================================== // @@ -697,13 +690,13 @@ class StatusScreen abstract play version("2.5") finished.Init(gameinfo.mStatscreenFinishedFont, gameinfo.mStatscreenFinishedPatch); mapname.Init(gameinfo.mStatscreenMapNameFont); - 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" + Kills = TexMan.CheckForTexture("WIOSTK", TexMan.Type_MiscPatch); // "kills" + Secret = TexMan.CheckForTexture("WIOSTS", TexMan.Type_MiscPatch); // "scrt", not used + 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" 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 63af00965..56846b8ed 100644 --- a/wadsrc/static/zscript/statscreen/statscreen_sp.txt +++ b/wadsrc/static/zscript/statscreen/statscreen_sp.txt @@ -140,63 +140,60 @@ class DoomStatusScreen : StatusScreen // Fixme: This should try to retrieve the color from the intermission font and use the best approximation here let tcolor = Font.CR_RED; + + // For visual consistency, only use the patches here if all are present. + bool useGfx = Kills.OkForLocalization() && Items.OkForLocalization() && P_secret.OkForLocalization() && Timepic.OkForLocalization() && + (!wbs.partime || Par.OkForLocalization()); + + Font printFont; - if (Kills.isValid()) + if (useGfx) { + printFont = IntermissionFont; 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); - - 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); - - 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); - - if (Timepic.IsValid()) - { screen.DrawTexture (Timepic, true, SP_TIMEX, SP_TIMEY, DTA_Clean, true); + if (wbs.partime) screen.DrawTexture (Par, true, 160 + SP_TIMEX, SP_TIMEY, DTA_Clean, true); } 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, SP_TIMEX, SP_TIMEY, "$TXT_IMPAR", DTA_Clean, true); } - drawTime (160 - SP_TIMEX, SP_TIMEY, cnt_time); - if (wi_showtotaltime) - { - drawTime (160 - SP_TIMEX, SP_TIMEY + lh, cnt_total_time, true); // no 'sucks' for total time ever! - } - - if (wbs.partime) - { - if (Par.IsValid()) + + drawPercent (printFont, 320 - SP_STATSX, SP_STATSY, cnt_kills[0], wbs.maxkills); + drawPercent (printFont, 320 - SP_STATSX, SP_STATSY+lh, cnt_items[0], wbs.maxitems); + drawPercent (printFont, 320 - SP_STATSX, SP_STATSY+2*lh, cnt_secret[0], wbs.maxsecret); + drawTimeFont (printFont, 160 - SP_TIMEX, SP_TIMEY, cnt_time); + + // This really sucks - not just by its message - and should have been removed long ago! + // To avoid problems here, the "sucks" text only gets printed if the lump is present, this even applies to the text replacement. + + if (cnt_time >= wbs.sucktime * 60 * 60 && wbs.sucktime > 0 && Sucks.IsValid()) + { // "sucks" + int x = 160 - SP_TIMEX; + int y = SP_TIMEY; + if (useGfx && Sucks.OkForLocalization()) { - screen.DrawTexture (Par, true, 160 + SP_TIMEX, SP_TIMEY, DTA_Clean, true); + let size = TexMan.GetScaledSize(Sucks); + screen.DrawTexture (Sucks, true, x - size.X, y - size.Y - 2, DTA_Clean, true); } else { - screen.DrawText (BigFont, tcolor, SP_TIMEX, SP_TIMEY, "$TXT_IMPAR", DTA_Clean, true); + screen.DrawText (printFont, Font.CR_UNTRANSLATED, x - printFont.StringWidth("$TXT_IMSUCKS"), y - printFont.GetHeight() - 2, "$TXT_IMSUCKS", DTA_Clean, true); } - drawTime (320 - SP_TIMEX, SP_TIMEY, cnt_par); } + + if (wi_showtotaltime) + { + drawTimeFont (printFont, 160 - SP_TIMEX, SP_TIMEY + lh, cnt_total_time, true); // no 'sucks' for total time ever! + } + drawTimeFont (printFont, 320 - SP_TIMEX, SP_TIMEY, cnt_par); } }