mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-14 08:30:49 +00:00
- reworked summary screen to use consistent contents, either all patches or all text but not mixed
This commit is contained in:
parent
9f59a84a37
commit
a6a091c83a
2 changed files with 65 additions and 75 deletions
|
@ -18,10 +18,14 @@ 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);
|
||||||
|
if (TexMan.OkForLocalization(mPatch))
|
||||||
|
{
|
||||||
mColor = mPatch.isValid() ? Font.CR_UNTRANSLATED : Font.CR_UNDEFINED;
|
mColor = mPatch.isValid() ? Font.CR_UNTRANSLATED : Font.CR_UNDEFINED;
|
||||||
mFont = NULL;
|
mFont = NULL;
|
||||||
}
|
}
|
||||||
|
else mPatch.setInvalid();
|
||||||
|
}
|
||||||
if (!mPatch.isValid())
|
if (!mPatch.isValid())
|
||||||
{
|
{
|
||||||
mFont = Font.GetFont(gifont.fontname);
|
mFont = Font.GetFont(gifont.fontname);
|
||||||
|
@ -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;
|
||||||
|
|
|
@ -141,62 +141,59 @@ 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;
|
||||||
|
|
||||||
if (Kills.isValid())
|
// 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 (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);
|
|
||||||
|
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())
|
||||||
|
{
|
||||||
|
let size = TexMan.GetScaledSize(Sucks);
|
||||||
|
screen.DrawTexture (Sucks, true, x - size.X, y - size.Y - 2, DTA_Clean, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
screen.DrawText (printFont, Font.CR_UNTRANSLATED, x - printFont.StringWidth("$TXT_IMSUCKS"), y - printFont.GetHeight() - 2, "$TXT_IMSUCKS", DTA_Clean, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (wi_showtotaltime)
|
if (wi_showtotaltime)
|
||||||
{
|
{
|
||||||
drawTime (160 - SP_TIMEX, SP_TIMEY + lh, cnt_total_time, true); // no 'sucks' for total time ever!
|
drawTimeFont (printFont, 160 - SP_TIMEX, SP_TIMEY + lh, cnt_total_time, true); // no 'sucks' for total time ever!
|
||||||
}
|
|
||||||
|
|
||||||
if (wbs.partime)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
drawTimeFont (printFont, 320 - SP_TIMEX, SP_TIMEY, cnt_par);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue