]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/scoreboard.qc
Require semicolon or definition following `METHOD`
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / scoreboard.qc
index 9a1cef2788855fc64bdbac28fa25e3974eb6b940..b6d2db25c2e90086e9ba9dedf7f410f52382d629 100644 (file)
@@ -1,3 +1,16 @@
+#include "scoreboard.qh"
+#include "_all.qh"
+
+#include "hud.qh"
+#include "sortlist.qh"
+
+#include "../common/constants.qh"
+#include "../common/counting.qh"
+#include "../common/mapinfo.qh"
+#include "../common/stats.qh"
+#include "../common/teams.qh"
+#include "../common/util.qh"
+
 float scoreboard_alpha_bg;
 float scoreboard_alpha_fg;
 float scoreboard_highlight;
@@ -54,7 +67,6 @@ string TranslateScoresLabel(string l)
        }
 }
 
-void Cmd_HUD_SetFields(float argc);
 void HUD_InitScores()
 {
        int i, f;
@@ -85,7 +97,6 @@ void HUD_InitScores()
        Cmd_HUD_SetFields(0);
 }
 
-void HUD_UpdatePlayerPos(entity pl);
 float SetTeam(entity pl, float Team);
 //float lastpnum;
 void HUD_UpdatePlayerTeams()
@@ -134,7 +145,7 @@ int HUD_CompareScore(float vl, float vr, int f)
 
 float HUD_ComparePlayerScores(entity left, entity right)
 {
-       float vl, vr, r, i;
+       float vl, vr, r;
        vl = GetPlayerColor(left.sv_entnum);
        vr = GetPlayerColor(right.sv_entnum);
 
@@ -165,6 +176,7 @@ float HUD_ComparePlayerScores(entity left, entity right)
        if (r >= 0)
                return r;
 
+       int i;
        for(i = 0; i < MAX_SCORE; ++i)
        {
                r = HUD_CompareScore(left.scores[i], right.scores[i], scores_flags[i]);
@@ -348,16 +360,15 @@ void Cmd_HUD_SetFields(float argc)
 
        hud_fontsize = HUD_GetFontsize("hud_fontsize");
 
-       draw_beginBoldFont();
        for(i = 1; i < argc - 1; ++i)
        {
                float nocomplain;
                str = argv(i+1);
 
-               nocomplain = FALSE;
+               nocomplain = false;
                if(substring(str, 0, 1) == "?")
                {
-                       nocomplain = TRUE;
+                       nocomplain = true;
                        str = substring(str, 1, strlen(str) - 1);
                }
 
@@ -367,13 +378,13 @@ void Cmd_HUD_SetFields(float argc)
                        pattern = substring(str, 0, slash);
                        str = substring(str, slash + 1, strlen(str) - (slash + 1));
 
-                       if (!isGametypeInFilter(gametype, teamplay, FALSE, pattern))
+                       if (!isGametypeInFilter(gametype, teamplay, false, pattern))
                                continue;
                }
 
                strunzone(hud_title[hud_num_fields]);
                hud_title[hud_num_fields] = strzone(TranslateScoresLabel(str));
-               hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], FALSE, hud_fontsize);
+               hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], false, hud_fontsize);
                str = strtolower(str);
 
                if(str == "ping") {
@@ -452,7 +463,7 @@ void Cmd_HUD_SetFields(float argc)
                                }
                                hud_title[1] = strzone("|");
                                hud_field[1] = SP_SEPARATOR;
-                               hud_size[1] = stringwidth("|", FALSE, hud_fontsize);
+                               hud_size[1] = stringwidth("|", false, hud_fontsize);
                                ++hud_num_fields;
                                print("fixed missing field '|'\n");
                        }
@@ -461,7 +472,7 @@ void Cmd_HUD_SetFields(float argc)
                {
                        strunzone(hud_title[hud_num_fields]);
                        hud_title[hud_num_fields] = strzone("|");
-                       hud_size[hud_num_fields] = stringwidth("|", FALSE, hud_fontsize);
+                       hud_size[hud_num_fields] = stringwidth("|", false, hud_fontsize);
                        hud_field[hud_num_fields] = SP_SEPARATOR;
                        ++hud_num_fields;
                        print("fixed missing field '|'\n");
@@ -470,7 +481,7 @@ void Cmd_HUD_SetFields(float argc)
                {
                        strunzone(hud_title[hud_num_fields]);
                        hud_title[hud_num_fields] = strzone(TranslateScoresLabel(scores_label[ps_secondary]));
-                       hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], FALSE, hud_fontsize);
+                       hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], false, hud_fontsize);
                        hud_field[hud_num_fields] = ps_secondary;
                        ++hud_num_fields;
                        printf("fixed missing field '%s'\n", scores_label[ps_secondary]);
@@ -479,7 +490,7 @@ void Cmd_HUD_SetFields(float argc)
                {
                        strunzone(hud_title[hud_num_fields]);
                        hud_title[hud_num_fields] = strzone(TranslateScoresLabel(scores_label[ps_primary]));
-                       hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], FALSE, hud_fontsize);
+                       hud_size[hud_num_fields] = stringwidth(hud_title[hud_num_fields], false, hud_fontsize);
                        hud_field[hud_num_fields] = ps_primary;
                        ++hud_num_fields;
                        printf("fixed missing field '%s'\n", scores_label[ps_primary]);
