]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
remove unused vector
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index 7b04825981468337e6ae206ff70a1df7ea4d845f..4e7628f3fdaf8da08018ac1eeadcff9c11b55ed3 100644 (file)
@@ -639,41 +639,46 @@ void HUD_Panel_ExportCfg(string cfgname)
        fclose(fh);
 }
 
-vector HUD_Panel_CheckLimitSize(float id, vector mySize)
+vector HUD_Panel_GetMinSize(float id)
 {
+       vector mySize;
+       // note: please only set mySize_y on aspect ratio forced panels
        switch(id) {
                case 0: 
-                       mySize_x = max(mySize_y * (1/10), mySize_x); // at least 1/10 * height
-                       mySize_y = max(mySize_x * (1/26), mySize_y); // at least 1/26 * width
+                       mySize_x = 1/10; // at least 1/10 * height
+                       mySize_y = 1/26; // at least 1/26 * width
                        break;
                case 1: 
-                       mySize_x = max(mySize_y * 0.7, mySize_x); // at least 0.7 * height
+                       if(cvar("hud_inventory_onlycurrent"))
+                               mySize_y = 2/5; //  2/5 width
+                       else
+                               mySize_x = 0.7; // at least 0.7 * height
+                       break;
+               case 3: 
+                       if(cvar("hud_healtharmor") == 2)
+                               mySize_y = 0.23; // 0.23 * width, trial and error...
                        break;
-               //case 2: 
-               //      mySize_x = max(mySize_y * 1.5, mySize_x); // at least 1.5 * height
-               //      break;
-               //case 3: 
-               //      mySize_x = max(mySize_y * 2, mySize_x); // at least 2 * height
-               //      break;
                case 5: 
-                       mySize_y = (1/4.1) * mySize_x; // 1/4.1 * width, trial and error...
+                       mySize_y = 1/4.1; // 1/4.1 * width, trial and error...
                        break;
                case 7: 
-                       mySize_y = (1/4) * mySize_x; // 1/4 * width
+                       mySize_y = 1/4; // 1/4 * width
                        break;
                case 8: 
-                       mySize_y = (1/4) * mySize_x; // 1/4 * width
+                       mySize_y = 1/4; // 1/4 * width
                        break;
                case 9: 
-                       mySize_y = (1/4) * mySize_x; // 1/4 * width
+                       mySize_y = 1/4; // 1/4 * width
                        break;
                case 10: 
-                       mySize_y = (1/2) * mySize_x; // 1/2 * width
+                       mySize_y = 1/2; // 1/2 * width
                        break;
                case 11: 
-                       mySize_y = 0.5898 * mySize_x; // 0.5898 * width, reason: bg has weird dimensions...
+                       mySize_y = 0.5898; // 0.5898 * width, reason: bg has weird dimensions...
                        break;
        }
+       if(!mySize_x)
+               mySize_x = 1/mySize_y;
        return mySize;
 }
 
@@ -722,12 +727,50 @@ float HUD_Panel_GetBorder(float id)
 
 vector HUD_Panel_GetColor(float id)
 {
-       // TODO: idea: let user choose colors "pants", "shirt"
+       float f;
+       vector color_vec;
        string color;
        color = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color"));
-       if(color == "")
+       color_vec = stov(color);
+       if(color == "") {
                color = cvar_string("hud_bg_color");
-       return stov(color);
+               color_vec = stov(color);
+               if(color == "shirt") {
+                       f = stof(getplayerkey(self.sv_entnum, "colors"));
+                       color_vec = colormapPaletteColor(floor(f / 16), 0);
+               }
+               else if(color == "pants") {
+                       f = stof(getplayerkey(self.sv_entnum, "colors"));
+                       color_vec = colormapPaletteColor(mod(f, 16), 1);
+               }
+       }
+       else if(color == "shirt") {
+               f = stof(getplayerkey(self.sv_entnum, "colors"));
+               color_vec = colormapPaletteColor(floor(f / 16), 0);
+       }
+       else if(color == "pants") {
+               f = stof(getplayerkey(self.sv_entnum, "colors"));
+               color_vec = colormapPaletteColor(mod(f, 16), 1);
+       }
+       return color_vec;
+}
+
+vector HUD_Panel_Dock_GetColor(void)
+{
+       float f;
+       vector color_vec;
+       string color;
+       color = cvar_string("hud_dock_color");
+       color_vec = stov(color);
+       if(color == "shirt") {
+               f = stof(getplayerkey(self.sv_entnum, "colors"));
+               color_vec = colormapPaletteColor(floor(f / 16), 0);
+       }
+       else if(color == "pants") {
+               f = stof(getplayerkey(self.sv_entnum, "colors"));
+               color_vec = colormapPaletteColor(mod(f, 16), 1);
+       }
+       return color_vec;
 }
 
 float HUD_Panel_GetAlpha(float id)
@@ -804,14 +847,13 @@ vector HUD_Panel_GetProgressBarColor(string item)
        return stov(cvar_string(strcat("hud_progressbar_", item, "_color")));
 }
 
