]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
hey, fix the vote window coloring and add more useless TODO comments :)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index e21071da5fe8e2e0a4fa1a7cea145eab54e69933..3b0f9594fbf575f7e118f411b54695f1e262921e 100644 (file)
@@ -181,7 +181,7 @@ void HUD_DrawXNum (vector pos, float num, float digits, float showsign, float le
                hl_pos_y = pos_y - lettersize/20;
                hl_pos_z = 0;
 
-               drawpic_skin(hl_pos, strcat("highlight_", l_length), hl_size, '1 1 1', alpha, dflags);
+               drawpic_skin(hl_pos, strcat("num_leading_", l_length), hl_size, '1 1 1', alpha, dflags);
        }
 
        if (stroke == 1)
@@ -575,14 +575,15 @@ void HUD_Panel_ExportCfg(string cfgname)
                fputs(fh, strcat("seta hud_skin \"", cvar_string("hud_skin"), "\"", "\n"));
                fputs(fh, strcat("seta hud_bg \"", cvar_string("hud_bg"), "\"", "\n"));
                fputs(fh, strcat("seta hud_bg_color \"", cvar_string("hud_bg_color"), "\"", "\n"));
-               fputs(fh, strcat("seta hud_bg_alpha ", ftos(cvar("hud_bg_alpha")), "\n"));
-               fputs(fh, strcat("seta hud_bg_border ", ftos(cvar("hud_bg_border")), "\n"));
-               fputs(fh, strcat("seta hud_fg_alpha ", ftos(cvar("hud_fg_alpha")), "\n"));
+               fputs(fh, strcat("seta hud_bg_alpha \"", cvar_string("hud_bg_alpha"), "\"", "\n"));
+               fputs(fh, strcat("seta hud_bg_border \"", cvar_string("hud_bg_border"), "\"", "\n"));
+               fputs(fh, strcat("seta hud_bg_padding \"", cvar_string("hud_bg_padding"), "\"", "\n"));
+               fputs(fh, strcat("seta hud_fg_alpha \"", cvar_string("hud_fg_alpha"), "\"", "\n"));
                fputs(fh, "\n");
 
                fputs(fh, strcat("seta hud_dock \"", cvar_string("hud_dock"), "\"", "\n"));
                fputs(fh, strcat("seta hud_dock_color \"", cvar_string("hud_dock_color"), "\"", "\n"));
-               fputs(fh, strcat("seta hud_dock_alpha ", ftos(cvar("hud_dock_alpha")), "\n"));
+               fputs(fh, strcat("seta hud_dock_alpha \"", ftos(cvar("hud_dock_alpha")), "\"", "\n"));
                fputs(fh, "\n");
 
                fputs(fh, strcat("seta hud_progressbar_alpha ", ftos(cvar("hud_progressbar_alpha")), "\n"));
@@ -603,8 +604,9 @@ void HUD_Panel_ExportCfg(string cfgname)
                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_size \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_size")), "\"", "\n"));
                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg")), "\"", "\n"));
                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_color \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_color")), "\"", "\n"));