@@ -487,7 +498,6 @@ void Cmd_HUD_SetFields(float argc)
        }
 
        hud_field[hud_num_fields] = SP_END;
-       draw_endBoldFont();
 }
 
 // MOVEUP::
@@ -501,9 +511,10 @@ vector hud_field_icon2_rgb;
 float hud_field_icon0_alpha;
 float hud_field_icon1_alpha;
 float hud_field_icon2_alpha;
-string HUD_GetField(entity pl, float field)
+string HUD_GetField(entity pl, int field)
 {
-       float tmp, num, denom, f;
+       float tmp, num, denom;
+       int f;
        string str;
        hud_field_rgb = '1 1 1';
        hud_field_icon0 = "";
@@ -606,7 +617,6 @@ string HUD_GetField(entity pl, float field)
        //return "error";
 }
 
-float xmin, xmax, ymin, ymax, sbwidth;
 float hud_fixscoreboardcolumnwidth_len;
 float hud_fixscoreboardcolumnwidth_iconlen;
 float hud_fixscoreboardcolumnwidth_marginlen;
@@ -622,7 +632,7 @@ string HUD_FixScoreboardColumnWidth(int i, string str)
        if(hud_field_icon0 != "")
        {
                sz = draw_getimagesize(hud_field_icon0);
-               f = sz_x / sz_y;
+               f = sz.x / sz.y;
                if(hud_fixscoreboardcolumnwidth_iconlen < f)
                        hud_fixscoreboardcolumnwidth_iconlen = f;
        }
@@ -630,7 +640,7 @@ string HUD_FixScoreboardColumnWidth(int i, string str)
        if(hud_field_icon1 != "")
        {
                sz = draw_getimagesize(hud_field_icon1);
-               f = sz_x / sz_y;
+               f = sz.x / sz.y;
                if(hud_fixscoreboardcolumnwidth_iconlen < f)
                        hud_fixscoreboardcolumnwidth_iconlen = f;
        }
@@ -638,15 +648,15 @@ string HUD_FixScoreboardColumnWidth(int i, string str)
        if(hud_field_icon2 != "")
        {
                sz = draw_getimagesize(hud_field_icon2);
-               f = sz_x / sz_y;
+               f = sz.x / sz.y;
                if(hud_fixscoreboardcolumnwidth_iconlen < f)
                        hud_fixscoreboardcolumnwidth_iconlen = f;
        }
 
-       hud_fixscoreboardcolumnwidth_iconlen *= hud_fontsize_y / hud_fontsize_x; // fix icon aspect
+       hud_fixscoreboardcolumnwidth_iconlen *= hud_fontsize.y / hud_fontsize.x; // fix icon aspect
 
        if(hud_fixscoreboardcolumnwidth_iconlen != 0)
-               hud_fixscoreboardcolumnwidth_marginlen = stringwidth(" ", FALSE, hud_fontsize);
+               hud_fixscoreboardcolumnwidth_marginlen = stringwidth(" ", false, hud_fontsize);
        else
                hud_fixscoreboardcolumnwidth_marginlen = 0;
 
@@ -658,17 +668,17 @@ string HUD_FixScoreboardColumnWidth(int i, string str)
                for(j = 0; j < hud_num_fields; ++j)
                        if(j != i)
                                if (hud_field[i] != SP_SEPARATOR)
-                                       namesize -= hud_size[j] + hud_fontsize_x;
-               namesize += hud_fontsize_x;
+                                       namesize -= hud_size[j] + hud_fontsize.x;
+               namesize += hud_fontsize.x;
                hud_size[i] = namesize;
 
                if (hud_fixscoreboardcolumnwidth_iconlen != 0)
                        namesize -= hud_fixscoreboardcolumnwidth_marginlen + hud_fixscoreboardcolumnwidth_iconlen;
                str = textShortenToWidth(str, namesize, hud_fontsize, stringwidth_colors);
-               hud_fixscoreboardcolumnwidth_len = stringwidth(str, TRUE, hud_fontsize);
+               hud_fixscoreboardcolumnwidth_len = stringwidth(str, true, hud_fontsize);
        }
        else
-               hud_fixscoreboardcolumnwidth_len = stringwidth(str, FALSE, hud_fontsize);
+               hud_fixscoreboardcolumnwidth_len = stringwidth(str, false, hud_fontsize);
 
        f = hud_fixscoreboardcolumnwidth_len + hud_fixscoreboardcolumnwidth_marginlen + hud_fixscoreboardcolumnwidth_iconlen;
        if(hud_size[i] < f)
@@ -682,14 +692,14 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
        vector tmp, rgb;
        rgb = Team_ColorRGB(pl.team);
        string str;
