]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
Merge branch 'master' into terencehill/physics_panel_updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index 76a2db6794315aa1372ae80f97ac2749d01fc6f7..ef45602716d9033af4af4212bf7778b8a4973a72 100644 (file)
@@ -452,7 +452,7 @@ void HUD_Weapons(void)
        float fadetime = autocvar_hud_panel_weapons_complainbubble_fadetime;
        
        vector weapon_pos, weapon_size;
-       vector old_panel_size;
+       local noref vector old_panel_size; // fteqcc sucks
        vector color, ammo_color;
        
        // check to see if we want to continue
@@ -506,7 +506,7 @@ void HUD_Weapons(void)
                        }
                }
                for(i = weapon_cnt; i < WEP_MAXCOUNT; ++i)
-                       weaponorder[i] = NULL;
+                       weaponorder[i] = world;
                heapsort(weapon_cnt, weaponorder_swap, weaponorder_cmp, world);
 
                weaponorder_cmp_str = string_null;
@@ -931,7 +931,7 @@ void HUD_Ammo(void)
                ammo_size = eX * mySize_x*(1/columns) + eY * mySize_y*(1/rows);
        }
 
-       vector offset;
+       local noref vector offset; // fteqcc sucks
        float newSize;
        if(ammo_size_x/ammo_size_y > 3)
        {
@@ -1801,10 +1801,55 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg) // s
                                else
                                        print (sprintf(_("^1%s^1 is now conserved for centuries to come\n"), s1));
                        }
