From: terencehill Date: Mon, 10 Sep 2018 11:55:07 +0000 (+0200) Subject: Hide accuracy panel until there is some stats to display, i.e. when you have at least... X-Git-Tag: xonotic-v0.8.5~1841^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d1f6778ea3816cff62e2ddf43306fd75904ff9c3;p=xonotic%2Fxonotic-data.pk3dir.git Hide accuracy panel until there is some stats to display, i.e. when you have at least one weapon with positive accuracy. It frees up useful space to see the level description on campaign levels with many bots --- diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index faf184262..799042696 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -1469,6 +1469,7 @@ vector Scoreboard_Rankings_Draw(vector pos, entity pl, vector rgb, vector bg_siz return end_pos; } +bool have_weapon_stats; void Scoreboard_Draw() { if(!autocvar__hud_configure) @@ -1602,6 +1603,19 @@ void Scoreboard_Draw() bool show_accuracy = (gametype != MAPINFO_TYPE_CTS && gametype != MAPINFO_TYPE_RACE && gametype != MAPINFO_TYPE_NEXBALL); + if (!have_weapon_stats) + { + FOREACH(Weapons, it != WEP_Null, { + int weapon_stats = weapon_accuracy[i - WEP_FIRST]; + if (weapon_stats >= 0) + { + have_weapon_stats = true; + break; + } + }); + } + + if (have_weapon_stats) if (show_accuracy && autocvar_hud_panel_scoreboard_accuracy && !warmup_stage && pos.y > 0.91 * vid_conheight) pos = Scoreboard_AccuracyStats_Draw(pos, panel_bg_color, bg_size);