-float resizeCorner; // 1 = topleft, 2 = topright, 3 = bottomleft, 4 = bottomright
-// check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
-vector HUD_Panel_CheckResize(float id, vector myPos, vector mySize)
+// 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(float id, vector myPos, vector mySize)
 {
        float i;
 
        vector myTarget;
-       myTarget = mySize;
+       myTarget = myPos;
 
        vector targPos;
        vector targSize;
@@ -824,9 +866,6 @@ vector HUD_Panel_CheckResize(float id, vector myPos, vector mySize)
                if(i == id || !HUD_Panel_CheckActive(i))
                        continue;
 
-               targPos = HUD_Panel_GetPos(i);
-               targSize = HUD_Panel_GetSize(i);
-
                targPos = HUD_Panel_GetPos(i) - '1 1 0' * HUD_Panel_GetBorder(id);
                targSize = HUD_Panel_GetSize(i) + '2 2 0' * HUD_Panel_GetBorder(id);
 
@@ -848,24 +887,24 @@ 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;
 
-               if(myCenter_x < targCenter_x && myCenter_y < targCenter_y && resizeCorner != 1) // top left (of target panel)
+               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 - myPos_x;
+                               myTarget_x = targPos_x - mySize_x;
                        else // push it upwards
-                               myTarget_y = targPos_y - myPos_y;
+                               myTarget_y = targPos_y - mySize_y;
                }
-               else if(myCenter_x > targCenter_x && myCenter_y < targCenter_y && resizeCorner != 2) // top right
+               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;
                        else // push it upwards
-                               myTarget_y = targPos_y - myPos_y;
+                               myTarget_y = targPos_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 - myPos_x;
+                               myTarget_x = targPos_x - mySize_x;
                        else // push it downwards
                                myTarget_y = targPos_y + targSize_y;
                }
@@ -881,58 +920,44 @@ vector HUD_Panel_CheckResize(float id, vector myPos, vector mySize)
        return myTarget;
 }
 
-// TODO: checkResize
-float HUD_Panel_SetSize(float id, vector mySize)
+void HUD_Panel_SetPos(float id, vector pos)
 {
-       float didntresize;
-
-       vector oldSize;
-       oldSize = stov(cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_size")));
+       vector oldPos;
+       oldPos = HUD_Panel_GetPos(id);
 
-       vector myPos;
-       myPos = HUD_Panel_GetPos(id);
+       vector mySize;
+       mySize = HUD_Panel_GetSize(id);
 
-       // check for collisions
        if(cvar("hud_configure_checkcollisions"))
-               mySize = HUD_Panel_CheckResize(id, HUD_Panel_GetPos(id), mySize);
-
-       mySize_x = bound(0.025 * vid_conwidth, mySize_x, vid_conwidth - myPos_x);
-       mySize_y = bound(0.025 * vid_conheight, mySize_y, vid_conheight - myPos_y);
-
-       // cap against panel's own limits
-       mySize = HUD_Panel_CheckLimitSize(id, mySize);
+               pos = HUD_Panel_CheckMove(id, pos, mySize);
 
-       //mySize_x = bound(0.025 * vid_conwidth, mySize_x, vid_conwidth);
-       //mySize_y = bound(0.025 * vid_conheight, mySize_y, vid_conheight);
+       pos_x = bound(0, pos_x, vid_conwidth - mySize_x);
+       pos_y = bound(0, pos_y, vid_conheight - mySize_y);
 
        if(cvar("hud_configure_grid"))
        {
-               mySize_x = floor(mySize_x/cvar("hud_configure_grid_x") + 0.5) * cvar("hud_configure_grid_x");
-               mySize_y = floor(mySize_y/cvar("hud_configure_grid_y") + 0.5) * cvar("hud_configure_grid_y");
+               pos_x = floor(pos_x/cvar("hud_configure_grid_x") + 0.5) * cvar("hud_configure_grid_x");
+               pos_y = floor(pos_y/cvar("hud_configure_grid_y") + 0.5) * cvar("hud_configure_grid_y");
        }
 
-       // TODO: is this needed?
-       // this is to check if (and how) SetPos should be called
-       if(mySize_x == oldSize_x && mySize_y == oldSize_y)
-               didntresize = 3; // didnt resize either
-       else if(mySize_x == oldSize_x && mySize_y != oldSize_y)
-               didntresize = 2; // resized Y
-       else if(mySize_y == oldSize_y && mySize_x != oldSize_x)
-               didntresize = 1; // resized X
+       if (pos_x + 0.5 * mySize_x > 0.5 * vid_conwidth)
+               pos_x = pos_x - vid_conwidth;
+       if (pos_y + 0.5 * mySize_y > 0.5 * vid_conheight)
+               pos_y = pos_y - vid_conheight;
 
        string s;
-       s = strcat(ftos(mySize_x/vid_conwidth), " ", ftos(mySize_y/vid_conheight));
-       cvar_set(strcat("hud_", HUD_Panel_GetName(id), "_size"), s);
-       return didntresize;
+       s = strcat(ftos(pos_x/vid_conwidth), " ", ftos(pos_y/vid_conheight));
+
+       cvar_set(strcat("hud_", HUD_Panel_GetName(id), "_pos"), s);
 }
 
-// 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(float id, vector myPos, vector mySize)
+// check if resize will result in panel being moved into another panel. If so, return snapped vector, otherwise return the given vector
+vector HUD_Panel_CheckResize(float id, vector myPos, vector mySize)
 {
        float i;
 
        vector myTarget;
-       myTarget = myPos;
+       myTarget = mySize;
 
        vector targPos;
        vector targSize;
@@ -945,6 +970,9 @@ vector HUD_Panel_CheckMove(float id, vector myPos, vector mySize)
                if(i == id || !HUD_Panel_CheckActive(i))
                        continue;
 
+               targPos = HUD_Panel_GetPos(i);
+               targSize = HUD_Panel_GetSize(i);
+
                targPos = HUD_Panel_GetPos(i) - '1 1 0' * HUD_Panel_GetBorder(id);
                targSize = HUD_Panel_GetSize(i) + '2 2 0' * HUD_Panel_GetBorder(id);
 
@@ -966,24 +994,24 @@ 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;
 
-               if(myCenter_x < targCenter_x && myCenter_y < targCenter_y) // top left (of the target panel)
+               if(myCenter_x < targCenter_x && myCenter_y < targCenter_y) // top left (of 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;
+                               myTarget_x = targPos_x - myPos_x;
                        else // push it upwards
-                               myTarget_y = targPos_y - mySize_y;
+                               myTarget_y = targPos_y - myPos_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;
                        else // push it upwards
-                               myTarget_y = targPos_y - mySize_y;
+                               myTarget_y = targPos_y - myPos_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;
+                               myTarget_x = targPos_x - myPos_x;
                        else // push it downwards
                                myTarget_y = targPos_y + targSize_y;
                }
@@ -999,40 +1027,95 @@ vector HUD_Panel_CheckMove(float id, vector myPos, vector mySize)
        return myTarget;
 }
 
