]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add cvar to show or hide secondary timer, and to show it swapped
authorz411 <z411@omaera.org>
Sat, 19 Feb 2022 20:55:26 +0000 (17:55 -0300)
committerz411 <z411@omaera.org>
Sat, 19 Feb 2022 20:55:26 +0000 (17:55 -0300)
_hud_common.cfg
qcsrc/client/hud/panel/timer.qc
qcsrc/client/hud/panel/timer.qh

index a97800ba15b33d8ed7c425f5ad60d30c83a0da4e..3aaa8ae6df5e74d0110106955cce979c0efb3d19 100644 (file)
@@ -93,6 +93,7 @@ seta hud_panel_healtharmor_progressbar_gfx_lowhealth 40 "health progressbar blin
 seta hud_panel_healtharmor_hide_ondeath 0 "hide this panel when dead"
 
 seta hud_panel_timer_increment "0" "show elapsed time instead of remaining time"
+seta hud_panel_timer_secondary "1" "secondary timer (0 = hide, 1 = show, 2 = show swapped)"
 seta hud_panel_timer_unbound "0" "show seconds leading up to the start of the match"
 
 seta hud_panel_engineinfo_framecounter_exponentialmovingaverage 1 "use an averaging method for calculating fps instead of counting frametime like engine does"
index 308ef52a0cc2c8b1ead993b980fc6638ecb4a734..f52eecb16c45d134e506cea58af048ed5bb71f24 100644 (file)
@@ -53,6 +53,7 @@ void HUD_Timer()
        vector timer_size, subtext_size, subtimer_size;
        vector timer_color = '1 1 1';
        vector subtimer_color = '1 1 1';
+       bool swap = (autocvar_hud_panel_timer_secondary == 2);
 
        // Calculate timelimit
        if(warmup_stage)
@@ -90,7 +91,7 @@ void HUD_Timer()
        }
        
        // Round-based game modes
-       if(STAT(ROUNDSTARTTIME))
+       if(STAT(ROUNDSTARTTIME) && autocvar_hud_panel_timer_secondary)
        {
                round_timelimit = STAT(ROUND_TIMELIMIT);
 
@@ -141,10 +142,10 @@ void HUD_Timer()
        
        if(subtimer) {
                timer_size.x -= subtimer_size.x;
-               drawstring_aspect(pos + eX * timer_size.x, subtimer, subtimer_size, subtimer_color, panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(pos + eX * timer_size.x, (swap ? timer : subtimer), subtimer_size, (swap ? timer_color : subtimer_color), panel_fg_alpha, DRAWFLAG_NORMAL);
        }
        
-       drawstring_aspect(pos, timer, timer_size, timer_color, panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawstring_aspect(pos, (swap ? subtimer : timer), timer_size, (swap ? subtimer_color : timer_color), panel_fg_alpha, DRAWFLAG_NORMAL);
        
        if(subtext)
                drawstring_aspect(pos + eY * timer_size.y, subtext, subtext_size, '0 1 0', panel_fg_alpha, DRAWFLAG_NORMAL);
index bbeeb727282064ec95637d2c6550c4e27a30036b..c029e656f45761ce3027df16642bbdd5ccd12979 100644 (file)
@@ -4,4 +4,5 @@
 bool autocvar_hud_panel_timer;
 bool autocvar_hud_panel_timer_dynamichud        = true;
 bool autocvar_hud_panel_timer_increment;
+int autocvar_hud_panel_timer_secondary = 1;
 bool autocvar_hud_panel_timer_unbound;