From: z411 Date: Wed, 9 Feb 2022 19:18:37 +0000 (-0300) Subject: Added timeout subtext X-Git-Tag: xonotic-v0.8.5~177^2~23 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=53f65bc2b4eec2d9ab011dd91424ab0a3afb5d06;p=xonotic%2Fxonotic-data.pk3dir.git Added timeout subtext --- diff --git a/qcsrc/client/hud/panel/timer.qc b/qcsrc/client/hud/panel/timer.qc index ff7aab1d6..1b45095bb 100644 --- a/qcsrc/client/hud/panel/timer.qc +++ b/qcsrc/client/hud/panel/timer.qc @@ -36,7 +36,7 @@ void HUD_Timer() } string timer, subtimer, subtext; - float timelimit, timeleft, minutesLeft, overtimes; + float timelimit, timeleft, overtimes; float round_timelimit, round_timeleft; // Calculate timelimit @@ -45,8 +45,6 @@ void HUD_Timer() timelimit = STAT(WARMUP_TIMELIMIT); if(timelimit == 0) timelimit = STAT(TIMELIMIT) * 60; - else if(timelimit == -1) - timelimit = 0; } else { @@ -57,13 +55,11 @@ void HUD_Timer() timeleft = bound(0, timelimit + STAT(GAMESTARTTIME) - time, timelimit); timeleft = ceil(timeleft); - minutesLeft = floor(timeleft / 60); - // Timer color vector timer_color; - if(intermission_time || minutesLeft >= 5 || warmup_stage || timelimit == 0) + if(intermission_time || timeleft >= 300 || warmup_stage || timelimit <= 0) timer_color = '1 1 1'; //white - else if(minutesLeft >= 1) + else if(timeleft >= 60) timer_color = '1 1 0'; //yellow else timer_color = '1 0 0'; //red @@ -71,7 +67,7 @@ void HUD_Timer() // Timer text if (intermission_time) { timer = seconds_tostring(max(0, floor(intermission_time - STAT(GAMESTARTTIME)))); - } else if (autocvar_hud_panel_timer_increment || timelimit == 0) { + } else if (autocvar_hud_panel_timer_increment || timelimit <= 0) { float time_elapsed = floor(time - STAT(GAMESTARTTIME)); timer = seconds_tostring(max(0, time_elapsed)); } else { @@ -99,12 +95,16 @@ void HUD_Timer() // Subtext overtimes = STAT(OVERTIMESADDED); - if(warmup_stage) - subtext = "Warmup"; + if(warmup_stage || autocvar__hud_configure) + subtext = _("Warmup"); + else if(intermission_time) + subtext = _("Intermission"); + else if(STAT(TIMEOUT_STATUS)) + subtext = _("Timeout"); else if(overtimes == 1) - subtext = "Overtime"; + subtext = _("Overtime"); else if (overtimes > 1) - subtext = sprintf("Overtime #%d", overtimes); + subtext = sprintf(_("Overtime #%d"), overtimes); else subtext = string_null; diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index b5f684db0..afc4b5e9f 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -80,6 +80,7 @@ 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; float checkrules_overtimesadded; +float 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! #define autocvar_fraglimit cvar("fraglimit") @@ -118,6 +119,7 @@ REGISTER_STAT(SECRETS_FOUND, int, secrets_found) REGISTER_STAT(RESPAWN_TIME, float) REGISTER_STAT(ROUNDSTARTTIME, float, round_starttime) REGISTER_STAT(OVERTIMESADDED, float, checkrules_overtimesadded) +REGISTER_STAT(TIMEOUT_STATUS, float, timeout_status) REGISTER_STAT(MONSTERS_TOTAL, int) REGISTER_STAT(MONSTERS_KILLED, int) REGISTER_STAT(NADE_BONUS, float) diff --git a/qcsrc/server/command/common.qh b/qcsrc/server/command/common.qh index 5fd66bdbb..5fbf0dc69 100644 --- a/qcsrc/server/command/common.qh +++ b/qcsrc/server/command/common.qh @@ -58,7 +58,6 @@ float sys_frametime; // gets initialised in worldspawn, saves the value from float orig_slowmo; // contains the value of autocvar_slowmo so that, after timeout finished, it isn't set to slowmo 1 necessarily float timeout_time; // contains the time in seconds that the active timeout has left float timeout_leadtime; // contains the number of seconds left of the leadtime (before the timeout starts) -float 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) .float allowed_timeouts; // contains the number of allowed timeouts for each player .vector lastV_angle; // used when pausing the game in order to force the player to keep his old view angle fixed