]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
Merge remote branch 'refs/remotes/origin/terencehill/newpanelhud'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index 0bf4c5051bc41c04f01e135369f9106eee35d1df..db423eb8718a10686b9962c78c0ce285d004438f 100644 (file)
@@ -131,7 +131,7 @@ float stringwidth_nocolors(string s, vector theSize)
 #define CENTERPRINT_MAX_LINES 30
 string centerprint_messages[CENTERPRINT_MAX_LINES];
 float centerprint_width[CENTERPRINT_MAX_LINES];
-vector centerprint_start;
+float centerprint_time;
 float centerprint_expire;
 float centerprint_num;
 float centerprint_offset_hint;
@@ -182,6 +182,8 @@ void centerprint(string strMessage)
                while(getWrappedLine_remaining)
                {
                        s = getWrappedLine(vid_conwidth * 0.75, centerprint_fontsize, stringwidth_colors);
+                       if(centerprint_messages[i] != s) // don't fade the same message in, looks stupid
+                               centerprint_time = time;
                        if(centerprint_messages[i])
                                strunzone(centerprint_messages[i]);
                        centerprint_messages[i] = strzone(s);
@@ -208,8 +210,6 @@ void centerprint(string strMessage)
        if(havail > vid_conheight - 70)
                havail = vid_conheight - 70; // avoid overlapping HUD
 
-       centerprint_start_x = 0;
-
 #if 0
        float forbiddenmin, forbiddenmax, allowedmin, allowedmax, preferred;
 
@@ -260,17 +260,10 @@ void centerprint(string strMessage)
                centerprint_start_y = bound(forbiddenmax, preferred, allowedmax);
        }
 #else
-       centerprint_start_y =
-               min(
-                       max(
-                               max(scoreboard_bottom, vid_conheight * 0.5 + 16),
-                               (havail - h)/2
-                       ),
-                       havail - h
-               );
 #endif
 
        centerprint_num = i;
+
        centerprint_expire = time + cvar("scr_centertime");
 }
 
@@ -279,32 +272,39 @@ void HUD_DrawCenterPrint (void)
        float i;
        vector pos;
        string ts;
-       float a;
-
-       //if(time > centerprint_expire)
-       //      return;
+       float a, sz;
 
-       //a = bound(0, 1 - 2 * (time - centerprint_expire), 1);
-       a = bound(0, 1 - 4 * (time - centerprint_expire), 1);
-       //sz = 1.2 / (a + 0.2);
+       if(time - centerprint_time < 0.25)
+               a = (time - centerprint_time) / 0.25;
+       else
+               a = bound(0, 1 - 4 * (time - centerprint_expire), 1);
 
        if(a <= 0)
                return;
 
+       sz = 0.8 + (a / 5);
+
+       if(centerprint_num * cvar("scr_centersize") > 24 && HUD_WouldDrawScoreboard()) // 24 = height of Scoreboard text
+       {
+               centerprint_start_y = scoreboard_bottom + centerprint_fontsize_y;
+       }
        pos = centerprint_start;
        for (i=0; i<centerprint_num; i = i + 1)
        {
-               pos_x = (vid_conwidth - centerprint_width[i]) * 0.5;
                ts = centerprint_messages[i];
+               drawfontscale = sz * '1 1 0';
+               drawfont = hud_bigfont;
+               pos_x = (vid_conwidth - stringwidth(ts, TRUE, centerprint_fontsize)) * 0.5;
                if (ts != "")
                {
-                       drawcolorcodedstring(pos, ts, centerprint_fontsize, a, DRAWFLAG_NORMAL);
-                       //  - '0 0.5 0' * (sz - 1) * centerprint_fontsize_x - '0.5 0 0' * (sz - 1) * centerprint_width[i] * centerprint_fontsize_y, centerprint_fontsize * sz
+                       drawcolorcodedstring(pos + '0 1 0' * (1 - sz) * 0.5 *centerprint_fontsize_y, ts, centerprint_fontsize, a, DRAWFLAG_NORMAL);
                        pos_y = pos_y + centerprint_fontsize_y;
                }
                else
                        // half height for empty lines looks better
-                       pos_y = pos_y + centerprint_fontsize_y * 0.5;
+                       pos_y = pos_y + sz * centerprint_fontsize_y * 0.5;
+               drawfontscale = '1 1 0';
+               drawfont = hud_font;
        }
 }
 
@@ -421,13 +421,13 @@ void HUD_Panel_ExportCfg(string cfgname)
        if(fh >= 0)
        {
                fputs(fh, strcat("seta hud_skin \"", cvar_string("hud_skin"), "\"", "\n"));
-               fputs(fh, strcat("seta hud_bg \"", cvar_string("hud_bg"), "\"", "\n"));
-               fputs(fh, strcat("seta hud_bg_color \"", cvar_string("hud_bg_color"), "\"", "\n"));
-               fputs(fh, strcat("seta hud_bg_color_team \"", cvar_string("hud_bg_color_team"), "\"", "\n"));
-               fputs(fh, strcat("seta hud_bg_alpha \"", cvar_string("hud_bg_alpha"), "\"", "\n"));
-               fputs(fh, strcat("seta hud_bg_border \"", cvar_string("hud_bg_border"), "\"", "\n"));
-               fputs(fh, strcat("seta hud_bg_padding \"", cvar_string("hud_bg_padding"), "\"", "\n"));
-               fputs(fh, strcat("seta hud_fg_alpha \"", cvar_string("hud_fg_alpha"), "\"", "\n"));
+               fputs(fh, strcat("seta hud_panel_bg \"", cvar_string("hud_panel_bg"), "\"", "\n"));
+               fputs(fh, strcat("seta hud_panel_bg_color \"", cvar_string("hud_panel_bg_color"), "\"", "\n"));
+               fputs(fh, strcat("seta hud_panel_bg_color_team \"", cvar_string("hud_panel_bg_color_team"), "\"", "\n"));
+               fputs(fh, strcat("seta hud_panel_bg_alpha \"", cvar_string("hud_panel_bg_alpha"), "\"", "\n"));
+               fputs(fh, strcat("seta hud_panel_bg_border \"", cvar_string("hud_panel_bg_border"), "\"", "\n"));
+               fputs(fh, strcat("seta hud_panel_bg_padding \"", cvar_string("hud_panel_bg_padding"), "\"", "\n"));
+               fputs(fh, strcat("seta hud_panel_fg_alpha \"", cvar_string("hud_panel_fg_alpha"), "\"", "\n"));
                fputs(fh, "\n");
 
                fputs(fh, strcat("seta hud_dock \"", cvar_string("hud_dock"), "\"", "\n"));
@@ -453,6 +453,9 @@ void HUD_Panel_ExportCfg(string cfgname)
                fputs(fh, strcat("seta hud_configure_grid_ysize \"", cvar_string("hud_configure_grid_ysize"), "\"", "\n"));
                fputs(fh, "\n");
 
+               fputs(fh, strcat("seta scr_centerpos \"", cvar_string("scr_centerpos"), "\"", "\n"));
+               fputs(fh, "\n");
+
                // common cvars for all panels
                float i;
                for (i = 0; i < HUD_PANEL_NUM; ++i)
@@ -477,7 +480,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_complainbubble_color_unavailable \"", cvar_string(strcat("hud_panel_", panel_name, "_complainbubble_color_unavailable")), "\"", "\n"));
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_ammo_color \"", cvar_string(strcat("hud_panel_", panel_name, "_ammo_color")), "\"", "\n"));
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_ammo_alpha \"", cvar_string(strcat("hud_panel_", panel_name, "_ammo_alpha")), "\"", "\n"));
-                                       fputs(fh, strcat("seta hud_panel_", panel_name, "_aspect \"", cvar_string(strcat("hud_panel_", panel_name, "_ammo_alpha")), "\"", "\n"));
+                                       fputs(fh, strcat("seta hud_panel_", panel_name, "_aspect \"", cvar_string(strcat("hud_panel_", panel_name, "_aspect")), "\"", "\n"));
                                        break;
                                case HUD_PANEL_AMMO:
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_onlycurrent \"", cvar_string(strcat("hud_panel_", panel_name, "_onlycurrent")), "\"", "\n"));
@@ -487,11 +490,13 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_flip \"", cvar_string(strcat("hud_panel_", panel_name, "_flip")), "\"", "\n"));
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_iconalign \"", cvar_string(strcat("hud_panel_", panel_name, "_iconalign")), "\"", "\n"));
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_baralign \"", cvar_string(strcat("hud_panel_", panel_name, "_baralign")), "\"", "\n"));
+                                       fputs(fh, strcat("seta hud_panel_", panel_name, "_progressbar \"", cvar_string(strcat("hud_panel_", panel_name, "_progressbar")), "\"", "\n"));
                                        break;
                                case HUD_PANEL_HEALTHARMOR:
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_flip \"", cvar_string(strcat("hud_panel_", panel_name, "_flip")), "\n"));
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_iconalign \"", cvar_string(strcat("hud_panel_", panel_name, "_iconalign")), "\"", "\n"));
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_baralign \"", cvar_string(strcat("hud_panel_", panel_name, "_baralign")), "\"", "\n"));
+                                       fputs(fh, strcat("seta hud_panel_", panel_name, "_progressbar \"", cvar_string(strcat("hud_panel_", panel_name, "_progressbar")), "\"", "\n"));
                                        break;
                                case HUD_PANEL_NOTIFY:
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_flip \"", cvar_string(strcat("hud_panel_", panel_name, "_flip")), "\"", "\n"));
@@ -506,10 +511,13 @@ void HUD_Panel_ExportCfg(string cfgname)
                                case HUD_PANEL_PRESSEDKEYS:
                                        fputs(fh, strcat("seta hud_panel_", panel_name, "_aspect \"", cvar_string(strcat("hud_panel_", panel_name, "_aspect")), "\"", "\n"));
                                        break;
+                               case HUD_PANEL_INFOMESSAGES:
+                                       fputs(fh, strcat("seta hud_panel_", panel_name, "_flip \"", cvar_string(strcat("hud_panel_", panel_name, "_flip")), "\"", "\n"));
+                                       break;
                        }
                        fputs(fh, "\n");
                }
