]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Added timeout subtext
authorz411 <z411@omaera.org>
Wed, 9 Feb 2022 19:18:37 +0000 (16:18 -0300)
committerz411 <z411@omaera.org>
Wed, 9 Feb 2022 19:18:37 +0000 (16:18 -0300)
qcsrc/client/hud/panel/timer.qc
qcsrc/common/stats.qh
qcsrc/server/command/common.qh

index ff7aab1d60b32c6728717e63eb27426d54b70408..1b45095bb534d2847e053811bdbd2399b6440158 100644 (file)
@@ -36,7 +36,7 @@ void HUD_Timer()
        }
 
        string timer, subtimer, subtext;
        }
 
        string timer, subtimer, subtext;
-       float timelimit, timeleft, minutesLeft, overtimes;
+       float timelimit, timeleft, overtimes;
        float round_timelimit, round_timeleft;
 
        // Calculate timelimit
        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;
                timelimit = STAT(WARMUP_TIMELIMIT);
                if(timelimit == 0)
                        timelimit = STAT(TIMELIMIT) * 60;
-               else if(timelimit == -1)
-                       timelimit = 0;
        }
        else
        {
        }
        else
        {
@@ -57,13 +55,11 @@ void HUD_Timer()
        timeleft = bound(0, timelimit + STAT(GAMESTARTTIME) - time, timelimit);
        timeleft = ceil(timeleft);
 
        timeleft = bound(0, timelimit + STAT(GAMESTARTTIME) - time, timelimit);
        timeleft = ceil(timeleft);
 
-       minutesLeft = floor(timeleft / 60);
-
        // Timer color
        vector timer_color;
        // 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
                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
                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))));
        // 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 {
                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);
        
        // 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)
        else if(overtimes == 1)
-               subtext = "Overtime";
+               subtext = _("Overtime");
        else if (overtimes > 1)
        else if (overtimes > 1)
-               subtext = sprintf("Overtime #%d", overtimes);
+               subtext = sprintf(_("Overtime #%d"), overtimes);
        else
                subtext = string_null;
 
        else
                subtext = string_null;
 
index b5f684db0ad75b43cd264d8b7b98064484aab1d3..afc4b5e9ff52011a0d969197608582d0d6a02e67 100644 (file)
@@ -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 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")
 
 // 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(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)
 REGISTER_STAT(MONSTERS_TOTAL, int)
 REGISTER_STAT(MONSTERS_KILLED, int)
 REGISTER_STAT(NADE_BONUS, float)
index 5fd66bdbbac1f595e76e0bb06ca4024d0865ea46..5fbf0dc697d5a0ac5d046292d525f6a6c2def2a5 100644 (file)
@@ -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 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
 
 .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