-void HUD_Panel_SetPos(float id, vector pos, float didntresize)
+void HUD_Panel_SetPosSize(float id, vector resizeorigin)
 {
+       vector mySize, myPos;
        vector oldPos;
-       oldPos = HUD_Panel_GetPos(id);
-       if(didntresize == 2)
-               pos_x = oldPos_x;
-       else if(didntresize == 1)
-               pos_y = oldPos_y;
-       else if(didntresize == 3)
-               return;
 
-       vector mySize;
-       mySize = HUD_Panel_GetSize(id);
+       if(resizeCorner == 1) {
+               mySize_x = resizeorigin_x - (mousepos_x - panel_click_distance_x);
+               mySize_y = resizeorigin_y - (mousepos_y - panel_click_distance_y);
+       } else if(resizeCorner == 2) {          
+               mySize_x = mousepos_x + panel_click_distance_x - resizeorigin_x;
+               mySize_y = panel_click_distance_y + resizeorigin_y - mousepos_y;
+       } else if(resizeCorner == 3) {
+               mySize_x = resizeorigin_x + panel_click_distance_x - mousepos_x;
+               mySize_y = mousepos_y + panel_click_distance_y - resizeorigin_y;
+       } else { // resizeCorner == 4
+               mySize_x = mousepos_x - (resizeorigin_x - panel_click_distance_x);
+               mySize_y = mousepos_y - (resizeorigin_y - panel_click_distance_y);
+       }
 
-       if(cvar("hud_configure_checkcollisions"))
-               pos = HUD_Panel_CheckMove(id, pos, mySize);
+       // minimum panel size cap
+       mySize_x = max(0.025 * vid_conwidth, mySize_x);
+       mySize_y = max(0.025 * vid_conheight, mySize_y);
 
-       pos_x = bound(0, pos_x, vid_conwidth - mySize_x);
-       pos_y = bound(0, pos_y, vid_conheight - mySize_y);
+       // cap against panel's own limits
+       vector minSize;
+       minSize = HUD_Panel_GetMinSize(id); // mySize_x at least minSize_x * mySize_y, and vice versa
+
+       mySize_x = max(minSize_x * mySize_y, mySize_x);
+       mySize_y = max(minSize_y * mySize_x, mySize_y);
+
+       // collision testing|
+       // -----------------+
+
+       // we need to know pos at this stage, but it might still change later if we hit a screen edge/other panel (?)
+       if(resizeCorner == 1) {
+               myPos_x = resizeorigin_x - mySize_x;
+               myPos_y = resizeorigin_y - mySize_y;
+       } else if(resizeCorner == 2) {
+               myPos_x = resizeorigin_x;
+               myPos_y = resizeorigin_y - mySize_y;
+       } else if(resizeCorner == 3) {
+               myPos_x = resizeorigin_x - mySize_x;
+               myPos_y = resizeorigin_y;
+       } else { // resizeCorner == 4
+               myPos_x = resizeorigin_x;
+               myPos_y = resizeorigin_y;
+       }
+
+       // left/top screen edges
+       mySize_x = min(myPos_x + mySize_x, mySize_x);
+       mySize_y = min(myPos_y + mySize_y, mySize_y);
+
+       // bottom/right screen edges
+       mySize_x = min(vid_conwidth - myPos_x, mySize_x); 
+       mySize_y = min(vid_conheight - myPos_y, mySize_y); 
+
+       if(cvar("hud_configure_checkcollisions")) {
+               oldPos = myPos;
+               mySize = HUD_Panel_CheckResize(id, myPos, mySize);
+               myPos = HUD_Panel_CheckMove(id, myPos, mySize); // touching myPos won't do anything... unless we make it change mySize somehow, see next line
+               mySize = mySize - myPos + oldPos; // TODO: this is still borked in some situations :(
+       }
 
        if(cvar("hud_configure_grid"))
        {
-               pos_x = floor(pos_x/cvar("hud_configure_grid_x") + 0.5) * cvar("hud_configure_grid_x");
-               pos_y = floor(pos_y/cvar("hud_configure_grid_y") + 0.5) * cvar("hud_configure_grid_y");
+               mySize_x = floor(mySize_x/cvar("hud_configure_grid_x") + 0.5) * cvar("hud_configure_grid_x");
+               mySize_y = floor(mySize_y/cvar("hud_configure_grid_y") + 0.5) * cvar("hud_configure_grid_y");
        }
 
-       if (pos_x + 0.5 * mySize_x > 0.5 * vid_conwidth)
-               pos_x = pos_x - vid_conwidth;
-       if (pos_y + 0.5 * mySize_y > 0.5 * vid_conheight)
-               pos_y = pos_y - vid_conheight;
+       // do another pos check, as size might have changed by now
+       if(resizeCorner == 1) {
+               myPos_x = resizeorigin_x - mySize_x;
+               myPos_y = resizeorigin_y - mySize_y;
+       } else if(resizeCorner == 2) {
+               myPos_x = resizeorigin_x;
+               myPos_y = resizeorigin_y - mySize_y;
+       } else if(resizeCorner == 3) {
+               myPos_x = resizeorigin_x - mySize_x;
+               myPos_y = resizeorigin_y;
+       } else { // resizeCorner == 4
+               myPos_x = resizeorigin_x;
+               myPos_y = resizeorigin_y;
+       }
 
        string s;
-       s = strcat(ftos(pos_x/vid_conwidth), " ", ftos(pos_y/vid_conheight));
+       s = strcat(ftos(mySize_x/vid_conwidth), " ", ftos(mySize_y/vid_conheight));
+       cvar_set(strcat("hud_", HUD_Panel_GetName(id), "_size"), s);
 
+       s = strcat(ftos(myPos_x/vid_conwidth), " ", ftos(myPos_y/vid_conheight));
        cvar_set(strcat("hud_", HUD_Panel_GetName(id), "_pos"), s);
 }
 
