return color_vec;
}
-float HUD_Panel_GetBgAlpha(float id)
-{
- string alpha;
- alpha = cvar_string(strcat("hud_", panel_name, "_bg_alpha"));
- if(alpha == "")
- alpha = cvar_string("hud_bg_alpha");
-
- if(autocvar__hud_configure && disable_menu_alphacheck == 2 && highlightedPanel == id) // do not set a minalpha cap when showing the config dialog for this panel
- alpha = ftos((1 - cvar("_menu_alpha")) * max(autocvar_hud_configure_bg_minalpha, stof(alpha)) + (cvar("_menu_alpha")) * stof(alpha));
- else if(autocvar__hud_configure)
- alpha = ftos(max(autocvar_hud_configure_bg_minalpha, stof(alpha)));
-
- if(autocvar__hud_configure && !cvar(strcat("hud_", panel_name))) // ALWAYS show disabled panels at 0.25 alpha when in config mode
- return 0.25;
-
- if(disable_menu_alphacheck == 2 && highlightedPanel == id) // don't fade this panel when showing the panel-specific menu dialog
- return stof(alpha);
- else
- return stof(alpha) * menu_fade_alpha;
-}
-
float HUD_Panel_GetFgAlpha(float id)
{
float alpha;
return alpha * menu_fade_alpha;
}
-float HUD_Panel_GetPadding(float id)
-{
- string padding;
- padding = cvar_string(strcat("hud_", panel_name, "_bg_padding"));
- if(padding == "")
- padding = cvar_string("hud_bg_padding");
-
- vector mySize;
- mySize = panel_size;
- float smallestsize;
- smallestsize = min(mySize_x, mySize_y);
- return min(smallestsize/2 - 5, stof(panel_bg_padding));
-}
-
// draw the background/borders
void HUD_Panel_DrawBg(float id, vector pos, vector mySize, float alpha)
{
borderf = stof(border);
vector color;
- color = panel_bg_color;
+ color = stov(panel_bg_color);
- if(alpha)
- alpha = HUD_Panel_GetBgAlpha(id) * alpha; // allow panels to fade in/out by passing an alpha value
- else
- alpha = HUD_Panel_GetBgAlpha(id);
+ //if(alpha)
+ // alpha = HUD_Panel_GetBgAlpha(id) * alpha; // allow panels to fade in/out by passing an alpha value
+ //else
+ // alpha = HUD_Panel_GetBgAlpha(id);
draw_BorderPicture(pos - '1 1 0' * borderf, strcat("gfx/hud/", cvar_string("hud_skin"), "/", panel_bg), mySize + '1 1 0' * 2 * borderf, color, alpha, '1 1 0' * (borderf/BORDER_MULTIPLIER));
}
// Get value for panel_bg_color_team: if "" fetch default, else use panel_bg_color_team_str
#define HUD_Panel_GetColorTeam()\
-if(panel_bg_color_team_str == "")\
+if(panel_bg_color_team_str == "") {\
panel_bg_color_team = autocvar_hud_bg_color_team;\
-else\
- panel_bg_color_team = stof(panel_bg_color_team_str);
+} else {\
+ panel_bg_color_team = stof(panel_bg_color_team_str);\
+}
// Get value for panel_bg_alpha: if "" fetch default, else use panel_bg_alpha. Also do various menu dialog fadeout/in checks, and minalpha checks
// comment on line 3 of macro: // do not set a minalpha cap when showing the config dialog for this panel
#define HUD_Panel_GetBgAlpha()\
-if(panel_bg_alpha_str == "")\
+if(panel_bg_alpha_str == "") {\
panel_bg_alpha_str = autocvar_hud_bg_alpha;\
+}\
panel_bg_alpha = stof(panel_bg_alpha_str);\
-if(autocvar__hud_configure && disable_menu_alphacheck == 2 && highlightedPanel == active_panel)\
- panel_bg_alpha = (1 - autocvar__menu_alpha) * max(autocvar_hud_configure_bg_minalpha, panel_bg_alpha) + autocvar__menu_alpha) * panel_bg_alpha;\
-else if(autocvar__hud_configure)\
+if(autocvar__hud_configure && disable_menu_alphacheck == 2 && highlightedPanel == active_panel) {\
+ panel_bg_alpha = (1 - autocvar__menu_alpha) * max(autocvar_hud_configure_bg_minalpha, panel_bg_alpha) + autocvar__menu_alpha * panel_bg_alpha;\
+} else if(autocvar__hud_configure) {\
panel_bg_alpha = max(autocvar_hud_configure_bg_minalpha, panel_bg_alpha);\
-if(autocvar__hud_configure && !panel_enabled)\
+} if(autocvar__hud_configure && !panel_enabled) {\
panel_bg_alpha = 0.25;\
-if(!(disable_menu_alphacheck == 2 && highlightedPanel == id))\
+} if(!(disable_menu_alphacheck == 2 && highlightedPanel == id)) {\
panel_bg_alpha *= menu_fade_alpha;\
+}
#define HUD_Panel_GetBorder()\
-if(panel_bg_border_str == "")\
+if(panel_bg_border_str == "") {\
panel_bg_border = autocvar_hud_bg_border;\
-else\
- panel_bg_border = stof(panel_bg_border_str);
+} else {\
+ panel_bg_border = stof(panel_bg_border_str);\
+}
#define HUD_Panel_GetPadding()\
-if(panel_bg_border_padding == "")\
+if(panel_bg_border_padding == "") {\
panel_bg_padding = autocvar_hud_bg_padding;\
-else\
+} else {\
panel_bg_padding = stof(panel_bg_padding_str);\
+}\
panel_bg_padding = min(min(mySize_x, mySize_y)/2 - 5, panel_bg_padding);
// Point to the macros above (stupid max macro length)
#define HUD_Panel_StringVars()\
-HUD_Panel_GetBg \
-HUD_Panel_GetColorTeam \
-HUD_Panel_GetBgAlpha \
-HUD_Panel_GetBorder \
-HUD_Panel_GetPadding
+HUD_Panel_GetBg()\
+HUD_Panel_GetColorTeam\
+HUD_Panel_GetBgAlpha()\
+HUD_Panel_GetBorder()\
+HUD_Panel_GetPadding()
// Update all common cvars of given panel name
#define HUD_Panel_UpdateCvars(name) \
panel_bg_alpha_str = autocvar_hud_##name##_bg_alpha; \
panel_bg_border_str = autocvar_hud_##name##_bg_border; \
panel_bg_padding_str = autocvar_hud_##name##_bg_padding; \
-HUD_Panel_StringVars
+HUD_Panel_StringVars()
// Update all common cvars of given panel id
#define HUD_Panel_UpdateCvarsForId(id) \