From: z411 Date: Sat, 19 Feb 2022 20:55:26 +0000 (-0300) Subject: Add cvar to show or hide secondary timer, and to show it swapped X-Git-Tag: xonotic-v0.8.5~177^2~17 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=51c2cefa37fbca957e4d74f8772a0f50450ed735;p=xonotic%2Fxonotic-data.pk3dir.git Add cvar to show or hide secondary timer, and to show it swapped --- diff --git a/_hud_common.cfg b/_hud_common.cfg index a97800ba1..3aaa8ae6d 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -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" diff --git a/qcsrc/client/hud/panel/timer.qc b/qcsrc/client/hud/panel/timer.qc index 308ef52a0..f52eecb16 100644 --- a/qcsrc/client/hud/panel/timer.qc +++ b/qcsrc/client/hud/panel/timer.qc @@ -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); diff --git a/qcsrc/client/hud/panel/timer.qh b/qcsrc/client/hud/panel/timer.qh index bbeeb7272..c029e656f 100644 --- a/qcsrc/client/hud/panel/timer.qh +++ b/qcsrc/client/hud/panel/timer.qh @@ -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;