]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
Merge remote branch 'origin/divVerent/fruitbalance' into fruitiex/fruitbalance
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index d7b73fc7813c4a2f70d9695483b2100c1219e76e..b348ff0d7fc601984a1ea2c9934a71bbcf6a13a3 100644 (file)
@@ -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"));
@@ -477,7 +477,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"));
@@ -1380,10 +1380,6 @@ 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)
@@ -1469,17 +1465,6 @@ void HUD_Weapons(void)
        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;
-
-               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);
@@ -2412,7 +2397,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)
@@ -2449,12 +2434,31 @@ void HUD_KillNotify(string s1, string s2, string s3, float type, float msg)
                
                if (stof(s2) > 2) // killcount > 2
                        print ("^1",s1,"^1 ended it all after a ",s2," kill spree\n");
+       } else if(msg == MSG_KILL_MELEE) { // handle melee types separately
+               if(type == KILL_FRAG_GAUNTLET) {
+                       if(alsoprint)
+                       {
+                               if(gentle) {
+                                       print ("^1", s1, "^1 got too close to", s2, "^1's gauntlet\n");
+                               } else {
+                                       print ("^1", s1, "^1 was cut in half by", s2, "^1's gauntlet\n");
+                               }
+                       }
+               }
+               else if(type == KILL_FRAG_SHOTGUN_MELEE)
+               {
+                       if(alsoprint)
+                       {
+                               print ("^7", s2, "^7 slapped ", s1, "^7 around a bit with a large ^2shotgun\n");
+                       }
+               }
+               HUD_KillNotify_Push(s1, s2, 1, type);
        } else if(msg == MSG_KILL) {
                w = DEATH_WEAPONOF(type);
                if(WEP_VALID(w)) {
                        HUD_KillNotify_Push(s2, s1, 1, w);
                        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);
@@ -3014,6 +3018,14 @@ void HUD_Notify (void)
                                self = get_weaponinfo(killnotify_deathtype[j]);
                                s = strcat("weapon", self.netname);
                        }
+                       else if(killnotify_deathtype[j] == KILL_FRAG_GAUNTLET)
+                       {
+                               s = "notify_melee";
+                       }
+                       else if(killnotify_deathtype[j] == KILL_FRAG_SHOTGUN_MELEE)
+                       {
+                               s = "notify_melee";
+                       }
                        else if(killnotify_deathtype[j] == KILL_TEAM_RED)
                        {
                                s = "notify_teamkill_red";
@@ -4229,11 +4241,22 @@ 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")
+                       panel_bg = "border"; // force a border when maximized
+               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;
@@ -4345,18 +4368,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;
@@ -4368,24 +4391,23 @@ void HUD_InfoMessages(void)
        o = pos;
 
        vector fontsize;
-       fontsize = '0.25 0.25 0' * mySize_y;
+       fontsize = '0.20 0.20 0' * mySize_y;
        
        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 = strcat("^1Spectating: ^7", 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;
+                       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;
 
-                       // spectator text in the upper right corner
                        if(spectatee_status == -1)
                                s = strcat("^1Press ^3", getcommandkey("primary fire", "+attack"), "^1 to spectate");
                        else
@@ -4764,9 +4786,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();