-               } else if(type == DEATH_TURRET) {
+               } else if(DEATH_ISTURRET(type)) {
                        HUD_KillNotify_Push(s1, "", 0, DEATH_GENERIC);
                        if(alsoprint)
-                               print (sprintf(_("^1%s^1 was mowed down by a turret \n"), s1));
+                       {
+                               if(gentle)
+                                       print (sprintf(_("^1%s^1 ran into a turret\n"), s1));
+                               else
+                               {
+                                       switch(type)
+                                       {
+                                               case DEATH_TURRET_EWHEEL:
+                                                       print (sprintf(_("^1%s^1 was laserd down by a eWheel turret \n"), s1));
+                                                       break;
+                                               case DEATH_TURRET_FLAC:
+                                                       print (sprintf(_("^1%s^1 got caught in the flac \n"), s1));
+                                                       break;
+                                               case DEATH_TURRET_MACHINEGUN:
+                                                       print (sprintf(_("^1%s^1 was riddeld full of riddled by a machinegun turret \n"), s1));
+                                                       break;
+                                               case DEATH_TURRET_WALKER_GUN:
+                                                       print (sprintf(_("^1%s^1 got served a led enrichment by a walker turret \n"), s1));
+                                                       break;
+                                               case DEATH_TURRET_WALKER_MEELE:
+                                                       print (sprintf(_("^1%s^1 was impaled by a walker turret \n"), s1));
+                                                       break;
+                                               case DEATH_TURRET_WALKER_ROCKET:
+                                                       print (sprintf(_("^1%s^1 was rocketed to hell by a walker turret \n"), s1));
+                                                       break;
+                                               case DEATH_TURRET_HELLION:
+                                                       print (sprintf(_("^1%s^1 was blasted away hellion turret \n"), s1));
+                                                       break;
+                                               case DEATH_TURRET_HK:
+                                                       print (sprintf(_("^1%s^1 could not hide from the hunter turret \n"), s1));
+                                                       break;
+                                               case DEATH_TURRET_MLRS:
+                                                       print (sprintf(_("^1%s^1 got turned into smoldering gibs by a mlrs turret \n"), s1));
+                                                       break;
+                                               case DEATH_TURRET_PLASMA:
+                                                       print (sprintf(_("^1%s^1 got served some superheated plasma from a plasma turret \n"), s1));
+                                                       break;
+                                               case DEATH_TURRET_PHASER:
+                                                       print (sprintf(_("^1%s^1 was phased out \n"), s1));
+                                                       break;
+                                               case DEATH_TURRET_TESLA:                        
+                                                       print (sprintf(_("^1%s^1 was electrocuted by a tesla turret \n"), s1));
+                                                       break;
+                                       }
+                               }
+                       }
                } else if (type == DEATH_CUSTOM) {
                        HUD_KillNotify_Push(s1, "", 0, DEATH_CUSTOM);
                        if(alsoprint)
@@ -1895,84 +1940,84 @@ void HUD_KillCenterprint(string s1, string s2, float type, float msg)
        gentle = (autocvar_cl_gentle || autocvar_cl_gentle_messages);
        if(msg == MSG_SUICIDE) {
                if (type == DEATH_TEAMCHANGE) {
-                       centerprint(sprintf(_("You are now on: %s"), s1));
+                       centerprint_hud(sprintf(_("You are now on: %s"), s1));
                } else if (type == DEATH_AUTOTEAMCHANGE) {
-                       centerprint(sprintf(_("You have been moved into a different team to improve team balance\nYou are now on: %s"), s1));
+                       centerprint_hud(sprintf(_("You have been moved into a different team to improve team balance\nYou are now on: %s"), s1));
                } else if (type == DEATH_CAMP) {
                        if(gentle)
-                               centerprint(_("^1Reconsider your tactics, camper!"));
+                               centerprint_hud(_("^1Reconsider your tactics, camper!"));
                        else
-                               centerprint(_("^1Die camper!"));
+                               centerprint_hud(_("^1Die camper!"));
                } else if (type == DEATH_NOAMMO) {
                        if(gentle)
-                               centerprint(_("^1You are reinserted into the game for running out of ammo..."));
+                               centerprint_hud(_("^1You are reinserted into the game for running out of ammo..."));
                        else
-                               centerprint(_("^1You were killed for running out of ammo..."));
+                               centerprint_hud(_("^1You were killed for running out of ammo..."));
                } else if (type == DEATH_ROT) {
                        if(gentle)
-                               centerprint(_("^1You need to preserve your health"));
+                               centerprint_hud(_("^1You need to preserve your health"));
                        else
-                               centerprint(_("^1You grew too old without taking your medicine"));
+                               centerprint_hud(_("^1You grew too old without taking your medicine"));
                } else if (type == KILL_TEAM_RED || type == KILL_TEAM_BLUE) {
                        if(gentle)
-                               centerprint(_("^1Don't go against team mates!"));
+                               centerprint_hud(_("^1Don't go against team mates!"));
                        else
-                               centerprint(_("^1Don't shoot your team mates!"));
+                               centerprint_hud(_("^1Don't shoot your team mates!"));
                } else if (type == DEATH_QUIET) {
                        // do nothing
                } else { // generic message
                        if(gentle)
-                               centerprint(_("^1You need to be more careful!"));
+                               centerprint_hud(_("^1You need to be more careful!"));
                        else
-                               centerprint(_("^1You killed your own dumb self!"));
+                               centerprint_hud(_("^1You killed your own dumb self!"));
                }
        } else if(msg == MSG_KILL) {
                if (type == KILL_TEAM_RED || type == KILL_TEAM_BLUE) {
                        if(gentle) {
-                               centerprint(sprintf(_("^1Moron! You went against ^7%s^1, a team mate!"), s1));
+                               centerprint_hud(sprintf(_("^1Moron! You went against ^7%s^1, a team mate!"), s1));
                        } else {
-                               centerprint(sprintf(_("^1Moron! You fragged ^7%s^1, a team mate!"), s1));
+                               centerprint_hud(sprintf(_("^1Moron! You fragged ^7%s^1, a team mate!"), s1));
                        }
                } else if (type == KILL_FIRST_BLOOD) {
                        if(gentle) {
-                               centerprint(_("^1First score"));
+                               centerprint_hud(_("^1First score"));
                        } else {
-                               centerprint(_("^1First blood"));
+                               centerprint_hud(_("^1First blood"));
                        }
                } else if (type == KILL_FIRST_VICTIM) {
                        if(gentle) {
-                               centerprint(_("^1First casualty"));
+                               centerprint_hud(_("^1First casualty"));
                        } else {
-                               centerprint(_("^1First victim"));
+                               centerprint_hud(_("^1First victim"));
                        }
                } else if (type == KILL_TYPEFRAG) { // s2 contains "advanced kill messages" such as ping, handicap...
                        if(gentle) {
-                               centerprint(strcat(sprintf(_("^1You scored against ^7%s^1 who was typing!"), s1), s2));
+                               centerprint_hud(strcat(sprintf(_("^1You scored against ^7%s^1 who was typing!"), s1), s2));
                        } else {
-                               centerprint(strcat(sprintf(_("^1You typefragged ^7%s"), s1), s2));
+                               centerprint_hud(strcat(sprintf(_("^1You typefragged ^7%s"), s1), s2));
                        }
                } else if (type == KILL_TYPEFRAGGED) {
                        if(gentle) {
-                               centerprint(strcat(sprintf(_("^1You were scored against by ^7%s^1 while you were typing!"), s1), s2));
+                               centerprint_hud(strcat(sprintf(_("^1You were scored against by ^7%s^1 while you were typing!"), s1), s2));
                        } else {
-                               centerprint(strcat(sprintf(_("^1You were typefragged by ^7%s"), s1), s2));
+                               centerprint_hud(strcat(sprintf(_("^1You were typefragged by ^7%s"), s1), s2));
                        }
                } else if (type == KILL_FRAG) {
                        if(gentle) {
-                               centerprint(strcat(sprintf(_("^4You scored against ^7%s"), s1), s2));
+                               centerprint_hud(strcat(sprintf(_("^4You scored against ^7%s"), s1), s2));
                        } else {
-                               centerprint(strcat(sprintf(_("^4You fragged ^7%s"), s1), s2));
+                               centerprint_hud(strcat(sprintf(_("^4You fragged ^7%s"), s1), s2));
                        }
                } else { // generic message
                        if(gentle) {
-                               centerprint(strcat(sprintf(_("^1You were scored against by ^7%s"), s1), s2));
+                               centerprint_hud(strcat(sprintf(_("^1You were scored against by ^7%s"), s1), s2));
                        } else {
-                               centerprint(strcat(sprintf(_("^1You were fragged by ^7%s"), s1), s2));
+                               centerprint_hud(strcat(sprintf(_("^1You were fragged by ^7%s"), s1), s2));
                        }
                }
        } else if(msg == MSG_KILL_ACTION) {
                // TODO: invent more centerprints here?
-               centerprint(_("^1Watch your step!"));
+               centerprint_hud(_("^1Watch your step!"));
        }
 }
 
