Further improvements to cv_timelimit support, to the point that I DO think it might be worth having on the menu (but mark the game as modified if it's touched, to discourage its overzealous use?)

This commit is contained in:
toaster 2018-07-19 14:39:46 +01:00
parent 7af613a814
commit 1aa6267665
2 changed files with 23 additions and 15 deletions

View file

@ -1692,7 +1692,7 @@ static void HU_DrawRankings(void)
timeval = timelimitintics; timeval = timelimitintics;
timeval /= TICRATE; timeval /= TICRATE;
if (leveltime <= timelimitintics) if (leveltime <= (timelimitintics + starttime))
{ {
V_DrawCenteredString(64, 8, 0, "TIME LEFT"); V_DrawCenteredString(64, 8, 0, "TIME LEFT");
V_DrawCenteredString(64, 16, hilicol, va("%u", timeval)); V_DrawCenteredString(64, 16, hilicol, va("%u", timeval));

View file

@ -4585,55 +4585,63 @@ static void K_drawKartTimestamp(void)
// TIME_X = BASEVIDWIDTH-124; // 196 // TIME_X = BASEVIDWIDTH-124; // 196
// TIME_Y = 6; // 6 // TIME_Y = 6; // 6
INT32 TIME_XB; INT32 TIME_XB, splitflags = V_HUDTRANS|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTORIGHT);
INT32 splitflags = V_HUDTRANS|K_calcSplitFlags(V_SNAPTOTOP|V_SNAPTORIGHT); tic_t drawtime = stplyr->realtime;
if (cv_timelimit.value && timelimitintics > 0)
{
if (drawtime > timelimitintics)
drawtime = 0;
else
drawtime = timelimitintics - drawtime;
}
V_DrawScaledPatch(TIME_X, TIME_Y, splitflags, kp_timestickerwide); V_DrawScaledPatch(TIME_X, TIME_Y, splitflags, kp_timestickerwide);
TIME_XB = TIME_X+33; TIME_XB = TIME_X+33;
if (stplyr->realtime/(60*TICRATE) < 100) // 99:99:99 only if (drawtime/(60*TICRATE) < 100) // 99:99:99 only
{ {
// zero minute // zero minute
if (stplyr->realtime/(60*TICRATE) < 10) if (drawtime/(60*TICRATE) < 10)
{ {
V_DrawKartString(TIME_XB, TIME_Y+3, splitflags, va("0")); V_DrawKartString(TIME_XB, TIME_Y+3, splitflags, va("0"));
// minutes time 0 __ __ // minutes time 0 __ __
V_DrawKartString(TIME_XB+12, TIME_Y+3, splitflags, va("%d", stplyr->realtime/(60*TICRATE))); V_DrawKartString(TIME_XB+12, TIME_Y+3, splitflags, va("%d", drawtime/(60*TICRATE)));
} }
// minutes time 0 __ __ // minutes time 0 __ __
else else
V_DrawKartString(TIME_XB, TIME_Y+3, splitflags, va("%d", stplyr->realtime/(60*TICRATE))); V_DrawKartString(TIME_XB, TIME_Y+3, splitflags, va("%d", drawtime/(60*TICRATE)));
// apostrophe location _'__ __ // apostrophe location _'__ __
V_DrawKartString(TIME_XB+24, TIME_Y+3, splitflags, va("'")); V_DrawKartString(TIME_XB+24, TIME_Y+3, splitflags, va("'"));
// zero second _ 0_ __ // zero second _ 0_ __
if ((stplyr->realtime/TICRATE % 60) < 10) if ((drawtime/TICRATE % 60) < 10)
{ {
V_DrawKartString(TIME_XB+36, TIME_Y+3, splitflags, va("0")); V_DrawKartString(TIME_XB+36, TIME_Y+3, splitflags, va("0"));
// seconds time _ _0 __ // seconds time _ _0 __
V_DrawKartString(TIME_XB+48, TIME_Y+3, splitflags, va("%d", stplyr->realtime/TICRATE % 60)); V_DrawKartString(TIME_XB+48, TIME_Y+3, splitflags, va("%d", drawtime/TICRATE % 60));
} }
// zero second _ 00 __ // zero second _ 00 __
else else
V_DrawKartString(TIME_XB+36, TIME_Y+3, splitflags, va("%d", stplyr->realtime/TICRATE % 60)); V_DrawKartString(TIME_XB+36, TIME_Y+3, splitflags, va("%d", drawtime/TICRATE % 60));
// quotation mark location _ __"__ // quotation mark location _ __"__
V_DrawKartString(TIME_XB+60, TIME_Y+3, splitflags, va("\"")); V_DrawKartString(TIME_XB+60, TIME_Y+3, splitflags, va("\""));
// zero tick _ __ 0_ // zero tick _ __ 0_
if (G_TicsToCentiseconds(stplyr->realtime) < 10) if (G_TicsToCentiseconds(drawtime) < 10)
{ {
V_DrawKartString(TIME_XB+72, TIME_Y+3, splitflags, va("0")); V_DrawKartString(TIME_XB+72, TIME_Y+3, splitflags, va("0"));
// tics _ __ _0 // tics _ __ _0
V_DrawKartString(TIME_XB+84, TIME_Y+3, splitflags, va("%d", G_TicsToCentiseconds(stplyr->realtime))); V_DrawKartString(TIME_XB+84, TIME_Y+3, splitflags, va("%d", G_TicsToCentiseconds(drawtime)));
} }
// zero tick _ __ 00 // zero tick _ __ 00
if (G_TicsToCentiseconds(stplyr->realtime) >= 10) if (G_TicsToCentiseconds(drawtime) >= 10)
V_DrawKartString(TIME_XB+72, TIME_Y+3, splitflags, va("%d", G_TicsToCentiseconds(stplyr->realtime))); V_DrawKartString(TIME_XB+72, TIME_Y+3, splitflags, va("%d", G_TicsToCentiseconds(drawtime)));
} }
else if ((stplyr->realtime/TICRATE) & 1) else if ((drawtime/TICRATE) & 1)
V_DrawKartString(TIME_XB, TIME_Y+3, splitflags, va("99'59\"99")); V_DrawKartString(TIME_XB, TIME_Y+3, splitflags, va("99'59\"99"));
if (modeattacking) // emblem time! if (modeattacking) // emblem time!