]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
bigfont for health/armor and powerups
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index 5c7ae68d716475b01aec281a51d23dbbe2f61b07..4ec5852d4d008313f3601806999babd06c849ded 100644 (file)
@@ -86,48 +86,25 @@ void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector the
 // TODO: make a default skin, and fallback to these!
 
 // drawpic wrapper to draw an image as large as possible with preserved aspect ratio into a box
-void drawpic_aspect_skin(vector pos, string pic, vector sz, vector color, float alpha, float drawflag) {
-       pic = strcat(hud_skin_path, "/", pic);
-
-       vector imgsize;
-       imgsize = drawgetimagesize(pic);
-       float imgaspect;
-       imgaspect = imgsize_x/imgsize_y;
-
-       vector oldsz;
-       oldsz = sz;
-       float aspect;
-       aspect = sz_x/sz_y;
-
-       if(aspect > imgaspect) {
-               sz_x = sz_y * imgaspect;
-               drawpic(pos + eX * (oldsz_x - sz_x) * 0.5, pic, sz, color, alpha, drawflag);
-       } else {
-               sz_y = sz_x / imgaspect; 
-               drawpic(pos + eY * (oldsz_y - sz_y) * 0.5, pic, sz, color, alpha, drawflag);
-       }
-}
-
-// drawpic wrapper to draw an image as large as possible with preserved aspect ratio into a box
-void drawpic_aspect(vector pos, string pic, vector sz, vector color, float alpha, float drawflag) {
-       vector imgsize;
-       imgsize = drawgetimagesize(pic);
-       float imgaspect;
-       imgaspect = imgsize_x/imgsize_y;
-
-       vector oldsz;
-       oldsz = sz;
-       float aspect;
-       aspect = sz_x/sz_y;
-
-       if(aspect > imgaspect) {
-               sz_x = sz_y * imgaspect;
-               drawpic(pos + eX * (oldsz_x - sz_x) * 0.5, pic, sz, color, alpha, drawflag);
-       } else {
-               sz_y = sz_x / imgaspect; 
-               drawpic(pos + eY * (oldsz_y - sz_y) * 0.5, pic, sz, color, alpha, drawflag);
-       }
-}
+var float imgaspect;
+var float aspect;
+#define drawpic_aspect(pos,pic,mySize,color,alpha,drawflag)\
+       vector imgsize;\
+       imgsize = drawgetimagesize(pic);\
+       imgaspect = imgsize_x/imgsize_y;\
+       vector oldsz, sz;\
+       oldsz = sz = mySize;\
+       aspect = sz_x/sz_y;\
+       if(aspect > imgaspect) {\
+               sz_x = sz_y * imgaspect;\
+               drawpic(pos + eX * (oldsz_x - sz_x) * 0.5, pic, sz, color, alpha, drawflag);\
+       } else {\
+               sz_y = sz_x / imgaspect;\
+               drawpic(pos + eY * (oldsz_y - sz_y) * 0.5, pic, sz, color, alpha, drawflag);\
+       }
+
+#define drawpic_aspect_skin(pos,pic,sz,color,alpha,drawflag)\
+       do {drawpic_aspect(pos, strcat(hud_skin_path, "/", pic), sz, color, alpha, drawflag) } while(0)
 
 // TODO: aspect!
 void drawpic_aspect_skin_expanding(vector pos, string pic, vector sz, vector rgb, float alpha, float flag, float fadelerp) {
@@ -140,42 +117,6 @@ void drawpic_aspect_skin_expanding_two(vector pos, string pic, vector sz, vector
        //drawpic_aspect_expanding_two(pos, strcat("gfx/hud/", autocvar_hud_skin, "/", pic), sz, rgb, alpha, flag, fadelerp);
 }
 
-// return HUD background color
-vector HUD_GetBgColor()
-{
-       vector color;
-       if (teamplay)
-               GetTeamRGB(myteam) * hud_color_bg_team;
-       else {
-               // allow custom HUD colors in non-teamgames
-               color_x = cvar("hud_color_bg_r");
-               color_y = cvar("hud_color_bg_g");
-               color_z = cvar("hud_color_bg_b");
-       }
-       return color;
-}
-
-// return accuracy text color
-vector HUD_AccuracyColor(float accuracy)
-{
-       vector rgb;
-       float yellow_accuracy = cvar("hud_weaponicons_accuracy_yellow"); // value at which this function returns yellow
-       if(accuracy >= 100) {
-               rgb_x = 0;
-               rgb_y = 1;
-       }
-       else if(accuracy > yellow_accuracy) {
-               rgb_x = 1 - (accuracy-yellow_accuracy)/(100-yellow_accuracy); // red value between 1 -> 0
-               rgb_y = 1;
-       }
-       else {
-               rgb_x = 1;
-               rgb_y = accuracy/yellow_accuracy; // green value between 0 -> 1
-       }
-       rgb_z = 0;
-       return rgb;
-}
-
 vector HUD_Get_Num_Color (float x, float maxvalue)
 {
        vector color;
@@ -531,7 +472,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                fputs(fh, strcat("seta hud_dock_alpha \"", ftos(autocvar_hud_dock_alpha), "\"", "\n"));
                fputs(fh, "\n");
 
-               fputs(fh, strcat("seta hud_progressbar_alpha ", ftos(cvar("hud_progressbar_alpha")), "\n"));
+               fputs(fh, strcat("seta hud_progressbar_alpha ", ftos(autocvar_hud_progressbar_alpha), "\n"));
                fputs(fh, strcat("seta hud_progressbar_strength_color \"", cvar_string("hud_progressbar_strength_color"), "\"", "\n"));
                fputs(fh, strcat("seta hud_progressbar_shield_color \"", cvar_string("hud_progressbar_shield_color"), "\"", "\n"));
                fputs(fh, strcat("seta hud_progressbar_health_color \"", cvar_string("hud_progressbar_health_color"), "\"", "\n"));
@@ -677,10 +618,6 @@ void HUD_Panel_DrawProgressBar(vector pos, float vertical, vector mySize, vector
        }
 }
 
-// TODO: autocvar
-#define HUD_Panel_GetProgressBarColor(item) \
-stov(cvar_string(strcat("hud_progressbar_", item, "_color")))
-
 // check if move will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
 vector HUD_Panel_CheckMove(vector myPos, vector mySize)
 {
@@ -697,22 +634,22 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize)
        targCenter = '0 0 0'; // shut up fteqcc, there IS a reference
 
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
-               HUD_Panel_UpdatePosSizeForId(i)
-
                if(i == highlightedPanel || !panel_enabled)
                        continue;
 
-               targPos = panel_pos;
-               targSize = panel_size;
+               HUD_Panel_UpdatePosSizeForId(i)
+
+               panel_pos -= '1 1 0' * panel_bg_border;
+               panel_size += '2 2 0' * panel_bg_border;
 
-               if(myPos_y + mySize_y < targPos_y)
+               if(myPos_y + mySize_y < panel_pos_y)
                        continue;
-               if(myPos_y > targPos_y + targSize_y)
+               if(myPos_y > panel_pos_y + panel_size_y)
                        continue;
 
-               if(myPos_x + mySize_x < targPos_x)
+               if(myPos_x + mySize_x < panel_pos_x)
                        continue;
-               if(myPos_x > targPos_x + targSize_x)
+               if(myPos_x > panel_pos_x + panel_size_x)
                        continue;
 
                // OK, there IS a collision.
@@ -720,37 +657,39 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize)
                myCenter_x = myPos_x + 0.5 * mySize_x;
                myCenter_y = myPos_y + 0.5 * mySize_y;
 