@@ -2351,14 +2396,34 @@ void HUD_Radar(void)
 {
        if (!autocvar__hud_configure)
        {
-               if (autocvar_hud_panel_radar == 0) return;
-               if (autocvar_hud_panel_radar != 2 && !teamplay) return;
+               if (hud_panel_radar_maximized)
+               {
+                       if (!hud_draw_maximized) return;
+               }
+               else
+               {
+                       if (autocvar_hud_panel_radar == 0) return;
+                       if (autocvar_hud_panel_radar != 2 && !teamplay) return;
+               }
        }
        else
                hud_configure_active_panel = HUD_PANEL_RADAR;
 
        HUD_Panel_UpdateCvars(radar);
        HUD_Panel_ApplyFadeAlpha();
+
+       if (hud_panel_radar_maximized && !autocvar__hud_configure)
+       {
+               panel_size = autocvar_hud_panel_radar_maximized_size;
+               panel_size_x = bound(0.2, panel_size_x, 1) * vid_conwidth;
+               panel_size_y = bound(0.2, panel_size_y, 1) * vid_conheight;
+               panel_pos_x = (vid_conwidth - panel_size_x) / 2;
+               panel_pos_y = (vid_conheight - panel_size_y) / 2;
+               
+               panel_bg = strcat(hud_skin_path, "/border_default"); // always use the default border when maximized
+               if(precache_pic(panel_bg) == "") { panel_bg = "gfx/hud/default/border_default"; } // fallback
+       }
+
        vector pos, mySize;
        pos = panel_pos;
        mySize = panel_size;
@@ -2370,8 +2435,8 @@ void HUD_Radar(void)
                mySize -= '2 2 0' * panel_bg_padding;
        }
 