-               fputs(fh, strcat("menu_restart", "\n")); // force a menu update when execing config, so that the dialogs are updated
+               fputs(fh, strcat("menu_sync", "\n")); // force the menu to reread the cvars, so that the dialogs are updated
 
                print("^2Successfully exported to hud_", autocvar_hud_skin, "_", cfgname, ".cfg! (Note: It's saved in data/data/)\n");
        }
@@ -938,6 +946,10 @@ void HUD_Panel_Arrow_Action(float nPrimary)
 
        HUD_Panel_UpdatePosSizeForId(highlightedPanel)
 
+       vector prev_pos, prev_size;
+       prev_pos = panel_pos;
+       prev_size = panel_size;
+
        if (hudShiftState & S_ALT) // resize
        {
                highlightedAction = 1;
@@ -991,6 +1003,16 @@ void HUD_Panel_Arrow_Action(float nPrimary)
 
                HUD_Panel_SetPos(pos);
        }
+
+       HUD_Panel_UpdatePosSizeForId(highlightedPanel)
+
+       if (prev_pos != panel_pos || prev_size != panel_size)
+       {
+               // backup!
+               panel_pos_backup = prev_pos;
+               panel_size_backup = prev_size;
+               highlightedPanel_backup = highlightedPanel;
+       }
 }
 
 float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
@@ -1042,6 +1064,78 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                menu_enabled_time = time;
                localcmd("menu_showhudexit\n");
        }
+       else if(hudShiftState & S_CTRL)
+       {
+               if (mouseClicked)
+                       return true;
+
+               if(nPrimary == K_SPACE) // enable/disable highlighted panel or dock
+               {
+                       if (bInputType == 1)
+                               return true;
+
+                       if (highlightedPanel_prev != -1)
+                               cvar_set(strcat("hud_panel_", panel_name), ftos(!(panel_enabled)));
+                       else
+                               cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
+               }
+               if(nPrimary == 'c') // copy highlighted panel size
+               {
+                       if (bInputType == 1)
+                               return true;
+
+                       if (highlightedPanel_prev != -1)
+                       {
+                               panel_size_copied = panel_size;
+                               highlightedPanel_copied = highlightedPanel_prev;
+                       }
+               }
+               else if(nPrimary == 'v') // past copied size on the highlighted panel
+               {
+                       if (bInputType == 1)
+                               return true;
+
+                       if (highlightedPanel_copied == -1 || highlightedPanel_prev == -1)
+                               return true;
+
+                       HUD_Panel_UpdatePosSizeForId(highlightedPanel_prev)
+
+                       // reduce size if it'd go beyond screen boundaries
+                       vector tmp_size = panel_size_copied;
+                       if (panel_pos_x + panel_size_copied_x > vid_conwidth)
+                               tmp_size_x = vid_conwidth - panel_pos_x;
+                       if (panel_pos_y + panel_size_copied_y > vid_conheight)
+                               tmp_size_y = vid_conheight - panel_pos_y;
+
+                       if (panel_size == tmp_size)
+                               return true;
+
+                       // backup first!
+                       panel_pos_backup = panel_pos;
+                       panel_size_backup = panel_size;
+                       highlightedPanel_backup = highlightedPanel_prev;
+
+                       string s;
+                       s = strcat(ftos(tmp_size_x/vid_conwidth), " ", ftos(tmp_size_y/vid_conheight));
+                       cvar_set(strcat("hud_panel_", panel_name, "_size"), s);
+               }
+               else if(nPrimary == 'z') // undo last action
+               {
+                       if (bInputType == 1)
+                               return true;
+                       //restore previous values
+                       if (highlightedPanel_backup != -1)
+                       {
+                               HUD_Panel_GetName(highlightedPanel_backup)
+                               string s;
+                               s = strcat(ftos(panel_pos_backup_x/vid_conwidth), " ", ftos(panel_pos_backup_y/vid_conheight));
+                               cvar_set(strcat("hud_panel_", panel_name, "_pos"), s);
+                               s = strcat(ftos(panel_size_backup_x/vid_conwidth), " ", ftos(panel_size_backup_y/vid_conheight));
+                               cvar_set(strcat("hud_panel_", panel_name, "_size"), s);
+                               highlightedPanel_backup = -1;
+                       }
+               }
+       }
        else if(nPrimary == K_UPARROW || nPrimary == K_DOWNARROW || nPrimary == K_LEFTARROW || nPrimary == K_RIGHTARROW)
        {
                if (bInputType == 1)
@@ -1224,6 +1318,7 @@ void HUD_Panel_Highlight()
 }
 
 float highlightcheck;
+vector prev_pos, prev_size;
 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
@@ -1253,9 +1348,28 @@ void HUD_Panel_Mouse()
        if(mouseClicked)
        {
                if(prevMouseClicked == 0)
+               {
                        HUD_Panel_Highlight(); // sets highlightedPanel, highlightedAction, panel_click_distance, panel_click_resizeorigin
+                                                                       // and calls HUD_Panel_UpdatePosSizeForId() for the highlighted panel
+                       prev_pos = panel_pos;
+                       prev_size = panel_size;
+               }
+               else
+                       HUD_Panel_UpdatePosSizeForId(highlightedPanel)
 
-               hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
+               if (prev_pos != panel_pos || prev_size != panel_size)
+               {
+                       hud_configure_checkcollisions = (!(hudShiftState & S_CTRL) && autocvar_hud_configure_checkcollisions);
+                       // backup!
+                       panel_pos_backup = prev_pos;
+                       panel_size_backup = prev_size;
+                       highlightedPanel_backup = highlightedPanel;
+               }
+               else
+                       // in case the clicked panel is inside another panel and we aren't
+                       // moving it, avoid the immediate "fix" of its position/size
+                       // (often unwanted and hateful) by disabling collisions check
+                       hud_configure_checkcollisions = false;
 
                if(highlightedAction == 1)
                        HUD_Panel_SetPos(mousepos - panel_click_distance);
@@ -1378,23 +1492,99 @@ float GetAmmoTypeForWep(float i)
        }
 }
 
