]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote branch 'origin/master' into fruitiex/newpanelhud
authorFruitieX <rasse@rasse-lappy.localdomain>
Tue, 29 Jun 2010 08:09:05 +0000 (11:09 +0300)
committerFruitieX <rasse@rasse-lappy.localdomain>
Tue, 29 Jun 2010 08:09:05 +0000 (11:09 +0300)
20 files changed:
gfx/hud/wickedhud/flag_blue_captured.tga [new file with mode: 0644]
gfx/hud/wickedhud/flag_blue_carrying.tga
gfx/hud/wickedhud/flag_blue_lost.tga
gfx/hud/wickedhud/flag_blue_returned.tga [new file with mode: 0644]
gfx/hud/wickedhud/flag_blue_shielded.tga
gfx/hud/wickedhud/flag_blue_taken.tga
gfx/hud/wickedhud/flag_red_captured.tga [new file with mode: 0644]
gfx/hud/wickedhud/flag_red_carrying.tga
gfx/hud/wickedhud/flag_red_lost.tga
gfx/hud/wickedhud/flag_red_returned.tga [new file with mode: 0644]
gfx/hud/wickedhud/flag_red_shielded.tga
gfx/hud/wickedhud/flag_red_taken.tga
gfx/hud/wickedhud/notify_teamkill.tga
hud_wickedhud_default.cfg
hud_wickedhud_minimalistic.cfg [new file with mode: 0644]
qcsrc/client/hud.qc
qcsrc/client/hud.qh
qcsrc/client/scoreboard.qc
qcsrc/common/items.qh
qcsrc/server/g_damage.qc

diff --git a/gfx/hud/wickedhud/flag_blue_captured.tga b/gfx/hud/wickedhud/flag_blue_captured.tga
new file mode 100644 (file)
index 0000000..7cff17e
Binary files /dev/null and b/gfx/hud/wickedhud/flag_blue_captured.tga differ
index 0700cd5bc77d69776a417c0d171633f77df88b2f..ace6a5f2c3a01c554eda6a1ba10944252499d5c2 100644 (file)
Binary files a/gfx/hud/wickedhud/flag_blue_carrying.tga and b/gfx/hud/wickedhud/flag_blue_carrying.tga differ
index f0bb89d2ee80532e0ec9f4d8664e81c802b6a93d..67d894d82dfce9467ee18d6e90604b224d1eadab 100644 (file)
Binary files a/gfx/hud/wickedhud/flag_blue_lost.tga and b/gfx/hud/wickedhud/flag_blue_lost.tga differ
diff --git a/gfx/hud/wickedhud/flag_blue_returned.tga b/gfx/hud/wickedhud/flag_blue_returned.tga
new file mode 100644 (file)
index 0000000..8e8b67f
Binary files /dev/null and b/gfx/hud/wickedhud/flag_blue_returned.tga differ
index e385437f1c17c57acbef3b583c19f8e5d5db9fde..a8993f6b2cc58a3e92f5ae12ceba9e1a81d970de 100644 (file)
Binary files a/gfx/hud/wickedhud/flag_blue_shielded.tga and b/gfx/hud/wickedhud/flag_blue_shielded.tga differ
index e51e297bab335ccb70f8e29d7f580e8835858285..6847e7cc19ed17384a8112b0d36b9bbfd1d4e3d7 100644 (file)
Binary files a/gfx/hud/wickedhud/flag_blue_taken.tga and b/gfx/hud/wickedhud/flag_blue_taken.tga differ
diff --git a/gfx/hud/wickedhud/flag_red_captured.tga b/gfx/hud/wickedhud/flag_red_captured.tga
new file mode 100644 (file)
index 0000000..72814ec
Binary files /dev/null and b/gfx/hud/wickedhud/flag_red_captured.tga differ
index c28cea877c2d82bbe53e6431fcb512e9d663a6c2..33930833233d10c4649fe955dc7fb7ce6456109d 100644 (file)
Binary files a/gfx/hud/wickedhud/flag_red_carrying.tga and b/gfx/hud/wickedhud/flag_red_carrying.tga differ
index 93d55793e9a87d17d12d3e48202599efc61eb098..f96e02147e738af1d0f051efe1b9b4138d04f00b 100644 (file)
Binary files a/gfx/hud/wickedhud/flag_red_lost.tga and b/gfx/hud/wickedhud/flag_red_lost.tga differ
diff --git a/gfx/hud/wickedhud/flag_red_returned.tga b/gfx/hud/wickedhud/flag_red_returned.tga
new file mode 100644 (file)
index 0000000..deee468
Binary files /dev/null and b/gfx/hud/wickedhud/flag_red_returned.tga differ
index ed9994ac402c568a34afeed31b52f4a0c7e1dbcb..e7ec491fd6bcc7bb49fcf053de2642a179a492c5 100644 (file)
Binary files a/gfx/hud/wickedhud/flag_red_shielded.tga and b/gfx/hud/wickedhud/flag_red_shielded.tga differ
index f999476d232e2d7730b9b04ae092660ab90f2832..bf71977e149ab7de484f221c14fab285c61a411f 100644 (file)
Binary files a/gfx/hud/wickedhud/flag_red_taken.tga and b/gfx/hud/wickedhud/flag_red_taken.tga differ
index 0f28ebb36e1de6a5811c883c61f0d6a4f04b1109..a40920b204ada24a40da0b3ed7ff3445af9147ac 100644 (file)
Binary files a/gfx/hud/wickedhud/notify_teamkill.tga and b/gfx/hud/wickedhud/notify_teamkill.tga differ
index 62d9d11b314cf24fbfb6c90797adb0f620c1edfb..dfb3a89fa944d0a10ad4e49c1de2219cef573f59 100644 (file)
@@ -36,6 +36,7 @@ seta hud_inventory 1 "enable/disable this panel"
 seta hud_inventory_pos "0.190000 0.930000" "position of this panel"
 seta hud_inventory_size "0.093750 0.050000" "size of this panel"
 seta hud_inventory_onlycurrent 1 "1 = show only current ammo type"
+seta hud_inventory_iconalign 0 "0 = align icons to the left, 1 = align icons to the right"
 seta hud_inventory_bg "border_inventory" "if set to something else than \"\" = override default background"
 seta hud_inventory_bg_color "" "if set to something else than \"\" = override default panel background color"
 seta hud_inventory_bg_color_team "" "override panel color with team color in team based games"
@@ -47,7 +48,8 @@ seta hud_powerups 1 "enable/disable this panel"
 seta hud_powerups_pos "0.400000 0.130000" "position of this panel"
 seta hud_powerups_size "0.200000 0.050000" "size of this panel"
 seta hud_powerups_flip 1 "flip strength/shield positions"
-seta hud_powerups_mirror 0 "mirror alignment of panel items"
+seta hud_powerups_baralign 0 "0 = align bars to the left, 1 = align bars to the right, 2 = align right bar to the right, 3 = align left bar to the right"
+seta hud_powerups_iconalign 0 "0 = align icons to the left, 1 = align icons to the right, 2 = align right icon to the right, 3 = align left icon to the right"
 seta hud_powerups_bg "border_powerups" "if set to something else than \"\" = override default background"
 seta hud_powerups_bg_color "" "if set to something else than \"\" = override default panel background color"
 seta hud_powerups_bg_color_team "" "override panel color with team color in team based games"
@@ -59,7 +61,8 @@ seta hud_healtharmor 1 "enable/disable this panel, 2 = combined health/armor dis
 seta hud_healtharmor_pos "0.300000 0.930000" "position of this panel"
 seta hud_healtharmor_size "0.240000 0.050000" "size of this panel"
 seta hud_healtharmor_flip 0 "flip health/armor positions"
-seta hud_healtharmor_mirror 0 "mirror alignment of panel items"
+seta hud_healtharmor_baralign 0 "0 = align bars to the left, 1 = align bars to the right, 2 = align right bar to the right, 3 = align left bar to the right"
+seta hud_healtharmor_iconalign 0 "0 = align icons to the left, 1 = align icons to the right, 2 = align right icon to the right, 3 = align left icon to the right"
 seta hud_healtharmor_bg "border_healtharmor" "if set to something else than \"\" = override default background"
 seta hud_healtharmor_bg_color "" "if set to something else than \"\" = override default panel background color"
 seta hud_healtharmor_bg_color_team "" "override panel color with team color in team based games"
