]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/timer.qc
Reset QuickMenu_Page_Command_Type when clearing up a quickmenu command otherwise...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / timer.qc
index 4de0c1e5f6ce76a51a72707db74acb1ad9ad8cbc..5a7194a45849ee7967f97e2a9694fccaf3b97c0c 100644 (file)
@@ -1,3 +1,4 @@
+#include "timer.qh"
 void HUD_Timer()
 {
        if(!autocvar__hud_configure)
@@ -13,6 +14,10 @@ void HUD_Timer()
        pos = panel_pos;
        mySize = panel_size;
 
+       if (autocvar_hud_panel_timer_dynamichud)
+               HUD_Scale_Enable();
+       else
+               HUD_Scale_Disable();
        HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
@@ -30,6 +35,17 @@ void HUD_Timer()
 
        minutesLeft = floor(timeleft / 60);
 
+       float warmup_timeleft = 0;
+       if(warmup_stage)
+       {
+               float warmup_timelimit = STAT(WARMUP_TIMELIMIT);
+               if(warmup_timelimit > 0)
+                       warmup_timeleft = max(0, warmup_timelimit - time);
+               else if(warmup_timelimit == 0)
+                       warmup_timeleft = timeleft;
+               warmup_timeleft = ceil(warmup_timeleft);
+       }
+
        vector timer_color;
        if(minutesLeft >= 5 || warmup_stage || timelimit == 0) //don't use red or yellow in warmup or when there is no timelimit
                timer_color = '1 1 1'; //white
@@ -38,16 +54,19 @@ void HUD_Timer()
        else
                timer_color = '1 0 0'; //red
 
-       if (autocvar_hud_panel_timer_increment || timelimit == 0 || warmup_stage) {
+       if (autocvar_hud_panel_timer_increment || (!warmup_stage && timelimit == 0) || (warmup_stage && warmup_timeleft <= 0)) {
                if (time < STAT(GAMESTARTTIME)) {
                        //while restart is still active, show 00:00
                        timer = seconds_tostring(0);
                } else {
-                       elapsedTime = floor(time - STAT(GAMESTARTTIME)); //127
+                       elapsedTime = floor(time - STAT(GAMESTARTTIME));
                        timer = seconds_tostring(elapsedTime);
                }
        } else {
-               timer = seconds_tostring(timeleft);
+               if(warmup_stage)
+                       timer = seconds_tostring(warmup_timeleft);
+               else
+                       timer = seconds_tostring(timeleft);
        }
 
        drawstring_aspect(pos, timer, mySize, timer_color, panel_fg_alpha, DRAWFLAG_NORMAL);