-#define acc_color(i) stov(cvar_string(strcat("hud_panel_weapons_accuracy_color", ftos(i))))
-#define MAX_ACCURACY_LEVELS 10
-float acc_lev[MAX_ACCURACY_LEVELS];
-
 void HUD_Weapons(void)
 {
        if(!autocvar_hud_panel_weapons && !autocvar__hud_configure)
                return;
 
+       float timeout = cvar("hud_panel_weapons_timeout");
+       float timeout_effect_length, timein_effect_length;
+       if (cvar("hud_panel_weapons_timeout_effect") == 0)
+       {
+               timeout_effect_length = 0;
+               timein_effect_length = 0;
+       }
+       else
+       {
+               timeout_effect_length = 0.75;
+               timein_effect_length = 0.375;
+       }
+
+       if (timeout && time >= weapontime + timeout + timeout_effect_length && !autocvar__hud_configure)
+       {
+               weaponprevtime = time;
+               return;
+       }
+
        active_panel = HUD_PANEL_WEAPONS;
        HUD_Panel_UpdateCvars(weapons);
-       vector pos, mySize;
-       float i, weapid, fade, weapon_stats, weapon_number, weapon_cnt;
 
-       pos = panel_pos;
-       mySize = panel_size;
+       if (timeout && time >= weapontime + timeout && !autocvar__hud_configure)
+       {
+               float f = (time - (weapontime + timeout)) / timeout_effect_length;
+               if (cvar("hud_panel_weapons_timeout_effect"))
+               {
+                       panel_bg_alpha *= (1 - f);
+                       panel_fg_alpha *= (1 - f);
+               }
+               if (cvar("hud_panel_weapons_timeout_effect") == 1)
+               {
+                       f *= f; // for a cooler movement
+                       vector center;
+                       center_x = panel_pos_x + panel_size_x/2;
+                       center_y = panel_pos_y + panel_size_y/2;
+                       float screen_ar = vid_conwidth/vid_conheight;
+                       if (center_x/center_y < screen_ar) //bottom left
+                       {
+                               if ((vid_conwidth - center_x)/center_y < screen_ar) //bottom
+                                       panel_pos_y += f * (vid_conheight - panel_pos_y);
+                               else //left
+                                       panel_pos_x -= f * (panel_pos_x + panel_size_x);
+                       }
+                       else //top right
+                       {
+                               if ((vid_conwidth - center_x)/center_y < screen_ar) //right
+                                       panel_pos_x += f * (vid_conwidth - panel_pos_x);
+                               else //top
+                                       panel_pos_y -= f * (panel_pos_y + panel_size_y);
+                       }
+               }
+               weaponprevtime = time - (1 - f) * timein_effect_length;
+       }
+       else if (timeout && time < weaponprevtime + timein_effect_length && !autocvar__hud_configure)
+       {
+               float f = (time - weaponprevtime) / timein_effect_length;
+               if (cvar("hud_panel_weapons_timeout_effect"))
+               {
+                       panel_bg_alpha *= (f);
+                       panel_fg_alpha *= (f);
+               }
+               if (cvar("hud_panel_weapons_timeout_effect") == 1)
+               {
+                       f *= f; // for a cooler movement
+                       f = 1 - f;
+                       vector center;
+                       center_x = panel_pos_x + panel_size_x/2;
+                       center_y = panel_pos_y + panel_size_y/2;
+                       float screen_ar = vid_conwidth/vid_conheight;
+                       if (center_x/center_y < screen_ar) //bottom left
+                       {
+                               if ((vid_conwidth - center_x)/center_y < screen_ar) //bottom
+                                       panel_pos_y += f * (vid_conheight - panel_pos_y);
+                               else //left
+                                       panel_pos_x -= f * (panel_pos_x + panel_size_x);
+                       }
+                       else //top right
+                       {
+                               if ((vid_conwidth - center_x)/center_y < screen_ar) //right
+                                       panel_pos_x += f * (vid_conwidth - panel_pos_x);
+                               else //top
+                                       panel_pos_y -= f * (panel_pos_y + panel_size_y);
+                       }
+               }
+       }
 
+       float i, weapid, fade, weapon_stats, weapon_number, weapon_cnt;
        weapon_cnt = 0;
        for(i = WEP_FIRST; i <= WEP_LAST; ++i)
        {
@@ -1424,310 +1614,305 @@ void HUD_Weapons(void)
                heapsort(weapon_cnt, weaponorder_swap, weaponorder_cmp, world);
        }
 
-       HUD_Panel_DrawBg(1);
-       if(panel_bg_padding)
-       {
-               pos += '1 1 0' * panel_bg_padding;
-               mySize -= '2 2 0' * panel_bg_padding;
-       }
+               HUD_Panel_DrawBg(1);
+               if(panel_bg_padding)
+               {
+                       panel_pos += '1 1 0' * panel_bg_padding;
+                       panel_size -= '2 2 0' * panel_bg_padding;
+               }
 
-       // hits
-       weapon_stats = getstati(STAT_DAMAGE_HITS);
-       weapon_number = weapon_stats & 63;
-       weapon_hits[weapon_number-WEP_FIRST] = floor(weapon_stats / 64);
-       // fired
-       weapon_stats = getstati(STAT_DAMAGE_FIRED);
-       weapon_number = weapon_stats & 63;
-       weapon_fired[weapon_number-WEP_FIRST] = floor(weapon_stats / 64);
+               // hits
+               weapon_stats = getstati(STAT_DAMAGE_HITS);
+               weapon_number = weapon_stats & 63;
+               weapon_hits[weapon_number-WEP_FIRST] = floor(weapon_stats / 64);
+               // fired
+               weapon_stats = getstati(STAT_DAMAGE_FIRED);
+               weapon_number = weapon_stats & 63;
+               weapon_fired[weapon_number-WEP_FIRST] = floor(weapon_stats / 64);
 
-       if(cvar_or("hud_panel_weapons_fade", 1))
-       {
-               fade = 3.2 - 2 * (time - weapontime);
-               fade = bound(0.7, fade, 1);
-       }
-       else
-               fade = 1;
+               if(cvar_or("hud_panel_weapons_fade", 1))
+               {
+                       fade = 3.2 - 2 * (time - weapontime);
+                       fade = bound(0.7, fade, 1);
+               }
+               else
+                       fade = 1;
 
-       HUD_Weapons_Clear();
+               HUD_Weapons_Clear();
 
-       float rows, columns;
-       rows = mySize_y/mySize_x;
-       rows = bound(1, floor((sqrt(4 * autocvar_hud_panel_weapons_aspect * rows * WEP_COUNT + rows * rows) + rows + 0.5) / 2), WEP_COUNT);
+               float rows, columns;
+               rows = panel_size_y/panel_size_x;
+               rows = bound(1, floor((sqrt(4 * autocvar_hud_panel_weapons_aspect * rows * WEP_COUNT + rows * rows) + rows + 0.5) / 2), WEP_COUNT);
 
-       columns = ceil(WEP_COUNT/rows);
-       float row, column;
+               columns = ceil(WEP_COUNT/rows);
+               float row, column;
 
-       float a, type, fullammo;
-       float when;
-       when = autocvar_hud_panel_weapons_complainbubble_time;
-       float fadetime;
-       fadetime = autocvar_hud_panel_weapons_complainbubble_fadetime;
+               float a, type, fullammo;
+               float when;
+               when = autocvar_hud_panel_weapons_complainbubble_time;
+               float fadetime;
+               fadetime = autocvar_hud_panel_weapons_complainbubble_fadetime;
 
-       vector color;
-       vector wpnpos;
-       vector wpnsize;
-
-       float acc_levels;
-       if(autocvar_hud_panel_weapons_accuracy && !(gametype == GAME_RACE || gametype == GAME_CTS))
-       {
-               acc_levels = tokenize(cvar_string("hud_panel_weapons_accuracy_color_levels"));
-               if (acc_levels > MAX_ACCURACY_LEVELS)
-                       acc_levels = MAX_ACCURACY_LEVELS;
+               vector color;
+               vector wpnpos;
+               vector wpnsize;
 
-               for (i = 0; i < acc_levels; ++i)
-                       acc_lev[i] = stof(argv(i));
-       }
-
-       for(i = 0; i < weapon_cnt; ++i)
-       {
-               wpnpos = pos + eX * column * mySize_x*(1/columns) + eY * row * mySize_y*(1/rows);
-               wpnsize = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
+               for(i = 0; i < weapon_cnt; ++i)
+               {
+                       wpnpos = panel_pos + eX * column * panel_size_x*(1/columns) + eY * row * panel_size_y*(1/rows);
+                       wpnsize = eX * panel_size_x*(1/columns) + eY * panel_size_y*(1/rows);
 
-               self = weaponorder[i];
-               weapid = self.impulse;
+                       self = weaponorder[i];
+                       weapid = self.impulse;
 
-               // draw background behind currently selected weapon
-               if(self.weapon == activeweapon)
-                       drawpic_aspect_skin(wpnpos, "weapon_current_bg", wpnsize, '1 1 1', fade * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       // draw background behind currently selected weapon
+                       if(self.weapon == activeweapon)
+                               drawpic_aspect_skin(wpnpos, "weapon_current_bg", wpnsize, '1 1 1', fade * panel_fg_alpha, DRAWFLAG_NORMAL);
 
-               // draw the weapon accuracy
-               if(acc_levels)
-               {
-                       float weapon_hit, weapon_damage;
-                       weapon_damage = weapon_fired[self.weapon-WEP_FIRST];
-                       if(weapon_damage)
+                       // draw the weapon accuracy
+                       if(acc_levels)
                        {
-                               weapon_hit = weapon_hits[self.weapon-WEP_FIRST];
-                               weapon_stats = floor(100 * weapon_hit / weapon_damage);
-                       }
-
-                       // find the max level lower than weapon_stats
-                       float j;
-                       j = acc_levels-1;
-                       while ( j && weapon_stats < acc_lev[j] )
-                               --j;
-
-                       // inject color j+1 in color j, how much depending on how much weapon_stats is higher than level j
-                       float factor;
-                       factor = (weapon_stats - acc_lev[j]) / (acc_lev[j+1] - acc_lev[j]);
-                       color = acc_color(j);
-                       color = color + factor * (acc_color(j+1) - color);
+                               float weapon_hit, weapon_damage;
+                               weapon_damage = weapon_fired[self.weapon-WEP_FIRST];
+                               if(weapon_damage)
+                               {
+                                       weapon_hit = weapon_hits[self.weapon-WEP_FIRST];
+                                       weapon_stats = floor(100 * weapon_hit / weapon_damage);
+                               }
 
-                       if(weapon_damage)
-                               drawpic_aspect_skin(wpnpos, "weapon_accuracy", wpnsize, color, panel_fg_alpha, DRAWFLAG_NORMAL);
-               }
+                               // find the max level lower than weapon_stats
+                               float j;
+                               j = acc_levels-1;
+                               while ( j && weapon_stats < acc_lev[j] )
+                                       --j;
 
-               // draw the weapon icon
-               if((self.impulse >= 0) && (getstati(STAT_WEAPONS) & self.weapons))
-               {
-                       drawpic_aspect_skin(wpnpos, strcat("weapon", self.netname), wpnsize, '1 1 1', fade * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               // inject color j+1 in color j, how much depending on how much weapon_stats is higher than level j
+                               float factor;
+                               factor = (weapon_stats - acc_lev[j]) / (acc_lev[j+1] - acc_lev[j]);
+                               color = acc_color(j);
+                               color = color + factor * (acc_color(j+1) - color);
 
-                       if(autocvar_hud_panel_weapons_label == 1) // weapon number
-                               drawstring(wpnpos, ftos(weapid), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
-                       else if(autocvar_hud_panel_weapons_label == 2) // bind
-                               drawstring(wpnpos, getcommandkey(ftos(weapid), strcat("impulse ", ftos(weapid))), '1 1 0' * 0.5 * mySize_y*(1/rows), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                               if(weapon_damage)
+                                       drawpic_aspect_skin(wpnpos, "weapon_accuracy", wpnsize, color, panel_fg_alpha, DRAWFLAG_NORMAL);
+                       }
 
-                       // draw ammo status bar
-                       if(autocvar_hud_panel_weapons_ammo && weapid != WEP_TUBA && weapid != WEP_LASER && weapid != WEP_PORTO)
+                       // draw the weapon icon
+                       if((self.impulse >= 0) && (getstati(STAT_WEAPONS) & self.weapons))
                        {
-                               a = 0;
-                               type = GetAmmoTypeForWep(weapid);
-                               if(type != -1)
-                                       a = getstati(GetAmmoStat(type)); // how much ammo do we have?
+                               drawpic_aspect_skin(wpnpos, strcat("weapon", self.netname), wpnsize, '1 1 1', fade * panel_fg_alpha, DRAWFLAG_NORMAL);
 
-                               if(a > 0)
-                               {
-                                       switch(type) {
-                                               case 0: fullammo = autocvar_hud_panel_weapons_ammo_full_shells; break;
-                                               case 1: fullammo = autocvar_hud_panel_weapons_ammo_full_nails; break;
-                                               case 2: fullammo = autocvar_hud_panel_weapons_ammo_full_rockets; break;
-                                               case 3: fullammo = autocvar_hud_panel_weapons_ammo_full_cells; break;
-                                               case 4: fullammo = autocvar_hud_panel_weapons_ammo_full_fuel; break;
-                                               default: fullammo = 60;
-                                       }
+                               if(autocvar_hud_panel_weapons_label == 1) // weapon number
+                                       drawstring(wpnpos, ftos(weapid), '1 1 0' * 0.5 * panel_size_y*(1/rows), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+                               else if(autocvar_hud_panel_weapons_label == 2) // bind
+                                       drawstring(wpnpos, getcommandkey(ftos(weapid), strcat("impulse ", ftos(weapid))), '1 1 0' * 0.5 * panel_size_y*(1/rows), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 
-                                       vector barsize;
-                                       vector barpos;
-                                       if(wpnsize_x/wpnsize_y > autocvar_hud_panel_weapons_aspect)
-                                       {
-                                               barsize_x = autocvar_hud_panel_weapons_aspect * wpnsize_y;
-                                               barsize_y = wpnsize_y;
+                               // draw ammo status bar
+                               if(autocvar_hud_panel_weapons_ammo && weapid != WEP_TUBA && weapid != WEP_LASER && weapid != WEP_PORTO)
+                               {
+                                       a = 0;
+                                       type = GetAmmoTypeForWep(weapid);
+                                       if(type != -1)
+                                               a = getstati(GetAmmoStat(type)); // how much ammo do we have?
 
-                                               barpos_x = wpnpos_x + (wpnsize_x - barsize_x) / 2;
-                                               barpos_y = wpnpos_y;
-                                       }
-                                       else
+                                       if(a > 0)
                                        {
-                                               barsize_y = 1/autocvar_hud_panel_weapons_aspect * wpnsize_x;
-                                               barsize_x = wpnsize_x;
-
-                                               barpos_y = wpnpos_y + (wpnsize_y - barsize_y) / 2;
-                                               barpos_x = wpnpos_x;
+                                               switch(type) {
+                                                       case 0: fullammo = autocvar_hud_panel_weapons_ammo_full_shells; break;
+                                                       case 1: fullammo = autocvar_hud_panel_weapons_ammo_full_nails; break;
+                                                       case 2: fullammo = autocvar_hud_panel_weapons_ammo_full_rockets; break;
+                                                       case 3: fullammo = autocvar_hud_panel_weapons_ammo_full_cells; break;
+                                                       case 4: fullammo = autocvar_hud_panel_weapons_ammo_full_fuel; break;
+                                                       default: fullammo = 60;
+                                               }
+
+                                               vector barsize;
+                                               vector barpos;
+                                               if(wpnsize_x/wpnsize_y > autocvar_hud_panel_weapons_aspect)
+                                               {
+                                                       barsize_x = autocvar_hud_panel_weapons_aspect * wpnsize_y;
+                                                       barsize_y = wpnsize_y;
+
+                                                       barpos_x = wpnpos_x + (wpnsize_x - barsize_x) / 2;
+                                                       barpos_y = wpnpos_y;
+                                               }
+                                               else
+                                               {
+                                                       barsize_y = 1/autocvar_hud_panel_weapons_aspect * wpnsize_x;
+                                                       barsize_x = wpnsize_x;
+
+                                                       barpos_y = wpnpos_y + (wpnsize_y - barsize_y) / 2;
+                                                       barpos_x = wpnpos_x;
+                                               }
+
+                                               drawsetcliparea(
+                                                       barpos_x,
+                                                       barpos_y,
+                                                       barsize_x * bound(0, a/fullammo, 1),
+                                                       barsize_y);
+                                               drawpic_aspect_skin(wpnpos, "weapon_ammo", wpnsize, autocvar_hud_panel_weapons_ammo_color, panel_fg_alpha * autocvar_hud_panel_weapons_ammo_alpha, DRAWFLAG_NORMAL);
+                                               drawresetcliparea();
                                        }
-
-                                       drawsetcliparea(
-                                               barpos_x,
-                                               barpos_y,
-                                               barsize_x * bound(0, a/fullammo, 1),
-                                               barsize_y);
-                                       drawpic_aspect_skin(wpnpos, "weapon_ammo", wpnsize, autocvar_hud_panel_weapons_ammo_color, panel_fg_alpha * autocvar_hud_panel_weapons_ammo_alpha, DRAWFLAG_NORMAL);
-                                       drawresetcliparea();
                                }
                        }
-               }
 
-               // draw a "ghost weapon icon" if you don't have the weapon
-               else
-               {
-                       drawpic_aspect_skin(wpnpos, strcat("weapon", self.netname), wpnsize, '0 0 0', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
-               }
-
-               // draw the complain message
-               if(time - complain_weapon_time < when + fadetime && self.weapon == complain_weapon && autocvar_hud_panel_weapons_complainbubble)
-               {
-                       if(fadetime)
+                       // draw a "ghost weapon icon" if you don't have the weapon
+                       else
                        {
-                               if(complain_weapon_time + when > time)
-                                       a = 1;
-                               else
-                                       a = bound(0, (complain_weapon_time + when + fadetime - time) / fadetime, 1);
+                               drawpic_aspect_skin(wpnpos, strcat("weapon", self.netname), wpnsize, '0 0 0', panel_fg_alpha * 0.5, DRAWFLAG_NORMAL);
                        }
-                       else
+
+                       // draw the complain message
+                       if(time - complain_weapon_time < when + fadetime && self.weapon == complain_weapon && autocvar_hud_panel_weapons_complainbubble)
                        {
-                               if(complain_weapon_time + when > time)
-                                       a = 1;
+                               if(fadetime)
+                               {
+                                       if(complain_weapon_time + when > time)
+                                               a = 1;
+                                       else
+                                               a = bound(0, (complain_weapon_time + when + fadetime - time) / fadetime, 1);
+                               }
                                else
-                                       a = 0;
-                       }
+                               {
+                                       if(complain_weapon_time + when > time)
+                                               a = 1;
+                                       else
+                                               a = 0;
+                               }
 
-                       string s;
-                       if(complain_weapon_type == 0) {
-                               s = "Out of ammo";
-                               color = autocvar_hud_panel_weapons_complainbubble_color_outofammo;
-                       }
-                       else if(complain_weapon_type == 1) {
-                               s = "Don't have";
-                               color = autocvar_hud_panel_weapons_complainbubble_color_donthave;
+                               string s;
+                               if(complain_weapon_type == 0) {
+                                       s = "Out of ammo";
+                                       color = autocvar_hud_panel_weapons_complainbubble_color_outofammo;
+                               }
+                               else if(complain_weapon_type == 1) {
+                                       s = "Don't have";
+                                       color = autocvar_hud_panel_weapons_complainbubble_color_donthave;
+                               }
+                               else {
+                                       s = "Unavailable";
+                                       color = autocvar_hud_panel_weapons_complainbubble_color_unavailable;
+                               }
+                               drawpic_aspect_skin(wpnpos + '1 1 0' * autocvar_hud_panel_weapons_complainbubble_padding, "weapon_complainbubble", wpnsize - '2 2 0' * autocvar_hud_panel_weapons_complainbubble_padding, color, a * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               drawstring_aspect(wpnpos + '1 1 0' * autocvar_hud_panel_weapons_complainbubble_padding, s, wpnsize - '2 2 0' * autocvar_hud_panel_weapons_complainbubble_padding, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
                        }
-                       else {
-                               s = "Unavailable";
-                               color = autocvar_hud_panel_weapons_complainbubble_color_unavailable;
+
+                       ++row;
+                       if(row >= rows)
+                       {
+                               row = 0;
+                               ++column;
                        }
-                       drawpic_aspect_skin(wpnpos + '1 1 0' * autocvar_hud_panel_weapons_complainbubble_padding, "weapon_complainbubble", wpnsize - '2 2 0' * autocvar_hud_panel_weapons_complainbubble_padding, color, a * panel_fg_alpha, DRAWFLAG_NORMAL);
-                       drawstring_aspect(wpnpos + '1 1 0' * autocvar_hud_panel_weapons_complainbubble_padding, s, wpnsize - '2 2 0' * autocvar_hud_panel_weapons_complainbubble_padding, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL);
                }
 
-               ++row;
-               if(row >= rows)
-               {
-                       row = 0;
-                       ++column;
-               }
        }
 
-}
-
-// Ammo (#1)
-//
-// TODO: macro
-float GetAmmoItemCode(float i)
-{
-       switch(i)
+       // Ammo (#1)
+       //
+       // TODO: macro
+       float GetAmmoItemCode(float i)
        {
-               case 0: return IT_SHELLS;
-               case 1: return IT_NAILS;
-               case 2: return IT_ROCKETS;
-               case 3: return IT_CELLS;
-               case 4: return IT_FUEL;
-               default: return -1;
+               switch(i)
+               {
+                       case 0: return IT_SHELLS;
+                       case 1: return IT_NAILS;
+                       case 2: return IT_ROCKETS;
+                       case 3: return IT_CELLS;
+                       case 4: return IT_FUEL;
+                       default: return -1;
+               }
        }
-}
 
-string GetAmmoPicture(float i)
-{
-       switch(i)
+       string GetAmmoPicture(float i)
        {
-               case 0: return "ammo_shells";
-               case 1: return "ammo_bullets";
-               case 2: return "ammo_rockets";
-               case 3: return "ammo_cells";
-               case 4: return "ammo_fuel";
-               default: return "";
+               switch(i)
+               {
+                       case 0: return "ammo_shells";
+                       case 1: return "ammo_bullets";
+                       case 2: return "ammo_rockets";
+                       case 3: return "ammo_cells";
+                       case 4: return "ammo_fuel";
+                       default: return "";
+               }
        }
-}
 
-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(autocvar__hud_configure)
-               a = 100;
+       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(autocvar__hud_configure)
+                       a = 100;
 
-       vector color;
-       if(a < 10)
-               color = '0.7 0 0';
-       else
-               color = '1 1 1';
+               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;
+               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;
+               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_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;
-       }
+                       newPos_y = myPos_y + (mySize_y - newSize_y) / 2;
+                       newPos_x = myPos_x;
+               }
 
-       vector picpos, numpos;
-       if(autocvar_hud_panel_ammo_iconalign)
-       {
-               numpos = newPos;
-               picpos = newPos + eX * 2 * newSize_y;
-       }
-       else
-       {
-               numpos = newPos + eX * newSize_y;
-               picpos = newPos;
-       }
+               vector picpos, numpos;
+               if(autocvar_hud_panel_ammo_iconalign)
+               {
+                       numpos = newPos;
+                       picpos = newPos + eX * 2 * newSize_y;
+               }
+               else
+               {
+                       numpos = newPos + eX * newSize_y;
+                       picpos = newPos;
+               }
 
-       if (currently_selected)
-               drawpic_aspect_skin(newPos, "ammo_current_bg", newSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               if (currently_selected)
+                       drawpic_aspect_skin(newPos, "ammo_current_bg", newSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 
-       drawfont = hud_bigfont;
-       drawstring_aspect(numpos, ftos(a), eX * (2/3) * newSize_x + eY * newSize_y, color, panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
-       drawfont = hud_font;
-       drawpic_aspect_skin(picpos, GetAmmoPicture(itemcode), '1 1 0' * newSize_y, '1 1 1', panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
-}
+               drawfont = hud_bigfont;
+               if(a > 0)
+                       drawstring_aspect(numpos, ftos(a), eX * (2/3) * newSize_x + eY * newSize_y, color, panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
+               else // "ghost" ammo count
+                       drawstring_aspect(numpos, ftos(a), eX * (2/3) * newSize_x + eY * newSize_y, '0 0 0', panel_fg_alpha * alpha * 0.5, DRAWFLAG_NORMAL);
+               drawfont = hud_font;
+               if(a > 0)
+                       drawpic_aspect_skin(picpos, GetAmmoPicture(itemcode), '1 1 0' * newSize_y, '1 1 1', panel_fg_alpha * alpha, DRAWFLAG_NORMAL);
+               else // "ghost" ammo icon
+                       drawpic_aspect_skin(picpos, GetAmmoPicture(itemcode), '1 1 0' * newSize_y, '0 0 0', panel_fg_alpha * alpha * 0.5, DRAWFLAG_NORMAL);
+       }
 
-void HUD_Ammo(void)
-{
-       if(!autocvar_hud_panel_ammo && !autocvar__hud_configure)
-               return;
+       void HUD_Ammo(void)
+       {
+               if(!autocvar_hud_panel_ammo && !autocvar__hud_configure)
+                       return;
 
-       active_panel = HUD_PANEL_AMMO;
-       HUD_Panel_UpdateCvars(ammo);
-       float i, currently_selected;
+               active_panel = HUD_PANEL_AMMO;
+               HUD_Panel_UpdateCvars(ammo);
+               float i, currently_selected;
 
-       vector pos, mySize;
-       pos = panel_pos;
-       mySize = panel_size;
+               vector pos, mySize;
+               pos = panel_pos;
+               mySize = panel_size;
 
-       HUD_Panel_DrawBg(1);
+               HUD_Panel_DrawBg(1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -1852,10 +2037,17 @@ void HUD_Powerups(void) {
        pos = panel_pos;
        mySize = panel_size;
 
-       float strength_time, shield_time;
-
-       strength_time = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 99);
-       shield_time = bound(0, getstatf(STAT_INVINCIBLE_FINISHED) - time, 99);
+       float strength_time, shield_time;
+       if(autocvar__hud_configure)
+       {
+               strength_time = 15;
+               shield_time = 27;
+       }
+       else
+       {
+               strength_time = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 99);
+               shield_time = bound(0, getstatf(STAT_INVINCIBLE_FINISHED) - time, 99);
+       }
 
        HUD_Panel_DrawBg(bound(0, max(strength_time, shield_time), 1));
        if(panel_bg_padding)
@@ -1864,12 +2056,6 @@ void HUD_Powerups(void) {
                mySize -= '2 2 0' * panel_bg_padding;
        }
 
-       if(autocvar__hud_configure)
-       {
-               strength_time = 15;
-               shield_time = 27;
-       }
-
        vector barpos, barsize;
        vector picpos;
        vector numpos;
@@ -1908,8 +2094,11 @@ void HUD_Powerups(void) {
                                barsize = eX * 0.5 * mySize_x * min(1, leftcnt/30) + eY * mySize_y;
                        }
 
-                       HUD_Panel_GetProgressBarColor(leftname)
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1), DRAWFLAG_NORMAL);
+                       if(autocvar_hud_panel_powerups_progressbar)
+                       {
+                               HUD_Panel_GetProgressBarColor(leftname)
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1), DRAWFLAG_NORMAL);
+                       }
                        if(leftcnt > 1)
                                DrawNumIcon(autocvar_hud_panel_powerups_iconalign, pos, eX * 0.5 * mySize_x + eY * mySize_y, leftcnt, leftname, 1, '1 1 1', 1);
                        if(leftcnt <= 5)
@@ -1926,8 +2115,11 @@ void HUD_Powerups(void) {
                                barsize = eX * 0.5 * mySize_x * min(1, rightcnt/30) + eY * mySize_y;
                        }
 
-                       HUD_Panel_GetProgressBarColor(rightname)
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       if(autocvar_hud_panel_powerups_progressbar)
+                       {
+                               HUD_Panel_GetProgressBarColor(rightname)
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       }
                        if(rightcnt > 1)
                                DrawNumIcon(autocvar_hud_panel_powerups_iconalign, pos + eX * 0.5 * mySize_x, eX * 0.5 * mySize_x + eY * mySize_y, rightcnt, rightname, 0, '1 1 1', 1);
                        if(rightcnt <= 5)
@@ -1946,8 +2138,11 @@ void HUD_Powerups(void) {
                                barsize = eX * mySize_x * min(1, leftcnt/30) + eY * 0.5 * mySize_y;
                        }
 
-                       HUD_Panel_GetProgressBarColor(leftname)
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       if(autocvar_hud_panel_powerups_progressbar)
+                       {
+                               HUD_Panel_GetProgressBarColor(leftname)
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       }
                        if(leftcnt > 1)
                                DrawNumIcon(autocvar_hud_panel_powerups_iconalign, pos, eX * mySize_x + eY * 0.5 * mySize_y, leftcnt, leftname, 1, '1 1 1', 1);
                        if(leftcnt <= 5)
@@ -1964,8 +2159,11 @@ void HUD_Powerups(void) {
                                barsize = eX * mySize_x * min(1, rightcnt/30) + eY * 0.5 * mySize_y;
                        }
 
-                       HUD_Panel_GetProgressBarColor(rightname)
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       if(autocvar_hud_panel_powerups_progressbar)
+                       {
+                               HUD_Panel_GetProgressBarColor(rightname)
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       }
                        if(rightcnt > 1)
                                DrawNumIcon(autocvar_hud_panel_powerups_iconalign, pos + eY * 0.5 * mySize_y, eX * mySize_x + eY * 0.5 * mySize_y, rightcnt, rightname, 0, '1 1 1', 1);
                        if(rightcnt <= 5)
@@ -1992,8 +2190,11 @@ void HUD_Powerups(void) {
                                numpos = pos + eY * 0.4 * mySize_x;
                        }
 
-                       HUD_Panel_GetProgressBarColor(leftname)
-                       HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       if(autocvar_hud_panel_powerups_progressbar)
+                       {
+                               HUD_Panel_GetProgressBarColor(leftname)
+                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       }
                        if(leftcnt <= 5)
                                drawpic_aspect_skin_expanding(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, bound(0, (leftcnt - leftexact) / 0.5, 1));
                        if(leftcnt > 1)
@@ -2019,8 +2220,11 @@ void HUD_Powerups(void) {
                                numpos = pos + eY * mySize_y - eY * 0.25 * mySize_x + eX * 0.5 * mySize_x;
                        }
 
-                       HUD_Panel_GetProgressBarColor(rightname)
-                       HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       if(autocvar_hud_panel_powerups_progressbar)
+                       {
+                               HUD_Panel_GetProgressBarColor(rightname)
+                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha * bound(0, max(strength_time, shield_time), 1) * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       }
                        if(rightcnt <= 5)
                                drawpic_aspect_skin_expanding(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, bound(0, (rightcnt - rightexact) / 0.5, 1));
                        if(rightcnt > 1)
@@ -2093,16 +2297,22 @@ void HUD_HealthArmor(void)
                if(v_z) // NOT fully armored
                {
                        biggercount = "health";
-                       HUD_Panel_GetProgressBarColor("health")
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       if(autocvar_hud_panel_healtharmor_progressbar)
+                       {
+                               HUD_Panel_GetProgressBarColor("health")
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       }
                        if(armor)
                                drawpic_aspect_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "armor", '0.5 0.5 0' * mySize_y, '1 1 1', panel_fg_alpha * armor / health, DRAWFLAG_NORMAL);
                }
                else
                {
                        biggercount = "armor";
-                       HUD_Panel_GetProgressBarColor("armor")
-                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       if(autocvar_hud_panel_healtharmor_progressbar)
+                       {
+                               HUD_Panel_GetProgressBarColor("armor")
+                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                       }
                        if(health)
                                drawpic_aspect_skin(pos + eX * mySize_x - eX * 0.5 * mySize_y, "health", '0.5 0.5 0' * mySize_y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
@@ -2164,8 +2374,11 @@ void HUD_HealthArmor(void)
                                        barsize = eX * 0.5 * mySize_x * min(1, leftcnt/200) + eY * mySize_y;
                                }
 
-                               HUD_Panel_GetProgressBarColor(leftname)
-                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               if(autocvar_hud_panel_healtharmor_progressbar)
+                               {
+                                       HUD_Panel_GetProgressBarColor(leftname)
+                                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               }
                                DrawNumIcon(autocvar_hud_panel_healtharmor_iconalign, pos, eX * 0.5 * mySize_x + eY * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, 200), 1);
                        }
 
@@ -2179,9 +2392,12 @@ void HUD_HealthArmor(void)
                                        barsize = eX * 0.5 * mySize_x * min(1, rightcnt/200) + eY * mySize_y;
                                }
 
-                               HUD_Panel_GetProgressBarColor(rightname)
-                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
-                               DrawNumIcon(autocvar_hud_panel_healtharmor_iconalign, pos + eX * 0.5 * mySize_x, eX * 0.5 * mySize_x + eY * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(leftcnt, 200), 1);
+                               if(autocvar_hud_panel_healtharmor_progressbar)
+                               {
+                                       HUD_Panel_GetProgressBarColor(rightname)
+                                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               }
+                               DrawNumIcon(autocvar_hud_panel_healtharmor_iconalign, pos + eX * 0.5 * mySize_x, eX * 0.5 * mySize_x + eY * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(rightcnt, 200), 1);
                        }
 
                        if(fuel)
@@ -2209,8 +2425,11 @@ void HUD_HealthArmor(void)
                                        barsize = eX * mySize_x * min(1, leftcnt/200) + eY * 0.5 * mySize_y;
                                }
 
-                               HUD_Panel_GetProgressBarColor(leftname)
-                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               if(autocvar_hud_panel_healtharmor_progressbar)
+                               {
+                                       HUD_Panel_GetProgressBarColor(leftname)
+                                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               }
                                DrawNumIcon(autocvar_hud_panel_healtharmor_iconalign, pos, eX * mySize_x + eY * 0.5 * mySize_y, leftcnt, leftname, 1, HUD_Get_Num_Color(leftcnt, 200), 1);
                        }
 
@@ -2224,9 +2443,12 @@ void HUD_HealthArmor(void)
                                        barsize = eX * mySize_x * min(1, rightcnt/200) + eY * 0.5 * mySize_y;
                                }
 
-                               HUD_Panel_GetProgressBarColor(rightname)
-                               HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
-                               DrawNumIcon(autocvar_hud_panel_healtharmor_iconalign, pos + eY * 0.5 * mySize_y, eX * mySize_x + eY * 0.5 * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(leftcnt, 200), 1);
+                               if(autocvar_hud_panel_healtharmor_progressbar)
+                               {
+                                       HUD_Panel_GetProgressBarColor(rightname)
+                                       HUD_Panel_DrawProgressBar(barpos, 0, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               }
+                               DrawNumIcon(autocvar_hud_panel_healtharmor_iconalign, pos + eY * 0.5 * mySize_y, eX * mySize_x + eY * 0.5 * mySize_y, rightcnt, rightname, 0, HUD_Get_Num_Color(rightcnt, 200), 1);
                        }
 
                        if(fuel)
@@ -2262,8 +2484,11 @@ void HUD_HealthArmor(void)
                                        numpos = pos + eY * 0.4 * mySize_x;
                                }
 
-                               HUD_Panel_GetProgressBarColor(leftname)
-                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               if(autocvar_hud_panel_healtharmor_progressbar)
+                               {
+                                       HUD_Panel_GetProgressBarColor(leftname)
+                                       HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               }
                                drawpic_aspect_skin(picpos, leftname, '0.4 0.4 0' * mySize_x, '1 1 1', leftalpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                                drawstring_aspect(numpos, ftos(leftcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, HUD_Get_Num_Color(leftcnt, 200), panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
@@ -2286,8 +2511,11 @@ void HUD_HealthArmor(void)
                                        numpos = pos + eY * mySize_y - eY * 0.25 * mySize_x + eX * 0.5 * mySize_x;
                                }
 
-                               HUD_Panel_GetProgressBarColor(rightname)
-                               HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               if(autocvar_hud_panel_healtharmor_progressbar)
+                               {
+                                       HUD_Panel_GetProgressBarColor(rightname)
+                                       HUD_Panel_DrawProgressBar(barpos, 1, barsize, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               }
                                drawpic_aspect_skin(picpos, rightname, '0.4 0.4 0' * mySize_x, '1 1 1', rightalpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                                drawstring_aspect(numpos, ftos(rightcnt), eX * 0.5 * mySize_x + eY * 0.25 * mySize_x, HUD_Get_Num_Color(rightcnt, 200), panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
@@ -2356,7 +2584,7 @@ void HUD_KillNotify_Push(string attacker, string victim, float actiontype, float
        killnotify_victims[0] = strzone(victim);
 }
 
-void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
+void HUD_KillNotify(string s1, string s2, string s3, float type, float msg) // s1 = attacker, s2 = victim
 {
        float w;
        float alsoprint, gentle;
@@ -2368,7 +2596,7 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
                if(WEP_VALID(w)) {
                        HUD_KillNotify_Push(s1, "", 0, DEATH_GENERIC);
                        if (alsoprint)
-                               print("^1", s1, "^1 ", Weapon_SuicideMessage(type), "\n");
+                               print("^1", sprintf(Weapon_SuicideMessage(type), strcat(s1, "^1")), "\n");
                } else if (type == DEATH_KILL) {
                        HUD_KillNotify_Push(s1, "", 0, DEATH_KILL);
                        if (alsoprint)
@@ -2408,9 +2636,9 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
        } else if(msg == MSG_KILL) {
                w = DEATH_WEAPONOF(type);
                if(WEP_VALID(w)) {
-                       HUD_KillNotify_Push(s2, s1, 1, w);
+                       HUD_KillNotify_Push(s1, s2, 1, type);
                        if (alsoprint)
-                               print("^1", s1, "^1 ", Weapon_KillMessage(type), "\n");
+                               print("^1", sprintf(Weapon_KillMessage(type), strcat(s2, "^1"), strcat(s1, "^1")), "\n"); // default order: victim, killer
                }
                else if(type == KILL_TEAM_RED || type == KILL_TEAM_BLUE || type == KILL_TEAM_SPREE) {
                        HUD_KillNotify_Push(s1, s2, 1, type);
@@ -2437,96 +2665,100 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
                }
                else if(type == KILL_FIRST_BLOOD)
                        print("^1",s1, "^1 drew first blood", "\n");
-               // TODO: icon!
-               else if (type == DEATH_TELEFRAG)
-                       print ("^1",s1, "^1 was telefragged by ", s2, "\n");
+               else if (type == DEATH_TELEFRAG) {
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_TELEFRAG);
+                       if(gentle)
+                               print ("^1",s2, "^1 tried to occupy ", s1, "^1's teleport destination space\n");
+                       else
+                               print ("^1",s2, "^1 was telefragged by ", s1, "\n");
+               }
                else if (type == DEATH_DROWN) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_DROWN);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_DROWN);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was drowned by ", s2, "\n");
+                               print ("^1",s2, "^1 was drowned by ", s1, "\n");
                }
                else if (type == DEATH_SLIME) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_SLIME);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_SLIME);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was slimed by ", s2, "\n");
+                               print ("^1",s2, "^1 was slimed by ", s1, "\n");
                }
                else if (type == DEATH_LAVA) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_LAVA);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_LAVA);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was cooked by ", s2, "\n");