diff --git a/hud_wickedhud_minimalistic.cfg b/hud_wickedhud_minimalistic.cfg
new file mode 100644 (file)
index 0000000..ad2ae87
--- /dev/null
@@ -0,0 +1,173 @@
+seta hud_skin "wickedhud"
+seta hud_bg "border"
+seta hud_bg_color "0.875 0.375 0"
+seta hud_bg_color_team "0"
+seta hud_bg_alpha "1"
+seta hud_bg_border "6"
+seta hud_bg_padding "2"
+seta hud_fg_alpha "1"
+
+seta hud_dock ""
+seta hud_dock_color "0 0.1875 0.4375"
+seta hud_dock_color_team "0.700000"
+seta hud_dock_alpha "1"
+
+seta hud_progressbar_alpha 0.500000
+seta hud_progressbar_strength_color "0 0 0.6"
+seta hud_progressbar_shield_color "0.6 0 0.6"
+seta hud_progressbar_health_color "0.6 0 0"
+seta hud_progressbar_armor_color "0 0.6 0"
+seta hud_progressbar_fuel_color "0.6 0.6 0"
+seta hud_progressbar_nexball_color "0.7 0.1 0"
+
+seta hud_weaponicons 1
+seta hud_weaponicons_pos "0.940000 0.040000"
+seta hud_weaponicons_size "0.060000 0.630000"
+seta hud_weaponicons_bg "0"
+seta hud_weaponicons_bg_color ""
+seta hud_weaponicons_bg_color_team ""
+seta hud_weaponicons_bg_alpha ""
+seta hud_weaponicons_bg_border ""
+seta hud_weaponicons_bg_padding ""
+seta hud_weaponicons_accuracy_yellow 40
+
+seta hud_inventory 1
+seta hud_inventory_pos "0 0.810000"
+seta hud_inventory_size "0.090000 0.190000"
+seta hud_inventory_bg "0"
+seta hud_inventory_bg_color ""
+seta hud_inventory_bg_color_team ""
+seta hud_inventory_bg_alpha ""
+seta hud_inventory_bg_border ""
+seta hud_inventory_bg_padding ""
+seta hud_inventory_onlycurrent 0
+
+seta hud_powerups 1
+seta hud_powerups_pos "0.400000 0.130000"
+seta hud_powerups_size "0.200000 0.050000"
+seta hud_powerups_bg "0"
+seta hud_powerups_bg_color ""
+seta hud_powerups_bg_color_team ""
+seta hud_powerups_bg_alpha ""
+seta hud_powerups_bg_border ""
+seta hud_powerups_bg_padding ""
+seta hud_powerups_flip 1
+seta hud_powerups_mirror 0
+
+seta hud_healtharmor 1
+seta hud_healtharmor_pos "0.100000 0.920000"
+seta hud_healtharmor_size "0.560000 0.080000"
+seta hud_healtharmor_bg "0"
+seta hud_healtharmor_bg_color ""
+seta hud_healtharmor_bg_color_team ""
+seta hud_healtharmor_bg_alpha ""
+seta hud_healtharmor_bg_border ""
+seta hud_healtharmor_bg_padding ""
+seta hud_healtharmor_flip 0
+seta hud_healtharmor_mirror 1
+
+seta hud_notify 1
+seta hud_notify_pos "0.670000 0.680000"
+seta hud_notify_size "0.330000 0.230000"
+seta hud_notify_bg "border_modicons"
+seta hud_notify_bg_color ""
+seta hud_notify_bg_color_team ""
+seta hud_notify_bg_alpha "0"
+seta hud_notify_bg_border ""
+seta hud_notify_bg_padding ""
+seta hud_notify_flip 0
+seta hud_notify_info_top 1
+
+seta hud_timer 1
+seta hud_timer_pos "0.940000 0"
+seta hud_timer_size "0.060000 0.030000"
+seta hud_timer_bg "border_timer"
+seta hud_timer_bg_color ""
+seta hud_timer_bg_color_team ""
+seta hud_timer_bg_alpha ""
+seta hud_timer_bg_border ""
+seta hud_timer_bg_padding "0"
+
+seta hud_radar 0
+seta hud_radar_pos "0 0"
+seta hud_radar_size "0.190000 0.230000"
+seta hud_radar_bg "border_radar"
+seta hud_radar_bg_color ""
+seta hud_radar_bg_color_team ""
+seta hud_radar_bg_alpha ""
+seta hud_radar_bg_border ""
+seta hud_radar_bg_padding "-3"
+seta hud_radar_foreground_alpha 0.800000
+seta hud_radar_alreadyvoted_alpha 0
+
+seta hud_score 1
+seta hud_score_pos "0.830000 0.920000"
+seta hud_score_size "0.170000 0.060000"
+seta hud_score_bg "0"
+seta hud_score_bg_color ""
+seta hud_score_bg_color_team ""
+seta hud_score_bg_alpha ""
+seta hud_score_bg_border ""
+seta hud_score_bg_padding ""
+
+seta hud_racetimer 1
+seta hud_racetimer_pos "0.360000 0.010000"
+seta hud_racetimer_size "0.280000 0.093333"
+seta hud_racetimer_bg "border_timer"
+seta hud_racetimer_bg_color ""
+seta hud_racetimer_bg_color_team ""
+seta hud_racetimer_bg_alpha "0"
+seta hud_racetimer_bg_border ""
+seta hud_racetimer_bg_padding ""
+
+seta hud_vote 1
+seta hud_vote_pos "0.690000 0"
+seta hud_vote_size "0.240000 0.080000"
+seta hud_vote_bg "border_vote"
+seta hud_vote_bg_color ""
+seta hud_vote_bg_color_team ""
+seta hud_vote_bg_alpha ""
+seta hud_vote_bg_border ""
+seta hud_vote_bg_padding ""
+seta hud_vote_alreadyvoted_alpha 0.750000
+
+seta hud_modicons 1
+seta hud_modicons_pos "0.700000 0.920000"
+seta hud_modicons_size "0.120000 0.080000"
+seta hud_modicons_bg "border_modicons"
+seta hud_modicons_bg_color ""
+seta hud_modicons_bg_color_team ""
+seta hud_modicons_bg_alpha ""
+seta hud_modicons_bg_border ""
+seta hud_modicons_bg_padding ""
+
+seta hud_pressedkeys 0
+seta hud_pressedkeys_pos "0 0"
+seta hud_pressedkeys_size "0.080000 0.062912"
+seta hud_pressedkeys_bg "border_modicons"
+seta hud_pressedkeys_bg_color ""
+seta hud_pressedkeys_bg_color_team ""
+seta hud_pressedkeys_bg_alpha "0"
+seta hud_pressedkeys_bg_border ""
+seta hud_pressedkeys_bg_padding ""
+
+seta hud_chat 1
+seta hud_chat_pos "0.100000 0.790000"
+seta hud_chat_size "0.560000 0.120000"
+seta hud_chat_bg "border_chat"
+seta hud_chat_bg_color ""
+seta hud_chat_bg_color_team ""
+seta hud_chat_bg_alpha "0"
+seta hud_chat_bg_border ""
+seta hud_chat_bg_padding ""
+
+seta hud_engineinfo 0
+seta hud_engineinfo_pos "0 0"
+seta hud_engineinfo_size "0.130000 0.034667"
+seta hud_engineinfo_bg "border_modicons"
+seta hud_engineinfo_bg_color ""
+seta hud_engineinfo_bg_color_team ""
+seta hud_engineinfo_bg_alpha "0"
+seta hud_engineinfo_bg_border ""
+seta hud_engineinfo_bg_padding ""
+
index 1b8b2366e0122f52b1b7d9e814970fff075acba7..20df329395e3fec735d4f004a2b9082ca363977a 100644 (file)
@@ -14,6 +14,13 @@ Misc HUD functions
 //   1/4 height: bottom part
 void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
 {
+       if (theBorderSize_x <= 0 && theBorderSize_y <= 0) // no border
+       {
+               // draw only the central part
+               drawsubpic(theOrigin, theSize, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
+               return;
+       }
+
        vector dX, dY;
        vector width, height;
        vector bW, bH;
@@ -97,17 +104,20 @@ void drawpic_aspect(vector pos, string pic, vector sz, vector color, float alpha
 }
 
 // draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
+// TODO: make a default skin, and fallback to these!
 void drawpic_skin(vector pos, string pic, vector sz, vector color, float alpha, float drawflag) {
        drawpic_aspect(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, color, alpha, drawflag);
 }
 
 // TODO: aspect!
 void drawpic_skin_expanding(vector pos, string pic, vector sz, vector rgb, float alpha, float flag, float fadelerp) {
-       drawpic_expanding(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, rgb, alpha, flag, fadelerp);
+       return;
+       //drawpic_aspect_expanding(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, rgb, alpha, flag, fadelerp);
 }
 
 void drawpic_skin_expanding_two(vector pos, string pic, vector sz, vector rgb, float alpha, float flag, float fadelerp) {
-       drawpic_expanding_two(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, rgb, alpha, flag, fadelerp);
+       return;
+       //drawpic_aspect_expanding_two(pos, strcat("gfx/hud/", cvar_string("hud_skin"), "/", pic), sz, rgb, alpha, flag, fadelerp);
 }
 
 // return HUD background color
@@ -146,99 +156,6 @@ vector HUD_AccuracyColor(float accuracy)
        return rgb;
 }
 
-// draw number in the XSCALE font
-void HUD_DrawXNum (vector pos, float num, float digits, float showsign, float lettersize, vector rgb, float highlighted, float stroke, float alpha, float dflags)
-{
-       float l, i;
-       string str, tmp, l_length;
-       float minus, plus;
-       vector vsize, num_color;
-
-       vsize_x = vsize_y = lettersize;
-       vsize_z = 0;
-
-       // showsign 1: always prefix with minus sign (useful in race distribution display)
-       // showsign 2: always prefix with plus sign (useful in race distribution display)
-       // showsign 3: prefix with minus sign if negative, plus sign if positive (useful in score distribution display)
-
-       if((showsign == 2 && num >= 0) || (num > 0 && showsign == 3))
-       {
-               plus = true;
-               pos_x -= lettersize;
-       } else
-               plus = false;
-
-       if(num < 0 || (num < 0 && showsign == 3) || (showsign == 1 && num <= 0))
-       {
-               minus = true;
-               num = -num;
-               pos_x -= lettersize;
-       } else
-               minus = false;
-
-       if(digits < 0)
-       {
-               tmp = ftos(num);
-               digits = -digits;
-               str = strcat(substring("0000000000", 0, digits - strlen(tmp)), tmp);
-       } else
-               str = ftos(num);
-
-       l = strlen(str);
-       l_length = ftos(l);
-
-       if(l > digits)
-       {
-               str = substring(str, l-digits, 999);
-               l = strlen(str);
-       } else if(l < digits)
-               pos_x += (digits-l) * lettersize;
-
-       if (highlighted == 1) {
-               vector hl_size;
-               hl_size_x = vsize_x * l + vsize_x * 0.2;
-               hl_size_y = vsize_y * 1.1;
-               hl_size_z = 0;
-               if(minus)
-                       hl_size_x = hl_size_x + vsize_x;
-
-               vector hl_pos;
-               hl_pos_x = pos_x - lettersize/10;
-               hl_pos_y = pos_y - lettersize/20;
-               hl_pos_z = 0;
-
-               drawpic_skin(hl_pos, strcat("num_leading_", l_length), hl_size, '1 1 1', alpha, dflags);
-       }
-
-       if (stroke == 1)
-               num_color = '1 1 1';
-       else
-               num_color = rgb;
-
-       if(minus)
-       {
-               if (stroke == 1)
-                       drawpic_skin(pos, "num_minus_stroke", vsize, rgb, alpha, dflags);
-               drawpic_skin(pos, "num_minus", vsize, num_color, alpha, dflags);
-               pos_x += lettersize;
-       } else if(plus)
-       {
-               if (stroke == 1)
-                       drawpic_skin(pos, "num_plus_stroke", vsize, rgb, alpha, dflags);
-               drawpic_skin(pos, "num_plus", vsize, num_color, alpha, dflags);
-               pos_x += lettersize;
-       }
-
-       for(i = 0; i < l; ++i)
-       {
-               tmp = substring(str, i, 1);
-               if (stroke == 1)
-                       drawpic_skin(pos, strcat("num_", tmp, "_stroke"), vsize, rgb, alpha, dflags);
-               drawpic_skin(pos, strcat("num_", tmp), vsize, num_color, alpha, dflags);
-               pos_x += lettersize;
-       }
-}
-
 vector HUD_Get_Num_Color (float x, float maxvalue)
 {
        vector color;
@@ -274,13 +191,6 @@ vector HUD_Get_Num_Color (float x, float maxvalue)
        }
        return color;
 }
