]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Item stats panel: don't show uninteresting items (ammo and smaller health/armor)...
authorterencehill <piuntn@gmail.com>
Sat, 24 Oct 2020 15:06:46 +0000 (17:06 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 25 Oct 2020 09:42:54 +0000 (10:42 +0100)
_hud_common.cfg
_hud_descriptions.cfg
hud_luma.cfg
hud_luminos.cfg
hud_luminos_minimal.cfg
hud_luminos_minimal_xhair.cfg
hud_luminos_old.cfg
hud_nexuiz.cfg
qcsrc/client/hud/panel/scoreboard.qc

index f2be854d5b1d9603ad9ae1ca5e66ca4d2d66662b..2bcee153c59c62587a52f137c97a75b4c90a0df1 100644 (file)
@@ -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"
index 6880f96e045c863e25a083b7e446b0db8b2891a1..8dd81c1cbce4ec8b10fc2e42e7fe4e993d92a386 100644 (file)
@@ -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"
index 747736b26998c49741663256473f75f1b5289f57..5181130b2e4e9f12c742df5bd4332aeea8d8f27c 100644 (file)
@@ -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"
index 3a02780b6b24a754777d03d7ce91173d9765ea72..a91a289705ab4dce76470d4743545ea891447404 100644 (file)
@@ -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"
index 80642d6fe535d7a0d09e2d77dbcfbae36cfc7492..31a798f050dd7c71592593b214cfdc09114ed292 100644 (file)
@@ -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"
index 31abc94cfcc1fae657bf053c0677a8593fbf5f9f..9e6538520a45ac6dc65016012abf80413ff937b9 100644 (file)
@@ -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"
index d53902eac34183ffdbfef1d60b2a702098cbec55..eac63c6bbcb3295e1f1bbed1b74b44b8dff8923f 100644 (file)
@@ -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"
index b820ef52499dd172255ff69aef9a45dbf759fc0a..f2a56cc080e42f7f377e26de2edc25623f971b09 100644 (file)
@@ -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"
index 0afb9574b021888660f3c8d126c426bec3868206..d7ecff8aea2167fd9729c2fdc465a212203b8765 100644 (file)
@@ -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;