From: z411 Date: Fri, 4 Mar 2022 21:28:59 +0000 (-0300) Subject: Using a separate global to keep track of overtime phase X-Git-Tag: xonotic-v0.8.5~177^2~3 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dd714ffac6b09917fcff8a0f449ea4e347e01ec0;p=xonotic%2Fxonotic-data.pk3dir.git Using a separate global to keep track of overtime phase --- diff --git a/qcsrc/client/hud/panel/timer.qc b/qcsrc/client/hud/panel/timer.qc index 872e74fd5..31468b152 100644 --- a/qcsrc/client/hud/panel/timer.qc +++ b/qcsrc/client/hud/panel/timer.qc @@ -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); diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index e91aa3725..abadaa47d 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -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) diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 40b621aa9..7ff8d2a13 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -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 diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index e9c4fadeb..7fce21e6e 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -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); diff --git a/qcsrc/server/world.qh b/qcsrc/server/world.qh index bf2092bbc..242b33694 100644 --- a/qcsrc/server/world.qh +++ b/qcsrc/server/world.qh @@ -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;