+                               print ("^1",s2, "^1 was cooked by ", s1, "\n");
                }
                else if (type == DEATH_FALL) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_FALL);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_FALL);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was grounded by ", s2, "\n");
+                               print ("^1",s2, "^1 was grounded by ", s1, "\n");
                }
                else if (type == DEATH_SHOOTING_STAR) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_SHOOTING_STAR);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_SHOOTING_STAR);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was shot into space by ", s2, "\n");
+                               print ("^1",s2, "^1 was shot into space by ", s1, "\n");
                }
                else if (type == DEATH_SWAMP) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was conserved by ", s2, "\n");
+                               print ("^1",s2, "^1 was conserved by ", s1, "\n");
                }
                else if (type == DEATH_HURTTRIGGER)
                {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_HURTTRIGGER);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_HURTTRIGGER);
                        if(alsoprint)
-                               print("^1",s1, "^1 was thrown into a world of hurt by ", s2, "\n");
+                               print("^1",s2, "^1 was thrown into a world of hurt by ", s1, "\n");
                } else if(type == DEATH_SBCRUSH) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was crushed by ^1", s2, "\n");
+                               print ("^1",s2, "^1 was crushed by ^1", s1, "\n");
                } else if(type == DEATH_SBMINIGUN) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 got shredded by ^1", s2, "\n");