@@ -1055,12 +1138,6 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
        return false;
 }
 
-vector mousepos, mouseprevpos;
-vector panel_click_distance; // mouse cursor distance from the top left corner of the panel (saved only upon a click)
-vector panel_click_pos; // panel pos (saved only upon a click)
-vector panel_click_size; // panel size (saved only upon a click)
-float highlightedPanel;
-float highlightedAction; // 0 = nothing, 1 = move, 2 = resize
 void HUD_Panel_Mouse()
 {
        if(mouseClicked == 0) {
@@ -1127,48 +1204,38 @@ void HUD_Panel_Mouse()
                        {
                                if(prevMouseClicked == 0)
                                {
-                                       panel_click_distance = mousepos - panelPos;
-                                       panel_click_pos = panelPos;
-                                       panel_click_size = panelSize;
+                                       if(highlightedAction == 1)
+                                               panel_click_distance = mousepos - panelPos;
+                                       else if(highlightedAction == 2)
+                                       {
+                                               if(resizeCorner == 1) {
+                                                       panel_click_distance = mousepos - panelPos;
+                                                       panel_click_resizeorigin = panelPos + panelSize;
+                                               } else if(resizeCorner == 2) {
+                                                       panel_click_distance_x = panelSize_x - mousepos_x + panelPos_x;
+                                                       panel_click_distance_y = mousepos_y - panelPos_y;
+                                                       panel_click_resizeorigin = panelPos + eY * panelSize_y;
+                                               } else if(resizeCorner == 3) {
+                                                       panel_click_distance_x = mousepos_x - panelPos_x;
+                                                       panel_click_distance_y = panelSize_y - mousepos_y + panelPos_y;
+                                                       panel_click_resizeorigin = panelPos + eX * panelSize_x;
+                                               } else if(resizeCorner == 4) {
+                                                       panel_click_distance = panelSize - mousepos + panelPos;
+                                                       panel_click_resizeorigin = panelPos;
+                                               }
+                                       }       
                                }
 
                                if(highlightedAction == 1)
-                                       HUD_Panel_SetPos(i, mousepos - panel_click_distance, 0);
+                                       HUD_Panel_SetPos(i, mousepos - panel_click_distance);
                                else if(highlightedAction == 2)
-                               {
-                                       float didntresize; // panel too big/too small, dont resize (also has to affect moving)
-                                       if(resizeCorner == 1) {
-                                               didntresize = HUD_Panel_SetSize(i, panelSize + mouseprevpos - mousepos);
-                                               HUD_Panel_SetPos(i, mousepos - panel_click_distance, didntresize);
-                                       }
-                                       if(resizeCorner == 2) {
-                                               didntresize = HUD_Panel_SetSize(i, eY * panel_click_size_y + eX * (mousepos_x - panelPos_x - (panel_click_distance_x - panel_click_size_x))
-                                                               + eY * (panel_click_distance_y + (panel_click_pos_y - mousepos_y)));
-                                               HUD_Panel_SetPos(i, eX * panelPos_x + eY * (mousepos_y - panel_click_distance_y), didntresize);
-                                       }
-                                       if(resizeCorner == 3) {
-                                               didntresize = HUD_Panel_SetSize(i, panelSize + eX * (mouseprevpos_x - mousepos_x) + eY * (mousepos_y - mouseprevpos_y));
-                                               HUD_Panel_SetPos(i, eX * (mousepos_x - panel_click_distance_x) + eY * panelPos_y, didntresize);
-                                       }
-                                       if(resizeCorner == 4) {
-                                               HUD_Panel_SetSize(i, mousepos - panelPos - (panel_click_distance - panel_click_size));
-                                       }
-                               }
+                                       HUD_Panel_SetPosSize(i, panel_click_resizeorigin);
                        }
                }
        }
