// draw the background/borders
#define HUD_Panel_DrawBg(theAlpha)\
-if(panel_bg != "0")\
- draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * theAlpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER))
+if(panel.current_panel_bg != "0")\
+ draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel.current_panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * theAlpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER))
//basically the same code of draw_ButtonPicture and draw_VertButtonPicture for the menu
void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, float vertical, float baralign, vector theColor, float theAlpha, float drawflag)
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
-
+ if(precache_pic(panel_bg) == "")
+ panel_bg = "gfx/hud/default/border_default"; // fallback
+ if(panel.current_panel_bg)
+ strunzone(panel.current_panel_bg);
+ panel.current_panel_bg = strzone(panel_bg);
+
switch(hud_panel_radar_maximized_zoommode)
{
default:
{
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(panel.current_panel_bg == "0") // force a border when maximized
{
- if(precache_pic(panel_bg) == "") {
+ if(precache_pic(panel.current_panel_bg) == "") {
panel_bg = strcat(hud_skin_path, "/border_default");
if(precache_pic(panel_bg) == "") {
panel_bg = "gfx/hud/default/border_default";
}
+ if(panel.current_panel_bg)
+ strunzone(panel.current_panel_bg);
+ panel.current_panel_bg = strzone(panel_bg);
}
}
panel_bg_alpha = max(0.75, panel_bg_alpha); // force an theAlpha of at least 0.75
var float panel_enabled;
var vector panel_pos;
var vector panel_size;
-var string panel_bg;
+var string panel_bg; // exceptionally this a temporary var, panel.current_panel_bg keeps the real value
var string panel_bg_str; // "_str" vars contain the raw value of the cvar, non-"_str" contains what hud.qc code should use
var vector panel_bg_color;
var string panel_bg_color_str;
// ----------------------
// Little help for the poor people who have to make sense of this: Start from the bottom ;)
-// Get value for panel_bg: if "" fetch default, else use panel_bg_str
+// Get value for panel.current_panel_bg: if "" fetch default, else use panel_bg_str
// comment on last line of macro: // we probably want to see a background in config mode at all times...
#define HUD_Panel_GetBg()\
if(!autocvar__hud_configure && panel_bg_str == "0") {\
}\
}\
}\
-}
+}\
+if(panel.current_panel_bg)\
+ strunzone(panel.current_panel_bg);\
+panel.current_panel_bg = strzone(panel_bg);
// Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector.
#define HUD_Panel_GetColor()\
panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border")); \
panel_bg_padding_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_padding")); \
HUD_Panel_GetBg()\
- if (panel_bg != "0") {\
+ if (panel.current_panel_bg != "0") {\
HUD_Panel_GetColorTeam()\
HUD_Panel_GetColor()\
HUD_Panel_GetBgAlpha()\
}\
panel.current_panel_pos = panel_pos; \
panel.current_panel_size = panel_size; \
- if(panel.current_panel_bg != "") \
- strunzone(panel.current_panel_bg); \
- panel.current_panel_bg = strzone(panel_bg); \
panel.current_panel_bg_border = panel_bg_border; \
panel.current_panel_bg_color = panel_bg_color; \
panel.current_panel_bg_color_team = panel_bg_color_team; \
} else { \
panel_pos = panel.current_panel_pos; \
panel_size = panel.current_panel_size; \
- panel_bg = panel.current_panel_bg; \
panel_bg_alpha = panel.current_panel_bg_alpha * hud_fade_alpha; \
panel_bg_border = panel.current_panel_bg_border; \
panel_bg_color = panel.current_panel_bg_color; \