-                       fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_alpha ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_bg_alpha"))), "\n"));
-                       fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_border ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_bg_border"))), "\n"));
+                       fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_alpha \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_alpha")), "\"", "\n"));
+                       fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_border \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_border")), "\"", "\n"));
+                       fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_padding \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_padding")), "\"", "\n"));
                        switch(i) {
                                case 0:
                                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_accuracy_height ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_accuracy_height"))), "\n"));
@@ -707,16 +709,46 @@ vector HUD_Panel_GetPos(float id)
 
 float HUD_Panel_GetBorder(float id)
 {
-       float border;
-       border = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_border"));
-       if(!border)
-               border = cvar("hud_bg_border");
-       return border;
+       string border;
+       border = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_border"));
+       if(border == "")
+               border = cvar_string("hud_bg_border");
+       return stof(border);
+}
+
+vector HUD_Panel_GetColor(float id)
+{
+       // TODO: idea: let user choose colors "pants", "shirt"
+       string color;
+       color = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color"));
+       if(color == "")
+               color = cvar_string("hud_bg_color");
+       return stov(color);
+}
+
+float HUD_Panel_GetAlpha(float id)
+{
+       string alpha;
+       alpha = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_alpha"));
+       if(alpha == "")
+               alpha = cvar_string("hud_bg_alpha");
+       return stof(alpha);
+}
+
+float HUD_Panel_GetPadding(float id)
+{
+       string padding;
+       padding = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       if(padding == "")
+               padding = cvar_string("hud_bg_padding");
+       return stof(padding);
 }
 
 // draw the background/borders
 void HUD_Panel_DrawBg(float id, vector pos, vector mySize)
 {
+       float alpha;
+
        if(!hud_configure && cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg")) == "0")
                return;
 
@@ -725,23 +757,21 @@ void HUD_Panel_DrawBg(float id, vector pos, vector mySize)
        if(bg == "")
                bg = cvar_string("hud_bg");
 
+       if(bg == "0" && hud_configure) {
+               bg = "border"; // we probably want to see a background in config mode at all times...
+               alpha = cvar("hud_configure_bg_minalpha");
+       }
+
        if(bg != "0")
        {
                float border;
                border = max(0.0000001, HUD_Panel_GetBorder(id)); // draw_BorderPicture does not like border = 0
 
                vector color;
-               if(cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color")) != "")
-                       color = stov(cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color")));
-               else
-                       color = stov(cvar_string("hud_bg_color"));
+               color = HUD_Panel_GetColor(id);
 
-               float alpha;
-               alpha = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_alpha"));
                if(!alpha)
-                       alpha = cvar("hud_bg_alpha");
-               if(hud_configure)
-                       alpha = max(cvar("hud_configure_bg_minalpha"), alpha);
+                       alpha = HUD_Panel_GetAlpha(id);
 
                draw_BorderPicture(pos - '1 1 0' * border, strcat("gfx/hud/", cvar_string("hud_skin"), "/", bg), mySize + '1 1 0' * 2 * border, color, alpha, '1 1 0' * (border/BORDER_MULTIPLIER));
        }
@@ -765,6 +795,8 @@ vector HUD_Panel_CheckResize(float id, vector myPos, vector mySize)
        vector targSize;
        vector myCenter;
        vector targCenter;
+       myCenter = '0 0 0'; // shut up fteqcc, there IS a reference
+       targCenter = '0 0 0'; // shut up fteqcc, there IS a reference
 
        for (i = 0; i < panel_cnt; ++i) {
                if(i == id || !HUD_Panel_CheckActive(i))
@@ -794,7 +826,6 @@ vector HUD_Panel_CheckResize(float id, vector myPos, vector mySize)
                targCenter_x = targPos_x + 0.5 * targSize_x;
                targCenter_y = targPos_y + 0.5 * targSize_y;
 
-               float k, y;
                if(myCenter_x < targCenter_x && myCenter_y < targCenter_y && resizeCorner != 1) // top left (of target panel)
                {
                        if(myPos_x + mySize_x - targPos_x < myPos_y + mySize_y - targPos_y) // push it to the side
@@ -885,6 +916,8 @@ vector HUD_Panel_CheckMove(float id, vector myPos, vector mySize)
        vector targSize;
        vector myCenter;
        vector targCenter;
+       myCenter = '0 0 0'; // shut up fteqcc, there IS a reference
+       targCenter = '0 0 0'; // shut up fteqcc, there IS a reference
 
        for (i = 0; i < panel_cnt; ++i) {
                if(i == id || !HUD_Panel_CheckActive(i))
@@ -911,7 +944,6 @@ vector HUD_Panel_CheckMove(float id, vector myPos, vector mySize)
                targCenter_x = targPos_x + 0.5 * targSize_x;
                targCenter_y = targPos_y + 0.5 * targSize_y;
 
-               float k, y;
                if(myCenter_x < targCenter_x && myCenter_y < targCenter_y) // top left (of the target panel)
                {
                        if(myPos_x + mySize_x - targPos_x < myPos_y + mySize_y - targPos_y) // push it to the side
@@ -1137,7 +1169,7 @@ void weaponorder_swap(float i, float j, entity pass)
 
 float weaponorder_cmp(float i, float j, entity pass)
 {
-       float d, ii, ij;
+       float d;
        d = mod(weaponorder[i].impulse + 9, 10) - mod(weaponorder[j].impulse + 9, 10);
        if(d)
                return d;
@@ -1148,13 +1180,12 @@ float weaponorder_cmp(float i, float j, entity pass)
 void HUD_WeaponIcons()
 {
        float id = 0;
-       float alpha, height, accuracybar_height, stat_weapons; // "constants"
-       vector pos, mySize, mysize, mypos, accuracy_color;
+       float alpha, stat_weapons; // "constants"
+       vector pos, mySize, accuracy_color;
        float i, weapid, fade, weapon_stats, weapon_hit, weapon_damage, weapon_cnt; // variables
 
        pos = HUD_Panel_GetPos(id);
        mySize = HUD_Panel_GetSize(id);
-       accuracybar_height = cvar_or("hud_weaponicons_accuracy_height", 3);
 
        stat_weapons = getstati(STAT_WEAPONS);
        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
@@ -1170,7 +1201,7 @@ void HUD_WeaponIcons()
 
        HUD_Panel_DrawBg(id, pos, mySize);
        float padding;
-       padding = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       padding = HUD_Panel_GetPadding(id);
        if(padding)
        {
                pos += '1 1 0' * padding;
@@ -1215,12 +1246,9 @@ void HUD_WeaponIcons()
                        weapon_hit = weapon_hits[self.weapon-WEP_FIRST];
                        weapon_damage = weapon_fired[self.weapon-WEP_FIRST];
 
+                       // draw background behind currently selected weapon
                        if(self.weapon == activeweapon)
                                drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), "weapon_current_bg", eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '1 1 1', fade * hud_alpha_fg, DRAWFLAG_NORMAL);
-                       drawpic(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), strcat("gfx/weapons/weapon", self.netname), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '1 1 1', fade * hud_alpha_fg, DRAWFLAG_NORMAL);
-
-                       if(cvar_or("hud_weaponicons_number", 1))
-                               drawstring(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), ftos(weapid), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
 
                        // draw the weapon accuracy on the HUD
                        if(hud_accuracy_hud && !(gametype == GAME_RACE || gametype == GAME_CTS))
@@ -1230,8 +1258,14 @@ void HUD_WeaponIcons()
 
                                accuracy_color = HUD_AccuracyColor(weapon_stats);
                                if(weapon_damage)
-                                       drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows) - '2 0 0' + eY * (mySize_y/rows - accuracybar_height), "accuracy_bar.tga", eX * mySize_x*(1/columns) + eY * accuracybar_height, accuracy_color, hud_alpha_fg, DRAWFLAG_NORMAL);
+                                       drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), "weapon_accuracy", eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), accuracy_color, hud_alpha_fg, DRAWFLAG_NORMAL);
                        }
+
+                       // draw the weapon icon
+                       drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), strcat("weapon", self.netname), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '1 1 1', fade * hud_alpha_fg, DRAWFLAG_NORMAL);
+
+                       if(cvar_or("hud_weaponicons_number", 1))
+                               drawstring(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), ftos(weapid), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
                }
 
                ++row;