-               targCenter_x = targPos_x + 0.5 * targSize_x;
-               targCenter_y = targPos_y + 0.5 * targSize_y;
+               targCenter_x = panel_pos_x + 0.5 * panel_size_x;
+               targCenter_y = panel_pos_y + 0.5 * panel_size_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
-                               myTarget_x = targPos_x - mySize_x;
+                       if(myPos_x + mySize_x - panel_pos_x < myPos_y + mySize_y - panel_pos_y) // push it to the side
+                               myTarget_x = panel_pos_x - mySize_x;
                        else // push it upwards
-                               myTarget_y = targPos_y - mySize_y;
+                               myTarget_y = panel_pos_y - mySize_y;
                }
                else if(myCenter_x > targCenter_x && myCenter_y < targCenter_y) // top right
                {
-                       if(targPos_x + targSize_x - myPos_x < myPos_y + mySize_y - targPos_y) // push it to the side
-                               myTarget_x = targPos_x + targSize_x;
+                       if(panel_pos_x + panel_size_x - myPos_x < myPos_y + mySize_y - panel_pos_y) // push it to the side
+                               myTarget_x = panel_pos_x + panel_size_x;
                        else // push it upwards
-                               myTarget_y = targPos_y - mySize_y;
+                               myTarget_y = panel_pos_y - mySize_y;
                }
                else if(myCenter_x < targCenter_x && myCenter_y > targCenter_y) // bottom left
                {
-                       if(myPos_x + mySize_x - targPos_x < targPos_y + targSize_y - myPos_y) // push it to the side
-                               myTarget_x = targPos_x - mySize_x;
+                       if(myPos_x + mySize_x - panel_pos_x < panel_pos_y + panel_size_y - myPos_y) // push it to the side
+                               myTarget_x = panel_pos_x - mySize_x;
                        else // push it downwards
-                               myTarget_y = targPos_y + targSize_y;
+                               myTarget_y = panel_pos_y + panel_size_y;
                }
                else if(myCenter_x > targCenter_x && myCenter_y > targCenter_y) // bottom right
                {
-                       if(targPos_x + targSize_x - myPos_x < targPos_y + targSize_y - myPos_y) // push it to the side
-                               myTarget_x = targPos_x + targSize_x;
+                       if(panel_pos_x + panel_size_x - myPos_x < panel_pos_y + panel_size_y - myPos_y) // push it to the side
+                               myTarget_x = panel_pos_x + panel_size_x;
                        else // push it downwards
-                               myTarget_y = targPos_y + targSize_y;
+                               myTarget_y = panel_pos_y + panel_size_y;
                }
+               if(cvar("hud_configure_checkcollisions_debug"))
+                       drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
        }
 
        return myTarget;
@@ -762,18 +701,21 @@ void HUD_Panel_SetPos(vector pos)
        vector mySize;
        mySize = panel_size;
 