-       local float color2;
-       local entity tm;
+       float color2;
+       entity tm;
        float scale2d, normalsize, bigsize;
        float f;
 
@@ -2429,8 +2494,8 @@ void HUD_Radar(void)
                c2 = rotate('1 0 0' * mi_min_x + '0 1 0' * mi_max_y, teamradar_angle * DEG2RAD);
                c3 = rotate('1 0 0' * mi_max_x + '0 1 0' * mi_min_y, teamradar_angle * DEG2RAD);
                span = '0 0 0';
-               span_x = max4(c0_x, c1_x, c2_x, c3_x) - min4(c0_x, c1_x, c2_x, c3_x);
-               span_y = max4(c0_y, c1_y, c2_y, c3_y) - min4(c0_y, c1_y, c2_y, c3_y);
+               span_x = max(c0_x, c1_x, c2_x, c3_x) - min(c0_x, c1_x, c2_x, c3_x);
+               span_y = max(c0_y, c1_y, c2_y, c3_y) - min(c0_y, c1_y, c2_y, c3_y);
 
                // max-min distance must fit the radar in x=x, y=y
                bigsize = min(
@@ -2705,7 +2770,7 @@ void HUD_Score(void)
                drawstring_aspect(pos + eX * 0.75 * mySize_x, distribution_str, eX * 0.25 * mySize_x + eY * (1/3) * mySize_y, distribution_color, panel_fg_alpha, DRAWFLAG_NORMAL);
        } else { // teamgames
                float scores_count, row, column, rows, columns;
-               vector offset;
+               local noref vector offset; // fteqcc sucks
                vector score_pos, score_size; //for scores other than myteam
                if (spectatee_status == -1 || autocvar_hud_panel_score_rankings)
                {
@@ -2941,7 +3006,7 @@ float vote_change; // "time" when vote_active changed
 
 void HUD_VoteWindow(void) 
 {
-       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE))
+       if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE || (serverflags & SERVERFLAG_PLAYERSTATS)))
        {
                vote_active = 1;
                if (autocvar__hud_configure)
@@ -2951,7 +3016,9 @@ void HUD_VoteWindow(void)
                        print(_("^1You must answer before entering hud configure mode\n"));
                        cvar_set("_hud_configure", "0");
                }
-               vote_called_vote = strzone(_("^2Name ^7instead of \"^1Unregistered player^7\" in stats"));
+               if(vote_called_vote)
+                       strunzone(vote_called_vote);
+               vote_called_vote = strzone(_("^2Name ^7instead of \"^1Anonymous player^7\" in stats"));
                uid2name_dialog = 1;
        }
 
@@ -3859,6 +3926,8 @@ void HUD_Chat(void)
                                cvar_set("con_chatrect", "0");
                        return;
                }
+               if(autocvar__con_chat_maximized)
+                       if(!hud_draw_maximized) return;
        }
        else
                hud_configure_active_panel = HUD_PANEL_CHAT;
@@ -4199,6 +4268,16 @@ void HUD_Physics(void)
                panel_size -= '2 2 0' * panel_bg_padding;
        }
 
