From ed0529b9d5dc8dd097ece3d79ebc9b16e2594a2b Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 29 Nov 2019 20:35:59 +0000 Subject: [PATCH 1/2] Match final countdown timer to timer (resolves #400). --- src/st_stuff.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 8b3ceac9d..954ba022d 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -696,9 +696,9 @@ static void ST_drawTime(void) // Counting down the hidetime? if ((gametype == GT_TAG || gametype == GT_HIDEANDSEEK) && (stplyr->realtime <= (hidetime*TICRATE))) { - tics = (hidetime*TICRATE - stplyr->realtime); - if (tics < 3*TICRATE) - ST_drawRaceNum(tics); + tics = (hidetime*TICRATE + (TICRATE-1) - stplyr->realtime); + if ((tics+1-TICRATE) < 3*TICRATE) + ST_drawRaceNum(tics+1-TICRATE); downwards = true; } else @@ -713,8 +713,8 @@ static void ST_drawTime(void) if (timelimitintics >= stplyr->realtime) { tics = (timelimitintics + (TICRATE-1) - stplyr->realtime); - if (tics < 3*TICRATE) - ST_drawRaceNum(tics); + if ((tics+1-TICRATE) && (tics+1-TICRATE) < 3*TICRATE) + ST_drawRaceNum(tics+1-TICRATE); } else // Overtime! tics = 0; From fdcc8c912a4a2941c39f830e5b158960553be317 Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 29 Nov 2019 20:41:13 +0000 Subject: [PATCH 2/2] Actually, wait; this is way better and cleaner. --- src/st_stuff.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 954ba022d..3a8a4d2f1 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -696,9 +696,10 @@ static void ST_drawTime(void) // Counting down the hidetime? if ((gametype == GT_TAG || gametype == GT_HIDEANDSEEK) && (stplyr->realtime <= (hidetime*TICRATE))) { - tics = (hidetime*TICRATE + (TICRATE-1) - stplyr->realtime); - if ((tics+1-TICRATE) < 3*TICRATE) - ST_drawRaceNum(tics+1-TICRATE); + tics = (hidetime*TICRATE - stplyr->realtime); + if (tics < 3*TICRATE) + ST_drawRaceNum(tics); + tics += (TICRATE-1); // match the race num downwards = true; } else @@ -710,11 +711,12 @@ static void ST_drawTime(void) // Time limit? if (gametype != GT_COOP && gametype != GT_RACE && gametype != GT_COMPETITION && cv_timelimit.value && timelimitintics > 0) { - if (timelimitintics >= stplyr->realtime) + if (timelimitintics > stplyr->realtime) { - tics = (timelimitintics + (TICRATE-1) - stplyr->realtime); - if ((tics+1-TICRATE) && (tics+1-TICRATE) < 3*TICRATE) - ST_drawRaceNum(tics+1-TICRATE); + tics = (timelimitintics - stplyr->realtime); + if (tics < 3*TICRATE) + ST_drawRaceNum(tics); + tics += (TICRATE-1); // match the race num } else // Overtime! tics = 0;