+       if(cvar("hud_configure_checkcollisions_debug"))
+               drawfill(pos, mySize, '1 1 1', .2, DRAWFLAG_NORMAL);
+
+       if(autocvar_hud_configure_grid)
+       {
+               pos_x = floor((pos_x/vid_conwidth)/bound(0.005, autocvar_hud_configure_grid_xsize, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_xsize, 0.2) * vid_conwidth;
+               pos_y = floor((pos_y/vid_conheight)/bound(0.005, autocvar_hud_configure_grid_ysize, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_ysize, 0.2) * vid_conheight;
+       }
+
        if(hud_configure_checkcollisions)
                pos = HUD_Panel_CheckMove(pos, mySize);
 
        pos_x = bound(0, pos_x, vid_conwidth - mySize_x);
        pos_y = bound(0, pos_y, vid_conheight - mySize_y);
 
-       if(autocvar_hud_configure_grid)
-       {
-               pos_x = floor((pos_x/vid_conwidth)/bound(0.005, autocvar_hud_configure_grid_x, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_x, 0.2) * vid_conwidth;
-               pos_y = floor((pos_y/vid_conheight)/bound(0.005, autocvar_hud_configure_grid_y, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_y, 0.2) * vid_conheight;
-       }
-
        string s;
        s = strcat(ftos(pos_x/vid_conwidth), " ", ftos(pos_y/vid_conheight));
 
@@ -795,25 +737,26 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
        ratio = mySize_x/mySize_y;
 
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
-               HUD_Panel_UpdatePosSizeForId(i)
-
                if(i == highlightedPanel || !panel_enabled)
                        continue;
 
-               targPos = panel_pos;
-               targSize = panel_size;
-               targEndPos = targPos + targSize;
+               HUD_Panel_UpdatePosSizeForId(i)
+
+               panel_pos -= '1 1 0' * panel_bg_border;
+               panel_size += '2 2 0' * panel_bg_border;
+
+               targEndPos = panel_pos + panel_size;
 
                // resizeorigin is WITHIN target panel, just abort any collision testing against that particular panel to produce expected behaviour!
-               if(resizeorigin_x > targPos_x && resizeorigin_x < targEndPos_x && resizeorigin_y > targPos_y && resizeorigin_y < targEndPos_y)
+               if(resizeorigin_x > panel_pos_x && resizeorigin_x < targEndPos_x && resizeorigin_y > panel_pos_y && resizeorigin_y < targEndPos_y)
                        continue;
 
                if (resizeCorner == 1)
                {
                        // check if this panel is on our way
-                       if (resizeorigin_x <= targPos_x)
+                       if (resizeorigin_x <= panel_pos_x)
                                continue;
-                       if (resizeorigin_y <= targPos_y)
+                       if (resizeorigin_y <= panel_pos_y)
                                continue;
                        if (targEndPos_x <= resizeorigin_x - mySize_x)
                                continue;
@@ -828,7 +771,7 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
                        // in this case resizeorigin (bottom-right point) and the bottom-right point of the panel
                        dist_x = resizeorigin_x - targEndPos_x;
                        dist_y = resizeorigin_y - targEndPos_y;
-                       if (dist_y < 0 || dist_x / dist_y > ratio)
+                       if (dist_y <= 0 || dist_x / dist_y > ratio)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
@@ -837,34 +780,34 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
                {
                        if (resizeorigin_x >= targEndPos_x)
                                continue;
-                       if (resizeorigin_y <= targPos_y)
+                       if (resizeorigin_y <= panel_pos_y)
                                continue;
-                       if (targPos_x >= resizeorigin_x + mySize_x)
+                       if (panel_pos_x >= resizeorigin_x + mySize_x)
                                continue;
                        if (targEndPos_y <= resizeorigin_y - mySize_y)
                                continue;
 
-                       dist_x = targPos_x - resizeorigin_x;
+                       dist_x = panel_pos_x - resizeorigin_x;
                        dist_y = resizeorigin_y - targEndPos_y;
-                       if (dist_y < 0 || dist_x / dist_y > ratio)
+                       if (dist_y <= 0 || dist_x / dist_y > ratio)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
                }
                else if (resizeCorner == 3)
                {
-                       if (resizeorigin_x <= targPos_x)
+                       if (resizeorigin_x <= panel_pos_x)
                                continue;
                        if (resizeorigin_y >= targEndPos_y)
                                continue;
                        if (targEndPos_x <= resizeorigin_x - mySize_x)
                                continue;
-                       if (targPos_y >= resizeorigin_y + mySize_y)
+                       if (panel_pos_y >= resizeorigin_y + mySize_y)
                                continue;
 
                        dist_x = resizeorigin_x - targEndPos_x;
-                       dist_y = targPos_y - resizeorigin_y;
-                       if (dist_y < 0 || dist_x / dist_y > ratio)
+                       dist_y = panel_pos_y - resizeorigin_y;
+                       if (dist_y <= 0 || dist_x / dist_y > ratio)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
@@ -875,20 +818,20 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
                                continue;
                        if (resizeorigin_y >= targEndPos_y)
                                continue;
-                       if (targPos_x >= resizeorigin_x + mySize_x)
+                       if (panel_pos_x >= resizeorigin_x + mySize_x)
                                continue;
-                       if (targPos_y >= resizeorigin_y + mySize_y)
+                       if (panel_pos_y >= resizeorigin_y + mySize_y)
                                continue;
 
-                       dist_x = targPos_x - resizeorigin_x;
-                       dist_y = targPos_y - resizeorigin_y;
-                       if (dist_y < 0 || dist_x / dist_y > ratio)
+                       dist_x = panel_pos_x - resizeorigin_x;
+                       dist_y = panel_pos_y - resizeorigin_y;
+                       if (dist_y <= 0 || dist_x / dist_y > ratio)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
                }
                if(cvar("hud_configure_checkcollisions_debug"))
-                       drawfill(targPos, targSize, '1 1 0', .3, DRAWFLAG_NORMAL);
+                       drawfill(panel_pos, panel_size, '1 1 0', .3, DRAWFLAG_NORMAL);
        }
 
        return mySize;
@@ -947,8 +890,8 @@ void HUD_Panel_SetPosSize(vector mySize)
        // before checkresize, otherwise panel can be snapped partially inside another panel or panel aspect ratio can be broken
        if(autocvar_hud_configure_grid)
        {
-               mySize_x = floor((mySize_x/vid_conwidth)/bound(0.005, autocvar_hud_configure_grid_x, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_x, 0.2) * vid_conwidth;
-               mySize_y = floor((mySize_y/vid_conheight)/bound(0.005, autocvar_hud_configure_grid_y, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_y, 0.2) * vid_conheight;
+               mySize_x = floor((mySize_x/vid_conwidth)/bound(0.005, autocvar_hud_configure_grid_xsize, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_xsize, 0.2) * vid_conwidth;
+               mySize_y = floor((mySize_y/vid_conheight)/bound(0.005, autocvar_hud_configure_grid_ysize, 0.2) + 0.5) * bound(0.005, autocvar_hud_configure_grid_ysize, 0.2) * vid_conheight;
        }
 
        if(hud_configure_checkcollisions)
@@ -1006,16 +949,16 @@ void HUD_Panel_Arrow_Action(float nPrimary)
                if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
                {
                        if (hudShiftState & S_SHIFT)
-                               step = bound(0.005, autocvar_hud_configure_grid_y, 0.2) * vid_conheight;
+                               step = bound(0.005, autocvar_hud_configure_grid_ysize, 0.2) * vid_conheight;
                        else
-                               step = 2 * bound(0.005, autocvar_hud_configure_grid_y, 0.2) * vid_conheight;
+                               step = 2 * bound(0.005, autocvar_hud_configure_grid_ysize, 0.2) * vid_conheight;
                }
                else
                {
                        if (hudShiftState & S_SHIFT)
-                               step = bound(0.005, autocvar_hud_configure_grid_x, 0.2) * vid_conwidth;
+                               step = bound(0.005, autocvar_hud_configure_grid_xsize, 0.2) * vid_conwidth;
                        else
-                               step = 2 * bound(0.005, autocvar_hud_configure_grid_x, 0.2) * vid_conwidth;
+                               step = 2 * bound(0.005, autocvar_hud_configure_grid_xsize, 0.2) * vid_conwidth;
                }
        }
        else
@@ -1390,7 +1333,7 @@ void HUD_WeaponIcons(void)
        float id = HUD_PANEL_WEAPONICONS;
        HUD_Panel_UpdateCvarsForId(id);
        float alpha, stat_weapons; // "constants"
-       vector pos, mySize, accuracy_color;
+       vector pos, mySize;
        float i, weapid, fade, weapon_stats, weapon_hit, weapon_damage, weapon_cnt; // variables
 
        pos = panel_pos;
@@ -1426,7 +1369,7 @@ void HUD_WeaponIcons(void)
                heapsort(weapon_cnt, weaponorder_swap, weaponorder_cmp, world);
        }
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -1462,10 +1405,11 @@ void HUD_WeaponIcons(void)
 
        float a;
        float when;
-       when = cvar("hud_weaponicons_complainbubble_time");
+       when = autocvar_hud_weaponicons_complainbubble_time;
        float fadetime;
-       fadetime = cvar("hud_weaponicons_complainbubble_fadetime");
+       fadetime = autocvar_hud_weaponicons_complainbubble_fadetime;
 
+       vector color;
        for(i = 0; i < weapon_cnt; ++i)
        {
                self = weaponorder[i];
@@ -1486,9 +1430,21 @@ void HUD_WeaponIcons(void)
                        if(weapon_damage)
                                weapon_stats = floor(100 * weapon_hit / weapon_damage);
 
-                       accuracy_color = HUD_AccuracyColor(weapon_stats);
+                       // yellow_accuracy = value at which accuracy becomes yellow
+                       if(weapon_stats >= 100) {
+                               color_x = 0;
+                               color_y = 1;
+                       }
+                       else if(weapon_stats > autocvar_hud_weaponicons_accuracy_yellow) {
+                               color_x = 1 - (weapon_stats-autocvar_hud_weaponicons_accuracy_yellow)/(100-autocvar_hud_weaponicons_accuracy_yellow); // red value between 1 -> 0
+                               color_y = 1;
+                       } else {
+                               color_x = 1;
+                               color_y = weapon_stats/autocvar_hud_weaponicons_accuracy_yellow; // green value between 0 -> 1
+                       }
+
                        if(weapon_damage)
-                               drawpic_aspect_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, panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawpic_aspect_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), color, panel_fg_alpha, DRAWFLAG_NORMAL);
                }
 
                // draw the weapon icon
@@ -1506,7 +1462,7 @@ void HUD_WeaponIcons(void)
                }
 
                // draw the complain message
-               if(time - complain_weapon_time < when + fadetime && self.weapon == complain_weapon && cvar("hud_weaponicons_complainbubble"))
+               if(time - complain_weapon_time < when + fadetime && self.weapon == complain_weapon && autocvar_hud_weaponicons_complainbubble)
                {
                        if(fadetime)
                        {
@@ -1523,11 +1479,10 @@ void HUD_WeaponIcons(void)
                                        a = 0;
                        }
 
-                       vector complain_bubble_size = '100 50 0' * bound(0.25, cvar("hud_weaponicons_complainbubble_size"), 2);
+                       vector complain_bubble_size = '100 50 0' * bound(0.25, autocvar_hud_weaponicons_complainbubble_size, 2);
                        drawpic_aspect_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows) - complain_bubble_size + 0.5 * (eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows)), "weapon_complainbubble", complain_bubble_size, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
 
                        string s;
-                       vector color;
                        if(complain_weapon_type == 0) {
                                s = "Out of ammo for the";
                                color = '1 0 0';
@@ -1664,7 +1619,7 @@ void HUD_Inventory(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -1776,7 +1731,7 @@ void HUD_Powerups(void) {
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -1802,7 +1757,7 @@ void HUD_Powerups(void) {
        float leftcnt, rightcnt;
        float leftexact, rightexact;
        float leftalpha, rightalpha;
-       if (cvar(strcat("hud_", panel_name, "_flip"))) {
+       if (autocvar_hud_powerups_flip) {
                leftname = "strength";
                leftcnt = ceil(strength_time);
                leftexact = strength_time;
@@ -1822,6 +1777,7 @@ void HUD_Powerups(void) {
        leftalpha = bound(0, leftexact, 1);
        rightalpha = bound(0, rightexact, 1);
 
+       drawfont = hud_bigfont;
        if (mySize_x/mySize_y > 4)
        {
                if(leftcnt)
@@ -1834,7 +1790,8 @@ void HUD_Powerups(void) {
                                barsize = eX * 0.5 * mySize_x * min(1, leftcnt/30) + eY * mySize_y;
                        }
 
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       HUD_Panel_GetProgressBarColor(leftname)
+                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        DrawNumIcon(autocvar_hud_powerups_iconalign, pos, eX * 0.5 * mySize_x + eY * mySize_y, leftcnt, leftname, 1, '1 1 1');
                        // TODO: expand
                        //if(leftcnt <= 5)
@@ -1853,7 +1810,8 @@ void HUD_Powerups(void) {
                                barsize = eX * 0.5 * mySize_x * min(1, rightcnt/30) + eY * mySize_y;
                        }
 
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       HUD_Panel_GetProgressBarColor(rightname)
+                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        DrawNumIcon(autocvar_hud_powerups_iconalign, pos + eX * 0.5 * mySize_x, eX * 0.5 * mySize_x + eY * mySize_y, rightcnt, rightname, 0, '1 1 1');
                }
        }
@@ -1869,7 +1827,8 @@ void HUD_Powerups(void) {
                                barsize = eX * mySize_x * min(1, leftcnt/30) + eY * 0.5 * mySize_y;
                        }
 
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       HUD_Panel_GetProgressBarColor(leftname)
+                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        DrawNumIcon(autocvar_hud_powerups_iconalign, pos, eX * mySize_x + eY * 0.5 * mySize_y, leftcnt, leftname, 1, '1 1 1');
                }
 
@@ -1883,7 +1842,8 @@ void HUD_Powerups(void) {
                                barsize = eX * mySize_x * min(1, rightcnt/30) + eY * 0.5 * mySize_y;
                        }
 
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       HUD_Panel_GetProgressBarColor(rightname)
+                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        DrawNumIcon(autocvar_hud_powerups_iconalign, pos + eY * 0.5 * mySize_y, eX * mySize_x + eY * 0.5 * mySize_y, rightcnt, rightname, 0, '1 1 1');
                }
        }
@@ -1907,10 +1867,11 @@ void HUD_Powerups(void) {
                                numpos = pos + eY * 0.4 * mySize_x;
                        }
 
-                       HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
-                       if(leftcnt <= 5)
-                               drawpic_aspect_skin_expanding_two(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * panel_fg_alpha, DRAWFLAG_ADDITIVE, bound(0, (leftcnt - leftexact) / 0.5, 1));
-                       else
+                       HUD_Panel_GetProgressBarColor(leftname)
+                       HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       //if(leftcnt <= 5)
+                               //drawpic_aspect_skin_expanding_two(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * panel_fg_alpha, DRAWFLAG_ADDITIVE, bound(0, (leftcnt - leftexact) / 0.5, 1));
+                       //else
                                drawpic_aspect_skin(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        drawstring_aspect(numpos, ftos(leftcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, 0.25 * mySize_x, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
@@ -1933,14 +1894,16 @@ void HUD_Powerups(void) {
                                numpos = pos + eY * mySize_y - eY * 0.25 * mySize_x + eX * 0.5 * mySize_x;
                        }
 
-                       HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
-                       if(rightcnt <= 5)
-                               drawpic_aspect_skin_expanding_two(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * panel_fg_alpha, DRAWFLAG_ADDITIVE, bound(0, (rightcnt - rightexact) / 0.5, 1));
-                       else
+                       HUD_Panel_GetProgressBarColor(rightname)
+                       HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       //if(rightcnt <= 5)
+                       //      drawpic_aspect_skin_expanding_two(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * panel_fg_alpha, DRAWFLAG_ADDITIVE, bound(0, (rightcnt - rightexact) / 0.5, 1));
+                       //else
                                drawpic_aspect_skin(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        drawstring_aspect(numpos, ftos(rightcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, 0.25 * mySize_x, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
        }
+       drawfont = hud_font;
 }
 
 // Health/armor (#3)
@@ -1953,7 +1916,7 @@ void HUD_HealthArmor(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -1981,11 +1944,8 @@ void HUD_HealthArmor(void)
        vector picpos;
        vector numpos;
 
-       float baralign, iconalign;
-       baralign = cvar(strcat("hud_", panel_name, "_baralign"));
-       iconalign = cvar(strcat("hud_", panel_name, "_iconalign"));
-
-       if(cvar("hud_healtharmor") == 2) // combined health and armor display
+       drawfont = hud_bigfont;
+       if(autocvar_hud_healtharmor == 2) // combined health and armor display
        {
                vector v;
                v = healtharmor_maxdamage(health, armor, armorblockpercent);
@@ -1993,7 +1953,7 @@ void HUD_HealthArmor(void)
                float x;
                x = floor(v_x + 1);
 
-               if(baralign == 1 || baralign == 3) { // right align
+               if(autocvar_hud_healtharmor_baralign == 1 || autocvar_hud_healtharmor_baralign == 3) { // right align
                        barpos = pos + eX * mySize_x - eX * mySize_x * min(1, x/400);
                        barsize = eX * mySize_x * min(1, x/400) + eY * mySize_y;
                } else { // left align
@@ -2005,30 +1965,33 @@ void HUD_HealthArmor(void)
                if(v_z) // NOT fully armored
                {
                        biggercount = "health";
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("health"), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       HUD_Panel_GetProgressBarColor("health")
+                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        if(armor)
                                drawpic_aspect_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "armor", '0.5 0.5 0' * mySize_y, '1 1 1', panel_fg_alpha * armor / health, DRAWFLAG_NORMAL);
                }
                else
                {
                        biggercount = "armor";
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("armor"), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       HUD_Panel_GetProgressBarColor("armor")
+                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        if(health)
                                drawpic_aspect_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "health", '0.5 0.5 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
-               DrawNumIcon(id, pos, mySize, x, biggercount, 1, HUD_Get_Num_Color(x, 2 * 200));
+               DrawNumIcon(autocvar_hud_healtharmor_iconalign, pos, mySize, x, biggercount, 1, HUD_Get_Num_Color(x, 2 * 200));
 
                // fuel
                if(fuel)
                {
-                       if(baralign == 0 || baralign == 3) { // left align
+                       if(autocvar_hud_healtharmor_baralign == 0 || autocvar_hud_healtharmor_baralign == 3) { // left align
                                barpos = pos + eX * mySize_x - eX * mySize_x * min(1, fuel/100);
                                barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
                        } else {
                                barpos = pos;
                                barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
                        }
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("fuel"), panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+                       HUD_Panel_GetProgressBarColor("fuel")
+                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
                }
        }
        else
@@ -2037,7 +2000,7 @@ void HUD_HealthArmor(void)
                float leftcnt, rightcnt;
                float leftactive, rightactive;
                float leftalpha, rightalpha;
-               if (cvar(strcat("hud_", panel_name, "_flip"))) { // old style layout with armor left/top of health
+               if (autocvar_hud_healtharmor_flip) { // old style layout with armor left/top of health
                        leftname = "armor";
                        leftcnt = armor;
                        if(leftcnt)
@@ -2065,7 +2028,7 @@ void HUD_HealthArmor(void)
                {
                        if(leftactive)
                        {
-                               if(baralign == 1 || baralign == 3) { // right align
+                               if(autocvar_hud_healtharmor_baralign == 1 || autocvar_hud_healtharmor_baralign == 3) { // right align
                                        barpos = pos + eX * 0.5 * mySize_x - eX * 0.5 * mySize_x * min(1, leftcnt/200);
                                        barsize = eX * 0.5 * mySize_x * min(1, leftcnt/200) + eY * mySize_y;
                                } else { // left align
@@ -2073,13 +2036,14 @@ void HUD_HealthArmor(void)
                                        barsize = eX * 0.5 * mySize_x * min(1, leftcnt/200) + eY * mySize_y;
                                }
 
-                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
-                               DrawNumIcon(id, pos, eX * 0.5 * mySize_x + eY * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, 200));
+                               HUD_Panel_GetProgressBarColor(leftname)
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               DrawNumIcon(autocvar_hud_healtharmor_iconalign, pos, eX * 0.5 * mySize_x + eY * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, 200));
                        }
 
                        if(rightactive)
                        {
-                               if(baralign == 0 || baralign == 3) { // left align
+                               if(autocvar_hud_healtharmor_baralign == 0 || autocvar_hud_healtharmor_baralign == 3) { // left align
                                        barpos = pos + eX * 0.5 * mySize_x;
                                        barsize = eX * 0.5 * mySize_x * min(1, rightcnt/200) + eY * mySize_y;
                                } else { // right align
@@ -2087,27 +2051,29 @@ void HUD_HealthArmor(void)
                                        barsize = eX * 0.5 * mySize_x * min(1, rightcnt/200) + eY * mySize_y;
                                }
 
-                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
-                               DrawNumIcon(id, pos + eX * 0.5 * mySize_x, eX * 0.5 * mySize_x + eY * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(leftcnt, 200));
+                               HUD_Panel_GetProgressBarColor(rightname)
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               DrawNumIcon(autocvar_hud_healtharmor_iconalign, pos + eX * 0.5 * mySize_x, eX * 0.5 * mySize_x + eY * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(leftcnt, 200));
                        }
 
                        if(fuel)
                        {
-                               if(baralign == 0 || baralign == 3) { // left align
+                               if(autocvar_hud_healtharmor_baralign == 0 || autocvar_hud_healtharmor_baralign == 3) { // left align
                                        barpos = pos + eX * mySize_x - eX * mySize_x * min(1, fuel/100);
                                        barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
                                } else {
                                        barpos = pos;
                                        barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
                                }
-                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("fuel"), panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+                               HUD_Panel_GetProgressBarColor("fuel")
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
                        }
                }
                else if (mySize_x/mySize_y > 1.5)
                {
                        if(leftactive)
                        {
-                               if(baralign == 1 || baralign == 3) { // right align
+                               if(autocvar_hud_healtharmor_baralign == 1 || autocvar_hud_healtharmor_baralign == 3) { // right align
                                        barpos = pos + eX * mySize_x - eX * mySize_x * min(1, leftcnt/200);
                                        barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
                                } else { // left align
@@ -2115,13 +2081,14 @@ void HUD_HealthArmor(void)
                                        barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
                                }
 
-                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
-                               DrawNumIcon(id, pos, eX * mySize_x + eY * 0.5 * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, 200));
+                               HUD_Panel_GetProgressBarColor(leftname)
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               DrawNumIcon(autocvar_hud_healtharmor_iconalign, pos, eX * mySize_x + eY * 0.5 * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, 200));
                        }
 
                        if(rightactive)
                        {
-                               if(baralign == 0 || baralign == 3) { // left align
+                               if(autocvar_hud_healtharmor_baralign == 0 || autocvar_hud_healtharmor_baralign == 3) { // left align
                                        barpos = pos + eY * 0.5 * mySize_y;
                                        barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
                                } else { // right align
@@ -2129,27 +2096,29 @@ void HUD_HealthArmor(void)
                                        barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
                                }
 
-                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
-                               DrawNumIcon(id, pos + eY * 0.5 * mySize_y, eX * mySize_x + eY * 0.5 * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(leftcnt, 200));
+                               HUD_Panel_GetProgressBarColor(rightname)
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               DrawNumIcon(autocvar_hud_healtharmor_iconalign, pos + eY * 0.5 * mySize_y, eX * mySize_x + eY * 0.5 * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(leftcnt, 200));
                        }
 
                        if(fuel)
                        {
-                               if(baralign == 0 || baralign == 3) { // left align
+                               if(autocvar_hud_healtharmor_baralign == 0 || autocvar_hud_healtharmor_baralign == 3) { // left align
                                        barpos = pos + eX * mySize_x - eX * mySize_x * min(1, fuel/100);
                                        barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.1 * mySize_y;
                                } else {
                                        barpos = pos;
                                        barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.1 * mySize_y;
                                }
-                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("fuel"), panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+                               HUD_Panel_GetProgressBarColor("fuel")
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
                        }
                }
                else
                {
                        if(leftactive)
                        {
-                               if(baralign == 1 || baralign == 3) { // down align
+                               if(autocvar_hud_healtharmor_baralign == 1 || autocvar_hud_healtharmor_baralign == 3) { // down align
                                        barpos = pos + eY * mySize_y - eY * mySize_y * min(1, leftcnt/200);
                                        barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/200);
                                } else { // up align
@@ -2157,7 +2126,7 @@ void HUD_HealthArmor(void)
                                        barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/200);
                                }
 
-                               if(iconalign == 1 || iconalign == 3) { // down align
+                               if(autocvar_hud_healtharmor_iconalign == 1 || autocvar_hud_healtharmor_iconalign == 3) { // down align
                                        picpos = pos + eX * 0.05 * mySize_x + eY * (mySize_y - 0.65 * mySize_x);
                                        numpos = pos + eY * mySize_y - eY * 0.25 * mySize_x;
                                } else { // up align
@@ -2165,14 +2134,15 @@ void HUD_HealthArmor(void)
                                        numpos = pos + eY * 0.4 * mySize_x;
                                }
 
-                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               HUD_Panel_GetProgressBarColor(leftname)
+                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                                drawpic_aspect_skin(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                                drawstring_aspect(numpos, ftos(leftcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, 0.25 * mySize_x, HUD_Get_Num_Color(leftcnt, 200), panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
 
                        if(rightactive)
                        {
-                               if(baralign == 0 || baralign == 3) { // up align
+                               if(autocvar_hud_healtharmor_baralign == 0 || autocvar_hud_healtharmor_baralign == 3) { // up align
                                        barpos = pos + eX * 0.5 * mySize_x;
                                        barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/200);
                                } else { // down align
@@ -2180,7 +2150,7 @@ void HUD_HealthArmor(void)
                                        barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/200);
                                }
 
-                               if(iconalign == 0 || iconalign == 3) { // up align
+                               if(autocvar_hud_healtharmor_iconalign == 0 || autocvar_hud_healtharmor_iconalign == 3) { // up align
                                        picpos = pos + eX * 0.05 * mySize_x + eX * 0.5 * mySize_x;
                                        numpos = pos + eY * 0.4 * mySize_x + eX * 0.5 * mySize_x;
                                } else { // down align
@@ -2188,24 +2158,27 @@ void HUD_HealthArmor(void)
                                        numpos = pos + eY * mySize_y - eY * 0.25 * mySize_x + eX * 0.5 * mySize_x;
                                }
 
-                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               HUD_Panel_GetProgressBarColor(rightname)
+                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                                drawpic_aspect_skin(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                                drawstring_aspect(numpos, ftos(rightcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, 0.25 * mySize_x, HUD_Get_Num_Color(rightcnt, 200), panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
 
                        if(fuel)
                        {
-                               if(baralign == 0 || baralign == 3) { // left align
+                               if(autocvar_hud_healtharmor_baralign == 0 || autocvar_hud_healtharmor_baralign == 3) { // left align
                                        barpos = pos;
                                        barsize = eX * 0.05 * mySize_x + eY * mySize_y * min(1, fuel/100);
                                } else {
                                        barpos = pos + eY * mySize_y - eY * mySize_y * min(1, fuel/100);
                                        barsize = eX * 0.05 * mySize_x + eY * mySize_y * min(1, fuel/100);
                                }
-                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor("fuel"), panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
+                               HUD_Panel_GetProgressBarColor("fuel")
+                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, panel_fg_alpha * 0.8, DRAWFLAG_NORMAL);
                        }
                }
        }
+       drawfont = hud_font;
 }
 
 // ___TODO___ !!!
@@ -2260,7 +2233,7 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
 {
        float w;
        float alsoprint;
-       alsoprint = (cvar("hud_notify_print") || !panel_enabled); // print message to console if: notify panel disabled, or cvar to do so enabled
+       alsoprint = (autocvar_hud_notify_print || !panel_enabled); // print message to console if: notify panel disabled, or cvar to do so enabled
        
        if(msg == MSG_SUICIDE) {
                // TODO: cl_gentle
@@ -2676,7 +2649,7 @@ void HUD_Notify (void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -2693,9 +2666,9 @@ void HUD_Notify (void)
 
        float a;
        float when;
-       when = cvar("hud_notify_time");
+       when = autocvar_hud_notify_time;
        float fadetime;
-       fadetime = cvar("hud_notify_fadetime");
+       fadetime = autocvar_hud_notify_fadetime;
 
        string s;
 
@@ -2707,11 +2680,11 @@ void HUD_Notify (void)
        float i, j;
        for(j = 0; j < entries; ++j)
        {
-               if(cvar("hud_notify_flip"))
+               if(autocvar_hud_notify_flip)
                        i = j;
                else // rather nasty hack for ordering items from the bottom up
                        i = entries - j - 1;
-               if(cvar("hud_notify_info_top"))
+               if(autocvar_hud_notify_info_top)
                        i += 2; // top/bottom two lines reserved for info messaged, such as spec instructions
 
                if(fadetime)
@@ -2921,7 +2894,7 @@ void HUD_Notify (void)
        entity tm;
        vector o;
        o = pos;
-       if(cvar("hud_notify_info_top"))
+       if(autocvar_hud_notify_info_top)
                o = pos + eY;
        else
                o = pos + eY * mySize_y - eY * 2 * height;
@@ -3087,7 +3060,7 @@ void HUD_Timer(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -3112,7 +3085,7 @@ void HUD_Timer(void)
        else
                timer_color = '1 0 0'; //red
 
-       if (cvar("hud_timer_increment") || timelimit == 0 || warmup_stage) {
+       if (autocvar_hud_timer_increment || timelimit == 0 || warmup_stage) {
                if (time < getstatf(STAT_GAMESTARTTIME)) {
                        //while restart is still active, show 00:00
                        timer = seconds_tostring(0);
@@ -3139,7 +3112,7 @@ void HUD_Radar(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -3264,7 +3237,7 @@ void HUD_Score(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -3414,7 +3387,7 @@ void HUD_RaceTimer (void) {
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -3597,9 +3570,9 @@ void HUD_VoteWindow(void)
        if(!vote_alpha)
                return;
 
-       a = vote_alpha * bound(cvar_or("hud_vote_alreadyvoted_alpha", 0.75), 1 - vote_highlighted, 1);
+       a = vote_alpha * bound(autocvar_hud_vote_alreadyvoted_alpha, 1 - vote_highlighted, 1);
 
-       HUD_Panel_DrawBg(id, pos, mySize, a);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -3999,7 +3972,8 @@ void HUD_Mod_NexBall(vector pos, vector mySize)
                        barsize = eX * mySize_x + eY * p * mySize_y;
                        vertical = 1;
                }
-               HUD_Panel_DrawProgressBar(pos, vertical, barsize, HUD_Panel_GetProgressBarColor("nexball"), cvar("hud_progressbar_alpha") * panel_fg_alpha, DRAWFLAG_NORMAL);
+               HUD_Panel_GetProgressBarColor("nexball")
+               HUD_Panel_DrawProgressBar(pos, vertical, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
        }
 
        if (stat_items & IT_KEY1)
@@ -4166,7 +4140,7 @@ void HUD_ModIcons(void)
                mod_alpha = bound(0, 1 - (time - mod_change) * 2, 1);
 
        if(mod_alpha)
-               HUD_Panel_DrawBg(id, pos, mySize, mod_alpha);
+               HUD_Panel_DrawBg(mod_alpha);
 
        if(panel_bg_padding)
        {
@@ -4195,7 +4169,7 @@ void HUD_DrawPressedKeys(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -4225,7 +4199,7 @@ void HUD_Chat(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -4274,7 +4248,7 @@ void HUD_EngineInfo(void)
        pos = panel_pos;
        mySize = panel_size;
 
-       HUD_Panel_DrawBg(id, pos, mySize, 0);
+       HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -4449,37 +4423,37 @@ void HUD_Main (void)
        {
                float i;
                // x-axis
-               for(i = 0; i < 1/bound(0.005, autocvar_hud_configure_grid_x, 0.2); ++i)
+               for(i = 0; i < 1/bound(0.005, autocvar_hud_configure_grid_xsize, 0.2); ++i)
                {
-                       drawfill(eX * i * vid_conwidth * bound(0.005, autocvar_hud_configure_grid_x, 0.2), eX + eY * vid_conheight, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
+                       drawfill(eX * i * vid_conwidth * bound(0.005, autocvar_hud_configure_grid_xsize, 0.2), eX + eY * vid_conheight, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
                }
                // y-axis
-               for(i = 0; i < 1/bound(0.005, autocvar_hud_configure_grid_y, 0.2); ++i)
+               for(i = 0; i < 1/bound(0.005, autocvar_hud_configure_grid_ysize, 0.2); ++i)
                {
-                       drawfill(eY * i * vid_conheight * bound(0.005, autocvar_hud_configure_grid_y, 0.2), eY + eX * vid_conwidth, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
+                       drawfill(eY * i * vid_conheight * bound(0.005, autocvar_hud_configure_grid_ysize, 0.2), eY + eX * vid_conwidth, '0.5 0.5 0.5', autocvar_hud_configure_grid_alpha, DRAWFLAG_NORMAL);
                }
        }
+       print("grid_xsize: ", ftos(autocvar_hud_configure_grid_xsize), "\n");
 
        float f;
-       vector color_vec;
-       string color;
-       color = cvar_string("hud_dock_color");
-       color_vec = stov(color);
-       if(teamplay && cvar(strcat("hud_dock_color_team"))) {
+       vector color;
+       if(teamplay && autocvar_hud_dock_color_team) {
                f = stof(getplayerkey(player_localentnum - 1, "colors"));
-               color_vec = colormapPaletteColor(mod(f, 16), 1) * cvar("hud_dock_color_team");
+               color = colormapPaletteColor(mod(f, 16), 1) * autocvar_hud_dock_color_team;
        }
-       else if(color == "shirt") {
+       else if(autocvar_hud_dock_color == "shirt") {
                f = stof(getplayerkey(player_localentnum - 1, "colors"));
-               color_vec = colormapPaletteColor(floor(f / 16), 0);
+               color = colormapPaletteColor(floor(f / 16), 0);
        }
-       else if(color == "pants") {
+       else if(autocvar_hud_dock_color == "pants") {
                f = stof(getplayerkey(player_localentnum - 1, "colors"));
-               color_vec = colormapPaletteColor(mod(f, 16), 1);
+               color = colormapPaletteColor(mod(f, 16), 1);
        }
+       else
+               color = stov(autocvar_hud_dock_color);
 
        if(autocvar_hud_dock != "" && autocvar_hud_dock != "0")
-               drawpic('0 0 0', strcat("gfx/hud/", autocvar_hud_skin, "/", autocvar_hud_dock), eX * vid_conwidth + eY * vid_conheight, color_vec, autocvar_hud_dock_alpha * menu_fade_alpha, DRAWFLAG_NORMAL); // no aspect ratio forcing on dock...
+               drawpic('0 0 0', strcat("gfx/hud/", autocvar_hud_skin, "/", autocvar_hud_dock), eX * vid_conwidth + eY * vid_conheight, color, autocvar_hud_dock_alpha * menu_fade_alpha, DRAWFLAG_NORMAL); // no aspect ratio forcing on dock...
 
        if(autocvar_hud_radar || autocvar__hud_configure)
                if(autocvar_hud_radar != 0 && (autocvar_hud_radar == 2 || teamplay))