]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Cleanup
authorterencehill <piuntn@gmail.com>
Mon, 15 Aug 2016 13:25:58 +0000 (15:25 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 15 Aug 2016 13:25:58 +0000 (15:25 +0200)
qcsrc/client/hud/hud.qc
qcsrc/client/hud/hud.qh
qcsrc/client/hud/hud_config.qc
qcsrc/client/hud/hud_config.qh
qcsrc/client/hud/panel/centerprint.qc
qcsrc/client/hud/panel/scoreboard.qc
qcsrc/client/hud/panel/weapons.qc
qcsrc/common/mutators/mutator/itemstime.qc

index 3a33eb1dd1bbf82818ba5a3e4235888a0ed79137..c87e733e1d4e633dc2bd28e815d8c885c89ab22e 100644 (file)
@@ -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);
index a895af36038e33d51760fd0965cd803b596953f3..b269312d8871ceb2212ea6fd8beba1f15d28779d 100644 (file)
@@ -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"));                        \
index e28ff04b71f227df7d4a7f9cbc6bed225d95108d..654d49ba8c60f5ce9f59b3eb40bd2b24877d28fa 100644 (file)
@@ -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;
index 32c846076145def23fbe3bb769dfbbec2bb63473..6ab64f6aed2a7548f5b51dc36bbb012713c8c9e7 100644 (file)
@@ -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();
index 5f9364e7a813c56f012fe464bd621166b31b792e..9dd5f05ff57d6152ba66c05ebdd154a1c2beb79c 100644 (file)
@@ -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;
index 2e5fd943192f860f8d8bcbf7a049c66ac34d4b06..9a3c5b61a9b01fe266f8650bea53741c0efca71e 100644 (file)
@@ -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);
index c3208896ee982f8bc23e894f767791900c9ab6c7..d08061d8108907d747427fecf419f7c8784fdb74 100644 (file)
@@ -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
                }
 
index c6afa33161c954d70f75fda41e2841afa4f20273..f47923d4efcc5c3b1e16f2e439655b9e9f1bd30a 100644 (file)
@@ -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