-       float field;
+       int field;
        float is_spec;
        is_spec = (GetPlayerColor(pl.sv_entnum) == NUM_SPECTATOR);
 
        if((rgb == '1 1 1') && (!is_spec)) {
-               rgb_x = autocvar_scoreboard_color_bg_r + 0.5;
-               rgb_y = autocvar_scoreboard_color_bg_g + 0.5;
-               rgb_z = autocvar_scoreboard_color_bg_b + 0.5; }
+               rgb.x = autocvar_scoreboard_color_bg_r + 0.5;
+               rgb.y = autocvar_scoreboard_color_bg_g + 0.5;
+               rgb.z = autocvar_scoreboard_color_bg_b + 0.5; }
 
        vector h_pos = pos - '1 1 0';
        vector h_size = item_size + '2 0 0';
@@ -699,9 +709,9 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
        else if((scoreboard_highlight) && (!(pl_number % 2)))
                drawfill(h_pos, h_size, rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
 
-       tmp_x = item_size_x;
-       tmp_y = 0;
-       tmp_z = 0;
+       tmp.x = item_size.x;
+       tmp.y = 0;
+       tmp.z = 0;
        int i;
        for(i = 0; i < hud_num_fields; ++i)
        {
@@ -710,49 +720,49 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
                        break;
 
                if(is_spec && field != SP_NAME && field != SP_PING) {
-                       pos_x += hud_size[i] + hud_fontsize_x;
+                       pos.x += hud_size[i] + hud_fontsize.x;
                        continue;
                }
                str = HUD_GetField(pl, field);
                str = HUD_FixScoreboardColumnWidth(i, str);
 
-               pos_x += hud_size[i] + hud_fontsize_x;
+               pos.x += hud_size[i] + hud_fontsize.x;
 
                if(field == SP_NAME) {
-                       tmp_x = hud_size[i] - hud_fontsize_x*hud_fixscoreboardcolumnwidth_iconlen - hud_fixscoreboardcolumnwidth_marginlen + hud_fontsize_x;
+                       tmp.x = hud_size[i] - hud_fontsize.x*hud_fixscoreboardcolumnwidth_iconlen - hud_fixscoreboardcolumnwidth_marginlen + hud_fontsize.x;
                        if (is_self)
                                drawcolorcodedstring(pos - tmp, str, hud_fontsize, scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                        else
                                drawcolorcodedstring(pos - tmp, str, hud_fontsize, scoreboard_alpha_name, DRAWFLAG_NORMAL);
                } else {
-                       tmp_x = hud_fixscoreboardcolumnwidth_len + hud_fontsize_x;
+                       tmp.x = hud_fixscoreboardcolumnwidth_len + hud_fontsize.x;
                        if (is_self)
                                drawstring(pos - tmp, str, hud_fontsize, hud_field_rgb, scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                        else
                                drawstring(pos - tmp, str, hud_fontsize, hud_field_rgb, scoreboard_alpha_name, DRAWFLAG_NORMAL);
                }
 
-               tmp_x = hud_size[i] + hud_fontsize_x;
+               tmp.x = hud_size[i] + hud_fontsize.x;
                if(hud_field_icon0 != "")
                        if (is_self)
-                               drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
+                               drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                        else
-                               drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
+                               drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
                if(hud_field_icon1 != "")
                        if (is_self)
-                               drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
+                               drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                        else
-                               drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
+                               drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
                if(hud_field_icon2 != "")
                        if (is_self)
-                               drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
+                               drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                        else
-                               drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
+                               drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
        }
 
        if(hud_field[i] == SP_SEPARATOR)
        {
-               pos_x = xmax;
+               pos.x = xmax;
                for(i = hud_num_fields-1; i > 0; --i)
                {
                        field = hud_field[i];
@@ -760,7 +770,7 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
                                break;
 
                        if(is_spec && field != SP_NAME && field != SP_PING) {
-                               pos_x -= hud_size[i] + hud_fontsize_x;
+                               pos.x -= hud_size[i] + hud_fontsize.x;
                                continue;
                        }
 
@@ -768,36 +778,36 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
                        str = HUD_FixScoreboardColumnWidth(i, str);
 
                        if(field == SP_NAME) {
-                               tmp_x = hud_fixscoreboardcolumnwidth_len; // left or right aligned? let's put it right...
+                               tmp.x = hud_fixscoreboardcolumnwidth_len; // left or right aligned? let's put it right...
                                if(is_self)
                                        drawcolorcodedstring(pos - tmp, str, hud_fontsize, scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                                else
                                        drawcolorcodedstring(pos - tmp, str, hud_fontsize, scoreboard_alpha_name, DRAWFLAG_NORMAL);
                        } else {
-                               tmp_x = hud_fixscoreboardcolumnwidth_len;
+                               tmp.x = hud_fixscoreboardcolumnwidth_len;
                                if(is_self)
                                        drawstring(pos - tmp, str, hud_fontsize, hud_field_rgb, scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                                else
                                        drawstring(pos - tmp, str, hud_fontsize, hud_field_rgb, scoreboard_alpha_name, DRAWFLAG_NORMAL);
                        }
 
-                       tmp_x = hud_size[i];
+                       tmp.x = hud_size[i];
                        if(hud_field_icon0 != "")
                                if (is_self)
-                                       drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
+                                       drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                                else
-                                       drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
+                                       drawpic(pos - tmp, hud_field_icon0, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon0_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
                        if(hud_field_icon1 != "")
                                if (is_self)
-                                       drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
+                                       drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                                else
-                                       drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
+                                       drawpic(pos - tmp, hud_field_icon1, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon1_rgb, hud_field_icon1_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
                        if(hud_field_icon2 != "")
                                if (is_self)
-                                       drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
+                                       drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name_self, DRAWFLAG_NORMAL);
                                else
-                                       drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize_y + '1 0 0' * hud_fontsize_x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
-                       pos_x -= hud_size[i] + hud_fontsize_x;
+                                       drawpic(pos - tmp, hud_field_icon2, '0 1 0' * hud_fontsize.y + '1 0 0' * hud_fontsize.x * hud_fixscoreboardcolumnwidth_iconlen, hud_field_icon2_rgb, hud_field_icon2_alpha * scoreboard_alpha_name, DRAWFLAG_NORMAL);
+                       pos.x -= hud_size[i] + hud_fontsize.x;
                }
        }
 
@@ -813,17 +823,17 @@ void HUD_PrintScoreboardItem(vector pos, vector item_size, entity pl, float is_s
 
 vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_size)
 {
-       float body_table_height, i;
+       float body_table_height;
        vector tmp = '0 0 0', column_dim = '0 0 0';
        entity pl;
 
-       body_table_height = 1.25 * hud_fontsize_y * max(1, tm.team_size); // no player? show 1 empty line
+       body_table_height = 1.25 * hud_fontsize.y * max(1, tm.team_size); // no player? show 1 empty line
 
-       pos_y += autocvar_scoreboard_border_thickness;
+       pos.y += autocvar_scoreboard_border_thickness;
        pos -= '1 1 0';
 
-       tmp_x = sbwidth + 2;
-       tmp_y = 1.25 * hud_fontsize_y;
+       tmp.x = sbwidth + 2;
+       tmp.y = 1.25 * hud_fontsize.y;
 
        // rounded header
        if (teamplay)
@@ -832,19 +842,19 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
                drawpic(pos, "gfx/scoreboard/scoreboard_tableheader", tmp, rgb + '0.5 0.5 0.5', scoreboard_alpha_bg, DRAWFLAG_NORMAL);
 
        // table border
-       tmp_y += autocvar_scoreboard_border_thickness;
-       tmp_y += body_table_height;
+       tmp.y += autocvar_scoreboard_border_thickness;
+       tmp.y += body_table_height;
        drawborderlines(autocvar_scoreboard_border_thickness, pos, tmp, '0 0 0', scoreboard_alpha_bg, DRAWFLAG_NORMAL); // more transparency for the scoreboard
 
        // separator header/table
-       pos_y += 1.25 * hud_fontsize_y;
-       tmp_y = autocvar_scoreboard_border_thickness;
+       pos.y += 1.25 * hud_fontsize.y;
+       tmp.y = autocvar_scoreboard_border_thickness;
        drawfill(pos, tmp, '0 0 0', scoreboard_alpha_bg, DRAWFLAG_NORMAL);
 
-       pos_y += autocvar_scoreboard_border_thickness;
+       pos.y += autocvar_scoreboard_border_thickness;
 
        // table background
-       tmp_y = body_table_height;
+       tmp.y = body_table_height;
        if (teamplay)
                drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb * autocvar_scoreboard_color_bg_team, scoreboard_alpha_bg, DRAWFLAG_NORMAL);
        else
@@ -854,71 +864,70 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
        //drawfill(pos, tmp + '2 0 0', rgb, 0.1, DRAWFLAG_NORMAL);
 
        // go back to the top to make alternated columns highlighting and to print the strings
-       pos_y -= 1.25 * hud_fontsize_y;
-       pos_y -= autocvar_scoreboard_border_thickness;
+       pos.y -= 1.25 * hud_fontsize.y;
+       pos.y -= autocvar_scoreboard_border_thickness;
 
        pos += '1 1 0';
 
        if (scoreboard_highlight)
        {
-               column_dim_y = 1.25 * hud_fontsize_y; // header
-               column_dim_y += autocvar_scoreboard_border_thickness;
-               column_dim_y += body_table_height;
+               column_dim.y = 1.25 * hud_fontsize.y; // header
+               column_dim.y += autocvar_scoreboard_border_thickness;
+               column_dim.y += body_table_height;
        }
 
        // print the strings of the columns headers and draw the columns
-       draw_beginBoldFont();
+       int i;
        for(i = 0; i < hud_num_fields; ++i)
        {
                if(hud_field[i] == SP_SEPARATOR)
                        break;
-               column_dim_x = hud_size[i] + hud_fontsize_x;
+               column_dim.x = hud_size[i] + hud_fontsize.x;
                if (scoreboard_highlight)
                {
                        if (i % 2)
-                               drawfill(pos - '0 1 0' - hud_fontsize_x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
+                               drawfill(pos - '0 1 0' - hud_fontsize.x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
                }
                drawstring(pos, hud_title[i], hud_fontsize, rgb * 1.5, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-               pos_x += column_dim_x;
+               pos.x += column_dim.x;
        }
        if(hud_field[i] == SP_SEPARATOR)
        {
-               pos_x = xmax;
-               tmp_y = 0;
+               pos.x = xmax;
+               tmp.y = 0;
                for(i = hud_num_fields-1; i > 0; --i)
                {
                        if(hud_field[i] == SP_SEPARATOR)
                                break;
 
-                       pos_x -= hud_size[i];
+                       pos.x -= hud_size[i];
 
                        if (scoreboard_highlight)
                        {
                                if (!(i % 2))
                                {
                                        if (i == hud_num_fields-1)
-                                               column_dim_x = hud_size[i] + hud_fontsize_x / 2 + 1;
+                                               column_dim.x = hud_size[i] + hud_fontsize.x / 2 + 1;
                                        else
-                                               column_dim_x = hud_size[i] + hud_fontsize_x;
-                                       drawfill(pos - '0 1 0' - hud_fontsize_x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
+                                               column_dim.x = hud_size[i] + hud_fontsize.x;
+                                       drawfill(pos - '0 1 0' - hud_fontsize.x / 2 * '1 0 0', column_dim, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
                                }
                        }
 
-                       tmp_x = stringwidth(hud_title[i], FALSE, hud_fontsize);
-                       tmp_x = (hud_size[i] - tmp_x);
+                       tmp.x = stringwidth(hud_title[i], false, hud_fontsize);
+                       tmp.x = (hud_size[i] - tmp.x);
                        drawstring(pos + tmp, hud_title[i], hud_fontsize, rgb * 1.5, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-                       pos_x -= hud_fontsize_x;
+                       pos.x -= hud_fontsize.x;
                }
        }
-       draw_endBoldFont();
 
-       pos_x = xmin;
-       pos_y += 1.25 * hud_fontsize_y; // skip the header
-       pos_y += autocvar_scoreboard_border_thickness;
+       pos.x = xmin;
+       pos.y += 1.25 * hud_fontsize.y; // skip the header
+       pos.y += autocvar_scoreboard_border_thickness;
 
        // item size
-       tmp_x = sbwidth;
-       tmp_y = hud_fontsize_y * 1.25;
+       tmp.x = sbwidth;
+       tmp.y = hud_fontsize.y * 1.25;
 
        // fill the table and draw the rows
        i = 0;
@@ -928,7 +937,7 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
                        if(pl.team != tm.team)
                                continue;
                        HUD_PrintScoreboardItem(pos, tmp, pl, (pl.sv_entnum == player_localnum), i);
-                       pos_y += 1.25 * hud_fontsize_y;
+                       pos.y += 1.25 * hud_fontsize.y;
                        ++i;
                }
        else
@@ -937,13 +946,13 @@ vector HUD_Scoreboard_MakeTable(vector pos, entity tm, vector rgb, vector bg_siz
                        if(pl.team == NUM_SPECTATOR)
                                continue;
                        HUD_PrintScoreboardItem(pos, tmp, pl, (pl.sv_entnum == player_localnum), i);
-                       pos_y += 1.25 * hud_fontsize_y;
+                       pos.y += 1.25 * hud_fontsize.y;
                        ++i;
                }
 
        if (i == 0)
-               pos_y += 1.25 * hud_fontsize_y; // move to the end of the table
-       pos_y += 1.25 * hud_fontsize_y; // move empty row (out of the table)
+               pos.y += 1.25 * hud_fontsize.y; // move to the end of the table
+       pos.y += 1.25 * hud_fontsize.y; // move empty row (out of the table)
 
        return pos;
 }
@@ -967,24 +976,46 @@ float HUD_WouldDrawScoreboard() {
 float average_accuracy;
 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_cnt = WEP_COUNT - 3; // either vaporizer/vortex are hidden, no port-o-launch, no tuba
-       float rows;
-       if(autocvar_scoreboard_accuracy_doublerows)
+       float weapon_stats;
+       int disownedcnt = 0;
+       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+       {
+               self = get_weaponinfo(i);
+               if(!self.weapon)
+                       continue;
+
+               weapon_stats = weapon_accuracy[i-WEP_FIRST];
+
+               if(weapon_stats < 0 && !(weapons_stat & WepSet_FromWeapon(i) || weapons_inmap & WepSet_FromWeapon(i)))
+                       ++disownedcnt;
+       }
+
+       int weapon_cnt = WEP_COUNT - disownedcnt;
+
+       if(weapon_cnt <= 0)
+               return pos;
+
+       int rows;
+       if(autocvar_scoreboard_accuracy_doublerows && weapon_cnt >= floor(WEP_COUNT * 0.5))
                rows = 2;
        else
                rows = 1;
+       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;
-       float g_instagib = 0;
+       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;
+       pos.y += 1.25 * hud_fontsize.y + autocvar_scoreboard_border_thickness;
        vector tmp = '0 0 0';
-       tmp_x = sbwidth;
-       tmp_y = height * rows;
+       tmp.x = sbwidth;
+       tmp.y = height * rows;
 
        if (teamplay)
                drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb * autocvar_scoreboard_color_bg_team, scoreboard_alpha_bg, DRAWFLAG_NORMAL);
@@ -993,7 +1024,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 < weapon_cnt/rows; ++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);
@@ -1006,29 +1037,29 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
        }
 
        average_accuracy = 0;
-       float weapons_with_stats;
-       weapons_with_stats = 0;
+       int weapons_with_stats = 0;
        if(rows == 2)
-               pos_x += weapon_width / 2;
+               pos.x += weapon_width / 2;
 
-       if(switchweapon == WEP_VAPORIZER)
-               g_instagib = 1; // TODO: real detection for instagib?
-
-       float weapon_stats;
        if(autocvar_scoreboard_accuracy_nocolors)
                rgb = '1 1 1';
        else
                Accuracy_LoadColors();
 
-       for(i = WEP_FIRST; i <= WEP_LAST; ++i)
+       float oldposx = pos.x;
+       vector tmpos = pos;
+
+       int column;
+       for(i = WEP_FIRST, column = 0; i <= WEP_LAST; ++i)
        {
                self = get_weaponinfo(i);
                if (!self.weapon)
                        continue;
-               if ((i == WEP_VORTEX && g_instagib) || i == WEP_PORTO || (i == WEP_VAPORIZER && !g_instagib) || i == WEP_TUBA) // skip port-o-launch, vortex || vaporizer and tuba
-                       continue;
                weapon_stats = weapon_accuracy[i-WEP_FIRST];
 
+               if(weapon_stats < 0 && !(weapons_stat & WepSet_FromWeapon(i) || weapons_inmap & WepSet_FromWeapon(i)))
+                       continue;
+
                float weapon_alpha;
                if(weapon_stats >= 0)
                        weapon_alpha = scoreboard_alpha_fg;
@@ -1036,7 +1067,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
                        weapon_alpha = 0.2 * scoreboard_alpha_fg;
 
                // weapon icon
-               drawpic_aspect_skin(pos, self.model2, '1 0 0' * weapon_width + '0 1 0' * weapon_height, '1 1 1', weapon_alpha, DRAWFLAG_NORMAL);
+               drawpic_aspect_skin(tmpos, self.model2, '1 0 0' * weapon_width + '0 1 0' * weapon_height, '1 1 1', weapon_alpha, DRAWFLAG_NORMAL);
                // the accuracy
                if(weapon_stats >= 0) {
                        weapons_with_stats += 1;
@@ -1046,40 +1077,40 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
                        s = sprintf("%d%%", weapon_stats*100);
 
                        float padding;
-                       padding = (weapon_width - stringwidth(s, FALSE, '1 0 0' * fontsize)) / 2; // center the accuracy value
+                       padding = (weapon_width - stringwidth(s, false, '1 0 0' * fontsize)) / 2; // center the accuracy value
 
                        if(!autocvar_scoreboard_accuracy_nocolors)
                                rgb = Accuracy_GetColor(weapon_stats);
 
-                       drawstring(pos + '1 0 0' * padding + '0 1 0' * weapon_height, s, '1 1 0' * fontsize, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+                       drawstring(tmpos + '1 0 0' * padding + '0 1 0' * weapon_height, s, '1 1 0' * fontsize, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
                }
-               pos_x += weapon_width * rows;
-               if(rows == 2 && i == 6) {
-                       pos_x -= sbwidth;
-                       pos_y += height;
+               tmpos.x += weapon_width * rows;
+               pos.x += weapon_width * rows;
+               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.y += height;
+       pos.y += 1.25 * hud_fontsize.y;
+       pos.x = initial_posx;
        return pos;
 }
 
 vector HUD_DrawKeyValue(vector pos, string key, string value) {
-       float px = pos_x;
-       pos_x += hud_fontsize_x * 0.25;
+       float px = pos.x;
+       pos.x += hud_fontsize.x * 0.25;
        drawstring(pos, key, hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-       pos_x = xmax - stringwidth(value, FALSE, hud_fontsize) - hud_fontsize_x * 0.25;
+       pos.x = xmax - stringwidth(value, false, hud_fontsize) - hud_fontsize.x * 0.25;
        drawstring(pos, value, hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-       pos_x = px;
-       pos_y+= hud_fontsize_y;
+       pos.x = px;
+       pos.y+= hud_fontsize.y;
 
        return pos;
 }
@@ -1110,12 +1141,12 @@ vector HUD_DrawMapStats(vector pos, vector rgb, vector bg_size) {
 
        //  draw table header
        drawstring(pos, _("Map stats:"), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-       pos_y += 1.25 * hud_fontsize_y + autocvar_scoreboard_border_thickness;
+       pos.y += 1.25 * hud_fontsize.y + autocvar_scoreboard_border_thickness;
 
        // draw table
        vector tmp = '0 0 0';
-       tmp_x = sbwidth;
-       tmp_y = hud_fontsize_y * rows;
+       tmp.x = sbwidth;
+       tmp.y = hud_fontsize.y * rows;
 
        if (teamplay)
                drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb * autocvar_scoreboard_color_bg_team, scoreboard_alpha_bg, DRAWFLAG_NORMAL);
@@ -1138,7 +1169,7 @@ vector HUD_DrawMapStats(vector pos, vector rgb, vector bg_size) {
        }
 
        // update position
-       pos_y += 1.25 * hud_fontsize_y;
+       pos.y += 1.25 * hud_fontsize.y;
        return pos;
 }
 
@@ -1157,16 +1188,16 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg_
        float is_spec;
        is_spec = (GetPlayerColor(pl.sv_entnum) == NUM_SPECTATOR);
        vector hl_rgb;
-       hl_rgb_x = autocvar_scoreboard_color_bg_r + 0.5;
-       hl_rgb_y = autocvar_scoreboard_color_bg_g + 0.5;
-       hl_rgb_z = autocvar_scoreboard_color_bg_b + 0.5;
+       hl_rgb.x = autocvar_scoreboard_color_bg_r + 0.5;
+       hl_rgb.y = autocvar_scoreboard_color_bg_g + 0.5;
+       hl_rgb.z = autocvar_scoreboard_color_bg_b + 0.5;
 
-       pos_y += hud_fontsize_y;
+       pos.y += hud_fontsize.y;
        drawstring(pos, _("Rankings"), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-       pos_y += hud_fontsize_y + autocvar_scoreboard_border_thickness;
+       pos.y += hud_fontsize.y + autocvar_scoreboard_border_thickness;
        vector tmp = '0 0 0';
-       tmp_x = sbwidth;
-       tmp_y = 1.25 * hud_fontsize_y * RANKINGS_RECEIVED_CNT;
+       tmp.x = sbwidth;
+       tmp.y = 1.25 * hud_fontsize.y * RANKINGS_RECEIVED_CNT;
 
        if (teamplay)
                drawpic_tiled(pos, "gfx/scoreboard/scoreboard_bg", bg_size, tmp, rgb * autocvar_scoreboard_color_bg_team, scoreboard_alpha_bg, DRAWFLAG_NORMAL);
@@ -1185,15 +1216,15 @@ vector HUD_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg_
                n = grecordholder[i];
                p = count_ordinal(i+1);
                if(grecordholder[i] == GetPlayerName(player_localnum))
-                       drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
+                       drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize.y, hl_rgb, scoreboard_highlight_alpha_self, DRAWFLAG_NORMAL);
                else if(!(i % 2) && scoreboard_highlight)
-                       drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize_y, hl_rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
-               drawstring(pos, p, '1 1 0' * hud_fontsize_y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-               drawstring(pos + '3 0 0' * hud_fontsize_y, TIME_ENCODED_TOSTRING(t), '1 1 0' * hud_fontsize_y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-               drawcolorcodedstring(pos + '8 0 0' * hud_fontsize_y, n, '1 1 0' * hud_fontsize_y, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-               pos_y += 1.25 * hud_fontsize_y;
+                       drawfill(pos, '1 0 0' * sbwidth + '0 1.25 0' * hud_fontsize.y, hl_rgb, scoreboard_highlight_alpha, DRAWFLAG_NORMAL);
+               drawstring(pos, p, '1 1 0' * hud_fontsize.y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+               drawstring(pos + '3 0 0' * hud_fontsize.y, TIME_ENCODED_TOSTRING(t), '1 1 0' * hud_fontsize.y, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+               drawcolorcodedstring(pos + '8 0 0' * hud_fontsize.y, n, '1 1 0' * hud_fontsize.y, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+               pos.y += 1.25 * hud_fontsize.y;
        }
-       pos_y += autocvar_scoreboard_border_thickness;
+       pos.y += autocvar_scoreboard_border_thickness;
 
        return pos;
 }
@@ -1250,9 +1281,9 @@ void HUD_DrawScoreboard()
        sbwidth = xmax - xmin;
 
        // Initializes position
-       pos_x = xmin;
-       pos_y = ymin;
-       pos_z = 0;
+       pos.x = xmin;
+       pos.y = ymin;
+       pos.z = 0;
 
        // Heading
        vector sb_heading_fontsize;
@@ -1261,7 +1292,7 @@ void HUD_DrawScoreboard()
        drawstring(pos, _("Scoreboard"), sb_heading_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
        draw_endBoldFont();
 
-       pos_y += sb_heading_fontsize_y + hud_fontsize_y * 0.25;
+       pos.y += sb_heading_fontsize.y + hud_fontsize.y * 0.25;
 
        // Draw the scoreboard
        vector bg_size = draw_getimagesize("gfx/scoreboard/scoreboard_bg") * autocvar_scoreboard_bg_scale;
@@ -1269,7 +1300,7 @@ void HUD_DrawScoreboard()
        if(teamplay)
        {
                vector team_score_baseoffset;
-               team_score_baseoffset = eY * (2 * autocvar_scoreboard_border_thickness + hud_fontsize_y) - eX * (autocvar_scoreboard_border_thickness + hud_fontsize_x * 0.25);
+               team_score_baseoffset = eY * (2 * autocvar_scoreboard_border_thickness + hud_fontsize.y) - eX * (autocvar_scoreboard_border_thickness + hud_fontsize.x * 0.25);
                for(tm = teams.sort_next; tm; tm = tm.sort_next)
                {
                        if(tm.team == NUM_SPECTATOR)
@@ -1278,33 +1309,26 @@ void HUD_DrawScoreboard()
                        draw_beginBoldFont();
                        rgb = Team_ColorRGB(tm.team);
                        str = ftos(tm.(teamscores[ts_primary]));
-                       drawstring(pos + team_score_baseoffset - eX * stringwidth(str, FALSE, hud_fontsize * 1.5), str, hud_fontsize * 1.5, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+                       drawstring(pos + team_score_baseoffset - eX * stringwidth(str, false, hud_fontsize * 1.5), str, hud_fontsize * 1.5, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
 
                        if(ts_primary != ts_secondary)
                        {
                                str = ftos(tm.(teamscores[ts_secondary]));
-                               drawstring(pos + team_score_baseoffset - eX * stringwidth(str, FALSE, hud_fontsize) + eY * hud_fontsize_y * 1.5, str, hud_fontsize, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+                               drawstring(pos + team_score_baseoffset - eX * stringwidth(str, false, hud_fontsize) + eY * hud_fontsize.y * 1.5, str, hud_fontsize, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
                        }
                        draw_endBoldFont();
 
                        pos = HUD_Scoreboard_MakeTable(pos, tm, rgb, bg_size);
                }
-
-#ifdef GMQCC
-               rgb = '0 0 0';
-#endif
-               rgb_x = autocvar_scoreboard_color_bg_r;
-               rgb_y = autocvar_scoreboard_color_bg_g;
-               rgb_z = autocvar_scoreboard_color_bg_b;
+               rgb.x = autocvar_scoreboard_color_bg_r;
+               rgb.y = autocvar_scoreboard_color_bg_g;
+               rgb.z = autocvar_scoreboard_color_bg_b;
        }
        else
        {
-#ifdef GMQCC
-               rgb = '0 0 0';
-#endif
-               rgb_x = autocvar_scoreboard_color_bg_r;
-               rgb_y = autocvar_scoreboard_color_bg_g;
-               rgb_z = autocvar_scoreboard_color_bg_b;
+               rgb.x = autocvar_scoreboard_color_bg_r;
+               rgb.y = autocvar_scoreboard_color_bg_g;
+               rgb.z = autocvar_scoreboard_color_bg_b;
 
                for(tm = teams.sort_next; tm; tm = tm.sort_next)
                {
@@ -1318,11 +1342,11 @@ void HUD_DrawScoreboard()
        if(gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE) {
                if(race_speedaward) {
                        drawcolorcodedstring(pos, sprintf(_("Speed award: %d ^7(%s^7)"), race_speedaward, race_speedaward_holder), hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-                       pos_y += 1.25 * hud_fontsize_y;
+                       pos.y += 1.25 * hud_fontsize.y;
                }
                if(race_speedaward_alltimebest) {
                        drawcolorcodedstring(pos, sprintf(_("All-time fastest: %d ^7(%s^7)"), race_speedaward_alltimebest, race_speedaward_alltimebest_holder), hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
-                       pos_y += 1.25 * hud_fontsize_y;
+                       pos.y += 1.25 * hud_fontsize.y;
                }
                pos = HUD_DrawScoreboardRankings(pos, playerslots[player_localnum], rgb, bg_size);
        }
@@ -1344,14 +1368,14 @@ void HUD_DrawScoreboard()
        specs = 0;
        tmp = pos;
        vector item_size;
-       item_size_x = sbwidth;
-       item_size_y = hud_fontsize_y * 1.25;
-       item_size_z = 0;
+       item_size.x = sbwidth;
+       item_size.y = hud_fontsize.y * 1.25;
+       item_size.z = 0;
        for(pl = players.sort_next; pl; pl = pl.sort_next)
        {
                if(pl.team != NUM_SPECTATOR)
                        continue;
-               pos_y += 1.25 * hud_fontsize_y;
+               pos.y += 1.25 * hud_fontsize.y;
                HUD_PrintScoreboardItem(pos, item_size, pl, (pl.sv_entnum == player_localnum), specs);
                ++specs;
        }
@@ -1361,7 +1385,7 @@ void HUD_DrawScoreboard()
                draw_beginBoldFont();
                drawstring(tmp, _("Spectators"), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
                draw_endBoldFont();
-               pos_y += 1.25 * hud_fontsize_y;
+               pos.y += 1.25 * hud_fontsize.y;
        }
 
        // Print info string
@@ -1419,8 +1443,8 @@ void HUD_DrawScoreboard()
                }
        }
 
-       pos_y += 1.2 * hud_fontsize_y;
-       drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, TRUE, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+       pos.y += 1.2 * hud_fontsize.y;
+       drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, true, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
 
        // print information about respawn status
        float respawn_time = getstatf(STAT_RESPAWN_TIME);
@@ -1454,9 +1478,9 @@ void HUD_DrawScoreboard()
                else if(time >= respawn_time)
                        str = sprintf(_("You are dead, press ^2%s^7 to respawn"), getcommandkey("jump", "+jump"));
 
-               pos_y += 1.2 * hud_fontsize_y;
-               drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, TRUE, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+               pos.y += 1.2 * hud_fontsize.y;
+               drawcolorcodedstring(pos + '0.5 0 0' * (sbwidth - stringwidth(str, true, hud_fontsize)), str, hud_fontsize, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
        }
 
-       scoreboard_bottom = pos_y + 2 * hud_fontsize_y;
+       scoreboard_bottom = pos.y + 2 * hud_fontsize.y;
 }