]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Using a separate global to keep track of overtime phase
authorz411 <z411@omaera.org>
Fri, 4 Mar 2022 21:28:59 +0000 (18:28 -0300)
committerz411 <z411@omaera.org>
Fri, 4 Mar 2022 21:28:59 +0000 (18:28 -0300)
qcsrc/client/hud/panel/timer.qc
qcsrc/common/stats.qh
qcsrc/server/command/vote.qc
qcsrc/server/world.qc
qcsrc/server/world.qh

index 872e74fd5d954c34fab0a7069b26f7a0848fd27a..31468b15228da37dbd01c72f6980775d25dbaa76 100644 (file)
@@ -126,16 +126,18 @@ void HUD_Timer()
        }
 
        // Subtext
-       int overtimes = STAT(OVERTIMESADDED);
+       int overtimes = STAT(OVERTIMES);
 
        if(warmup_stage || autocvar__hud_configure)
                subtext = _("Warmup");
        else if(STAT(TIMEOUT_STATUS))
                subtext = _("Timeout");
+       else if (overtimes == -1)
+               subtext = _("Sudden Death");
+       else if(overtimes == 1)
+               subtext = _("Overtime");
        else if (overtimes >= 2)
                subtext = sprintf(_("Overtime #%d"), overtimes);
-       else if(overtimes)
-               subtext = _("Overtime");
 
        subtext_size  = vec2(mySize.x, mySize.y / 3);
        timer_size    = vec2(mySize.x, mySize.y - subtext_size.y);
index e91aa37259f5b3fbef9c97e234539a8e337755c5..abadaa47deefb24f227e0f5350d1673dfa8ff02b 100644 (file)
@@ -79,7 +79,7 @@ float game_stopped;
 float game_starttime; //point in time when the countdown to game start is over
 float round_starttime; //point in time when the countdown to round start is over
 int autocvar_leadlimit;
-int checkrules_overtimesadded;
+int overtimes; // overtimes added (-1 = sudden death)
 int timeout_status; // (values: 0, 1, 2) contains whether a timeout is not active (0), was called but still at leadtime (1) or is active (2)
 
 // TODO: world.qh can't be included here due to circular includes!
@@ -118,7 +118,7 @@ REGISTER_STAT(SECRETS_TOTAL, int, secrets_total)
 REGISTER_STAT(SECRETS_FOUND, int, secrets_found)
 REGISTER_STAT(RESPAWN_TIME, float)
 REGISTER_STAT(ROUNDSTARTTIME, float, round_starttime)
-REGISTER_STAT(OVERTIMESADDED, int, checkrules_overtimesadded)
+REGISTER_STAT(OVERTIMES, int, overtimes)
 REGISTER_STAT(TIMEOUT_STATUS, int, timeout_status)
 REGISTER_STAT(MONSTERS_TOTAL, int)
 REGISTER_STAT(MONSTERS_KILLED, int)
index 40b621aa9ba77e157f3d20f056e7f79e42290a86..7ff8d2a133e16abd24425031214f7f11201c35aa 100644 (file)
@@ -435,7 +435,7 @@ void ReadyRestart_force(bool is_fake_round_start)
        // clear overtime, we have to decrease timelimit to its original value again.
        if (checkrules_overtimesadded > 0 && g_race_qualifying != 2)
                cvar_set("timelimit", ftos(autocvar_timelimit - (checkrules_overtimesadded * autocvar_timelimit_overtime)));
-       checkrules_suddendeathend = checkrules_overtimesadded = checkrules_suddendeathwarning = 0;
+       checkrules_suddendeathend = checkrules_overtimesadded = checkrules_suddendeathwarning = overtimes = 0;
 
        if(warmup_stage)
                game_starttime = time; // Warmup: No countdown in warmup
index e9c4fadeb5acc0f546c4ad290184d71fdd9852f4..7fce21e6ee81f69fe4a35112daaec00739e22ccc 100644 (file)
@@ -1351,9 +1351,14 @@ float InitiateSuddenDeath()
                if(!checkrules_suddendeathend)
                {
                        if(autocvar_g_campaign)
+                       {
                                checkrules_suddendeathend = time; // no suddendeath in campaign
+                       }
                        else
+                       {
                                checkrules_suddendeathend = time + 60 * autocvar_timelimit_suddendeath;
+                               overtimes = -1;
+                       }
                        if(g_race && !g_race_qualifying)
                                race_StartCompleting();
                }
@@ -1364,6 +1369,7 @@ float InitiateSuddenDeath()
 void InitiateOvertime() // ONLY call this if InitiateSuddenDeath returned true
 {
        ++checkrules_overtimesadded;
+       overtimes = checkrules_overtimesadded;
        //add one more overtime by simply extending the timelimit
        cvar_set("timelimit", ftos(autocvar_timelimit + autocvar_timelimit_overtime));
        Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_OVERTIME_TIME, autocvar_timelimit_overtime * 60);
index bf2092bbc0b7e96705fa003897b8a46e16d45cb8..242b3369470546ff8c0a1c4b0169e14605237044 100644 (file)
@@ -31,6 +31,7 @@ float autocvar_timelimit_suddendeath;
 float checkrules_equality;
 float checkrules_suddendeathwarning;
 float checkrules_suddendeathend;
+int checkrules_overtimesadded; //how many overtimes have been already added
 
 // flag set on worldspawn so that the code knows if it is dedicated or not
 bool server_is_dedicated;