From: terencehill Date: Sat, 24 Oct 2020 15:06:46 +0000 (+0200) Subject: Item stats panel: don't show uninteresting items (ammo and smaller health/armor)... X-Git-Tag: xonotic-v0.8.5~588^2~18 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=501b37c3ca4780caaf0b46043316dafb0d1c7aed;p=xonotic%2Fxonotic-data.pk3dir.git Item stats panel: don't show uninteresting items (ammo and smaller health/armor) by default --- diff --git a/_hud_common.cfg b/_hud_common.cfg index f2be854d5..2bcee153c 100644 --- a/_hud_common.cfg +++ b/_hud_common.cfg @@ -122,6 +122,7 @@ 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" +seta hud_panel_scoreboard_itemstats_filter 1 "filter out less interesting items (ammo and smaller health/armor)" seta hud_panel_scoreboard_team_size_position 0 "where to show the team size (0 = do not show, 1 = left of scoreboard, 2 = right of scoreboard), will move team scores to the other side if necessary" seta _hud_panel_strafehud_demo "0" "strafehud changes angle during configure" diff --git a/_hud_descriptions.cfg b/_hud_descriptions.cfg index 6880f96e0..8dd81c1cb 100644 --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@ -378,6 +378,7 @@ seta hud_panel_scoreboard_table_highlight_alpha_self "" "self highlight alpha of seta hud_panel_scoreboard_bg_teams_color_team "" "override panel team color in team tables" seta hud_panel_scoreboard_accuracy_doublerows "" "use two rows instead of one" seta hud_panel_scoreboard_accuracy_nocolors "" "don't use colors displaying accuracy stats" +seta hud_panel_scoreboard_itemstats_doublerows "" "use two rows instead of one" seta hud_panel_strafehud_pos "" "position of this base of the panel" seta hud_panel_strafehud_size "" "size of this panel" diff --git a/hud_luma.cfg b/hud_luma.cfg index 747736b26..5181130b2 100644 --- a/hud_luma.cfg +++ b/hud_luma.cfg @@ -379,6 +379,7 @@ seta hud_panel_scoreboard_table_highlight_alpha_self "0.4" seta hud_panel_scoreboard_bg_teams_color_team "0" seta hud_panel_scoreboard_accuracy_doublerows "0" seta hud_panel_scoreboard_accuracy_nocolors "0" +seta hud_panel_scoreboard_itemstats_doublerows "0" seta hud_panel_strafehud_pos "0.320000 0.570000" seta hud_panel_strafehud_size "0.360000 0.020000" diff --git a/hud_luminos.cfg b/hud_luminos.cfg index 3a02780b6..a91a28970 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -379,6 +379,7 @@ seta hud_panel_scoreboard_table_highlight_alpha_self "0.3" seta hud_panel_scoreboard_bg_teams_color_team "0" seta hud_panel_scoreboard_accuracy_doublerows "1" seta hud_panel_scoreboard_accuracy_nocolors "0" +seta hud_panel_scoreboard_itemstats_doublerows "0" seta hud_panel_strafehud_pos "0.330000 0.570000" seta hud_panel_strafehud_size "0.340000 0.020000" diff --git a/hud_luminos_minimal.cfg b/hud_luminos_minimal.cfg index 80642d6fe..31a798f05 100644 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@ -379,6 +379,7 @@ seta hud_panel_scoreboard_table_highlight_alpha_self "0.3" seta hud_panel_scoreboard_bg_teams_color_team "0.7" seta hud_panel_scoreboard_accuracy_doublerows "1" seta hud_panel_scoreboard_accuracy_nocolors "0" +seta hud_panel_scoreboard_itemstats_doublerows "0" seta hud_panel_strafehud_pos "0.380000 0.550000" seta hud_panel_strafehud_size "0.240000 0.025000" diff --git a/hud_luminos_minimal_xhair.cfg b/hud_luminos_minimal_xhair.cfg index 31abc94cf..9e6538520 100644 --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@ -379,6 +379,7 @@ seta hud_panel_scoreboard_table_highlight_alpha_self "0.3" seta hud_panel_scoreboard_bg_teams_color_team "0.7" seta hud_panel_scoreboard_accuracy_doublerows "1" seta hud_panel_scoreboard_accuracy_nocolors "0" +seta hud_panel_scoreboard_itemstats_doublerows "0" seta hud_panel_strafehud_pos "0.330000 0.700000" seta hud_panel_strafehud_size "0.340000 0.015000" diff --git a/hud_luminos_old.cfg b/hud_luminos_old.cfg index d53902eac..eac63c6bb 100644 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@ -379,6 +379,7 @@ seta hud_panel_scoreboard_table_highlight_alpha_self "0.3" seta hud_panel_scoreboard_bg_teams_color_team "0.7" seta hud_panel_scoreboard_accuracy_doublerows "1" seta hud_panel_scoreboard_accuracy_nocolors "0" +seta hud_panel_scoreboard_itemstats_doublerows "0" seta hud_panel_strafehud_pos "0.320000 0.540000" seta hud_panel_strafehud_size "0.360000 0.025000" diff --git a/hud_nexuiz.cfg b/hud_nexuiz.cfg index b820ef524..f2a56cc08 100644 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@ -379,6 +379,7 @@ seta hud_panel_scoreboard_table_highlight_alpha_self "0.25" seta hud_panel_scoreboard_bg_teams_color_team "0.7" seta hud_panel_scoreboard_accuracy_doublerows "1" seta hud_panel_scoreboard_accuracy_nocolors "0" +seta hud_panel_scoreboard_itemstats_doublerows "0" seta hud_panel_strafehud_pos "0.360000 0.570000" seta hud_panel_strafehud_size "0.280000 0.025000" diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 0afb9574b..d7ecff8ae 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -84,6 +84,9 @@ 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_itemstats_doublerows = false; +bool autocvar_hud_panel_scoreboard_itemstats_filter = true; + bool autocvar_hud_panel_scoreboard_dynamichud = false; float autocvar_hud_panel_scoreboard_maxheight = 0.6; @@ -1313,24 +1316,50 @@ vector Scoreboard_AccuracyStats_Draw(vector pos, vector rgb, vector bg_size) return initial_pos + (end_pos - initial_pos) * scoreboard_acc_fade_alpha; } +.bool uninteresting; +STATIC_INIT(default_order_items_label) +{ + IL_EACH(default_order_items, true, { + switch(it.netname) + { + case "bullets": + case "cells": + case "plasma": + case "rockets": + case "shells": + case "vaporizer_cells": + case "fuel": + case "armor_small": + case "armor_medium": + case "health_small": + case "health_medium": + it.uninteresting = true; + } + }); +} + vector Scoreboard_ItemStats_Draw(vector pos, vector rgb, vector bg_size) { float scoreboard_acc_fade_alpha_save = scoreboard_acc_fade_alpha; // debug scoreboard_acc_fade_alpha = 1; // debug: make Item Stats always visible float initial_posx = pos.x; - int disownedcnt = 0; - FOREACH(Items, true, { + int disowned_cnt = 0; + int uninteresting_cnt = 0; + IL_EACH(default_order_items, true, { int q = g_inventory.inv_items[it.m_id]; //q = 1; // debug: display all items - if (!q) ++disownedcnt; + if (autocvar_hud_panel_scoreboard_itemstats_filter && it.uninteresting) + ++uninteresting_cnt; + else if (!q) + ++disowned_cnt; }); - - int n = REGISTRY_COUNT(Items) - disownedcnt; + int items_cnt = REGISTRY_COUNT(Items) - uninteresting_cnt; + int n = items_cnt - disowned_cnt; if (n <= 0) return pos; - int rows = (autocvar_hud_panel_scoreboard_accuracy_doublerows && n >= floor(REGISTRY_COUNT(Items) / 2)) ? 2 : 1; - int columnns = ceil(n / rows); + int rows = (autocvar_hud_panel_scoreboard_itemstats_doublerows && n >= floor(REGISTRY_COUNT(Items) / 2)) ? 2 : 1; + int columnns = max(6, ceil(n / rows)); float height = 40; float fontsize = height * 1/3; @@ -1387,7 +1416,7 @@ vector Scoreboard_ItemStats_Draw(vector pos, vector rgb, vector bg_size) vector tmpos = pos; int column = 0; - IL_EACH(default_order_items, true, { + IL_EACH(default_order_items, !(autocvar_hud_panel_scoreboard_itemstats_filter && it.uninteresting), { int n = g_inventory.inv_items[it.m_id]; //n = 1 + floor(i * 3 + 4.8) % 7; // debug: display a value for each item if (n <= 0) continue;