-       mouseprevpos = mousepos;
        prevMouseClicked = mouseClicked;
 }
 
-/*void HUD_DrawDockEdge(float id, vector p1, vector p2, float target)
-{
-       vector pos;
-       vector size;
-
-       pos =
-*/ // maybe one day, since this will be quite complicated
-
 // Weapon icons (#0)
 //
 float weaponspace[10];
@@ -1370,11 +1437,11 @@ void HUD_Inventory()
 
                if(cvar("hud_inventory_onlycurrent")) {
                        if (stat_items & GetAmmoItemCode(i)) {
-                               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);
+                               drawpic_skin(pos, GetAmmoPicture(i), '1 1 0' * 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);
+                                       HUD_DrawXNum(pos + eX * 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);
                                else
-                                       HUD_DrawXNum(pos + eX * 0.8 * mySize_y + eY * 0.25 * mySize_y, a, strlen(ftos(a)), 0, 0.5 * mySize_y, '1 1 1', 0, 0, hud_alpha_fg, DRAWFLAG_NORMAL);
+                                       HUD_DrawXNum(pos + eX * mySize_y + eY * 0.25 * mySize_y, a, strlen(ftos(a)), 0, 0.5 * mySize_y, '1 1 1', 0, 0, hud_alpha_fg, DRAWFLAG_NORMAL);
                        }
                } else {
                        if (a > 0) {
@@ -1687,229 +1754,225 @@ void HUD_HealthArmor(void)
 
        float len;
 
-       // TODO!
-       /*
-       if(hud_hudselector == 2) // combined health and armor display
+       if(cvar("hud_healtharmor") == 2) // combined health and armor display
        {
                vector v;
                v = healtharmor_maxdamage(health, armor, armorblockpercent);
 
-               vector num_pos;
-               num_pos = - '96 28 0';
-
+               float x;
                x = floor(v_x + 1);
 
-               if(v_z) // fully armored
+               if(v_z) // NOT fully armored
                {
-                       // here, armorideal > armor
-                       drawpic_skin(num_pos + '78 -4.5 0', "health", '32 32 0', '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
-                       drawpic_skin(num_pos + '108 -4.5 0', "armor", '20 20 0', '1 1 1', hud_alpha_fg * armor / v_y, DRAWFLAG_NORMAL);
+                       drawpic_skin(pos + eX * 3 * mySize_y, "health", '1 1 0' * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
+                       if(armor)
+                               drawpic_skin(pos + eX * 4 * mySize_y, "armor", '0.5 0.5 0' * mySize_y, '1 1 1', hud_alpha_fg * armor / health, DRAWFLAG_NORMAL);
                }
                else
                {
-                       drawpic_skin(num_pos + '108 -4.5 0', "health", '20 20 0', '1 1 1', hud_alpha_fg * v_y / armor, DRAWFLAG_NORMAL);
-                       drawpic_skin(num_pos + '78 -4.5 0', "armor", '32 32 0', '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
+                       drawpic_skin(pos + eX * 4 * mySize_y, "health", '0.5 0.5 0' * mySize_y, '1 1 1', hud_alpha_fg * health / armor, DRAWFLAG_NORMAL);
+                       if(armor)
+                               drawpic_skin(pos + eX * 3 * mySize_y, "armor", '1 1 0' * mySize_y, '1 1 1', hud_alpha_fg, DRAWFLAG_NORMAL);
                }
-               HUD_DrawXNum_Colored(num_pos, x, 3, 24, hud_alpha_fg); // draw the combined health and armor
+               HUD_DrawXNum_Colored(pos, x, 3, mySize_y, hud_alpha_fg); // draw the combined health and armor
        }
 
        else
        {
-       */
-       vector barpos, barsize;
-       vector picpos;
-       vector numpos;
-
-       string leftname, rightname;
-       float leftcnt, rightcnt;
-       float leftactive, rightactive;
-       float leftalpha, rightalpha;
-       // TODO!
-       if (cvar(strcat("hud_", HUD_Panel_GetName(id), "_flip"))) { // old style layout with armor left/top of health
-               leftname = "armor";
-               leftcnt = armor;
-               if(leftcnt)
+               vector barpos, barsize;
+               vector picpos;
+               vector numpos;
+
+               string leftname, rightname;
+               float leftcnt, rightcnt;
+               float leftactive, rightactive;
+               float leftalpha, rightalpha;
+               if (cvar(strcat("hud_", HUD_Panel_GetName(id), "_flip"))) { // old style layout with armor left/top of health
+                       leftname = "armor";
+                       leftcnt = armor;
+                       if(leftcnt)
+                               leftactive = 1;
+                       leftalpha = min((armor+10)/55, 1);
+
+                       rightname = "health";
+                       rightcnt = health;
+                       rightactive = 1;
+                       rightalpha = 1;
+               } else {
+                       leftname = "health";
+                       leftcnt = health;
                        leftactive = 1;
-               leftalpha = min((armor+10)/55, 1);
+                       leftalpha = 1;
 
-               rightname = "health";
-               rightcnt = health;
-               rightactive = 1;
-               rightalpha = 1;
-       } else {
-               leftname = "health";
-               leftcnt = health;
-               leftactive = 1;
-               leftalpha = 1;
-
-               rightname = "armor";
-               rightcnt = armor;
-               if(rightcnt)
-                       rightactive = 1;
-               rightalpha = min((armor+10)/55, 1);
-       }
+                       rightname = "armor";
+                       rightcnt = armor;
+                       if(rightcnt)
+                               rightactive = 1;
+                       rightalpha = min((armor+10)/55, 1);
+               }
 
-       if (mySize_x/mySize_y > 5)
-       {
-               if(leftactive)
+               if (mySize_x/mySize_y > 5)
                {
-                       len = strlen(ftos(leftcnt));
+                       if(leftactive)
+                       {
+                               len = strlen(ftos(leftcnt));
 
-                       if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
-                               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;
-                               picpos = pos + eX * 0.5 * mySize_x - eX * mySize_y;
-                               numpos = picpos - eX * 3 * 0.5 * mySize_y + eX * (3-len) * 0.5 * mySize_y + eY * 0.25 * mySize_y;
-                       } else {
-                               barpos = pos;
-                               barsize = eX * 0.5 * mySize_x * min(1, leftcnt/200) + eY * mySize_y;
-                               picpos = pos;
-                               numpos = picpos + eX * mySize_y + eY * 0.25 * mySize_y;
+                               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                                       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;
+                                       picpos = pos + eX * 0.5 * mySize_x - eX * mySize_y;
+                                       numpos = picpos - eX * 3 * 0.5 * mySize_y + eX * (3-len) * 0.5 * mySize_y + eY * 0.25 * mySize_y;
+                               } else {
+                                       barpos = pos;
+                                       barsize = eX * 0.5 * mySize_x * min(1, leftcnt/200) + eY * mySize_y;
+                                       picpos = pos;
+                                       numpos = picpos + eX * mySize_y + eY * 0.25 * mySize_y;
+                               }
+
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha"), DRAWFLAG_NORMAL);
+                               drawpic_skin(picpos, leftname, '1 1 0' * mySize_y, '1 1 1', leftalpha * hud_alpha_fg, DRAWFLAG_NORMAL);
+                               HUD_DrawXNum_Colored(numpos, leftcnt, len, 0.5 * mySize_y, hud_alpha_fg);
                        }
 
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha"), DRAWFLAG_NORMAL);
-                       drawpic_skin(picpos, leftname, '1 1 0' * mySize_y, '1 1 1', leftalpha * hud_alpha_fg, DRAWFLAG_NORMAL);
-                       HUD_DrawXNum_Colored(numpos, leftcnt, len, 0.5 * mySize_y, hud_alpha_fg);
-               }
+                       if(rightactive)
+                       {
+                               len = strlen(ftos(rightcnt));
 
-               if(rightactive)
-               {
-                       len = strlen(ftos(rightcnt));
+                               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                                       barpos = pos + eX * 0.5 * mySize_x;
+                                       barsize = eX * 0.5 * mySize_x * min(1, rightcnt/200) + eY * mySize_y;
+                                       picpos = pos + eX * 0.5 * mySize_x;
+                                       numpos = picpos + eX * mySize_y - eX * (3-len) * 0.5 * mySize_y + eY * 0.25 * mySize_y;
+                               } else {
+                                       barpos = pos + eX * mySize_x - eX * 0.5 * mySize_x * min(1, rightcnt/200);
+                                       barsize = eX * 0.5 * mySize_x * min(1, rightcnt/200) + eY * mySize_y;
+                                       picpos = pos + eX * mySize_x - eX * mySize_y;
+                                       numpos = picpos - eX * 1.5 * mySize_y + eY * 0.25 * mySize_y;
+                               }
+
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha"), DRAWFLAG_NORMAL);
+                               drawpic_skin(picpos, rightname, '1 1 0' * mySize_y, '1 1 1', rightalpha * hud_alpha_fg, DRAWFLAG_NORMAL);
+                               HUD_DrawXNum_Colored(numpos, rightcnt, 3, 0.5 * mySize_y, hud_alpha_fg);
+                       }
 
                        if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
-                               barpos = pos + eX * 0.5 * mySize_x;
-                               barsize = eX * 0.5 * mySize_x * min(1, rightcnt/200) + eY * mySize_y;
-                               picpos = pos + eX * 0.5 * mySize_x;
-                               numpos = picpos + eX * mySize_y - eX * (3-len) * 0.5 * mySize_y + eY * 0.25 * mySize_y;
+                               barpos = pos - eX * mySize_x * min(1, fuel/100);
+                               barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
                        } else {
-                               barpos = pos + eX * mySize_x - eX * 0.5 * mySize_x * min(1, rightcnt/200);
-                               barsize = eX * 0.5 * mySize_x * min(1, rightcnt/200) + eY * mySize_y;
-                               picpos = pos + eX * mySize_x - eX * mySize_y;
-                               numpos = picpos - eX * 1.5 * mySize_y + eY * 0.25 * mySize_y;
+                               barpos = pos;
+                               barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
                        }
-
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha"), DRAWFLAG_NORMAL);
-                       drawpic_skin(picpos, rightname, '1 1 0' * mySize_y, '1 1 1', rightalpha * hud_alpha_fg, DRAWFLAG_NORMAL);
-                       HUD_DrawXNum_Colored(numpos, rightcnt, 3, 0.5 * mySize_y, hud_alpha_fg);
-               }
-
-               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
-                       barpos = pos - 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;
+                       if(fuel)
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("fuel"), hud_alpha_fg * 0.8, DRAWFLAG_NORMAL);
                }
