]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qc
Merge remote-tracking branch 'origin/Mario/name_colors'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qc
index d5f74f22a726c64ecf2c721b8aac958446b62614..bb5eb4a68f534081953aa7d860c69602659d7fa3 100644 (file)
@@ -567,7 +567,7 @@ void HUD_Weapons(void)
                weapon_size_y = old_panel_size_y / rows;
 
                // change table values to include only the owned weapons
-               // weapon_size won't be changed
+               float columns_save = columns;
                if(weapon_count <= rows)
                {
                        rows = weapon_count;
@@ -576,6 +576,10 @@ void HUD_Weapons(void)
                else
                        columns = ceil(weapon_count / rows);
 
+               // enlarge weapon_size to match desired aspect ratio in order to capitalize on panel space
+               if(columns < columns_save)
+                       weapon_size_x = min(old_panel_size_x / columns, aspect * weapon_size_y);
+
                // reduce size of the panel
                panel_size_x = columns * weapon_size_x;
                panel_size_y = rows * weapon_size_y;
@@ -1824,6 +1828,11 @@ void HUD_Radar(void)
                {
                        if (autocvar_hud_panel_radar == 0) return;
                        if (autocvar_hud_panel_radar != 2 && !teamplay) return;
+                       if(radar_panel_modified)
+                       {
+                               panel.update_time = time; // forces reload of panel attributes
+                               radar_panel_modified = false;
+                       }
                }
        }
 
@@ -1843,6 +1852,8 @@ void HUD_Radar(void)
                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
+               if(!radar_panel_modified && panel_bg != panel.current_panel_bg)
+                       radar_panel_modified = true;
                if(panel.current_panel_bg)
                        strunzone(panel.current_panel_bg);
                panel.current_panel_bg = strzone(panel_bg);
@@ -3451,7 +3462,14 @@ void HUD_Chat(void)
                        return;
                }
                if(autocvar__con_chat_maximized)
+               {
                        if(!hud_draw_maximized) return;
+               }
+               else if(chat_panel_modified)
+               {
+                       panel.update_time = time; // forces reload of panel attributes
+                       chat_panel_modified = false;
+               }
        }
 
        HUD_Panel_UpdateCvars();
@@ -3469,6 +3487,7 @@ void HUD_Chat(void)
                        if(panel.current_panel_bg)
                                strunzone(panel.current_panel_bg);
                        panel.current_panel_bg = strzone(panel_bg);
+                       chat_panel_modified = true;
                }
                panel_bg_alpha = max(0.75, panel_bg_alpha); // force an theAlpha of at least 0.75
        }