-// color the number differently based on how big it is (used in the health/armor panel)
-void HUD_DrawXNum_Colored (vector pos, float x, float digits, float lettersize, float alpha)
-{
-       vector color;
-       color = HUD_Get_Num_Color (x, 200);
-       HUD_DrawXNum(pos, x, digits, 0, lettersize, color, 0, 0, alpha, DRAWFLAG_NORMAL);
-}
 
 float stringwidth_colors(string s, vector theSize)
 {
@@ -624,27 +534,30 @@ void HUD_Panel_ExportCfg(string cfgname)
                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_border \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_border")), "\"", "\n"));
                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_padding \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_padding")), "\"", "\n"));
                        switch(i) {
-                               case 0:
+                               case HUD_PANEL_WEAPONICONS:
                                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_accuracy_yellow ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_accuracy_yellow"))), "\n"));
                                        break;
-                               case 1:
+                               case HUD_PANEL_INVENTORY:
                                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_onlycurrent ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_onlycurrent"))), "\n"));
+                                       fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_iconalign ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_mirror"))), "\n"));
                                        break;
-                               case 2:
+                               case HUD_PANEL_POWERUPS:
                                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_flip ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_flip"))), "\n"));
-                                       fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_mirror ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_mirror"))), "\n"));
+                                       fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_iconalign ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_mirror"))), "\n"));
+                                       fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_baralign ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_mirror"))), "\n"));
                                        break;
-                               case 3:
+                               case HUD_PANEL_HEALTHARMOR:
                                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_flip ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_flip"))), "\n"));
-                                       fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_mirror ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_mirror"))), "\n"));
+                                       fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_iconalign ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_mirror"))), "\n"));
+                                       fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_baralign ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_mirror"))), "\n"));
                                        break;
-                               case 4:
+                               case HUD_PANEL_NOTIFY:
                                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_flip ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_flip"))), "\n"));
                                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_info_top ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_info_top"))), "\n"));
                                        break;
-                               case 6:
+                               case HUD_PANEL_RADAR:
                                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_foreground_alpha ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_foreground_alpha"))), "\n"));
-                               case 9:
+                               case HUD_PANEL_VOTE:
                                        fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_alreadyvoted_alpha ", ftos(cvar(strcat("hud_", HUD_Panel_GetName(i), "_alreadyvoted_alpha"))), "\n"));
                                        break;
                        }
@@ -861,7 +774,7 @@ void HUD_Panel_DrawBg(float id, vector pos, vector mySize, float alpha)
        if(bg != "0")
        {
                float border;
-               border = max(0.0000001, HUD_Panel_GetBorder(id)); // draw_BorderPicture does not like border = 0
+               border = HUD_Panel_GetBorder(id);
 
                vector color;
                color = HUD_Panel_GetColor(id);
@@ -877,7 +790,9 @@ void HUD_Panel_DrawBg(float id, vector pos, vector mySize, float alpha)
 
 void HUD_Panel_DrawProgressBar(vector pos, float vertical, vector mySize, vector color, float alpha, float drawflag)
 {
-//float        drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #328;
+       if(!alpha)
+               return;
+
        string pic;
        pic = strcat("gfx/hud/", cvar_string("hud_skin"), "/");
        if(vertical) {
@@ -979,7 +894,7 @@ void HUD_Panel_SetPos(float id, vector pos)
        vector mySize;
        mySize = HUD_Panel_GetSize(id);
 
-       if(cvar("hud_configure_checkcollisions"))
+       if(hud_configure_checkcollisions)
                pos = HUD_Panel_CheckMove(id, pos, mySize);
 
        pos_x = bound(0, pos_x, vid_conwidth - mySize_x);
@@ -1005,7 +920,10 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) {
        vector targPos;
        vector targSize;
        vector targEndPos;
+
        vector dist;
+       float ratio;
+       ratio = mySize_x/mySize_y;
 
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
                if(i == id || !HUD_Panel_CheckActive(i))
@@ -1017,7 +935,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) {
                targEndPos = targPos + targSize;
 
                // 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 < targPos_x + targSize_x && resizeorigin_y > targPos_y && resizeorigin_y < targPos_y + targSize_y)
+               if(resizeorigin_x > targPos_x && resizeorigin_x < targEndPos_x && resizeorigin_y > targPos_y && resizeorigin_y < targEndPos_y)
                        continue;
 
                if (resizeCorner == 1)
@@ -1040,7 +958,7 @@ vector HUD_Panel_CheckResize(float id, 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)
+                       if (dist_y < 0 || dist_x / dist_y > ratio)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
@@ -1058,7 +976,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) {
 
                        dist_x = targPos_x - resizeorigin_x;
                        dist_y = resizeorigin_y - targEndPos_y;
-                       if (dist_y < 0)
+                       if (dist_y < 0 || dist_x / dist_y > ratio)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
@@ -1076,7 +994,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) {
 
                        dist_x = resizeorigin_x - targEndPos_x;
                        dist_y = targPos_y - resizeorigin_y;
-                       if (dist_y < 0)
+                       if (dist_y < 0 || dist_x / dist_y > ratio)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
@@ -1094,7 +1012,7 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) {
 
                        dist_x = targPos_x - resizeorigin_x;
                        dist_y = targPos_y - resizeorigin_y;
-                       if (dist_y < 0)
+                       if (dist_y < 0 || dist_x / dist_y > ratio)
                                mySize_x = min(mySize_x, dist_x);
                        else
                                mySize_y = min(mySize_y, dist_y);
@@ -1106,31 +1024,17 @@ vector HUD_Panel_CheckResize(float id, vector mySize, vector resizeorigin) {
        return mySize;
 }
 
-void HUD_Panel_SetPosSize(float id)
+void HUD_Panel_SetPosSize(float id, vector mySize)
 {
        vector resizeorigin;
        resizeorigin = panel_click_resizeorigin;
-       vector mySize, myPos;
-
-       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);
-       }
+       vector myPos;
 
        // minimum panel size cap
        mySize_x = max(0.025 * vid_conwidth, mySize_x);
        mySize_y = max(0.025 * vid_conheight, mySize_y);
 
-       if(id == 12) // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small.
+       if(id == HUD_PANEL_CHAT) // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small.
        {
                mySize_x = max(17 * cvar("con_chatsize"), mySize_x);
                mySize_y = max(2 * cvar("con_chatsize") + 2 * HUD_Panel_GetPadding(id), mySize_y);
@@ -1176,10 +1080,8 @@ void HUD_Panel_SetPosSize(float id)
                mySize_y = floor((mySize_y/vid_conheight)/bound(0.005, cvar("hud_configure_grid_y"), 0.2) + 0.5) * bound(0.005, cvar("hud_configure_grid_y"), 0.2) * vid_conheight;
        }
 
-       if(cvar("hud_configure_checkcollisions"))
-       {
+       if(hud_configure_checkcollisions)
                mySize = HUD_Panel_CheckResize(id, mySize, resizeorigin);
-       }
 
        // minimum panel size cap, do this once more so we NEVER EVER EVER have a panel smaller than this, JUST IN CASE above code still makes the panel eg negative (impossible to resize back without changing cvars manually then)
        mySize_x = max(0.025 * vid_conwidth, mySize_x);
@@ -1201,7 +1103,6 @@ void HUD_Panel_SetPosSize(float id)
        }
 
        if(cvar("hud_configure_checkcollisions_debug"))
-       if(cvar("hud_configure_checkcollisions"))
                drawfill(myPos, mySize, '0 1 0', .3, DRAWFLAG_NORMAL);
 
        string s;
@@ -1212,6 +1113,81 @@ void HUD_Panel_SetPosSize(float id)
        cvar_set(strcat("hud_", HUD_Panel_GetName(id), "_pos"), s);
 }
 
+float pressed_key_time;
+void HUD_Panel_Arrow_Action(float nPrimary)
+{
+       if (highlightedPanel_prev == -1)
+               return;
+
+       hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && cvar("hud_configure_checkcollisions"));
+
+       float step;
+       if (nPrimary == K_UPARROW || nPrimary == K_DOWNARROW)
+               step = vid_conheight;
+       else
+               step = vid_conwidth;
+       if (hudShiftState & S_SHIFT)
+               step = (step / 256); // more precision
+       else
+               step = (step / 64) * (1 + 2 * (time - pressed_key_time));
+
+       highlightedPanel = highlightedPanel_prev;
+
+       if (hudShiftState & S_ALT) // resize
+       {
+               highlightedAction = 1;
+               if(nPrimary == K_UPARROW)
+                       resizeCorner = 1;
+               else if(nPrimary == K_RIGHTARROW)
+                       resizeCorner = 2;
+               else if(nPrimary == K_LEFTARROW)
+                       resizeCorner = 3;
+               else // if(nPrimary == K_DOWNARROW)
+                       resizeCorner = 4;
+
+               // ctrl+arrow reduces the size, instead of increasing it
+               // Note that ctrl disables collisions check too, but it's fine
+               // since we don't collide with anything reducing the size
+               if (hudShiftState & S_CTRL) {
+                       step = -step;
+                       resizeCorner = 5 - resizeCorner;
+               }
+
+               vector mySize;
+               mySize = HUD_Panel_GetSize(highlightedPanel);
+               panel_click_resizeorigin = HUD_Panel_GetPos(highlightedPanel);
+               if(resizeCorner == 1) {
+                       panel_click_resizeorigin += mySize;
+                       mySize_y += step;
+               } else if(resizeCorner == 2) {
+                       panel_click_resizeorigin_y += mySize_y;
+                       mySize_x += step;
+               } else if(resizeCorner == 3) {
+                       panel_click_resizeorigin_x += mySize_x;
+                       mySize_x += step;
+               } else { // resizeCorner == 4
+                       mySize_y += step;
+               }
+               HUD_Panel_SetPosSize(highlightedPanel, mySize);
+       }
+       else // move
+       {
+               highlightedAction = 2;
+               vector pos;
+               pos = HUD_Panel_GetPos(highlightedPanel);
+               if(nPrimary == K_UPARROW)
+                       pos_y -= step;
+               else if(nPrimary == K_DOWNARROW)
+                       pos_y += step;
+               else if(nPrimary == K_LEFTARROW)
+                       pos_x -= step;
+               else // if(nPrimary == K_RIGHTARROW)
+                       pos_x += step;
+
+               HUD_Panel_SetPos(highlightedPanel, pos);
+       }
+}
+
 float mouseClicked;
 float prevMouseClicked; // previous state
 float prevMouseClickedTime; // time during previous mouse click, to check for doubleclicks
