From: terencehill Date: Fri, 29 Mar 2013 16:30:02 +0000 (+0100) Subject: Fix bad usage of panel_enabled X-Git-Tag: xonotic-v0.7.0~62^2~6 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=147ece6f20af2491f707700e0714d1da199d1eb5;p=xonotic%2Fxonotic-data.pk3dir.git Fix bad usage of panel_enabled --- diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index 982042851..62734abb7 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -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()\ diff --git a/qcsrc/client/hud_config.qc b/qcsrc/client/hud_config.qc index abe28920c..d478f734d 100644 --- a/qcsrc/client/hud_config.qc +++ b/qcsrc/client/hud_config.qc @@ -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" : ""); }