-               if(fuel)
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("fuel"), hud_alpha_fg * 0.8, DRAWFLAG_NORMAL);
-       }
-       else if (mySize_x/mySize_y > 2)
-       {
-               if(leftactive)
+               else if (mySize_x/mySize_y > 2)
                {
-                       len = strlen(ftos(leftcnt));
+                       if(leftactive)
+                       {
+                               len = strlen(ftos(leftcnt));
 
-                       if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
-                               barpos = pos + eX * mySize_x - eX * mySize_x * min(1, leftcnt/200);
-                               barsize = eX * mySize_x * min(1, leftcnt/200) + eY * 0.5 * mySize_y;
-                               picpos = pos + eX * mySize_x - eX * 0.5 * mySize_y;
-                               numpos = picpos - eX * len * 0.5 * mySize_y;
-                       } else {
-                               barpos = pos;
-                               barsize = eX * mySize_x * min(1, leftcnt/200) + eY * 0.5 * mySize_y;
-                               picpos = pos;
-                               numpos = picpos + eX * 0.5 * mySize_y;
+                               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                                       barpos = pos + eX * mySize_x - eX * mySize_x * min(1, leftcnt/200);
+                                       barsize = eX * mySize_x * min(1, leftcnt/200) + eY * 0.5 * mySize_y;
+                                       picpos = pos + eX * mySize_x - eX * 0.5 * mySize_y;
+                                       numpos = picpos - eX * len * 0.5 * mySize_y;
+                               } else {
+                                       barpos = pos;
+                                       barsize = eX * mySize_x * min(1, leftcnt/200) + eY * 0.5 * mySize_y;
+                                       picpos = pos;
+                                       numpos = picpos + eX * 0.5 * mySize_y;
+                               }
+
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha"), DRAWFLAG_NORMAL);
+                               drawpic_skin(picpos, leftname, '0.5 0.5 0' * mySize_y, '1 1 1', leftalpha * hud_alpha_fg, DRAWFLAG_NORMAL);
+                               HUD_DrawXNum_Colored(numpos, leftcnt, len, 0.5 * mySize_y, hud_alpha_fg);
                        }
 
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha"), DRAWFLAG_NORMAL);
-                       drawpic_skin(picpos, leftname, '0.5 0.5 0' * mySize_y, '1 1 1', leftalpha * hud_alpha_fg, DRAWFLAG_NORMAL);
-                       HUD_DrawXNum_Colored(numpos, leftcnt, len, 0.5 * mySize_y, hud_alpha_fg);
-               }
+                       if(rightactive)
+                       {
+                               len = strlen(ftos(rightcnt));
 
-               if(rightactive)
-               {
-                       len = strlen(ftos(rightcnt));
+                               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                                       barpos = pos + eX * mySize_x - eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
+                                       barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
+                                       picpos = pos + eX * mySize_x - eX * 0.5 * mySize_y + eY * 0.5 * mySize_y;
+                                       numpos = picpos - eX * len * 0.5 * mySize_y;
+                               } else {
+                                       barpos = pos + eY * 0.5 * mySize_y;
+                                       barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
+                                       picpos = pos + eY * 0.5 * mySize_y;
+                                       numpos = picpos + eX * 0.5 * mySize_y;
+                               }
+
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha"), DRAWFLAG_NORMAL);
+                               drawpic_skin(picpos, rightname, '0.5 0.5 0' * mySize_y, '1 1 1', rightalpha * hud_alpha_fg, DRAWFLAG_NORMAL);
+                               HUD_DrawXNum_Colored(numpos, rightcnt, len, 0.5 * mySize_y, hud_alpha_fg);
+                       }
 
                        if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
