]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix bad usage of panel_enabled
authorterencehill <piuntn@gmail.com>
Fri, 29 Mar 2013 16:30:02 +0000 (17:30 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 29 Mar 2013 16:30:02 +0000 (17:30 +0100)
qcsrc/client/hud.qh
qcsrc/client/hud_config.qc

index 982042851c7b4603e1cf498a59711abce9fe6cf3..62734abb7273a5018ac11e0142ba6ed21cf500d7 100644 (file)
@@ -315,9 +315,10 @@ else\
        }\
 }
 
+// NOTE: in hud_configure mode cvars must be reloaded every frame
 #define HUD_Panel_UpdateCvars() \
-panel_enabled = cvar(strcat("hud_panel_", panel.panel_name)); \
 if(panel.update_time < time) { \
+       if(autocvar__hud_configure) panel_enabled = cvar(strcat("hud_panel_", panel.panel_name)); \
        panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos"))); \
        panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size"))); \
        panel_bg_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg")); \
@@ -356,6 +357,7 @@ if(panel.update_time < time) { \
 } ENDS_WITH_CURLY_BRACE
 
 #define HUD_Panel_UpdatePosSize() {\
+panel_enabled = cvar(strcat("hud_panel_", panel.panel_name)); \
 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_GetScaledVectors()\
index abe28920c5daec44b7983355d52096beeb3082e6..d478f734dc4555a169775efe218836719db54011 100644 (file)
@@ -217,11 +217,10 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize)
        myTarget = myPos;
 
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
-               if(hud_panel[i] == highlightedPanel || !panel_enabled)
-                       continue;
-
                panel = hud_panel[i];
+               if(panel == highlightedPanel) continue;
                HUD_Panel_UpdatePosSize()
+               if(!panel_enabled) continue;
 
                panel_pos -= '1 1 0' * panel_bg_border;
                panel_size += '2 2 0' * panel_bg_border;
@@ -318,11 +317,10 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
        ratio = mySize_x/mySize_y;
 
        for (i = 0; i < HUD_PANEL_NUM; ++i) {
-               if(hud_panel[i] == highlightedPanel || !panel_enabled)
-                       continue;
-
                panel = hud_panel[i];
+               if(panel == highlightedPanel) continue;
                HUD_Panel_UpdatePosSize()
+               if(!panel_enabled) continue;
 
                panel_pos -= '1 1 0' * panel_bg_border;
                panel_size += '2 2 0' * panel_bg_border;
@@ -825,7 +823,7 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
                        return true;
 
                if (highlightedPanel)
-                       cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!(panel_enabled)));
+                       cvar_set(strcat("hud_panel_", highlightedPanel.panel_name), ftos(!cvar(strcat("hud_panel_", highlightedPanel.panel_name))));
                else
                        cvar_set(strcat("hud_dock"), (autocvar_hud_dock == "") ? "dock" : "");
        }