From: terencehill Date: Mon, 15 Aug 2016 13:25:58 +0000 (+0200) Subject: Cleanup X-Git-Tag: xonotic-v0.8.2~712 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=17b36316798423b04ec8f2612404ccec352301ef;p=xonotic%2Fxonotic-data.pk3dir.git Cleanup --- diff --git a/qcsrc/client/hud/hud.qc b/qcsrc/client/hud/hud.qc index 3a33eb1dd..c87e733e1 100644 --- a/qcsrc/client/hud/hud.qc +++ b/qcsrc/client/hud/hud.qc @@ -493,7 +493,7 @@ void HUD_Main() { int i; // global hud alpha fade (scoreboard-related panels behave differently and override it temporarly) - if(menu_enabled == 1) + if(hud_configure_menu_open == 1) hud_fade_alpha = 1; else if(!autocvar__hud_configure) hud_fade_alpha = (1 - scoreboard_fade_alpha) * (1 - autocvar__menu_alpha); diff --git a/qcsrc/client/hud/hud.qh b/qcsrc/client/hud/hud.qh index a895af360..b269312d8 100644 --- a/qcsrc/client/hud/hud.qh +++ b/qcsrc/client/hud/hud.qh @@ -98,18 +98,11 @@ float weaponprevtime; float teamnagger; -float hud_configure_checkcollisions; -float hud_configure_prev; -vector hud_configure_gridSize; -vector hud_configure_realGridSize; - int hudShiftState; const int S_SHIFT = 1; const int S_CTRL = 2; const int S_ALT = 4; -float menu_enabled; // 1 showing the entire HUD, 2 showing only the clicked panel - float hud_fade_alpha; string hud_skin_path; @@ -316,7 +309,7 @@ REGISTER_HUD_PANEL(SCOREBOARD, Scoreboard_Draw, scoreboard, PANEL_CO if (autocvar__hud_configure) { \ if (!panel_enabled) \ panel_bg_alpha = 0.25; \ - else if (menu_enabled == 2 && panel == highlightedPanel) \ + else if (hud_configure_menu_open == 2 && panel == highlightedPanel) \ panel_bg_alpha = (1 - autocvar__menu_alpha) * max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha) + autocvar__menu_alpha * panel_bg_alpha;\ else \ panel_bg_alpha = max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha); \ @@ -354,16 +347,16 @@ REGISTER_HUD_PANEL(SCOREBOARD, Scoreboard_Draw, scoreboard, PANEL_CO // return smoothly faded pos and size of given panel when a dialog is active // don't center too wide panels, it doesn't work with different resolutions #define HUD_Panel_UpdatePosSize_ForMenu() MACRO_BEGIN { \ - vector menu_enable_size = panel_size; \ + vector new_size = panel_size; \ float max_panel_width = 0.52 * vid_conwidth; \ if(panel_size.x > max_panel_width) \ { \ - menu_enable_size.x = max_panel_width; \ - menu_enable_size.y = panel_size.y * (menu_enable_size.x / panel_size.x); \ + new_size.x = max_panel_width; \ + new_size.y = panel_size.y * (new_size.x / panel_size.x); \ } \ - vector menu_enable_pos = eX * (panel_bg_border + 0.5 * max_panel_width) + eY * 0.5 * vid_conheight - 0.5 * menu_enable_size; \ - panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * menu_enable_pos; \ - panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * menu_enable_size; \ + vector new_pos = eX * (panel_bg_border + 0.5 * max_panel_width) + eY * 0.5 * vid_conheight - 0.5 * new_size; \ + panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * new_pos; \ + panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * new_size; \ } MACRO_END // Scale the pos and size vectors to absolute coordinates @@ -396,7 +389,7 @@ REGISTER_HUD_PANEL(SCOREBOARD, Scoreboard_Draw, scoreboard, PANEL_CO HUD_Panel_GetPadding(); \ panel.current_panel_bg_alpha = panel_bg_alpha; \ panel.current_panel_fg_alpha = panel_fg_alpha; \ - if (menu_enabled == 2 && panel == highlightedPanel) { \ + if (hud_configure_menu_open == 2 && panel == highlightedPanel) { \ HUD_Panel_UpdatePosSize_ForMenu(); \ } else { \ panel_bg_alpha *= hud_fade_alpha; \ @@ -426,7 +419,7 @@ REGISTER_HUD_PANEL(SCOREBOARD, Scoreboard_Draw, scoreboard, PANEL_CO panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos"))); \ panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size"))); \ HUD_Panel_ScalePosSize(); \ - if (menu_enabled == 2 && panel == highlightedPanel) { \ + if (hud_configure_menu_open == 2 && panel == highlightedPanel) { \ HUD_Panel_UpdatePosSize_ForMenu(); \ } \ panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border")); \ diff --git a/qcsrc/client/hud/hud_config.qc b/qcsrc/client/hud/hud_config.qc index e28ff04b7..654d49ba8 100644 --- a/qcsrc/client/hud/hud_config.qc +++ b/qcsrc/client/hud/hud_config.qc @@ -237,9 +237,9 @@ void HUD_Panel_ExportCfg(string cfgname) void HUD_Configure_Exit_Force() { - if (menu_enabled) + if (hud_configure_menu_open) { - menu_enabled = 0; + hud_configure_menu_open = 0; localcmd("togglemenu\n"); } cvar_set("_hud_configure", "0"); @@ -743,14 +743,14 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary) { if (bInputType == 1) return true; - menu_enabled = 1; + hud_configure_menu_open = 1; localcmd("menu_showhudexit\n"); } else if(nPrimary == K_BACKSPACE && hudShiftState & S_CTRL) { if (bInputType == 1) return true; - if (!menu_enabled) + if (!hud_configure_menu_open) cvar_set("_hud_configure", "0"); } else if(nPrimary == K_TAB && hudShiftState & S_CTRL) // switch panel @@ -1098,7 +1098,7 @@ void HUD_Panel_Highlight(float allow_move) void HUD_Panel_EnableMenu() { - menu_enabled = 2; + hud_configure_menu_open = 2; localcmd("menu_showhudoptions ", highlightedPanel.panel_name, "\n"); } float mouse_over_panel; @@ -1197,7 +1197,7 @@ void HUD_Panel_Mouse() { if(prevMouseClicked) highlightedAction = 0; - if(menu_enabled == 2) + if(hud_configure_menu_open == 2) mouse_over_panel = 0; else mouse_over_panel = HUD_Panel_Check_Mouse_Pos(true); @@ -1264,7 +1264,7 @@ void HUD_Configure_Frame() if(autocvar__menu_alpha != _menu_alpha_prev) { if(autocvar__menu_alpha == 0) - menu_enabled = 0; + hud_configure_menu_open = 0; _menu_alpha_prev = autocvar__menu_alpha; } @@ -1272,8 +1272,8 @@ void HUD_Configure_Frame() } else if(hud_configure_prev) { - if(menu_enabled) - menu_enabled = 0; + if(hud_configure_menu_open) + hud_configure_menu_open = 0; if(autocvar_hud_cursormode) setcursormode(0); hud_dynamic_shake_factor = -1; diff --git a/qcsrc/client/hud/hud_config.qh b/qcsrc/client/hud/hud_config.qh index 32c846076..6ab64f6ae 100644 --- a/qcsrc/client/hud/hud_config.qh +++ b/qcsrc/client/hud/hud_config.qh @@ -8,6 +8,12 @@ int prevMouseClicked; // previous state float prevMouseClickedTime; // time during previous left mouse click, to check for doubleclicks vector prevMouseClickedPos; // pos during previous left mouse click, to check for doubleclicks +float hud_configure_prev; +float hud_configure_checkcollisions; +vector hud_configure_gridSize; +vector hud_configure_realGridSize; +float hud_configure_menu_open; // 1 showing the entire HUD, 2 showing only the clicked panel + void HUD_Panel_ExportCfg(string cfgname); void HUD_Panel_Mouse(); diff --git a/qcsrc/client/hud/panel/centerprint.qc b/qcsrc/client/hud/panel/centerprint.qc index 5f9364e7a..9dd5f05ff 100644 --- a/qcsrc/client/hud/panel/centerprint.qc +++ b/qcsrc/client/hud/panel/centerprint.qc @@ -155,7 +155,7 @@ void HUD_CenterPrint () // this panel fades only when the menu does float hud_fade_alpha_save = hud_fade_alpha; - if(menu_enabled == 1) + if(hud_configure_menu_open == 1) hud_fade_alpha = 1; else hud_fade_alpha = 1 - autocvar__menu_alpha; diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc index 2e5fd9431..9a3c5b61a 100644 --- a/qcsrc/client/hud/panel/scoreboard.qc +++ b/qcsrc/client/hud/panel/scoreboard.qc @@ -1287,7 +1287,7 @@ void Scoreboard_Draw() { // frametime checks allow to toggle the scoreboard even when the game is paused if(scoreboard_active) { - if(menu_enabled == 1) + if(hud_configure_menu_open == 1) scoreboard_fade_alpha = 1; float scoreboard_fadeinspeed = autocvar_hud_panel_scoreboard_fadeinspeed; if (scoreboard_fadeinspeed && frametime) @@ -1315,7 +1315,7 @@ void Scoreboard_Draw() HUD_Scale_Disable(); float hud_fade_alpha_save = hud_fade_alpha; - if(menu_enabled == 1) + if(hud_configure_menu_open == 1) hud_fade_alpha = 1; else hud_fade_alpha = scoreboard_fade_alpha * (1 - autocvar__menu_alpha); diff --git a/qcsrc/client/hud/panel/weapons.qc b/qcsrc/client/hud/panel/weapons.qc index c3208896e..d08061d81 100644 --- a/qcsrc/client/hud/panel/weapons.qc +++ b/qcsrc/client/hud/panel/weapons.qc @@ -149,7 +149,7 @@ void HUD_Weapons() { if(autocvar__hud_configure) { - if(menu_enabled != 2) + if(hud_configure_menu_open != 2) HUD_Panel_DrawBg(1); // also draw the bg of the entire panel } diff --git a/qcsrc/common/mutators/mutator/itemstime.qc b/qcsrc/common/mutators/mutator/itemstime.qc index c6afa3316..f47923d4e 100644 --- a/qcsrc/common/mutators/mutator/itemstime.qc +++ b/qcsrc/common/mutators/mutator/itemstime.qc @@ -330,7 +330,7 @@ void HUD_ItemsTime() if (autocvar_hud_panel_itemstime_dynamicsize) { if (autocvar__hud_configure) - if (menu_enabled != 2) + if (hud_configure_menu_open != 2) HUD_Panel_DrawBg(1); // also draw the bg of the entire panel // reduce panel to avoid spacing items