]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/scoreboard.qc
Merge branch 'master' into Mario/minigames_merge
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / scoreboard.qc
index 8244836892d4f90ac178f48f85cb320bfdaea5a9..a24b9437902bd7659b20ff0c4833ce2a24ba41f8 100644 (file)
@@ -7,6 +7,7 @@
 #include "../common/constants.qh"
 #include "../common/counting.qh"
 #include "../common/mapinfo.qh"
+#include "../common/minigames/cl_minigames.qh"
 #include "../common/stats.qh"
 #include "../common/teams.qh"
 #include "../common/util.qh"
@@ -302,7 +303,7 @@ void Cmd_HUD_Help()
 #define HUD_DefaultColumnLayout() \
 "ping pl name | " \
 "-teams,race,lms/kills +ft,tdm/kills -teams,lms/deaths +ft,tdm/deaths -teams,lms,race,ka/suicides +ft,tdm/suicides -race,dm,tdm,ka,ft/frags " /* tdm already has this in "score" */ \
-"+ctf/caps +ctf/pickups +ctf/fckills +ctf/returns " \
+"+ctf/caps +ctf/pickups +ctf/fckills +ctf/returns +ons/caps +ons/takes " \
 "+lms/lives +lms/rank " \
 "+kh/caps +kh/pushes +kh/destroyed " \
 "?+race/laps ?+race/time ?+race/fastest " \
@@ -960,13 +961,15 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
 float HUD_WouldDrawScoreboard() {
        if (autocvar__hud_configure)
                return 0;
+       else if (HUD_Radar_Clickable())
+               return 0;
        else if (scoreboard_showscores)
                return 1;
        else if (intermission == 1)
                return 1;
        else if (intermission == 2)
                return 0;
-       else if (spectatee_status != -1 && getstati(STAT_HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != MAPINFO_TYPE_CTS)
+       else if (spectatee_status != -1 && getstati(STAT_HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != MAPINFO_TYPE_CTS && !active_minigame)
                return 1;
        else if (scoreboard_showscores_force)
                return 1;
@@ -978,6 +981,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
 {
        WepSet weapons_stat = WepSet_GetFromStat();
        WepSet weapons_inmap = WepSet_GetFromStat_InMap();
+       float initial_posx = pos.x;
        int i;
        float weapon_stats;
        int disownedcnt = 0;
@@ -1003,12 +1007,12 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
                rows = 2;
        else
                rows = 1;
-       int count_perrow = rint(weapon_cnt / rows);
+       int columnns = ceil(weapon_cnt / rows);
+
        float height = 40;
        float fontsize = height * 1/3;
        float weapon_height = height * 2/3;
-       float weapon_width = sbwidth / weapon_cnt / rows;
-       bool g_instagib = false;
+       float weapon_width = sbwidth / columnns / rows;
 
        drawstring(pos, sprintf(_("Accuracy stats (average %d%%)"), average_accuracy), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
        pos.y += 1.25 * hud_fontsize.y + autocvar_scoreboard_border_thickness;
@@ -1023,7 +1027,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        drawborderlines(autocvar_scoreboard_border_thickness, pos, tmp, '0 0 0', scoreboard_alpha_bg * 0.75, DRAWFLAG_NORMAL);
 
        // column highlighting
-       for(i = 0; i < count_perrow; ++i)
+       for(i = 0; i < columnns; ++i)
        {
                if(!(i % 2))
                        drawfill(pos + '1 0 0' * weapon_width * rows * i, '0 1 0' * height * rows + '1 0 0' * weapon_width * rows, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
@@ -1040,9 +1044,6 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        if(rows == 2)
                pos.x += weapon_width / 2;
 
-       if(switchweapon == WEP_VAPORIZER)
-               g_instagib = true; // TODO: real detection for instagib?
-
        if(autocvar_scoreboard_accuracy_nocolors)
                rgb = '1 1 1';
        else
@@ -1051,7 +1052,8 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        float oldposx = pos.x;
        vector tmpos = pos;
 
-       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+       int column;
+       for(i = WEP_FIRST, column = 0; i <= WEP_LAST; ++i)
        {
                self = get_weaponinfo(i);
                if (!self.weapon)
@@ -1087,22 +1089,20 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
                }
                tmpos.x += weapon_width * rows;
                pos.x += weapon_width * rows;
-               if(rows == 2 && i == count_perrow) {
+               if(rows == 2 && column == columnns - 1) {
                        tmpos.x = oldposx;
                        tmpos.y += height;
                        pos.y += height;
                }
+               ++column;
        }
 
        if(weapons_with_stats)
                average_accuracy = floor((average_accuracy * 100 / weapons_with_stats) + 0.5);
 
-       if(rows == 2)
-               pos.x -= weapon_width / 2;
-       pos.x -= sbwidth;
        pos.y += height;
-
        pos.y += 1.25 * hud_fontsize.y;
+       pos.x = initial_posx;
        return pos;
 }