- reworked summary screen to use consistent contents, either all patches or all text but not mixed

This commit is contained in:
Christoph Oelckers 2019-02-20 00:44:17 +01:00
parent 9f59a84a37
commit a6a091c83a
2 changed files with 65 additions and 75 deletions

View file

@ -18,9 +18,13 @@ struct PatchInfo play version("2.5")
{ {
if (gipatch != null) if (gipatch != null)
{ {
mPatch = TexMan.CheckForTexture(gipatch.fontname, TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); mPatch = TexMan.CheckForTexture(gipatch.fontname, TexMan.Type_MiscPatch);
mColor = mPatch.isValid() ? Font.CR_UNTRANSLATED : Font.CR_UNDEFINED; if (TexMan.OkForLocalization(mPatch))
mFont = NULL; {
mColor = mPatch.isValid() ? Font.CR_UNTRANSLATED : Font.CR_UNDEFINED;
mFont = NULL;
}
else mPatch.setInvalid();
} }
if (!mPatch.isValid()) if (!mPatch.isValid())
{ {
@ -190,8 +194,7 @@ class StatusScreen abstract play version("2.5")
if (pinfo.mPatch.isValid()) if (pinfo.mPatch.isValid())
{ {
let size = TexMan.GetScaledSize(pinfo.mPatch); screen.DrawTexture(pinfo.mPatch, true, midx, y, DTA_CleanNoMove, true, DTA_CenterXOffset, true);
screen.DrawTexture(pinfo.mPatch, true, midx - size.X * CleanXfac/2, y, DTA_CleanNoMove, true);
return y + int(size.Y * CleanYfac); return y + int(size.Y * CleanYfac);
} }
else 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; bool sucky;
if (t < 0) if (t < 0)
return; 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; int hours = t / 3600;
t -= hours * 3600; t -= hours * 3600;
int minutes = t / 60; 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 // Why were these offsets hard coded? Half the WADs with custom patches
// I tested screwed up miserably in this function! // I tested screwed up miserably in this function!
int num_spacing = IntermissionFont.GetCharWidth("3"); int num_spacing = printFont.GetCharWidth("3");
int colon_spacing = IntermissionFont.GetCharWidth(":"); int colon_spacing = printFont.GetCharWidth(":");
x = drawNum (IntermissionFont, x, y, seconds, 2) - 1; x = drawNum (printFont, x, y, seconds, 2) - 1;
DrawCharPatch (IntermissionFont, ":", x -= colon_spacing, y); DrawCharPatch (printFont, ":", x -= colon_spacing, y);
x = drawNum (IntermissionFont, x, y, minutes, 2, hours!=0); x = drawNum (printFont, x, y, minutes, 2, hours!=0);
if (hours) if (hours)
{ {
DrawCharPatch (IntermissionFont, ":", x -= colon_spacing, y); DrawCharPatch (printFont, ":", x -= colon_spacing, y);
drawNum (IntermissionFont, x, y, hours, 2); 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); finished.Init(gameinfo.mStatscreenFinishedFont, gameinfo.mStatscreenFinishedPatch);
mapname.Init(gameinfo.mStatscreenMapNameFont); mapname.Init(gameinfo.mStatscreenMapNameFont);
Kills = TexMan.CheckForTexture("WIOSTK", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "kills" Kills = TexMan.CheckForTexture("WIOSTK", TexMan.Type_MiscPatch); // "kills"
Secret = TexMan.CheckForTexture("WIOSTS", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "scrt", not used Secret = TexMan.CheckForTexture("WIOSTS", TexMan.Type_MiscPatch); // "scrt", not used
P_secret = TexMan.CheckForTexture("WISCRT2", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "secret" P_secret = TexMan.CheckForTexture("WISCRT2", TexMan.Type_MiscPatch); // "secret"
Items = TexMan.CheckForTexture("WIOSTI", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "items" Items = TexMan.CheckForTexture("WIOSTI", TexMan.Type_MiscPatch); // "items"
Timepic = TexMan.CheckForTexture("WITIME", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "time" Timepic = TexMan.CheckForTexture("WITIME", TexMan.Type_MiscPatch); // "time"
Sucks = TexMan.CheckForTexture("WISUCKS", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "sucks" Sucks = TexMan.CheckForTexture("WISUCKS", TexMan.Type_MiscPatch); // "sucks"
Par = TexMan.CheckForTexture("WIPAR", TexMan.Type_MiscPatch, TexMan.TryAny|TexMan.Localize); // "par" Par = TexMan.CheckForTexture("WIPAR", TexMan.Type_MiscPatch); // "par"
lnametexts[0] = wbstartstruct.thisname; lnametexts[0] = wbstartstruct.thisname;
lnametexts[1] = wbstartstruct.nextname; lnametexts[1] = wbstartstruct.nextname;

View file

@ -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 // Fixme: This should try to retrieve the color from the intermission font and use the best approximation here
let tcolor = Font.CR_RED; 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); 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); 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); 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); 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 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); 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) 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);
drawTime (160 - SP_TIMEX, SP_TIMEY + lh, cnt_total_time, true); // no 'sucks' for total time ever! drawPercent (printFont, 320 - SP_STATSX, SP_STATSY+2*lh, cnt_secret[0], wbs.maxsecret);
} drawTimeFont (printFont, 160 - SP_TIMEX, SP_TIMEY, cnt_time);
if (wbs.partime) // 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 (Par.IsValid())
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 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);
} }
} }