float prevMouseClickedTime; // time during previous mouse click, to check for doubleclicks
vector prevMouseClickedPos; // pos during previous mouse click, to check for doubleclicks
-float menu_enabled;
-float menu_enabled_time;
float pressed_key_time;
void HUD_Panel_Arrow_Action(float nPrimary)
{
{
if (bInputType == 1)
return true;
- disable_menu_alphacheck = 1;
menu_enabled = 1;
menu_enabled_time = time;
localcmd("menu_showhudexit\n");
void HUD_Panel_Mouse()
{
// TODO: needs better check... is there any float that contains the current state of the menu? _menu_alpha isn't apparently updated the frame the menu gets enabled
- if (menu_enabled == 0) // menu dialog closed, enable normal alpha stuff again
- disable_menu_alphacheck = 0;
if (autocvar__menu_alpha == 0 && time - menu_enabled_time > 0.5)
menu_enabled = 0;
/*
- print("Disable menu_alphacheck: ", ftos(disable_menu_alphacheck), "\n");
+ print("menu_enabled: ", ftos(menu_enabled), "\n");
print("Highlighted: ", ftos(highlightedPanel), "\n");
print("Menu alpha: ", cvar_string("_menu_alpha"), "\n");
*/
if(menu_enabled)
return;
- if(mouseClicked == 0 && disable_menu_alphacheck != 2 && highlightedPanel >= 0) { // don't reset these variables in disable_menu_alphacheck mode 2!
+ if(mouseClicked == 0 && menu_enabled != 2 && highlightedPanel >= 0) { // don't reset these variables in menu_enabled mode 2!
highlightedPanel = -1;
highlightedAction = 0;
}
if(time - prevMouseClickedTime < 0.4 && prevMouseClicked == 0 && prevMouseClickedPos == mousepos && highlightedPanel >= 0)
{
mouseClicked = 0; // to prevent spam, I guess.
- disable_menu_alphacheck = 2;
- menu_enabled = 1;
+ menu_enabled = 2;
menu_enabled_time = time;
HUD_Panel_GetName(highlightedPanel)
localcmd("menu_showhudoptions ", panel_name, "\n");
hud_skin_path = strcat("gfx/hud/", autocvar_hud_skin);
// global hud alpha fade
- if(disable_menu_alphacheck == 1)
+ if(menu_enabled == 1)
hud_fade_alpha = 1;
else
hud_fade_alpha = (1 - autocvar__menu_alpha);
hud_configure_prev = autocvar__hud_configure;
if (!autocvar__hud_configure) // hud config mode disabled, enable normal alpha stuff again
- disable_menu_alphacheck = 0;
+ if (menu_enabled)
+ menu_enabled = 0;
}
const float S_CTRL = 2;
const float S_ALT = 4;
-float disable_menu_alphacheck; // 0 = enable alpha check, 1 = disable for entire hud, 2 = disable for one panel
+float menu_enabled; // 1 showing the entire HUD, 2 showing only the clicked panel
+float menu_enabled_time;
+
float hud_fade_alpha;
string hud_skin_path;
panel_bg_alpha_str = ftos(autocvar_hud_panel_bg_alpha);\
}\
panel_bg_alpha = stof(panel_bg_alpha_str);\
-if(autocvar__hud_configure && disable_menu_alphacheck == 2 && highlightedPanel == active_panel) {\
+if(autocvar__hud_configure && menu_enabled == 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) {\
panel_bg_alpha = 0.25;\
-} if(!(disable_menu_alphacheck == 2 && highlightedPanel == active_panel)) {\
+} if(!(menu_enabled == 2 && highlightedPanel == active_panel)) {\
panel_bg_alpha *= hud_fade_alpha;\
}
panel_fg_alpha = autocvar_hud_panel_fg_alpha;\
if(autocvar__hud_configure && !panel_enabled)\
panel_fg_alpha = 0.25;\
-if(!(disable_menu_alphacheck == 2 && highlightedPanel == active_panel))\
+if(!(menu_enabled == 2 && highlightedPanel == active_panel))\
panel_fg_alpha *= hud_fade_alpha;
// Get border. See comments above, it's similar.
panel_bg_border_str = autocvar_hud_panel_##name##_bg_border; \
panel_bg_padding_str = autocvar_hud_panel_##name##_bg_padding; \
HUD_Panel_StringVars()\
-if(disable_menu_alphacheck == 2 && active_panel == highlightedPanel) {\
+if(menu_enabled == 2 && active_panel == highlightedPanel) {\
HUD_Panel_GetMenuSize()\
HUD_Panel_GetMenuPos()\
}
panel_pos = autocvar_hud_panel_##name##_pos; \
panel_size = autocvar_hud_panel_##name##_size; \
HUD_Panel_GetScaledVectors()\
-if(disable_menu_alphacheck == 2 && active_panel == highlightedPanel) {\
+if(menu_enabled == 2 && active_panel == highlightedPanel) {\
HUD_Panel_GetMenuSize()\
HUD_Panel_GetMenuPos()\
}\