+       float acceleration_progressbar_scale;
+       if(autocvar_hud_panel_physics_progressbar && autocvar_hud_panel_physics_acceleration_progressbar_scale > 1)
+               acceleration_progressbar_scale = autocvar_hud_panel_physics_acceleration_progressbar_scale;
+
+       float text_scale;
+       if (autocvar_hud_panel_physics_text_scale <= 0)
+               text_scale = 1;
+       else
+               text_scale = min(autocvar_hud_panel_physics_text_scale, 1);
+
        //compute speed
        float speed, conversion_factor;
        string unit;
@@ -4258,7 +4337,7 @@ void HUD_Physics(void)
        //compute layout
        float panel_ar = panel_size_x/panel_size_y;
        vector speed_offset, acceleration_offset;
-       if (panel_ar >= 5)
+       if (panel_ar >= 5 && !acceleration_progressbar_scale)
        {
                panel_size_x *= 0.5;
                if (autocvar_hud_panel_physics_flip)
@@ -4303,11 +4382,12 @@ void HUD_Physics(void)
        if (autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 2)
        {
                tmp_size_x = panel_size_x * 0.75;
-               tmp_size_y = panel_size_y;
+               tmp_size_y = panel_size_y * text_scale;
                if (speed_baralign)
                        tmp_offset_x = panel_size_x - tmp_size_x;
                //else
                        //tmp_offset_x = 0;
+               tmp_offset_y = (panel_size_y - tmp_size_y) / 2;
                drawstring_aspect(panel_pos + speed_offset + tmp_offset, ftos(speed), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 
                //draw speed unit
@@ -4319,7 +4399,8 @@ void HUD_Physics(void)
                {
                        //tmp_offset_y = 0;
                        tmp_size_x = panel_size_x * (1 - 0.75);
-                       tmp_size_y = panel_size_y * 0.4;
+                       tmp_size_y = panel_size_y * 0.4 * text_scale;
+                       tmp_offset_y = (panel_size_y * 0.4 - tmp_size_y) / 2;
                        drawstring_aspect(panel_pos + speed_offset + tmp_offset, unit, tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
        }
@@ -4380,7 +4461,8 @@ void HUD_Physics(void)
                        //top speed
                        tmp_offset_y = panel_size_y * 0.4;
                        tmp_size_x = panel_size_x * (1 - 0.75);
-                       tmp_size_y = panel_size_y - tmp_offset_y;
+                       tmp_size_y = (panel_size_y - tmp_offset_y) * text_scale;
+                       tmp_offset_y += (panel_size_y - tmp_offset_y - tmp_size_y) / 2;
                        drawstring_aspect(panel_pos + speed_offset + tmp_offset, ftos(top_speed), tmp_size, '1 0 0', f * panel_fg_alpha, DRAWFLAG_NORMAL);
                }
                else
@@ -4395,10 +4477,37 @@ void HUD_Physics(void)
                        HUD_Panel_GetProgressBarColor(acceleration_neg);
                else
                        HUD_Panel_GetProgressBarColor(acceleration);
-               HUD_Panel_DrawProgressBar(panel_pos + acceleration_offset, panel_size, "accelbar", acceleration/autocvar_hud_panel_physics_acceleration_max, 0, acceleration_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+
+               f = acceleration/autocvar_hud_panel_physics_acceleration_max;
+               if (autocvar_hud_panel_physics_acceleration_progressbar_nonlinear)
+                       f = sqrt(f);
+
+               if (acceleration_progressbar_scale) // allow progressbar to go out of panel bounds
+               {
+                       tmp_size = acceleration_progressbar_scale * panel_size_x * eX + panel_size_y * eY;
+
+                       if (acceleration_baralign == 1)
+                               tmp_offset_x = panel_size_x - tmp_size_x;
+                       else if (acceleration_baralign == 2 || acceleration_baralign == 3)
+                               tmp_offset_x = (panel_size_x - tmp_size_x) / 2;
+                       else
+                               tmp_offset_x = 0;
+                       tmp_offset_y = 0;
+               }
+               else
+               {
+                       tmp_size = panel_size;
+                       tmp_offset = '0 0 0';
+               }
+
+               HUD_Panel_DrawProgressBar(panel_pos + acceleration_offset + tmp_offset, tmp_size, "accelbar", f, 0, acceleration_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
        }
+       tmp_size_x = panel_size_x;
+       tmp_size_y = panel_size_y * text_scale;
+       tmp_offset_x = 0;
+       tmp_offset_y = (panel_size_y - tmp_size_y) / 2;
        if (autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 3)
-               drawstring_aspect(panel_pos + acceleration_offset, strcat(ftos_decimals(acceleration, 2), "g"), panel_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(panel_pos + acceleration_offset + tmp_offset, strcat(ftos_decimals(acceleration, 2), "g"), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 }
 
 // CenterPrint (#16)
@@ -4412,7 +4521,6 @@ float centerprint_msgID[CENTERPRINT_MAX_MSGS];
 float centerprint_time[CENTERPRINT_MAX_MSGS];
 float centerprint_expire_time[CENTERPRINT_MAX_MSGS];
 float centerprint_countdown_num[CENTERPRINT_MAX_MSGS];
-float centerprint_fadetime;
 float centerprint_showing;
 
 void centerprint_generic(float new_id, string strMessage, float duration, float countdown_num)
@@ -4445,8 +4553,6 @@ void centerprint_generic(float new_id, string strMessage, float duration, float
        if (!centerprint_showing)
                centerprint_showing = TRUE;
 
-       centerprint_fadetime = bound(0, autocvar_hud_panel_centerprint_fadetime, 1);
-
        for (i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
        {
                if (j == CENTERPRINT_MAX_MSGS)
@@ -4456,9 +4562,9 @@ void centerprint_generic(float new_id, string strMessage, float duration, float
                        if (strMessage == "" && centerprint_messages[j] != "" && centerprint_countdown_num[j] == 0)
                        {
                                // fade out the current msg (duration and countdown_num are ignored)
-                               centerprint_time[j] = centerprint_fadetime;
-                               if (centerprint_expire_time[j] > time + centerprint_fadetime || centerprint_expire_time[j] < time)
-                                       centerprint_expire_time[j] = time + centerprint_fadetime;
+                               centerprint_time[j] = min(5, autocvar_hud_panel_centerprint_fade_out);
+                               if (centerprint_expire_time[j] > time + min(5, autocvar_hud_panel_centerprint_fade_out) || centerprint_expire_time[j] < time)
+                                       centerprint_expire_time[j] = time + min(5, autocvar_hud_panel_centerprint_fade_out);
                                return;
                        }
                        break; // found a msg with the same id, at position j
@@ -4489,7 +4595,7 @@ void centerprint_generic(float new_id, string strMessage, float duration, float
        centerprint_countdown_num[j] = countdown_num;
 }
 
-void centerprint(string strMessage)
+void centerprint_hud(string strMessage)
 {
        centerprint_generic(0, strMessage, autocvar_hud_panel_centerprint_time, 0);
 }
@@ -4532,7 +4638,7 @@ void HUD_CenterPrint (void)
                        else if (r > 0.8)
                                centerprint_generic(0, sprintf("^1Multiline message at time %s that\n^1lasts longer than normal", seconds_tostring(time)), 20, 0);
                        else
-                               centerprint(sprintf("Message at time %s", seconds_tostring(time)));
+                               centerprint_hud(sprintf("Message at time %s", seconds_tostring(time)));
                        hud_configure_cp_generation_time = time + 1 + random()*4;
                }
        }
@@ -4549,9 +4655,14 @@ void HUD_CenterPrint (void)
                if (scoreboard_bottom >= 0.96 * vid_conheight)
                        return;
                vector target_pos;
+               
                target_pos = eY * scoreboard_bottom + eX * 0.5 * (vid_conwidth - panel_size_x);
-               panel_pos = panel_pos + (target_pos - panel_pos) * sqrt(scoreboard_fade_alpha);
-               panel_size_y = min(panel_size_y, vid_conheight - scoreboard_bottom);
+               
+               if(target_pos_y > panel_pos_y)
+               {
+                       panel_pos = panel_pos + (target_pos - panel_pos) * sqrt(scoreboard_fade_alpha);
+                       panel_size_y = min(panel_size_y, vid_conheight - scoreboard_bottom);
+               }
        }
 
        HUD_Panel_DrawBg(1);
@@ -4601,23 +4712,32 @@ void HUD_CenterPrint (void)
                        else
                                continue;
                }
-               if (centerprint_time[j] < 0 || centerprint_expire_time[j] - centerprint_fadetime > time)
-               {
-                       a = bound(0, (time - (centerprint_expire_time[j] - centerprint_time[j])) / centerprint_fadetime, 1);
-               }
+               
+               // fade the centerprint_hud in/out 
+               if (centerprint_time[j] < 0 || centerprint_expire_time[j] - autocvar_hud_panel_centerprint_fade_out > time)
+                       a = bound(0, (time - (centerprint_expire_time[j] - centerprint_time[j])) / max(0.0001, autocvar_hud_panel_centerprint_fade_in), 1);
                else if (centerprint_expire_time[j] > time)
+                       a = (centerprint_expire_time[j] - time) / max(0.0001, autocvar_hud_panel_centerprint_fade_out);
+               
+               // set the size from fading in/out before subsequent fading
+               sz = autocvar_hud_panel_centerprint_fade_minfontsize + a * (1 - autocvar_hud_panel_centerprint_fade_minfontsize); 
+               
+               // also fade it based on positioning
+               if(autocvar_hud_panel_centerprint_fade_subsequent)
                {
-                       a = (centerprint_expire_time[j] - time) / centerprint_fadetime;
+                       a = a * bound(autocvar_hud_panel_centerprint_fade_subsequent_passone_minalpha, (1 - (i / max(1, autocvar_hud_panel_centerprint_fade_subsequent_passone))), 1); // pass one: all messages after the first have half alpha
+                       a = a * bound(autocvar_hud_panel_centerprint_fade_subsequent_passtwo_minalpha, (1 - (i / max(1, autocvar_hud_panel_centerprint_fade_subsequent_passtwo))), 1); // pass two: after that, gradually lower alpha even more for each message
                }
                
-               a = a * (bound(0.5, (1 - (i / 2)), 1) * bound(0.5, (1 - (i / 10)), 1));
-               sz = 0.8 + a * (1 - 0.8);
-
+               // finally set the size based on the new alpha from subsequent fading
+               sz = sz * (autocvar_hud_panel_centerprint_fade_subsequent_minfontsize + a * (1 - autocvar_hud_panel_centerprint_fade_subsequent_minfontsize)); 
                drawfontscale = sz * '1 1 0';
+               
                if (centerprint_countdown_num[j])
                        n = tokenizebyseparator(sprintf(centerprint_messages[j], centerprint_countdown_num[j]), "\n");
                else
                        n = tokenizebyseparator(centerprint_messages[j], "\n");
+
                if (autocvar_hud_panel_centerprint_flip)
                {
                        // check if the message can be entirely shown
@@ -4631,12 +4751,6 @@ void HUD_CenterPrint (void)
                                                pos_y -= fontsize_y;
                                        else
                                                pos_y -= fontsize_y * CENTERPRINT_SPACING/2;
-                                       // NOTE: uncommented so as to not reject messages whenever they are "too large" -- This just continues drawing it anyway.
-                                       //if (pos_y < panel_pos_y) // check if the next line can be shown
-                                       //{
-                                       //      drawfontscale = '1 1 0';
-                                       //      return;
-                                       //}
                                }
                        }
                        current_msg_pos_y = pos_y; // save starting pos (first line) of the current message
@@ -4658,12 +4772,6 @@ void HUD_CenterPrint (void)
                                }
                                else
                                        pos_y += fontsize_y * CENTERPRINT_SPACING/2;
-                               // NOTE: uncommented so as to not reject messages whenever they are "too large" -- This just continues drawing it anyway.
-                               //if (!autocvar_hud_panel_centerprint_flip && pos_y > panel_pos_y + panel_size_y - fontsize_y) // check if the next line can be shown
-                               //{
-                               //      drawfontscale = '1 1 0';
-                               //      return;
-                               //}
                        }
                }
                msg_size = pos_y - msg_size;
@@ -4671,13 +4779,25 @@ void HUD_CenterPrint (void)
                {
                        pos_y = current_msg_pos_y - CENTERPRINT_SPACING * fontsize_y;
                        if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
-                               pos_y += (msg_size + CENTERPRINT_SPACING * fontsize_y) * (1 - sqrt(a));
+                               pos_y += (msg_size + CENTERPRINT_SPACING * fontsize_y) * (1 - sqrt(sz));
+                               
+                       if (pos_y < panel_pos_y) // check if the next message can be shown
+                       {
+                               drawfontscale = '1 1 0';
+                               return;
+                       }
                }
                else
                {
                        pos_y += CENTERPRINT_SPACING * fontsize_y;
                        if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
-                               pos_y -= (msg_size + CENTERPRINT_SPACING * fontsize_y) * (1 - sqrt(a));
+                               pos_y -= (msg_size + CENTERPRINT_SPACING * fontsize_y) * (1 - sqrt(sz));
+                               
+                       if(pos_y > panel_pos_y + panel_size_y - fontsize_y) // check if the next message can be shown
+                       {
+                               drawfontscale = '1 1 0';
+                               return;
+                       }
                }
        }
        drawfontscale = '1 1 0';