-                               barpos = pos + eX * mySize_x - eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
-                               barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
-                               picpos = pos + eX * mySize_x - eX * 0.5 * mySize_y + eY * 0.5 * mySize_y;
-                               numpos = picpos - eX * len * 0.5 * mySize_y;
+                               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 + eY * 0.5 * mySize_y;
-                               barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
-                               picpos = pos + eY * 0.5 * mySize_y;
-                               numpos = picpos + eX * 0.5 * mySize_y;
+                               barpos = pos;
+                               barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.1 * mySize_y;
                        }
-
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha"), DRAWFLAG_NORMAL);
-                       drawpic_skin(picpos, rightname, '0.5 0.5 0' * mySize_y, '1 1 1', rightalpha * hud_alpha_fg, DRAWFLAG_NORMAL);
-                       HUD_DrawXNum_Colored(numpos, rightcnt, len, 0.5 * mySize_y, hud_alpha_fg);
-               }
-
-               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
-                       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;
+                       if(fuel)
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("fuel"), hud_alpha_fg * 0.8, DRAWFLAG_NORMAL);
                }
-               if(fuel)
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("fuel"), hud_alpha_fg * 0.8, DRAWFLAG_NORMAL);
-       }
-       else
-       {
-               if(leftactive)
+               else
                {
-                       len = strlen(ftos(leftcnt));
+                       if(leftactive)
+                       {
+                               len = strlen(ftos(leftcnt));
 
-                       if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
-                               barpos = pos;
-                               barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/200);
-                               picpos = pos + eX * 0.05 * mySize_x;
-                               numpos = pos + eX * ((3-len)/2) * 0.25 * mySize_x + eY * 0.4 * mySize_x;
-                       } else {
-                               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);
-                               picpos = pos + eX * 0.05 * mySize_x + eY * mySize_y - eY * 0.566 * mySize_x;
-                               numpos = pos + eX * ((3-len)/2) * 0.25 * mySize_x + eY * mySize_y - eY * 0.166 * mySize_x;
+                               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                                       barpos = pos;
+                                       barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/200);
+                                       picpos = pos + eX * 0.05 * mySize_x;
+                                       numpos = pos + eX * ((3-len)/2) * 0.25 * mySize_x + eY * 0.4 * mySize_x;
+                               } else {
+                                       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);
+                                       picpos = pos + eX * 0.05 * mySize_x + eY * mySize_y - eY * 0.566 * mySize_x;
+                                       numpos = pos + eX * ((3-len)/2) * 0.25 * mySize_x + eY * mySize_y - eY * 0.166 * mySize_x;
+                               }
+
+                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha"), DRAWFLAG_NORMAL);
+                               drawpic_skin(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * hud_alpha_fg, DRAWFLAG_NORMAL);
+                               HUD_DrawXNum_Colored(numpos, leftcnt, len, 0.166 * mySize_x, hud_alpha_fg);
                        }
 