@@ -1278,7 +1312,7 @@ string GetAmmoPicture(float i)
        {
                case 0: return "ammo_shells";
                case 1: return "ammo_bullets";
-               case 2: return "ammo_rocket";
+               case 2: return "ammo_rockets";
                case 3: return "ammo_cells";
                case 4: return "ammo_fuel";
                default: return "";
@@ -1297,7 +1331,7 @@ void HUD_Inventory()
 
        HUD_Panel_DrawBg(id, pos, mySize);
        float padding;
-       padding = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       padding = HUD_Panel_GetPadding(id);
        if(padding)
        {
                pos += '1 1 0' * padding;
@@ -1314,7 +1348,6 @@ void HUD_Inventory()
 
                if(cvar("hud_inventory_onlycurrent")) {
                        if (stat_items & GetAmmoItemCode(i)) {
-                               drawpic_skin(pos, "ammo_current_bg", mySize, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
                                drawpic_skin(pos + eY * 0.05 * mySize_y, GetAmmoPicture(i), '1 1 0' * 0.8 * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
                                if(a < 10)
                                        HUD_DrawXNum(pos + eX * 0.8 * mySize_y + eY * 0.25 * mySize_y, a, strlen(ftos(a)), 0, 0.5 * mySize_y, '0.7 0 0', 0, 0, hud_alpha_fg, DRAWFLAG_NORMAL);
@@ -1374,8 +1407,6 @@ void HUD_Inventory()
 
 // Powerups (#2)
 //
-float shield_maxtime;
-float strength_maxtime;
 void HUD_Powerups() {
        float id = 2;
        float stat_items;
@@ -1397,7 +1428,7 @@ void HUD_Powerups() {
 
        HUD_Panel_DrawBg(id, pos, mySize);
        float padding;
-       padding = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       padding = HUD_Panel_GetPadding(id);
        if(padding)
        {
                pos += '1 1 0' * padding;
@@ -1634,14 +1665,14 @@ void HUD_HealthArmor(void)
 
        HUD_Panel_DrawBg(id, pos, mySize);
        float padding;
-       padding = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       padding = HUD_Panel_GetPadding(id);
        if(padding)
        {
                pos += '1 1 0' * padding;
                mySize -= '2 2 0' * padding;
        }
 
-       float armor, health, x;
+       float armor, health;
        armor = getstati(STAT_ARMOR);
        health = getstati(STAT_HEALTH);
 
@@ -1892,7 +1923,7 @@ void HUD_Notify (void)
 
        HUD_Panel_DrawBg(id, pos, mySize);
        float padding;
-       padding = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       padding = HUD_Panel_GetPadding(id);
        if(padding)
        {
                pos += '1 1 0' * padding;
@@ -2027,7 +2058,7 @@ void HUD_Timer()
 
        HUD_Panel_DrawBg(id, pos, mySize);
        float padding;
-       padding = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       padding = HUD_Panel_GetPadding(id);
        if(padding)
        {
                pos += '1 1 0' * padding;
@@ -2086,7 +2117,7 @@ void HUD_Radar(void)
 
        HUD_Panel_DrawBg(id, pos, mySize);
        float padding;
-       padding = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       padding = HUD_Panel_GetPadding(id);
        if(padding)
        {
                pos += '1 1 0' * padding;
@@ -2099,15 +2130,15 @@ void HUD_Radar(void)
        float scale2d, normalsize, bigsize;
        float f;
 
-       teamradar_origin2d = pos + 0.5 * mySize; // TODO: stupid compat, should be removed
+       teamradar_origin2d = pos + 0.5 * mySize; // TODO: stupid compat, should be removed (hint: code seems to assume origin to be in center, where panelhud code uses pos as topleft pixel)
        teamradar_size2d = mySize;
 
-       if(minimapname == "" && !ons_showmap)
+       if(minimapname == "")
                return;
 
        teamradar_loadcvars();
 
-       switch(cl_teamradar_zoommode)
+       switch(hud_radar_zoommode)
        {
                default:
                case 0:
@@ -2124,13 +2155,13 @@ void HUD_Radar(void)
                        break;
        }
 
-       switch(cl_teamradar_rotation)
+       switch(hud_radar_rotation)
        {
                case 0:
                        teamradar_angle = view_angles_y - 90;
                        break;
                default:
-                       teamradar_angle = 90 * cl_teamradar_rotation;
+                       teamradar_angle = 90 * hud_radar_rotation;
                        break;
        }
 
@@ -2140,7 +2171,7 @@ void HUD_Radar(void)
        teamradar_extraclip_mins = teamradar_extraclip_maxs = '0 0 0'; // we always center
 
        // pixels per world qu to match the teamradar_size2d_x range in the longest dimension
-       if(cl_teamradar_rotation == 0)
+       if(hud_radar_rotation == 0)
        {
                // max-min distance must fit the radar in any rotation
                bigsize = vlen_minnorm2d(teamradar_size2d) * scale2d / (1.05 * vlen2d(mi_max - mi_min));
@@ -2163,7 +2194,7 @@ void HUD_Radar(void)
                );
        }
 
-       normalsize = vlen_maxnorm2d(teamradar_size2d) * scale2d / cl_teamradar_scale;
+       normalsize = vlen_maxnorm2d(teamradar_size2d) * scale2d / hud_radar_scale;
        if(bigsize > normalsize)
                normalsize = bigsize;
 
@@ -2184,29 +2215,7 @@ void HUD_Radar(void)
                mySize_y
        );
 
-       draw_teamradar_background(cl_teamradar_background_alpha, cl_teamradar_foreground_alpha);
-
-       if(ons_showmap)
-       {
-               drawresetcliparea();
-
-               vector frame_origin, frame_size;
-               frame_origin = frame_size = '0 0 0';
-
-               frame_origin_x = pos_x - teamradar_size2d_x * 0.55859375; // matches the picture
-               frame_origin_y = pos_y - teamradar_size2d_y * 0.55859375; // matches the picture
-               frame_size_x = pos_x * 1.1171875; // matches the picture
-               frame_size_y = pos_y * 1.1171875; // matches the picture
-               drawpic_skin(frame_origin, "gfx/ons-frame.tga", frame_size, '1 1 1', hud_alpha_fg, 0);
-               drawpic_skin(frame_origin, "gfx/ons-frame-team.tga", frame_size, rgb, hud_alpha_fg, 0);
-
-               drawsetcliparea(
-                       pos_x - teamradar_size2d_x * 0.5,
-                       pos_y - teamradar_size2d_y * 0.5,
-                       teamradar_size2d_x,
-                       teamradar_size2d_y
-               );
-       }
+       draw_teamradar_background(hud_radar_background_alpha, hud_radar_foreground_alpha);
 
        for(tm = world; (tm = find(tm, classname, "radarlink")); )
                draw_teamradar_link(tm.origin, tm.velocity, tm.team);
@@ -2234,7 +2243,7 @@ void HUD_Score()
 
        HUD_Panel_DrawBg(id, pos, mySize);
        float padding;
-       padding = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       padding = HUD_Panel_GetPadding(id);
        if(padding)
        {
                pos += '1 1 0' * padding;
@@ -2243,7 +2252,7 @@ void HUD_Score()
 
        float score, distribution, leader;
        float score_len, distr_len;
-       vector score_pos, secondary_score_pos, distribution_color;
+       vector distribution_color;
        entity tm, pl, me;
        me = (spectatee_status > 0) ? playerslots[spectatee_status - 1] : playerslots[player_localentnum - 1];
 
@@ -2292,7 +2301,7 @@ void HUD_Score()
                }
                // race record display
                if (distribution <= 0 || distribution == score) // draw the highlight background behind the timer if we have the lead
-                       drawpic_skin(bottomright - '0 32 0' - '32 0 0' * (4 + TIME_DECIMALS), "highlight_4", '0 28 0' + '32 0 0' * (4 + TIME_DECIMALS), '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
+                       drawpic_skin(bottomright - '0 32 0' - '32 0 0' * (4 + TIME_DECIMALS), "num_leading_4", '0 28 0' + '32 0 0' * (4 + TIME_DECIMALS), '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
 
                HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0', racemsec, -TIME_DECIMALS, 0, 30, '1 1 1', 0, 0, hud_alpha_fg, DRAWFLAG_NORMAL);
                HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0'  - '66 0 0', racesec, -2, 0, 30, '1 1 1', 0, 0, hud_alpha_fg, DRAWFLAG_NORMAL);
@@ -2334,7 +2343,7 @@ void HUD_Score()
 
                HUD_DrawXNum(pos + eX * mySize_x - eX * 3 * 0.33 * mySize_y, distribution, 3, 3, 0.33 * mySize_y, distribution_color, 0, 0, hud_alpha_fg, DRAWFLAG_NORMAL);
                if (leader)
-                       drawpic_skin(pos + eX * mySize_x - eX * score_len * mySize_y - eX * 3 * 0.33 * mySize_y, strcat("highlight_", ftos(score_len)), eX * score_len * mySize_y + eY * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
+                       drawpic_skin(pos + eX * mySize_x - eX * score_len * mySize_y - eX * 3 * 0.33 * mySize_y, strcat("num_leading_", ftos(score_len)), eX * score_len * mySize_y + eY * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
                HUD_DrawXNum(pos + eX * mySize_x - eX * 3 * mySize_y - eX * 3 * 0.33 * mySize_y, score, 3, 0, mySize_y, distribution_color, 0, 0, hud_alpha_fg, DRAWFLAG_NORMAL);
        } else { // teamgames
                float max_fragcount;
@@ -2358,13 +2367,13 @@ void HUD_Score()
                                if (max_fragcount == score)
                                        leader = 1;
                                if (leader)
-                                       drawpic_skin(pos + eX * mySize_x - eX * score_len * mySize_y - eX * 3 * 0.33 * mySize_y, strcat("highlight_", ftos(score_len)), eX * score_len * mySize_y + eY * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
+                                       drawpic_skin(pos + eX * mySize_x - eX * score_len * mySize_y - eX * 3 * 0.33 * mySize_y, strcat("num_leading_", ftos(score_len)), eX * score_len * mySize_y + eY * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
                                HUD_DrawXNum(pos + eX * mySize_x - eX * 3 * mySize_y - eX * 3 * 0.33 * mySize_y, score, 3, 0, mySize_y, GetTeamRGB(tm.team) * 0.8, 0, 0, hud_alpha_fg, DRAWFLAG_NORMAL);
                        } else {
                                if (max_fragcount == score)
                                        leader = 1;
                                if (leader)
-                                       drawpic_skin(pos + eX * mySize_x - eX * 0.33 * score_len * mySize_y + eY * 0.33 * mySize_y * teamnum, strcat("highlight_", ftos(score_len)), eX * 0.33 * score_len * mySize_y + eY * 0.33 * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
+                                       drawpic_skin(pos + eX * mySize_x - eX * 0.33 * score_len * mySize_y + eY * 0.33 * mySize_y * teamnum, strcat("num_leading_", ftos(score_len)), eX * 0.33 * score_len * mySize_y + eY * 0.33 * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
                                HUD_DrawXNum(pos + eX * mySize_x - eX * 3 * 0.33 * mySize_y + eY * 0.33 * mySize_y * teamnum, score, 3, 0, 0.33 * mySize_y, GetTeamRGB(tm.team) * 0.8, 0, 0, hud_alpha_fg, DRAWFLAG_NORMAL);
                                teamnum += 1;
                        }
@@ -2382,7 +2391,7 @@ void HUD_RaceTimer (void) {
 
        HUD_Panel_DrawBg(id, pos, mySize);
        float padding;
-       padding = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       padding = HUD_Panel_GetPadding(id);
        if(padding)
        {
                pos += '1 1 0' * padding;
@@ -2545,7 +2554,7 @@ void HUD_VoteWindow(void)
 
        HUD_Panel_DrawBg(id, pos, mySize);
        float padding;
-       padding = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       padding = HUD_Panel_GetPadding(id);
        if(padding)
        {
                pos += '1 1 0' * padding;
@@ -2555,11 +2564,11 @@ void HUD_VoteWindow(void)
        if(vote_alpha) {
                a = vote_alpha * bound(cvar_or("hud_vote_alreadyvoted_alpha", 0.75), 1 - vote_highlighted, 1);
 
-               drawpic_skin(pos, "voteprogress_back", mySize, HUD_GetBgColor(), a * hud_alpha_bg, DRAWFLAG_NORMAL);
+               drawpic_skin(pos, "voteprogress_back", mySize, HUD_Panel_GetColor(id), a * hud_alpha_bg, DRAWFLAG_NORMAL);
 
                s = "A vote has been called for: ";
                drawstring(pos + '0.5 0 0' * mySize_x + '0 0.1 0' * mySize_y - eX * stringwidth(s, FALSE, '1 1 0' * 0.5 * mySize_y*(1/5)), s, '1 1 0' * mySize_y*(1/5), '1 1 1', a * hud_alpha_fg, DRAWFLAG_NORMAL);
-               s = textShortenToWidth(vote_called_vote, mySize_x * 0.96, '10 0 0', stringwidth_colors);
+               s = textShortenToWidth(vote_called_vote, mySize_x * 0.96, '10 0 0', stringwidth_colors); // TODO: broken?
                if(hud_configure)
                        s = "Configure the HUD";
                drawcolorcodedstring(pos + '0.52 0 0' * mySize_x + '0 0.3 0' * mySize_y - eX * stringwidth(s, FALSE, '1 1 0' * 0.5 * mySize_y*(1/6)), s, '1 1 0' * mySize_y*(1/6), a * hud_alpha_fg, DRAWFLAG_NORMAL);
@@ -2855,7 +2864,6 @@ void HUD_Mod_NexBall(vector pos, vector mySize)
        //Manage the progress bar if any
        if (nb_pb_starttime > 0)
        {
-               vector s;
                dt = mod(time - nb_pb_starttime, nb_pb_period);
                // one period of positive triangle
                p = 2 * dt / nb_pb_period;
@@ -3012,7 +3020,7 @@ void HUD_ModIcons(void)
 
        HUD_Panel_DrawBg(id, pos, mySize);
        float padding;
-       padding = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       padding = HUD_Panel_GetPadding(id);
        if(padding)
        {
                pos += '1 1 0' * padding;
@@ -3041,7 +3049,7 @@ void HUD_DrawPressedKeys(void)
 
        HUD_Panel_DrawBg(id, pos, mySize);
        float padding;
-       padding = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding"));
+       padding = HUD_Panel_GetPadding(id);
        if(padding)
        {
                pos += '1 1 0' * padding;
@@ -3184,8 +3192,8 @@ void HUD_Main (void)
        hud_configure = cvar("_hud_configure");
 
        // Drawing stuff
-       if(cvar("hud_dock"))
-               drawpic_skin('0 0 0', "dock", eX * vid_conwidth + eY * vid_conheight, stov(cvar_string("hud_dock_color")), cvar("hud_dock_alpha"), DRAWFLAG_NORMAL);
+       if(cvar_string("hud_dock") != "")
+               drawpic_skin('0 0 0', cvar_string("hud_dock"), eX * vid_conwidth + eY * vid_conheight, stov(cvar_string("hud_dock_color")), cvar("hud_dock_alpha"), DRAWFLAG_NORMAL);
 
        if(HUD_Panel_CheckActive(0))
                HUD_WeaponIcons();
@@ -3201,7 +3209,7 @@ void HUD_Main (void)
                HUD_Timer();
        // TODO hud'ify
        if(HUD_Panel_CheckActive(6))
-               if(ons_showmap || cvar_string("cl_teamradar") != "0" && (cvar("cl_teamradar") == 2 || teamplay))
+               if(cvar_string("hud_radar") != "0" && (cvar("hud_radar") == 2 || teamplay))
                        HUD_Radar();
        if(HUD_Panel_CheckActive(7))
                HUD_Score();