@@ -1237,6 +1213,17 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                        hit_con_bind = 1;
        }
 
+       if(bInputType == 0) {
+               if(nPrimary == K_ALT) hudShiftState |= S_ALT;
+               if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
+               if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
+       }
+       else if(bInputType == 1) {
+               if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
+               if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
+               if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
+       }
+
        if(nPrimary == K_MOUSE1)
        {
                if(bInputType == 0) { // key pressed
@@ -1250,18 +1237,96 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
        }
        else if(nPrimary == K_ESCAPE)
        {
+               if (bInputType == 1)
+                       return true;
                disable_menu_alphacheck = 1;
                menu_enabled = 1;
                menu_enabled_time = time;
                localcmd("menu_showhudexit\n");
        }
+       else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
+       {
+               if (bInputType == 1)
+               {
+                       pressed_key_time = 0;
+                       return true;
+               }
+               else if (pressed_key_time == 0)
+                       pressed_key_time = time;
 
+               HUD_Panel_Arrow_Action(nPrimary); //move or resize panel
+       }
        else if(hit_con_bind)
                return false;
 
        return true; // Suppress ALL other input
 }
 
+void HUD_Panel_Highlight()
+{
+       float i, border;
+       vector panelPos;
+       vector panelSize;
+
+       for(i = 0; i < HUD_PANEL_NUM; ++i)
+       {
+               panelPos = HUD_Panel_GetPos(i);
+               panelSize = HUD_Panel_GetSize(i);
+               border = HUD_Panel_GetBorder(i);
+
+               // move
+               if(mousepos_x >= panelPos_x && mousepos_y >= panelPos_y && mousepos_x <= panelPos_x + panelSize_x && mousepos_y <= panelPos_y + panelSize_y)
+               {
+                       highlightedPanel = i;
+                       highlightedAction = 1;
+                       panel_click_distance = mousepos - panelPos;
+                       return;
+               }
+               // resize from topleft border
+               else if(mousepos_x >= panelPos_x - border && mousepos_y >= panelPos_y - border && mousepos_x <= panelPos_x + 0.5 * panelSize_x && mousepos_y <= panelPos_y + 0.5 * panelSize_y)
+               {
+                       highlightedPanel = i;
+                       highlightedAction = 2;
+                       resizeCorner = 1;
+                       panel_click_distance = mousepos - panelPos;
+                       panel_click_resizeorigin = panelPos + panelSize;
+                       return;
+               }
+               // resize from topright border
+               else if(mousepos_x >= panelPos_x + 0.5 * panelSize_x && mousepos_y >= panelPos_y - border && mousepos_x <= panelPos_x + panelSize_x + border && mousepos_y <= panelPos_y + 0.5 * panelSize_y)
+               {
+                       highlightedPanel = i;
+                       highlightedAction = 2;
+                       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;
+                       return;
+               }
+               // resize from bottomleft border
+               else if(mousepos_x >= panelPos_x - border && mousepos_y >= panelPos_y + 0.5 * panelSize_y && mousepos_x <= panelPos_x + 0.5 * panelSize_x && mousepos_y <= panelPos_y + panelSize_y + border)
+               {
+                       highlightedPanel = i;
+                       highlightedAction = 2;
+                       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;
+                       return;
+               }
+               // resize from bottomright border
+               else if(mousepos_x >= panelPos_x + 0.5 * panelSize_x && mousepos_y >= panelPos_y + 0.5 * panelSize_y && mousepos_x <= panelPos_x + panelSize_x + border && mousepos_y <= panelPos_y + panelSize_y + border)
+               {
+                       highlightedPanel = i;
+                       highlightedAction = 2;
+                       resizeCorner = 4;
+                       panel_click_distance = panelSize - mousepos + panelPos;
+                       panel_click_resizeorigin = panelPos;
+                       return;
+               }
+       }
+}
+
 void HUD_Panel_Mouse()
 {
        // TODO: needs better check... is there any float that contains the current state of the menu? _menu_alpha isn't apparently updated the frame the menu gets enabled
@@ -1276,7 +1341,8 @@ void HUD_Panel_Mouse()
        print("Menu alpha: ", cvar_string("_menu_alpha"), "\n");
        */
 
-       if(mouseClicked == 0 && disable_menu_alphacheck != 2) { // don't reset these variables in disable_menu_alphacheck mode 2!
+       if(mouseClicked == 0 && disable_menu_alphacheck != 2 && highlightedPanel >= 0) { // don't reset these variables in disable_menu_alphacheck mode 2!
+               highlightedPanel_prev = highlightedPanel;
                highlightedPanel = -1;
                highlightedAction = 0;
        }
@@ -1290,86 +1356,30 @@ void HUD_Panel_Mouse()
 
        if(mouseClicked)
        {
-               float i, border;
-               vector panelPos;
-               vector panelSize;
-
-               for(i = 0; i < HUD_PANEL_NUM; ++i)
-               {
-                       panelPos = HUD_Panel_GetPos(i);
-                       panelSize = HUD_Panel_GetSize(i);
-                       border = HUD_Panel_GetBorder(i);
-                       if(prevMouseClicked == 0) {
-                               // move
-                               if(mousepos_x >= panelPos_x && mousepos_y >= panelPos_y && mousepos_x <= panelPos_x + panelSize_x && mousepos_y <= panelPos_y + panelSize_y)
-                               {
-                                       highlightedPanel = i;
-                                       highlightedAction = 1;
-                               }
-                               // resize from topleft border
-                               else if(mousepos_x >= panelPos_x - border && mousepos_y >= panelPos_y - border && mousepos_x <= panelPos_x + 0.5 * panelSize_x && mousepos_y <= panelPos_y + 0.5 * panelSize_y)
-                               {
-                                       highlightedPanel = i;
-                                       highlightedAction = 2;
-                                       resizeCorner = 1;
-                               }
-                               // resize from topright border
-                               else if(mousepos_x >= panelPos_x + 0.5 * panelSize_x && mousepos_y >= panelPos_y - border && mousepos_x <= panelPos_x + panelSize_x + border && mousepos_y <= panelPos_y + 0.5 * panelSize_y)
-                               {
-                                       highlightedPanel = i;
-                                       highlightedAction = 2;
-                                       resizeCorner = 2;
-                               }
-                               // resize from bottomleft border
-                               else if(mousepos_x >= panelPos_x - border && mousepos_y >= panelPos_y + 0.5 * panelSize_y && mousepos_x <= panelPos_x + 0.5 * panelSize_x && mousepos_y <= panelPos_y + panelSize_y + border)
-                               {
-                                       highlightedPanel = i;
-                                       highlightedAction = 2;
-                                       resizeCorner = 3;
-                               }
-                               // resize from bottomright border
-                               else if(mousepos_x >= panelPos_x + 0.5 * panelSize_x && mousepos_y >= panelPos_y + 0.5 * panelSize_y && mousepos_x <= panelPos_x + panelSize_x + border && mousepos_y <= panelPos_y + panelSize_y + border)
-                               {
-                                       highlightedPanel = i;
-                                       highlightedAction = 2;
-                                       resizeCorner = 4;
-                               }
-                       }
-
-                       if(highlightedPanel == i)
-                       {
-                               if(prevMouseClicked == 0)
-                               {
-                                       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(prevMouseClicked == 0)
+                       HUD_Panel_Highlight(); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
 
-                               if(cvar("hud_configure_checkcollisions_debug"))
-                                       drawfill(panelPos, panelSize, '1 0 0', .3, DRAWFLAG_NORMAL);
+               hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && cvar("hud_configure_checkcollisions"));
 
-                               if(highlightedAction == 1)
-                                       HUD_Panel_SetPos(i, mousepos - panel_click_distance);
-                               else if(highlightedAction == 2)
-                                       HUD_Panel_SetPosSize(i);
+               if(highlightedAction == 1)
+                       HUD_Panel_SetPos(highlightedPanel, mousepos - panel_click_distance);
+               else if(highlightedAction == 2)
+               {
+                       vector mySize;
+                       if(resizeCorner == 1) {
+                               mySize_x = panel_click_resizeorigin_x - (mousepos_x - panel_click_distance_x);
+                               mySize_y = panel_click_resizeorigin_y - (mousepos_y - panel_click_distance_y);
+                       } else if(resizeCorner == 2) {
+                               mySize_x = mousepos_x + panel_click_distance_x - panel_click_resizeorigin_x;
+                               mySize_y = panel_click_distance_y + panel_click_resizeorigin_y - mousepos_y;
+                       } else if(resizeCorner == 3) {
+                               mySize_x = panel_click_resizeorigin_x + panel_click_distance_x - mousepos_x;
+                               mySize_y = mousepos_y + panel_click_distance_y - panel_click_resizeorigin_y;
+                       } else { // resizeCorner == 4
+                               mySize_x = mousepos_x - (panel_click_resizeorigin_x - panel_click_distance_x);
+                               mySize_y = mousepos_y - (panel_click_resizeorigin_y - panel_click_distance_y);
                        }
+                       HUD_Panel_SetPosSize(highlightedPanel, mySize);
                }
 
                // doubleclick check
@@ -1528,6 +1538,7 @@ void HUD_WeaponIcons(void)
                        if(cvar_or("hud_weaponicons_number", 1))
                                drawstring(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), ftos(weapid), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                }
+               // draw a "ghost weapon icon" if you don't have the weapon
                else
                {
                        drawpic_skin(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), strcat("weapon", self.netname), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), '0 0 0', HUD_Panel_GetFgAlpha(id) * 0.5, DRAWFLAG_NORMAL);
@@ -1584,13 +1595,70 @@ string GetAmmoPicture(float i)
        }
 }
 
+void DrawAmmoItem(vector myPos, vector mySize, float itemcode, float currently_selected)
+{
+       float a;
+       a = getstati(GetAmmoStat(itemcode)); // how much ammo do we have of type itemcode?
+       if(hud_configure)
+               a = 100;
+
+       vector color;
+       if(a < 10)
+               color = '0.7 0 0';
+       else
+               color = '1 1 1';
+
+       float alpha;
+       if(currently_selected)
+               alpha = 1;
+       else
+               alpha = 0.7;
+
+       vector newSize, newPos;
+       if(mySize_x/mySize_y > 3)
+       {
+               newSize_x = 3 * mySize_y;
+               newSize_y = mySize_y;
+
+               newPos_x = myPos_x + (mySize_x - newSize_x) / 2;
+               newPos_y = myPos_y;
+       }
+       else
+       {
+               newSize_y = 1/3 * mySize_x;
+               newSize_x = mySize_x;
+
+               newPos_y = myPos_y + (mySize_y - newSize_y) / 2;
+               newPos_x = myPos_x;
+       }
+
+       vector picpos, numpos;
+       if(cvar("hud_inventory_iconalign"))
+       {
+               numpos = newPos;
+               picpos = newPos + eX * 2 * newSize_y;
+       }
+       else
+       {
+               numpos = newPos + eX * newSize_y;
+               picpos = newPos;
+       }
+
+       if (currently_selected)
+               drawpic_skin(newPos, "ammo_current_bg", newSize, '1 1 1', HUD_Panel_GetFgAlpha(HUD_PANEL_INVENTORY), DRAWFLAG_NORMAL);
+
+       drawfont = hud_bigfont;
+       drawstring_aspect(numpos, ftos(a), eX * (2/3) * newSize_x + eY * newSize_y, newSize_y, color, HUD_Panel_GetFgAlpha(HUD_PANEL_INVENTORY) * alpha, DRAWFLAG_NORMAL);
+       drawfont = hud_font;
+       drawpic_skin(picpos, GetAmmoPicture(itemcode), '1 1 0' * newSize_y, '1 1 1', HUD_Panel_GetFgAlpha(HUD_PANEL_INVENTORY) * alpha, DRAWFLAG_NORMAL);
+}
+
 void HUD_Inventory(void)
 {
        float id = HUD_PANEL_INVENTORY;
-       float i;
-       float stat_items;
+       float i, currently_selected;
 
-       vector pos, mySize, mysize, mypos;
+       vector pos, mySize;
        pos = HUD_Panel_GetPos(id);
        mySize = HUD_Panel_GetSize(id);
 
@@ -1603,76 +1671,90 @@ void HUD_Inventory(void)
                mySize -= '2 2 0' * padding;
        }
 
-       // ammo
-       stat_items = getstati(STAT_ITEMS);
-       for (i = 0; i < 4; ++i) {
-               float a;
-               a = getstati(GetAmmoStat(i)); // how much ammo do we have of type i?
-               if(hud_configure)
-                       a = 100;
+       float rows, columns;
+       rows = mySize_y/mySize_x;
+       rows = bound(1, floor((sqrt(4 * (3/1) * rows * AMMO_COUNT + rows * rows) + rows + 0.5) / 2), AMMO_COUNT);
+       //                               ^^^ ammo item aspect goes here
+
+       columns = ceil(AMMO_COUNT/rows);
 
+       float row, column;
+       // ammo
+       for (i = 0; i < AMMO_COUNT; ++i) {
+               currently_selected = getstati(STAT_ITEMS) & GetAmmoItemCode(i);
                if(cvar("hud_inventory_onlycurrent")) {
                        if(hud_configure)
                                i = 2;
-                       if (stat_items & GetAmmoItemCode(i) || hud_configure) {
-                               drawpic_skin(pos, GetAmmoPicture(i), '1 1 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               if(a < 10)
-                                       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_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               else
-                                       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_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       }
-                       if(hud_configure)
-                               break;
+                       if (currently_selected || hud_configure)
+                               DrawAmmoItem(pos, mySize, i, currently_selected);
+                       break;
                } else {
-                       if (a > 0) {
-                               if(mySize_x/mySize_y >= 10) { // arrange horizontally
-                                       switch (i) {
-                                               case 0: mypos_x = pos_x;                        mypos_y = pos_y;                        break; // shells
-                                               case 1: mypos_x = pos_x + 0.25 * mySize_x;      mypos_y = pos_y;                        break; // bullets
-                                               case 2: mypos_x = pos_x + 0.5  * mySize_x;      mypos_y = pos_y;                        break; // rockets
-                                               case 3: mypos_x = pos_x + 0.75 * mySize_x;      mypos_y = pos_y;                        break; // cells
-                                       }
-                                       mysize_x = 0.25 * mySize_x;
-                                       mysize_y = mySize_y;
-                               } else if(mySize_x/mySize_y >= 2.5) { // arrange in a 2x2 grid
-                                       switch (i) {
-                                               case 0: mypos_x = pos_x + 0.5 * mySize_x;       mypos_y = pos_y + 0.5 * mySize_y;       break; // shells
-                                               case 1: mypos_x = pos_x + 0.5 * mySize_x;       mypos_y = pos_y;                        break; // bullets
-                                               case 2: mypos_x = pos_x;                        mypos_y = pos_y + 0.5 * mySize_y;       break; // rockets
-                                               case 3: mypos_x = pos_x;                        mypos_y = pos_y;                        break; // cells
-                                       }
-                                       mysize_x = 0.5 * mySize_x;
-                                       mysize_y = 0.5 * mySize_y;
-                               } else { // arrange vertically
-                                       switch (i) {
-                                               case 0: mypos_x = pos_x;                        mypos_y = pos_y;                        break; // shells
-                                               case 1: mypos_x = pos_x;                        mypos_y = pos_y + 0.25 * mySize_y;      break; // bullets
-                                               case 2: mypos_x = pos_x;                        mypos_y = pos_y + 0.5  * mySize_y;      break; // rockets
-                                               case 3: mypos_x = pos_x;                        mypos_y = pos_y + 0.75 * mySize_y;      break; // cells
-                                       }
-                                       mysize_x = mySize_x;
-                                       mysize_y = 0.25 * mySize_y;
-                               }
-
-                               if (stat_items & GetAmmoItemCode(i))
-                                       drawpic_skin(mypos, "ammo_current_bg", mysize, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               drawpic_skin(mypos + eY * 0.05 * mysize_y, GetAmmoPicture(i), '1 1 0' * 0.8 * mysize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               if (a < 10) {
-                                       if(stat_items & GetAmmoItemCode(i))
-                                               HUD_DrawXNum(mypos + 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_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                                       else
-                                               HUD_DrawXNum(mypos + 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_Panel_GetFgAlpha(id) * 0.7, DRAWFLAG_NORMAL);
-                               } else {
-                                       if(stat_items & GetAmmoItemCode(i))
-                                               HUD_DrawXNum(mypos + 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_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                                       else
-                                               HUD_DrawXNum(mypos + eX * 0.8 * mysize_y + eY * 0.25 * mysize_y, a, strlen(ftos(a)), 0, 0.5 * mysize_y, '0.7 0.7 0.7', 0, 0, HUD_Panel_GetFgAlpha(id) * 0.7, DRAWFLAG_NORMAL);
-                               }
+                       DrawAmmoItem(pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows), eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows), i, currently_selected);
+                       ++row;
+                       if(row >= rows)
+                       {
+                               row = 0;
+                               column = column + 1;
                        }
                }
        }
 }
 
+void DrawNumIcon(float id, vector myPos, vector mySize, float x, string icon, float left, vector color)
+{
+       vector newSize, newPos;
+       if(mySize_x/mySize_y > 3)
+       {
+               newSize_x = 3 * mySize_y;
+               newSize_y = mySize_y;
+
+               newPos_x = myPos_x + (mySize_x - newSize_x) / 2;
+               newPos_y = myPos_y;
+       }
+       else
+       {
+               newSize_y = 1/3 * mySize_x;
+               newSize_x = mySize_x;
+
+               newPos_y = myPos_y + (mySize_y - newSize_y) / 2;
+               newPos_x = myPos_x;
+       }
+
+       vector picpos, numpos;
+       float iconalign;
+       iconalign = cvar(strcat("hud_", HUD_Panel_GetName(id), "_iconalign"));
+       if(left)
+       {
+               if(iconalign == 1 || iconalign == 3) // right align
+               {
+                       numpos = newPos;
+                       picpos = newPos + eX * 2 * newSize_y;
+               }
+               else // left align
+               {
+                       numpos = newPos + eX * newSize_y;
+                       picpos = newPos;
+               }
+       }
+       else
+       {
+               if(iconalign == 0 || iconalign == 3) // left align
+               {
+                       numpos = newPos + eX * newSize_y;
+                       picpos = newPos;
+               } 
+               else // right align
+               {
+                       numpos = newPos;
+                       picpos = newPos + eX * 2 * newSize_y;
+               }
+       }
+
+       drawfont = hud_bigfont;
+       drawstring_aspect(numpos, ftos(x), eX * (2/3) * newSize_x + eY * newSize_y, newSize_y, color, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+       drawfont = hud_font;
+       drawpic_skin(picpos, icon, '1 1 0' * newSize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+}
 
 // Powerups (#2)
 //
@@ -1715,8 +1797,6 @@ void HUD_Powerups(void) {
                shield_time = 27;
        }
 
-       float len;
-
        vector barpos, barsize;
        vector picpos;
        vector numpos;
@@ -1745,122 +1825,93 @@ void HUD_Powerups(void) {
        leftalpha = bound(0, leftexact, 1);
        rightalpha = bound(0, rightexact, 1);
 
+       float baralign, iconalign;
+       baralign = cvar(strcat("hud_", HUD_Panel_GetName(id), "_baralign"));
+       iconalign = cvar(strcat("hud_", HUD_Panel_GetName(id), "_iconalign"));
+
        if (mySize_x/mySize_y > 4)
        {
                if(leftcnt)
                {
-                       len = strlen(ftos(leftcnt));
-
-                       if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                       if(baralign == 1 || baralign == 3) { // right align
                                barpos = pos + eX * 0.5 * mySize_x - eX * 0.5 * mySize_x * min(1, leftcnt/30);
                                barsize = eX * 0.5 * mySize_x * min(1, leftcnt/30) + eY * mySize_y;
-                               picpos = pos + eX * 0.5 * mySize_x - eX * mySize_y;
-                               numpos = picpos - eX * 2 * 0.5 * mySize_y + eX * (2-len) * 0.5 * mySize_y + eY * 0.25 * mySize_y;
-                       } else {
+                       } else { // left align
                                barpos = pos;
                                barsize = eX * 0.5 * mySize_x * min(1, leftcnt/30) + eY * mySize_y;
-                               picpos = pos;
-                               numpos = picpos + eX * mySize_y - eX * (2-len) * 0.5 * mySize_y + eY * 0.25 * mySize_y;
                        }
 
                        HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       if(leftcnt <= 5)
-                               drawpic_skin_expanding_two(picpos, leftname, '1 1 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (leftcnt - leftexact) / 0.5, 1));
-                       else
-                               drawpic_skin(picpos, leftname, '1 1 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       HUD_DrawXNum(numpos, leftcnt, 2, 0, 0.5 * mySize_y, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       DrawNumIcon(id, pos, eX * 0.5 * mySize_x + eY * mySize_y, leftcnt, leftname, 1, '1 1 1');
+                       // TODO: expand
+                       //if(leftcnt <= 5)
+                       //      drawpic_skin_expanding_two(picpos, leftname, '1 1 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (leftcnt - leftexact) / 0.5, 1));
+                       //else
+                       //      drawpic_skin(picpos, leftname, eX * (1/6) * mySize_x + eY * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                }
 
                if(rightcnt)
                {
-                       len = strlen(ftos(rightcnt));
-
-                       if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                       if(baralign == 0 || baralign == 3) { // left align
                                barpos = pos + eX * 0.5 * mySize_x;
                                barsize = eX * 0.5 * mySize_x * min(1, rightcnt/30) + eY * mySize_y;
-                               picpos = pos + eX * 0.5 * mySize_x;
-                               numpos = picpos + eX * mySize_y - eX * (2-len) * 0.5 * mySize_y + eY * 0.25 * mySize_y;
-                       } else {
+                       } else { // right align
                                barpos = pos + eX * mySize_x - eX * 0.5 * mySize_x * min(1, rightcnt/30);
                                barsize = eX * 0.5 * mySize_x * min(1, rightcnt/30) + eY * mySize_y;
-                               picpos = pos + eX * mySize_x - eX * mySize_y;
-                               numpos = picpos - eX * mySize_y + eY * 0.25 * mySize_y;
                        }
 
                        HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       if(rightcnt <= 5)
-                               drawpic_skin_expanding_two(picpos, rightname, '1 1 0' * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (rightcnt - rightexact) / 0.5, 1));
-                       else
-                               drawpic_skin(picpos, rightname, '1 1 0' * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       HUD_DrawXNum(numpos, rightcnt, 2, 0, 0.5 * mySize_y, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       DrawNumIcon(id, pos + eX * 0.5 * mySize_x, eX * 0.5 * mySize_x + eY * mySize_y, rightcnt, rightname, 0, '1 1 1');
                }
        }
        else if (mySize_x/mySize_y > 1.5)
        {
                if(leftcnt)
                {
-                       len = strlen(ftos(leftcnt));
-
-                       if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                       if(baralign == 1 || baralign == 3) { // right align
                                barpos = pos + eX * mySize_x - eX * mySize_x * min(1, leftcnt/30);
                                barsize = eX * mySize_x * min(1, leftcnt/30) + eY * 0.5 * mySize_y;
-                               picpos = pos + eX * mySize_x - eX * 0.5 * mySize_y;
-                               numpos = picpos - eX * len * 0.5 * mySize_y;
-                       } else {
+                       } else { // left align
                                barpos = pos;
                                barsize = eX * mySize_x * min(1, leftcnt/30) + 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") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       if(leftcnt <= 5)
-                               drawpic_skin_expanding_two(picpos, leftname, '0.5 0.5 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (leftcnt - leftexact) / 0.5, 1));
-                       else
-                               drawpic_skin(picpos, leftname, '0.5 0.5 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       HUD_DrawXNum(numpos, leftcnt, len, 0, 0.5 * mySize_y, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       DrawNumIcon(id, pos, eX * mySize_x + eY * 0.5 * mySize_y, leftcnt, leftname, 1, '1 1 1');
                }
 
                if(rightcnt)
                {
-                       len = strlen(ftos(rightcnt));
-
-                       if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
-                               barpos = pos + eX * mySize_x - eX * mySize_x * min(1, rightcnt/30) + eY * 0.5 * mySize_y;
-                               barsize = eX * mySize_x * min(1, rightcnt/30) + 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 {
+                       if(baralign == 0 || baralign == 3) { // left align
                                barpos = pos + eY * 0.5 * mySize_y;
                                barsize = eX * mySize_x * min(1, rightcnt/30) + eY * 0.5 * mySize_y;
-                               picpos = pos + eY * 0.5 * mySize_y;
-                               numpos = picpos + eX * 0.5 * mySize_y;
+                       } else { // right align
+                               barpos = pos + eX * mySize_x - eX * mySize_x * min(1, rightcnt/30) + eY * 0.5 * mySize_y;
+                               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") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       if(rightcnt <= 5)
-                               drawpic_skin_expanding_two(picpos, rightname, '0.5 0.5 0' * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (rightcnt - rightexact) / 0.5, 1));
-                       else
-                               drawpic_skin(picpos, rightname, '0.5 0.5 0' * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       HUD_DrawXNum(numpos, rightcnt, len, 0, 0.5 * mySize_y, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       DrawNumIcon(id, pos + eY * 0.5 * mySize_y, eX * mySize_x + eY * 0.5 * mySize_y, rightcnt, rightname, 0, '1 1 1');
                }
        }
        else
        {
                if(leftcnt)
                {
-                       len = strlen(ftos(leftcnt));
-
-                       if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                       if(baralign == 1 || baralign == 3) { // down align
+                               barpos = pos + eY * mySize_y - eY * mySize_y * min(1, leftcnt/30);
+                               barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/30);
+                       } else { // up align
                                barpos = pos;
                                barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/30);
+                       }
+
+                       if(iconalign == 1 || 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
                                picpos = pos + eX * 0.05 * mySize_x;
-                               numpos = pos + eX * ((2-len)/2) * 0.25 * mySize_x + eY * 0.4 * mySize_x;
-                       } else {
-                               barpos = pos + eY * mySize_y - eY * mySize_y * min(1, leftcnt/30);
-                               barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/30);
-                               picpos = pos + eX * 0.05 * mySize_x + eY * mySize_y - eY * 0.65 * mySize_x;
-                               numpos = pos + eX * ((2-len)/2) * 0.25 * mySize_x + eY * mySize_y - eY * 0.25 * mySize_x;
+                               numpos = pos + eY * 0.4 * mySize_x;
                        }
 
                        HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
@@ -1868,23 +1919,25 @@ void HUD_Powerups(void) {
                                drawpic_skin_expanding_two(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (leftcnt - leftexact) / 0.5, 1));
                        else
                                drawpic_skin(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       HUD_DrawXNum(numpos, leftcnt, len, 0, 0.25 * mySize_x, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       drawstring_aspect(numpos, ftos(leftcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, 0.25 * mySize_x, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                }
 
                if(rightcnt)
                {
-                       len = strlen(ftos(rightcnt));
-
-                       if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                       if(baralign == 0 || baralign == 3) { // up align
                                barpos = pos + eX * 0.5 * mySize_x;
                                barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/30);
-                               picpos = pos + eX * 0.05 * mySize_x + eX * 0.5 * mySize_x;
-                               numpos = pos + eX * ((2-len)/2) * 0.25 * mySize_x + eY * 0.4 * mySize_x + eX * 0.5 * mySize_x;
-                       } else {
+                       } else { // down align
                                barpos = pos + eY * mySize_y - eY * mySize_y * min(1, rightcnt/30) + eX * 0.5 * mySize_x;
                                barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, rightcnt/30);
-                               picpos = pos + eX * 0.05 * mySize_x + eY * mySize_y - eY * 0.65 * mySize_x + eX * 0.5 * mySize_x;
-                               numpos = pos + eX * ((2-len)/2) * 0.25 * mySize_x + eY * mySize_y - eY * 0.25 * mySize_x + eX * 0.5 * mySize_x;
+                       }
+
+                       if(iconalign == 0 || 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
+                               picpos = pos + eX * 0.05 * mySize_x + eY * (mySize_y - 0.65 * mySize_x) + eX * 0.5 * mySize_x;
+                               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") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
@@ -1892,7 +1945,7 @@ void HUD_Powerups(void) {
                                drawpic_skin_expanding_two(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE, bound(0, (rightcnt - rightexact) / 0.5, 1));
                        else
                                drawpic_skin(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       HUD_DrawXNum(numpos, rightcnt, len, 0, 0.25 * mySize_x, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       drawstring_aspect(numpos, ftos(rightcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, 0.25 * mySize_x, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                }
        }
 }
@@ -1932,11 +1985,14 @@ void HUD_HealthArmor(void)
        if(health <= 0)
                return;
 
-       float len;
        vector barpos, barsize;
        vector picpos;
        vector numpos;
 
+       float baralign, iconalign;
+       baralign = cvar(strcat("hud_", HUD_Panel_GetName(id), "_baralign"));
+       iconalign = cvar(strcat("hud_", HUD_Panel_GetName(id), "_iconalign"));
+
        if(cvar("hud_healtharmor") == 2) // combined health and armor display
        {
                vector v;
@@ -1945,46 +2001,44 @@ void HUD_HealthArmor(void)
                float x;
                x = floor(v_x + 1);
 
-               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+               if(baralign == 1 || 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;
-                       picpos = pos;
-                       numpos = picpos + eX * 1.5 * mySize_y;
-               } else {
+               } else { // left align
                        barpos = pos;
                        barsize = eX * mySize_x * min(1, x/400) + eY * mySize_y;
-                       picpos = pos + eX * 3 * mySize_y;
-                       numpos = pos;
                }
 
+               string biggercount;
                if(v_z) // NOT fully armored
                {
+                       biggercount = "health";
                        HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("health"), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       drawpic_skin(picpos, "health", '1 1 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                        if(armor)
-                               drawpic_skin(picpos + eX * mySize_y, "armor", '0.5 0.5 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id) * armor / health, DRAWFLAG_NORMAL);
+                               drawpic_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "armor", '0.5 0.5 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id) * armor / health, DRAWFLAG_NORMAL);
                }
                else
                {
+                       biggercount = "armor";
                        HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor("armor"), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       drawpic_skin(picpos + eX * mySize_y, "health", '0.5 0.5 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id) * health / armor, DRAWFLAG_NORMAL);
-                       if(armor)
-                               drawpic_skin(picpos, "armor", '1 1 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       if(health)
+                               drawpic_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "health", '0.5 0.5 0' * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                }
-               HUD_DrawXNum_Colored(numpos, x, 3, mySize_y, HUD_Panel_GetFgAlpha(id)); // draw the combined health and armor
+               DrawNumIcon(id, pos, mySize, x, biggercount, 1, HUD_Get_Num_Color(x, 2 * 200));
 
                // fuel
-               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.2 * mySize_y;
-               } else {
-                       barpos = pos;
-                       barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
-               }
                if(fuel)
+               {
+                       if(baralign == 0 || 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"), HUD_Panel_GetFgAlpha(id) * 0.8, DRAWFLAG_NORMAL);
+               }
        }
-
        else
        {
                string leftname, rightname;
@@ -2015,167 +2069,149 @@ void HUD_HealthArmor(void)
                        rightalpha = min((armor+10)/55, 1);
                }
 
-               if (mySize_x/mySize_y > 5)
+               if (mySize_x/mySize_y > 4)
                {
                        if(leftactive)
                        {
-                               len = strlen(ftos(leftcnt));
-
-                               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                               if(baralign == 1 || 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;
-                                       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 {
+                               } else { // left align
                                        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") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               drawpic_skin(picpos, leftname, '1 1 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               HUD_DrawXNum_Colored(numpos, leftcnt, len, 0.5 * mySize_y, HUD_Panel_GetFgAlpha(id));
+                               DrawNumIcon(id, pos, eX * 0.5 * mySize_x + eY * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, 200));
                        }
 
                        if(rightactive)
                        {
-                               len = strlen(ftos(rightcnt));
-
-                               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                               if(baralign == 0 || baralign == 3) { // left align
                                        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 {
+                               } else { // right align
                                        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") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               drawpic_skin(picpos, rightname, '1 1 0' * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               HUD_DrawXNum_Colored(numpos, rightcnt, 3, 0.5 * mySize_y, HUD_Panel_GetFgAlpha(id));
+                               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));
                        }
 
-                       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.2 * mySize_y;
-                       } else {
-                               barpos = pos;
-                               barsize = eX * mySize_x * min(1, fuel/100) + eY * 0.2 * mySize_y;
-                       }
                        if(fuel)
+                       {
+                               if(baralign == 0 || 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"), HUD_Panel_GetFgAlpha(id) * 0.8, DRAWFLAG_NORMAL);
+                       }
                }
-               else if (mySize_x/mySize_y > 2)
+               else if (mySize_x/mySize_y > 1.5)
                {
                        if(leftactive)
                        {
-                               len = strlen(ftos(leftcnt));
-
-                               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                               if(baralign == 1 || baralign == 3) { // right align
                                        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 {
+                                       barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
+                               } else { // left align
                                        barpos = pos;
-                                       barsize = eX * mySize_x * min(1, leftcnt/200) + eY * 0.5 * mySize_y;
-                                       picpos = pos;
-                                       numpos = picpos + eX * 0.5 * mySize_y;
+                                       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") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               drawpic_skin(picpos, leftname, '0.5 0.5 0' * mySize_y, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               HUD_DrawXNum_Colored(numpos, leftcnt, len, 0.5 * mySize_y, HUD_Panel_GetFgAlpha(id));
+                               DrawNumIcon(id, pos, eX * mySize_x + eY * 0.5 * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, 200));
                        }
 
                        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 {
+                               if(baralign == 0 || baralign == 3) { // left align
                                        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;
+                               } else { // right align
+                                       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;
                                }
 
                                HUD_Panel_DrawProgressBar(barpos, 0, barsize, HUD_Panel_GetProgressBarColor(rightname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               drawpic_skin(picpos, rightname, '0.5 0.5 0' * mySize_y, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               HUD_DrawXNum_Colored(numpos, rightcnt, len, 0.5 * mySize_y, HUD_Panel_GetFgAlpha(id));
+                               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));
                        }
 
-                       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)
+                       {
+                               if(baralign == 0 || 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"), HUD_Panel_GetFgAlpha(id) * 0.8, DRAWFLAG_NORMAL);
+                       }
                }
                else
                {
                        if(leftactive)
                        {
-                               len = strlen(ftos(leftcnt));
-
-                               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                               if(baralign == 1 || 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
                                        barpos = pos;
                                        barsize = eX * 0.5 * mySize_x + eY * mySize_y * min(1, leftcnt/200);
+                               }
+
+                               if(iconalign == 1 || 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
                                        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;
+                                       numpos = pos + eY * 0.4 * mySize_x;
                                }
 
                                HUD_Panel_DrawProgressBar(barpos, 1, barsize, HUD_Panel_GetProgressBarColor(leftname), cvar("hud_progressbar_alpha") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                                drawpic_skin(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               HUD_DrawXNum_Colored(numpos, leftcnt, len, 0.166 * mySize_x, HUD_Panel_GetFgAlpha(id));
+                               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), HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                        }
 
                        if(rightactive)
                        {
-                               len = strlen(ftos(rightcnt));
-
-                               if(cvar(strcat("hud_", HUD_Panel_GetName(id), "_mirror"))) {
+                               if(baralign == 0 || baralign == 3) { // up align
                                        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 {
+                               } else { // down align
                                        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;
+                               }
+
+                               if(iconalign == 0 || 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
+                                       picpos = pos + eX * 0.05 * mySize_x + eY * (mySize_y - 0.65 * mySize_x) + eX * 0.5 * mySize_x;
+                                       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") * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                                drawpic_skin(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               HUD_DrawXNum_Colored(numpos, rightcnt, len, 0.166 * mySize_x, HUD_Panel_GetFgAlpha(id));
+                               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), HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                        }
 
-                       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)
+                       {
+                               if(baralign == 0 || 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"), HUD_Panel_GetFgAlpha(id) * 0.8, DRAWFLAG_NORMAL);
+                       }
                }
        }
 }
@@ -2888,6 +2924,7 @@ void HUD_Notify (void)
 
        }
 
+       // TODO: separate panel for these?
        // Info messages
        //
        entity tm;
@@ -3097,7 +3134,9 @@ void HUD_Timer(void)
                timer = seconds_tostring(timeleft);
        }
 
+       drawfont = hud_bigfont;
        drawstring_aspect(pos, timer, mySize, mySize_y, timer_color, HUD_Panel_GetFgAlpha(HUD_PANEL_TIMER), DRAWFLAG_NORMAL);
+       drawfont = hud_font;
 }
 
 // Radar (#6)
@@ -3245,7 +3284,7 @@ void HUD_Score(void)
        }
 
        float score, distribution, leader;
-       float score_len, distr_len;
+       float score_len;
        vector distribution_color;
        entity tm, pl, me;
        me = (spectatee_status > 0) ? playerslots[spectatee_status - 1] : playerslots[player_localentnum - 1];
@@ -3289,19 +3328,19 @@ void HUD_Score(void)
                                distribution_color = eX;
                                minusplus = 2; // minusplus 1: always prefix with plus sign
                        }
-                       HUD_DrawXNum(bottomright - '0 48 0' - '16 0 0' * TIME_DECIMALS, distmsec, -TIME_DECIMALS, 0, 16, distribution_color, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                       HUD_DrawXNum(bottomright - '68 48 0' - '16 0 0' * TIME_DECIMALS, distsec, 4, minusplus, 16, distribution_color, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       //HUD_DrawXNum(bottomright - '0 48 0' - '16 0 0' * TIME_DECIMALS, distmsec, -TIME_DECIMALS, 0, 16, distribution_color, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       //HUD_DrawXNum(bottomright - '68 48 0' - '16 0 0' * TIME_DECIMALS, distsec, 4, minusplus, 16, distribution_color, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                        drawpic_skin(bottomright - '10 48 0' - '16 0 0' * TIME_DECIMALS, "num_dot", '16 16 0', distribution_color, HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE);
                }
                // race record display
                if (distribution <= 0 || distribution == score) // draw the highlight background behind the timer if we have the lead
                        drawpic_skin(bottomright - '0 32 0' - '32 0 0' * (4 + TIME_DECIMALS), "num_leading_4", '0 28 0' + '32 0 0' * (4 + TIME_DECIMALS), '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
 
-               HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0', racemsec, -TIME_DECIMALS, 0, 30, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-               HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0'  - '66 0 0', racesec, -2, 0, 30, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+               //HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0', racemsec, -TIME_DECIMALS, 0, 30, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+               //HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0'  - '66 0 0', racesec, -2, 0, 30, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                drawpic_skin(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0' - '18 0 0', "num_dot", '30 30 0', '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE);
 
-               HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0' - '132 0 0', racemin, -2, 0, 30, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+               //HUD_DrawXNum(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0' - '132 0 0', racemin, -2, 0, 30, '1 1 1', 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                drawpic_skin(bottomright - '0 32 0' - TIME_DECIMALS * '30 0 0' - '84 0 0', "num_colon", '30 30 0', '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_ADDITIVE);
                */
        } else if (!teamplay) { // non-teamgames
@@ -3333,12 +3372,13 @@ void HUD_Score(void)
                        distribution_color = eX;
 
                score_len = strlen(ftos(score));
-               distr_len = strlen(ftos(distribution));
 
-               HUD_DrawXNum(pos + eX * mySize_x - eX * 3 * 0.33 * mySize_y, distribution, 3, 3, 0.33 * mySize_y, distribution_color, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+               drawstring_aspect(pos + eX * 0.75 * mySize_x, ftos(distribution), eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, (1/3) * mySize_y, distribution_color, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                if (leader)
-                       drawpic_skin(pos + eX * mySize_x - eX * score_len * mySize_y - eX * 3 * 0.33 * mySize_y, strcat("num_leading_", ftos(score_len)), eX * score_len * mySize_y + eY * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-               HUD_DrawXNum(pos + eX * mySize_x - eX * 3 * mySize_y - eX * 3 * 0.33 * mySize_y, score, 3, 0, mySize_y, distribution_color, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                       drawpic_skin(pos, strcat("num_leading_", ftos(score_len)), eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+               drawfont = hud_bigfont;
+               drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize_x + eY * mySize_y, mySize_y, distribution_color, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+               drawfont = hud_font;
        } else { // teamgames
                float max_fragcount;
                max_fragcount = -99;
@@ -3361,14 +3401,16 @@ void HUD_Score(void)
                                if (max_fragcount == score)
                                        leader = 1;
                                if (leader)
-                                       drawpic_skin(pos + eX * mySize_x - eX * score_len * mySize_y - eX * 3 * 0.33 * mySize_y, strcat("num_leading_", ftos(score_len)), eX * score_len * mySize_y + eY * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               HUD_DrawXNum(pos + eX * mySize_x - eX * 3 * mySize_y - eX * 3 * 0.33 * mySize_y, score, 3, 0, mySize_y, GetTeamRGB(tm.team) * 0.8, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                                       drawpic_skin(pos, strcat("num_leading_", ftos(score_len)), eX * 0.75 * mySize_x + eY * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                               drawfont = hud_bigfont;
+                               drawstring_aspect(pos, ftos(score), eX * 0.75 * mySize_x + eY * mySize_y, mySize_y, GetTeamRGB(tm.team) * 0.8, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                               drawfont = hud_font;
                        } else {
                                if (max_fragcount == score)
                                        leader = 1;
                                if (leader)
-                                       drawpic_skin(pos + eX * mySize_x - eX * 0.33 * score_len * mySize_y + eY * 0.33 * mySize_y * teamnum, strcat("num_leading_", ftos(score_len)), eX * 0.33 * score_len * mySize_y + eY * 0.33 * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-                               HUD_DrawXNum(pos + eX * mySize_x - eX * 3 * 0.33 * mySize_y + eY * 0.33 * mySize_y * teamnum, score, 3, 0, 0.33 * mySize_y, GetTeamRGB(tm.team) * 0.8, 0, 0, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                                       drawpic_skin(pos + eX * 0.75 * mySize_x + eY * (1/3) * teamnum * mySize_y, strcat("num_leading_", ftos(score_len)), eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, '1 1 1', HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+                               drawstring_aspect(pos + eX * 0.75 * mySize_x + eY * (1/3) * teamnum * mySize_y, ftos(score), eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, (1/3) * mySize_y, GetTeamRGB(tm.team) * 0.8, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
                                teamnum += 1;
                        }
                }
@@ -3392,6 +3434,24 @@ void HUD_RaceTimer (void) {
                mySize -= '2 2 0' * padding;
        }
 
+       // always force 2:1 aspect
+       vector newSize;
+       if(mySize_x/mySize_y > 2)
+       {
+               newSize_x = 2 * mySize_y;
+               newSize_y = mySize_y;
+
+               pos_x = pos_x + (mySize_x - newSize_x) / 2;
+       }
+       else
+       {
+               newSize_y = 1/2 * mySize_x;
+               newSize_x = mySize_x;
+
+               pos_y = pos_y + (mySize_y - newSize_y) / 2;
+       }
+       mySize = newSize;
+
        drawfont = hud_bigfont;
        float a, t;
        string s, forcetime;
@@ -3560,14 +3620,32 @@ void HUD_VoteWindow(void)
                mySize -= '2 2 0' * padding;
        }
 
+       // always force 2:1 aspect
+       vector newSize;
+       if(mySize_x/mySize_y > 2)
+       {
+               newSize_x = 2 * mySize_y;
+               newSize_y = mySize_y;
+
+               pos_x = pos_x + (mySize_x - newSize_x) / 2;
+       }
+       else
+       {
+               newSize_y = 1/2 * mySize_x;
+               newSize_x = mySize_x;
+
+               pos_y = pos_y + (mySize_y - newSize_y) / 2;
+       }
+       mySize = newSize;
+
        drawpic_skin(pos, "voteprogress_back", mySize, '1 1 1', a * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
 
        s = "A vote has been called for: ";
-       drawstring(pos + '0.5 0 0' * mySize_x + '0 0.1 0' * mySize_y - eX * stringwidth(s, FALSE, '1 1 0' * 0.5 * mySize_y*(1/5)), s, '1 1 0' * mySize_y*(1/5), '1 1 1', a * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
-       s = textShortenToWidth(vote_called_vote, mySize_x * 0.96, '1 1 0' * mySize_y*(1/5), stringwidth_colors); // TODO: broken?
+       drawstring_aspect(pos + eY * (1/12) * mySize_y, s, eX * mySize_x + eY * (3/12) * mySize_y, mySize_y*(3/12), '1 1 1', a * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+       s = textShortenToWidth(vote_called_vote, mySize_x, '1 1 0' * mySize_y * (3/12), stringwidth_colors); // TODO: broken?
        if(hud_configure)
                s = "Configure the HUD";
-       drawcolorcodedstring(pos + '0.52 0 0' * mySize_x + '0 0.3 0' * mySize_y - eX * stringwidth(s, FALSE, '1 1 0' * 0.5 * mySize_y*(1/6)), s, '1 1 0' * mySize_y*(1/6), a * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+       drawstring_aspect(pos + eY * (4/12) * mySize_y, s, eX * mySize_x + eY * (2/12) * mySize_y, mySize_y*(2/12), '1 1 1', a * HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
 
        // print the yes/no counts
        s = strcat("Yes: ", ftos(vote_yescount));
@@ -4249,7 +4327,9 @@ void HUD_EngineInfo(void)
 
        vector color;
        color = HUD_Get_Num_Color (prevfps, 100);
+       drawfont = hud_bigfont;
        drawstring_aspect(pos, strcat("FPS: ", ftos_decimals(prevfps, cvar("hud_engineinfo_framecounter_decimals"))), mySize, mySize_y, color, HUD_Panel_GetFgAlpha(id), DRAWFLAG_NORMAL);
+       drawfont = hud_font;
 }
 /*
 ==================
@@ -4397,7 +4477,7 @@ void HUD_Main (void)
                }
        }
 
-       if(cvar_string("hud_dock") != "")
+       if(cvar_string("hud_dock") != "" && cvar_string("hud_dock") != "0")
                drawpic('0 0 0', strcat("gfx/hud/", cvar_string("hud_skin"), "/", cvar_string("hud_dock")), eX * vid_conwidth + eY * vid_conheight, HUD_Panel_Dock_GetColor(), cvar("hud_dock_alpha") * menu_fade_alpha, DRAWFLAG_NORMAL); // no aspect ratio forcing on dock...
 
        if(HUD_Panel_CheckActive(HUD_PANEL_RADAR) || hud_configure)
index 6768221a3a89b6e0033599d8a25c75c01fba0707..16bbdfaebf23003ee7e5bef699c6e91c91e4e1e4 100644 (file)
@@ -3,6 +3,7 @@ vector panel_click_distance; // mouse cursor distance from the top left corner o
 vector panel_click_resizeorigin; // coordinates for opposite point when resizing
 float resizeCorner; // 1 = topleft, 2 = topright, 3 = bottomleft, 4 = bottomright
 float highlightedPanel;
+float highlightedPanel_prev;
 float highlightedAction; // 0 = nothing, 1 = move, 2 = resize
 
 const float BORDER_MULTIPLIER = 0.25;
@@ -25,6 +26,12 @@ float hud_border_thickness;
 float hud_accuracy_border_thickness;
 
 float hud_configure;
+float hud_configure_checkcollisions;
+
+float hudShiftState;
+const float S_SHIFT = 1;
+const float S_CTRL = 2;
+const float S_ALT = 4;
 
 float disable_menu_alphacheck; // 0 = enable alpha check, 1 = disable for entire hud, 2 = disable for one panel
 float menu_fade_alpha;
index 36168ea2e772ce05fce447b024d1abcbcf8d815d..cd6ea9efebbc1a583f1baea8217737c92c467955 100644 (file)
@@ -1114,10 +1114,10 @@ void HUD_DrawScoreboard()
                                continue;
 
                        rgb = GetTeamRGB(tm.team);
-                       HUD_DrawXNum(pos - '9.5 0 0' * hud_fontsize_y + '0 1 0' * hud_fontsize_y, tm.(teamscores[ts_primary]), 6, 0, hud_fontsize_y * 1.5, rgb, 0, 1, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+                       drawstring(pos - '9.5 0 0' * hud_fontsize_y + '0 1 0' * hud_fontsize_y, ftos(tm.(teamscores[ts_primary])), '1 1 0' * hud_fontsize_y * 1.5, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
 
                        if(ts_primary != ts_secondary)
-                               HUD_DrawXNum(pos - '7.5 0 0' * hud_fontsize_y + '0 2.5 0' * hud_fontsize_y, tm.(teamscores[ts_secondary]), 6, 0, hud_fontsize_y * 1, rgb, 0, 1, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
+                               drawstring(pos - '7.5 0 0' * hud_fontsize_y + '0 2.5 0' * hud_fontsize_y, ftos(tm.(teamscores[ts_secondary])), '1 1 0' * hud_fontsize_y * 1, rgb, scoreboard_alpha_fg, DRAWFLAG_NORMAL);
 
                        pos = HUD_Scoreboard_MakeTable(pos, tm, rgb, bg_size);
                }
index a410474eb559d98500fc3ad9e12f43743f9ecd95..62f2d8551e7c58716280895cd8c7bbc0ce531745 100644 (file)
@@ -49,6 +49,8 @@ float IT_AMMO                                 = 8064; // IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS | IT_S
 float  IT_PICKUPMASK           = 51; // IT_FUEL_REGEN | IT_JETPACK | IT_UNLIMITED_AMMO; // strength and invincible are handled separately
 float  IT_UNLIMITED_AMMO       = 3; // IT_UNLIMITED_SUPERWEAPONS | IT_UNLIMITED_WEAPON_AMMO;
 
+float AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel
+
 // variables:
 string weaponorder_byid;
 string weaponorder_byimpulse;
index 30e49cd56f7d782b11c0721fee96bde7bba0396b..3431129c32420e0efa53cc32242d1b826f693b5f 100644 (file)
@@ -294,11 +294,6 @@ void Obituary (entity attacker, entity inflictor, entity targ, float deathtype)
                                msg = ColoredTeamName(targ.team); // TODO: check if needed?
                        Send_CSQC_Centerprint(targ, msg, "", deathtype, MSG_SUICIDE);
 
-                       if(deathtype != DEATH_TEAMCHANGE && deathtype != DEATH_QUIET)
-                       {
-                               LogDeath("suicide", deathtype, targ, targ);
-                               GiveFrags(attacker, targ, -1);
-                       }
                        // TODO: hmm?
                        /*
                                if (targ.killcount > 2)