Merge commit 'refs/pull/1168/head' of https://github.com/coelckers/gzdoom

# Conflicts:
#	wadsrc/static/zscript/ui/statscreen/statscreen_coop.zs
This commit is contained in:
Rachael Alexanderson 2020-08-30 09:43:03 -04:00
commit 0868f65199
2 changed files with 67 additions and 4 deletions

View file

@ -509,6 +509,28 @@ class StatusScreen abstract play version("2.5")
drawTextScaled(fnt, x - fnt.StringWidth(s) * scale, y, s, scale, color);
}
//====================================================================
//
// Display the completed time scaled
//
//====================================================================
void drawTimeScaled (Font fnt, int x, int y, int t, double scale, int color = Font.CR_UNTRANSLATED)
{
if (t < 0)
return;
int hours = t / 3600;
t -= hours * 3600;
int minutes = t / 60;
t -= minutes * 60;
int seconds = t;
String s = (hours > 0 ? String.Format("%d:", hours) : "") .. String.Format("%02d:%02d", minutes, seconds);
drawTextScaled(fnt, x - fnt.StringWidth(s) * scale, y, s, scale, color);
}
//====================================================================
//
// Display level completion time and par, or "sucks" message if overflow.

View file

@ -55,7 +55,7 @@ class CoopStatusScreen : StatusScreen
bool stillticking;
bool autoskip = autoSkip();
if ((acceleratestage || autoskip) && ng_state != 10)
if ((acceleratestage || autoskip) && ng_state != 12)
{
acceleratestage = 0;
@ -72,8 +72,12 @@ class CoopStatusScreen : StatusScreen
cnt_frags[i] = fragSum (i);
}
cnt_otherkills = otherkills;
cnt_time = Thinker.Tics2Seconds(Plrs[me].stime);
cnt_total_time = Thinker.Tics2Seconds(wbs.totaltime);
PlaySound("intermission/nextstage");
ng_state = 10;
ng_state = 12;
}
if (ng_state == 2)
@ -156,7 +160,7 @@ class CoopStatusScreen : StatusScreen
if (!stillticking)
{
PlaySound("intermission/nextstage");
ng_state += 1 + 2*!dofrags;
ng_state ++;
}
}
else if (ng_state == 8)
@ -166,6 +170,34 @@ class CoopStatusScreen : StatusScreen
stillticking = false;
cnt_time += 3;
cnt_total_time += 3;
int sec = Thinker.Tics2Seconds(Plrs[me].stime);
if (cnt_time > sec)
cnt_time = sec;
else
stillticking = true;
int tsec = Thinker.Tics2Seconds(wbs.totaltime);
if (cnt_total_time > tsec)
cnt_total_time = tsec;
else
stillticking = true;
if (!stillticking)
{
PlaySound("intermission/nextstage");
ng_state += 1 + 2*!dofrags;
}
}
else if (ng_state == 10)
{
if (!(bcnt&3))
PlaySound("intermission/tick");
stillticking = false;
for (i=0 ; i<MAXPLAYERS ; i++)
{
if (!playeringame[i])
@ -185,7 +217,7 @@ class CoopStatusScreen : StatusScreen
ng_state++;
}
}
else if (ng_state == 10)
else if (ng_state == 12)
{
int i;
for (i = 0; i < MAXPLAYERS; i++)
@ -338,5 +370,14 @@ class CoopStatusScreen : StatusScreen
drawNumScaled(displayFont, secret_x, y, FontScale, wbs.maxsecret, 0, textcolor);
}
}
y += height + 3 * CleanYfac;
drawTextScaled(displayFont, name_x, y, Stringtable.Localize("$TXT_IMTIME"), FontScale, textcolor);
if (ng_state >= 8)
{
drawTimeScaled(displayFont, kills_x, y, cnt_time, FontScale, textcolor);
drawTimeScaled(displayFont, secret_x, y, cnt_total_time, FontScale, textcolor);
}
}
}