+                               print ("^1",s2, "^1 got shredded by ^1", s1, "\n");
                } else if(type == DEATH_SBROCKET) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was blased to bits by ^1", s2, "\n");
+                               print ("^1",s2, "^1 was blased to bits by ^1", s1, "\n");
                } else if(type == DEATH_SBBLOWUP) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 got caught in the destruction of ^1", s2, "'s vehicle\n");
+                               print ("^1",s2, "^1 got caught in the destruction of ^1", s1, "'s vehicle\n");
                } else if(type == DEATH_WAKIGUN) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was bolted down by ^1", s2, "\n");
+                               print ("^1",s2, "^1 was bolted down by ^1", s1, "\n");
                } else if(type == DEATH_WAKIROCKET) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 could find no shelter from ^1", s2, "'s rockets\n");
+                               print ("^1",s2, "^1 could find no shelter from ^1", s1, "'s rockets\n");
                } else if(type == DEATH_WAKIBLOWUP) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 dies when ^1", s2, "'s wakizashi dies.\n");
+                               print ("^1",s2, "^1 dies when ^1", s1, "'s wakizashi dies.\n");
                } else if(type == DEATH_TURRET) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was pushed into the line of fire by ^1", s2, "\n");
+                               print ("^1",s2, "^1 was pushed into the line of fire by ^1", s1, "\n");
                } else if(type == DEATH_TOUCHEXPLODE) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was pushed into an accident by ^1", s2, "\n");