-                       HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha"), DRAWFLAG_NORMAL);
-                       drawpic_skin(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * hud_alpha_fg, DRAWFLAG_NORMAL);
-                       HUD_DrawXNum_Colored(numpos, leftcnt, len, 0.166 * mySize_x, hud_alpha_fg);
-               }
+                       if(rightactive)
+                       {
+                               len = strlen(ftos(rightcnt));
 
-               if(rightactive)
-               {
-                       len = strlen(ftos(rightcnt));
+                               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                                       barpos = pos + eX * 0.5 * mySize_x;
+                                       barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/200);
+                                       picpos = pos + eX * 0.05 * mySize_x + eX * 0.5 * mySize_x;
+                                       numpos = pos + eX * ((3-len)/2) * 0.25 * mySize_x + eY * 0.4 * mySize_x + eX * 0.5 * mySize_x;
+                               } else {
+                                       barpos = pos + eY * mySize_y - eY * mySize_y * min(1, rightcnt/200) + eX * 0.5 * mySize_x;
+                                       barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/200);
+                                       picpos = pos + eX * 0.05 * mySize_x + eY * mySize_y - eY * 0.566 * mySize_x + eX * 0.5 * mySize_x;
+                                       numpos = pos + eX * ((3-len)/2) * 0.25 * mySize_x + eY * mySize_y - eY * 0.166 * mySize_x + eX * 0.5 * mySize_x;
+                               }
+
+                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha"), DRAWFLAG_NORMAL);
+                               drawpic_skin(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * hud_alpha_fg, DRAWFLAG_NORMAL);
+                               HUD_DrawXNum_Colored(numpos, rightcnt, len, 0.166 * mySize_x, hud_alpha_fg);
+                       }
 
                        if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
-                               barpos = pos + eX * 0.5 * mySize_x;
-                               barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/200);
-                               picpos = pos + eX * 0.05 * mySize_x + eX * 0.5 * mySize_x;
-                               numpos = pos + eX * ((3-len)/2) * 0.25 * mySize_x + eY * 0.4 * mySize_x + eX * 0.5 * mySize_x;
+                               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, rightcnt/200) + eX * 0.5 * mySize_x;
-                               barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/200);
-                               picpos = pos + eX * 0.05 * mySize_x + eY * mySize_y - eY * 0.566 * mySize_x + eX * 0.5 * mySize_x;
-                               numpos = pos + eX * ((3-len)/2) * 0.25 * mySize_x + eY * mySize_y - eY * 0.166 * mySize_x + eX * 0.5 * mySize_x;
+                               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(rightname), cvar("hud_progressbar_alpha"), DRAWFLAG_NORMAL);
-                       drawpic_skin(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * hud_alpha_fg, DRAWFLAG_NORMAL);
-                       HUD_DrawXNum_Colored(numpos, rightcnt, len, 0.166 * mySize_x, hud_alpha_fg);
-               }
-
-               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
-                       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);
+                       if(fuel)
+                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor("fuel"), hud_alpha_fg * 0.8, DRAWFLAG_NORMAL);
                }
-               if(fuel)
-                       HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor("fuel"), hud_alpha_fg * 0.8, DRAWFLAG_NORMAL);
        }
 }
 
@@ -2132,7 +2195,7 @@ void HUD_Radar(void)
        float scale2d, normalsize, bigsize;
        float f;
 
-       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_origin2d = pos + 0.5 * mySize;
        teamradar_size2d = mySize;
 
        if(minimapname == "")
@@ -3195,7 +3258,7 @@ void HUD_Main (void)
 
        // Drawing stuff
        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);
+               drawpic_skin('0 0 0', cvar_string("hud_dock"), eX * vid_conwidth + eY * vid_conheight, HUD_Panel_Dock_GetColor(), cvar("hud_dock_alpha"), DRAWFLAG_NORMAL);
 
        if(HUD_Panel_CheckActive(0))
                HUD_WeaponIcons();