]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Delay 2 seconds display of the accuracy panel after the scoreboard but only if its...
authorterencehill <piuntn@gmail.com>
Tue, 11 Sep 2018 09:46:13 +0000 (11:46 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 11 Sep 2018 20:34:41 +0000 (22:34 +0200)
_hud_common.cfg
qcsrc/client/hud/panel/scoreboard.qc

index 3631df7eb4882cc7d2dc9d85063c845bff47c887..ee1babe195f253b7e6611d69ffef9b8c53015fc0 100644 (file)
@@ -115,6 +115,9 @@ seta hud_panel_scoreboard_spectators_showping 1 "show ping of spectators"
 seta hud_panel_scoreboard_spectators_aligned 0 "align spectators in columns"
 seta hud_panel_scoreboard_minwidth 0.6 "minimum width of the scoreboard"
 
+seta hud_panel_scoreboard_accuracy_showdelay 2 "how long to delay displaying accuracy below the scoreboard if it's too far down"
+seta hud_panel_scoreboard_accuracy_showdelay_minpos 0.75 "delay displaying the accuracy panel only if its position is lower than this percentage of the screen height from the top"
+
 // hud panel aliases
 alias quickmenu "cl_cmd hud quickmenu ${* ?}"
 
index 5cd0fba738365fe3aeca434c8efbf75607105299..b9ca0fe82a40d71fb73b6eff6b3877320af25873 100644 (file)
@@ -61,6 +61,9 @@ float autocvar_hud_panel_scoreboard_namesize = 15;
 bool autocvar_hud_panel_scoreboard_accuracy = true;
 bool autocvar_hud_panel_scoreboard_accuracy_doublerows = false;
 bool autocvar_hud_panel_scoreboard_accuracy_nocolors = false;
+float autocvar_hud_panel_scoreboard_accuracy_showdelay = 2;
+float autocvar_hud_panel_scoreboard_accuracy_showdelay_minpos = 0.75;
+
 bool autocvar_hud_panel_scoreboard_ctf_leaderboard = true;
 
 bool autocvar_hud_panel_scoreboard_dynamichud = false;
@@ -1475,6 +1478,7 @@ vector Scoreboard_Rankings_Draw(vector pos, entity pl, vector rgb, vector bg_siz
        return end_pos;
 }
 
+float scoreboard_time;
 bool have_weapon_stats;
 bool Scoreboard_AccuracyStats_WouldDraw(float ypos)
 {
@@ -1483,6 +1487,12 @@ bool Scoreboard_AccuracyStats_WouldDraw(float ypos)
        if (!autocvar_hud_panel_scoreboard_accuracy || warmup_stage || ypos > 0.91 * vid_conheight)
                return false;
 
+       if (time < scoreboard_time + autocvar_hud_panel_scoreboard_accuracy_showdelay
+               && ypos > autocvar_hud_panel_scoreboard_accuracy_showdelay_minpos * vid_conheight)
+       {
+               return false;
+       }
+
        if (!have_weapon_stats)
        {
                FOREACH(Weapons, it != WEP_Null, {
@@ -1508,6 +1518,8 @@ void Scoreboard_Draw()
 
                // frametime checks allow to toggle the scoreboard even when the game is paused
                if(scoreboard_active) {
+                       if (scoreboard_fade_alpha < 1)
+                               scoreboard_time = time;
                        if(hud_configure_menu_open == 1)
                                scoreboard_fade_alpha = 1;
                        float scoreboard_fadeinspeed = autocvar_hud_panel_scoreboard_fadeinspeed;