+                               print ("^1",s2, "^1 was pushed into an accident by ^1", s1, "\n");
                } else if(type == DEATH_CHEAT) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was unfairly eliminated by ^1", s2, "\n");
+                               print ("^1",s2, "^1 was unfairly eliminated by ^1", s1, "\n");
                } else if (type == DEATH_FIRE) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was burnt to death by ^1", s2, "\n");
+                               print ("^1",s2, "^1 was burnt to death by ^1", s1, "\n");
                } else if (type == DEATH_CUSTOM) {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_CUSTOM);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_CUSTOM);
                        if(alsoprint)
-                               print ("^1",s1, "^1 ", s2, "\n");
+                               print ("^1",s2, "^1 ", s1, "\n");
                } else {
-                       HUD_KillNotify_Push(s2, s1, 1, DEATH_GENERIC);
+                       HUD_KillNotify_Push(s1, s2, 1, DEATH_GENERIC);
                        if(alsoprint)
-                               print ("^1",s1, "^1 was fragged by ", s2, "\n");
+                               print ("^1",s2, "^1 was fragged by ", s1, "\n");
                }
        } else if(msg == MSG_SPREE) {
                if(type == KILL_END_SPREE) {
@@ -2717,7 +2949,7 @@ void HUD_Centerprint(string s1, string s2, float type, float msg)
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1Don't shoot your team mates!"));
                } else if (type == DEATH_QUIET) {
                        // do nothing
-               } else if (type == DEATH_KILL) {
+               } else { // generic message
                        if(gentle)
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You need to be more careful!"));
                        else
@@ -2760,7 +2992,7 @@ void HUD_Centerprint(string s1, string s2, float type, float msg)
                        } else {
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^4You fragged ^7", s1, s2));
                        }
-               } else if (type == KILL_FRAGGED) {
+               } else { // generic message
                        if(gentle) {
                                centerprint(strcat(DAMAGE_CENTERPRINT_SPACER, "^1You were scored against by ^7", s1, s2));
                        } else {
@@ -2811,7 +3043,7 @@ void HUD_Notify (void)
        float width_attacker;
        string attacker, victim;
 
-       float i, j;
+       float i, j, w;
        for(j = 0; j < entries; ++j)
        {
                s = "";
@@ -2835,6 +3067,9 @@ void HUD_Notify (void)
                                a = 0;
                }
 
+               w = -1;
+               w = DEATH_WEAPONOF(killnotify_deathtype[j]);
+
                // TODO: maybe print in team colors?
                //
                // Y [used by] X
@@ -2965,9 +3200,17 @@ void HUD_Notify (void)
                        {
                                s = "weaponelectro";
                        }
-                       else if(WEP_VALID(killnotify_deathtype[j]))
+                       else if(killnotify_deathtype[j] & HITTYPE_SECONDARY && w == WEP_LASER)
+                       {
+                               s = "notify_melee_laser";
+                       }
+                       else if(killnotify_deathtype[j] & HITTYPE_SECONDARY && w == WEP_SHOTGUN)
                        {
-                               self = get_weaponinfo(killnotify_deathtype[j]);
+                               s = "notify_melee_shotgun";
+                       }
+                       else if(WEP_VALID(w))
+                       {
+                               self = get_weaponinfo(w);
                                s = strcat("weapon", self.netname);
                        }
                        else if(killnotify_deathtype[j] == KILL_TEAM_RED)
@@ -2978,6 +3221,10 @@ void HUD_Notify (void)
                        {
                                s = "notify_teamkill_red";
                        }
+                       else if(killnotify_deathtype[j] == DEATH_TELEFRAG)
+                       {
+                               s = "notify_telefrag";
+                       }
                        else if(killnotify_deathtype[j] == DEATH_DROWN)
                        {
                                s = "notify_water";
@@ -3192,7 +3439,7 @@ void HUD_Radar(void)
                mySize_y
        );
 
-       draw_teamradar_background(hud_panel_radar_background_alpha, hud_panel_radar_foreground_alpha);
+       draw_teamradar_background(hud_panel_radar_foreground_alpha);
 
        for(tm = world; (tm = find(tm, classname, "radarlink")); )
                draw_teamradar_link(tm.origin, tm.velocity, tm.team);
@@ -3501,6 +3748,17 @@ void HUD_VoteWindow(void)
        pos = panel_pos;
        mySize = panel_size;
 
+       if(!autocvar__hud_configure)
+       {
+               panel_fg_alpha = autocvar_hud_panel_fg_alpha;
+               panel_bg_alpha_str = autocvar_hud_panel_vote_bg_alpha;
+
+               if(panel_bg_alpha_str == "") {
+                       panel_bg_alpha_str = ftos(autocvar_hud_panel_bg_alpha);
+               }
+               panel_bg_alpha = stof(panel_bg_alpha_str);
+       }
+
        string s;
        float a;
        if(vote_active != vote_prev) {
@@ -3523,9 +3781,9 @@ void HUD_VoteWindow(void)
        if(!vote_alpha)
                return;
 
-       a = vote_alpha * bound(autocvar_hud_panel_vote_alreadyvoted_alpha, 1 - vote_highlighted, 1);
-
+       a = panel_bg_alpha * vote_alpha * bound(autocvar_hud_panel_vote_alreadyvoted_alpha, 1 - vote_highlighted, 1);
        HUD_Panel_DrawBg(a);
+       a = panel_fg_alpha * vote_alpha * bound(autocvar_hud_panel_vote_alreadyvoted_alpha, 1 - vote_highlighted, 1);
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -3551,37 +3809,37 @@ void HUD_VoteWindow(void)
        mySize = newSize;
 
        s = "A vote has been called for:";
-       drawstring_aspect(pos, s, eX * mySize_x + eY * (2/8) * mySize_y, '1 1 1', a * panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawstring_aspect(pos, s, eX * mySize_x + eY * (2/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
        s = textShortenToWidth(vote_called_vote, mySize_x, '1 1 0' * mySize_y * (1.75/8), stringwidth_colors);
        if(autocvar__hud_configure)
                s = "^1Configure the HUD";
-       drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize_y, s, eX * mySize_x + eY * (1.75/8) * mySize_y, a * panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawcolorcodedstring_aspect(pos + eY * (2/8) * mySize_y, s, eX * mySize_x + eY * (1.75/8) * mySize_y, a, DRAWFLAG_NORMAL);
 
        // print the yes/no counts
-       s = strcat("Yes (", getcommandkey("not bound", "vyes"), "): ", ftos(vote_yescount));
-       drawstring_aspect(pos + eY * (4/8) * mySize_y, s, eX * 0.5 * mySize_x + eY * (1.5/8) * mySize_y, '0 1 0', a * panel_fg_alpha, DRAWFLAG_NORMAL);
-       s = strcat("No (", getcommandkey("not bound", "vno"), "): ", ftos(vote_nocount));
-       drawstring_aspect(pos + eX * 0.5 * mySize_x + eY * (4/8) * mySize_y, s, eX * 0.5 * mySize_x + eY * (1.5/8) * mySize_y, '1 0 0', a * panel_fg_alpha, DRAWFLAG_NORMAL);
+       s = strcat("Yes (", getcommandkey("vyes", "vyes"), "): ", ftos(vote_yescount));
+       drawstring_aspect(pos + eY * (4/8) * mySize_y, s, eX * 0.5 * mySize_x + eY * (1.5/8) * mySize_y, '0 1 0', a, DRAWFLAG_NORMAL);
+       s = strcat("No (", getcommandkey("vno", "vno"), "): ", ftos(vote_nocount));
+       drawstring_aspect(pos + eX * 0.5 * mySize_x + eY * (4/8) * mySize_y, s, eX * 0.5 * mySize_x + eY * (1.5/8) * mySize_y, '1 0 0', a, DRAWFLAG_NORMAL);
 
        // draw the progress bar backgrounds
-       drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_back", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a * panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_back", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
 
        // draw the highlights
        if(vote_highlighted == 1) {
                drawsetcliparea(pos_x, pos_y, mySize_x * 0.5, mySize_y);
-               drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_voted", eX * mySize_x + eY * (3/8) * mySize_y, '0 1 0', a * panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_voted", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
        }
        else if(vote_highlighted == 2) {
                drawsetcliparea(pos_x + 0.5 * mySize_x, pos_y, mySize_x * 0.5, mySize_y);
-               drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_voted", eX * mySize_x + eY * (3/8) * mySize_y, '0 1 0', a * panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_voted", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
        }
 
        // draw the progress bars
        drawsetcliparea(pos_x, pos_y, mySize_x * 0.5 * (vote_yescount/vote_needed), mySize_y);
-       drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_prog", eX * mySize_x + eY * (3/8) * mySize_y, '0 1 0', a * panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_prog", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
 
        drawsetcliparea(pos_x + mySize_x - mySize_x * 0.5 * (vote_nocount/vote_needed), pos_y, mySize_x * 0.5, mySize_y);
-       drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_prog", eX * mySize_x + eY * (3/8) * mySize_y, '1 0 0', a * panel_fg_alpha, DRAWFLAG_NORMAL);
+       drawpic_skin(pos + eY * (5/8) * mySize_y, "voteprogress_prog", eX * mySize_x + eY * (3/8) * mySize_y, '1 1 1', a, DRAWFLAG_NORMAL);
 
        drawresetcliparea();
 
@@ -4185,11 +4443,29 @@ void HUD_Chat(void)
 
        active_panel = HUD_PANEL_CHAT;
        HUD_Panel_UpdateCvars(chat);
+
+       if(autocvar__con_chat_maximized && !autocvar__hud_configure) // draw at full screen height if maximized
+       {
+               panel_pos_y = panel_bg_border;
+               panel_size_y = vid_conheight - panel_bg_border * 2;
+               if(panel_bg == "0") // force a border when maximized
+               {
+                       if(precache_pic(panel_bg) == "") {
+                               panel_bg = strcat(hud_skin_path, "/border_default");
+                               if(precache_pic(panel_bg) == "") {
+                                       panel_bg = "gfx/hud/default/border_default";
+                               }
+                       }
+               }
+               panel_bg_alpha = max(0.75, panel_bg_alpha); // force an alpha of at least 0.75
+       }
+
        vector pos, mySize;
        pos = panel_pos;
        mySize = panel_size;
 
        HUD_Panel_DrawBg(1);
+
        if(panel_bg_padding)
        {
                pos += '1 1 0' * panel_bg_padding;
@@ -4283,6 +4559,11 @@ void HUD_EngineInfo(void)
 
 // Info messages panel (#14)
 //
+#define drawInfoMessage(s)\
+       if(autocvar_hud_panel_infomessages_flip)\
+               o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize);\
+       drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);\
+       o_y += fontsize_y;
 void HUD_InfoMessages(void)
 {
        if(!autocvar_hud_panel_infomessages && !autocvar__hud_configure)
@@ -4301,18 +4582,18 @@ void HUD_InfoMessages(void)
                mySize -= '2 2 0' * panel_bg_padding;
        }
 
-       // always force 6:1 aspect
+       // always force 5:1 aspect
        vector newSize;
-       if(mySize_x/mySize_y > 6)
+       if(mySize_x/mySize_y > 5)
        {
-               newSize_x = 6 * mySize_y;
+               newSize_x = 5 * mySize_y;
                newSize_y = mySize_y;
 
                pos_x = pos_x + (mySize_x - newSize_x) / 2;
        }
        else
        {
-               newSize_y = 1/6 * mySize_x;
+               newSize_y = 1/5 * mySize_x;
                newSize_x = mySize_x;
 
                pos_y = pos_y + (mySize_y - newSize_y) / 2;
@@ -4324,47 +4605,39 @@ void HUD_InfoMessages(void)
        o = pos;
 
        vector fontsize;
-       fontsize = '0.25 0.25 0' * mySize_y;
+       fontsize = '0.20 0.20 0' * mySize_y;
        
+       float a;
+       if(spectatee_status != 0)
+               a = 1;
+       else
+               a = panel_fg_alpha;
+
        string s;
        if(!autocvar__hud_configure)
        {
                if(spectatee_status && !intermission)
                {
-                       //drawfont = hud_bigfont;
                        if(spectatee_status == -1)
                                s = "^1Observing";
                        else
-                               s = GetPlayerName(spectatee_status - 1);
-
-                       //s = textShortenToWidth(s, mySize_y, 0.5 * height, stringwidth_colors);
-                       //drawcolorcodedstring(pos + eY * 0.25 * height, s, 0.5 * height, panel_fg_alpha, DRAWFLAG_NORMAL);
-                       //drawfont = hud_font;
+                               s = strcat("^1Spectating: ^7", GetPlayerName(spectatee_status - 1));
+                       drawInfoMessage(s)
 
-                       // spectator text in the upper right corner
                        if(spectatee_status == -1)
-                               s = strcat("^1Press ^3", getcommandkey("primary fire", "+attack"), "^1 to spectate");
+                               s = strcat("^1Press ^3", getcommandkey("primary fire", "+fire"), "^1 to spectate");
                        else
-                               s = strcat("^1Press ^3", getcommandkey("primary fire", "+attack"), "^1 for another player");
-                       if(autocvar_hud_panel_infomessages_flip)
-                               o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-                       o += eY * fontsize_y;
+                               s = strcat("^1Press ^3", getcommandkey("primary fire", "+fire"), "^1 for another player");
+                       drawInfoMessage(s)
 
                        if(spectatee_status == -1)
                                s = strcat("^1Use ^3", getcommandkey("next weapon", "weapnext"), "^1 or ^3", getcommandkey("previous weapon", "weapprev"), "^1 to change the speed");
                        else
-                               s = strcat("^1Press ^3", getcommandkey("secondary fire", "+attack2"), "^1 to observe");
-                       if(autocvar_hud_panel_infomessages_flip)
-                               o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-                       o += eY * fontsize_y;
+                               s = strcat("^1Press ^3", getcommandkey("secondary fire", "+fire2"), "^1 to observe");
+                       drawInfoMessage(s)
 
                        s = strcat("^1Press ^3", getcommandkey("server info", "+show_info"), "^1 for gamemode info");
-                       if(autocvar_hud_panel_infomessages_flip)
-                               o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-                       o += eY * fontsize_y;
+                       drawInfoMessage(s)
 
                        if(gametype == GAME_ARENA)
                                s = "^1Wait for your turn to join";
@@ -4381,10 +4654,7 @@ void HUD_InfoMessages(void)
                        }
                        else
                                s = strcat("^1Press ^3", getcommandkey("jump", "+jump"), "^1 to join");
-                       if(autocvar_hud_panel_infomessages_flip)
-                               o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-                       o += eY * fontsize_y;
+                       drawInfoMessage(s)
 
                        //show restart countdown:
                        if (time < getstatf(STAT_GAMESTARTTIME)) {
@@ -4392,17 +4662,14 @@ void HUD_InfoMessages(void)
                                //we need to ceil, otherwise the countdown would be off by .5 when using round()
                                countdown = ceil(getstatf(STAT_GAMESTARTTIME) - time);
                                s = strcat("^1Game starts in ^3", ftos(countdown), "^1 seconds");
-                               drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-                               o += eY * fontsize_y;
+                               drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL);
+                               o_y += fontsize_y;
                        }
                }
                if(warmup_stage && !intermission)
                {
                        s = "^2Currently in ^1warmup^2 stage!";
-                       if(autocvar_hud_panel_infomessages_flip)
-                               o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-                       o += eY * fontsize_y;
+                       drawInfoMessage(s)
                }
 
                string blinkcolor;
@@ -4427,18 +4694,12 @@ void HUD_InfoMessages(void)
                                else
                                        s = strcat("^2Waiting for others to ready up...");
                        }
-                       if(autocvar_hud_panel_infomessages_flip)
-                               o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-                       o += eY * fontsize_y;
+                       drawInfoMessage(s)
                }
                else if(warmup_stage && !intermission && !spectatee_status)
                {
                        s = strcat("^2Press ^3", getcommandkey("ready", "ready"), "^2 to end warmup");
-                       if(autocvar_hud_panel_infomessages_flip)
-                               o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-                       o += eY * fontsize_y;
+                       drawInfoMessage(s)
                }
 
                if(teamplay && !intermission && !spectatee_status && gametype != GAME_CA && teamnagger)
@@ -4464,11 +4725,7 @@ void HUD_InfoMessages(void)
                                        if (tm.team != COLOR_SPECTATOR)
                                        if (tm.team_size == ts_max)
                                                s = strcat(s, " Press ^3", getcommandkey("team menu", "menu_showteamselect"), blinkcolor, " to adjust");
-
-                                       if(autocvar_hud_panel_infomessages_flip)
-                                               o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-                                       drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-                                       o += eY * fontsize_y;
+                                       drawInfoMessage(s)
                                }
                        }
                }