@@ -4812,7 +4932,7 @@ void HUD_Main (void)
                vector color;
                float hud_dock_color_team = autocvar_hud_dock_color_team;
                if((teamplay) && hud_dock_color_team) {
-                       f = stof(getplayerkey(current_player - 1, "colors"));
+                       f = stof(getplayerkeyvalue(current_player - 1, "colors"));
                        color = colormapPaletteColor(mod(f, 16), 1) * hud_dock_color_team;
                }
                else if(autocvar_hud_configure_teamcolorforced && autocvar__hud_configure && hud_dock_color_team) {
@@ -4822,11 +4942,11 @@ void HUD_Main (void)
                {
                        string hud_dock_color = autocvar_hud_dock_color;
                        if(hud_dock_color == "shirt") {
-                               f = stof(getplayerkey(current_player - 1, "colors"));
+                               f = stof(getplayerkeyvalue(current_player - 1, "colors"));
                                color = colormapPaletteColor(floor(f / 16), 0);
                        }
                        else if(hud_dock_color == "pants") {
-                               f = stof(getplayerkey(current_player - 1, "colors"));
+                               f = stof(getplayerkeyvalue(current_player - 1, "colors"));
                                color = colormapPaletteColor(mod(f, 16), 1);
                        }
                        else
@@ -4885,15 +5005,17 @@ void HUD_Main (void)
                }
        }
 
+       hud_draw_maximized = 0;
        // draw panels in order specified by panel_order array
-       for(i = HUD_PANEL_NUM - 1; i >= 0; --i) {
-               if(i != HUD_PANEL_CHAT || !autocvar__con_chat_maximized) // don't draw maximized chat panel twice!
-                       HUD_DrawPanel(panel_order[i]);
-       }
+       for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
+               HUD_DrawPanel(panel_order[i]);
 
-       // draw chat panel on top if it is maximized
+       hud_draw_maximized = 1; // panels that may be maximized must check this var
+       // draw maximized panels on top
+       if(hud_panel_radar_maximized)
+               HUD_Radar();
        if(autocvar__con_chat_maximized)
-               HUD_Chat(); // HUD_DrawPanel(HUD_PANEL_CHAT);
+               HUD_Chat();
 
        if(autocvar__hud_configure)
        {