@@ -4476,25 +4733,13 @@ void HUD_InfoMessages(void)
        else 
        {
                s = "^7Press ^3ESC ^7to show HUD options.";
-               if(autocvar_hud_panel_infomessages_flip)
-                       o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-               drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-               o += eY * fontsize_y;
+               drawInfoMessage(s)
                s = "^3Doubleclick ^7a panel for panel-specific options.";
-               if(autocvar_hud_panel_infomessages_flip)
-                       o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-               drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-               o += eY * fontsize_y;
+               drawInfoMessage(s)
                s = "^3CTRL ^7to disable collision testing, ^3SHIFT ^7and";
-               if(autocvar_hud_panel_infomessages_flip)
-                       o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-               drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-               o += eY * fontsize_y;
+               drawInfoMessage(s)
                s = "^3ALT ^7+ ^3ARROW KEYS ^7for fine adjustments.";
-               if(autocvar_hud_panel_infomessages_flip)
-                       o_x = pos_x + mySize_x - stringwidth(s, TRUE, fontsize); 
-               drawcolorcodedstring(o, s, fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
-               o += eY * fontsize_y;
+               drawInfoMessage(s)
        }
 }
 
@@ -4545,11 +4790,11 @@ void HUD_ShowSpeed(void)
        pos = (vid_conheight - numsize_y) * cvar("cl_showspeed_position");
 
        drawfont = hud_bigfont;
-       drawstringcenter(eX + pos * eY, speed, numsize, '1 1 1', hud_fg_alpha, DRAWFLAG_NORMAL);
+       drawstringcenter(eX + pos * eY, speed, numsize, '1 1 1', autocvar_hud_panel_fg_alpha, DRAWFLAG_NORMAL);
 
        if (cvar("cl_showspeed_z") == 1) {
                zspeed = strcat(ftos(fabs(floor( pmove_vel_z * conversion_factor + 0.5 ))), unit);
-               drawstringcenter(eX + pos * eY + numsize_y * eY, zspeed, numsize * 0.5, '1 1 1', hud_fg_alpha, DRAWFLAG_NORMAL);
+               drawstringcenter(eX + pos * eY + numsize_y * eY, zspeed, numsize * 0.5, '1 1 1', autocvar_hud_panel_fg_alpha, DRAWFLAG_NORMAL);
        }
 
        drawfont = hud_font;
@@ -4595,9 +4840,9 @@ void HUD_ShowAcceleration(void)
        }
 
        if (acceleration > 0)
-               HUD_Panel_DrawProgressBar(pos, 0, acceleration * scale * '40 0 0' + sz * eY, rgb, alpha * hud_fg_alpha, DRAWFLAG_NORMAL);
+               HUD_Panel_DrawProgressBar(pos, 0, acceleration * scale * '40 0 0' + sz * eY, rgb, alpha * autocvar_hud_panel_fg_alpha, DRAWFLAG_NORMAL);
        else if (acceleration < 0)
-               HUD_Panel_DrawProgressBar(pos + acceleration * scale * '40 0 0', 0, -acceleration * scale * '40 0 0' + sz * eY, rgb, alpha * hud_fg_alpha, DRAWFLAG_NORMAL);
+               HUD_Panel_DrawProgressBar(pos + acceleration * scale * '40 0 0', 0, -acceleration * scale * '40 0 0' + sz * eY, rgb, alpha * autocvar_hud_panel_fg_alpha, DRAWFLAG_NORMAL);
 }
 
 void HUD_Reset (void)
@@ -4647,11 +4892,19 @@ void HUD_Main (void)
 {
        hud_skin_path = strcat("gfx/hud/", autocvar_hud_skin);
 
+       // global hud alpha fade
        if(disable_menu_alphacheck == 1)
-               menu_fade_alpha = 1;
+               hud_fade_alpha = 1;
        else
-               menu_fade_alpha = (1 - autocvar__menu_alpha);
-       hud_fg_alpha = cvar("hud_fg_alpha");
+               hud_fade_alpha = (1 - autocvar__menu_alpha);
+
+       if(scoreboard_fade_alpha)
+               hud_fade_alpha = (1 - scoreboard_fade_alpha);
+
+       if(intermission == 2) // no hud during mapvote
+               hud_fade_alpha = 0;
+       else if(autocvar__menu_alpha == 0 && scoreboard_fade_alpha == 0)
+               hud_fade_alpha = 1;
 
        hud_border_thickness = bound(0, cvar("hud_border_thickness"), 5);
        hud_accuracy_border_thickness = bound(0, cvar_or("hud_accuracy_border_thickness", 1), 5);
@@ -4703,9 +4956,12 @@ void HUD_Main (void)
                string pic;
                pic = strcat(hud_skin_path, "/", autocvar_hud_dock);
                if(precache_pic(pic) == "") {
-                       pic = "gfx/hud/default/dock";
+                       pic = strcat(hud_skin_path, "/dock_medium");
+                       if(precache_pic(pic) == "") {
+                               pic = "gfx/hud/default/dock_medium";
+                       }
                }
-               drawpic('0 0 0', pic, eX * vid_conwidth + eY * vid_conheight, color, autocvar_hud_dock_alpha * menu_fade_alpha, DRAWFLAG_NORMAL); // no aspect ratio forcing on dock...
+               drawpic('0 0 0', pic, eX * vid_conwidth + eY * vid_conheight, color, autocvar_hud_dock_alpha * hud_fade_alpha, DRAWFLAG_NORMAL); // no aspect ratio forcing on dock...
        }
 
        // cache the panel order into the panel_order array
@@ -4720,9 +4976,14 @@ void HUD_Main (void)
        }
        // draw panels in order specified by panel_order array
        for(i = HUD_PANEL_NUM - 1; i >= 0; --i) {
-               HUD_DrawPanel(panel_order[i]);
+               if(i != HUD_PANEL_CHAT || !autocvar__con_chat_maximized) // don't draw maximized chat panel twice!
+                       HUD_DrawPanel(panel_order[i]);
        }
 
+       // draw chat panel on top if it is maximized
+       if(autocvar__con_chat_maximized)
+               HUD_DrawPanel(HUD_PANEL_CHAT);
+
        // TODO hud_'ify these
        if (cvar("cl_showspeed"))
                HUD_ShowSpeed();