From 147ece6f20af2491f707700e0714d1da199d1eb5 Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 29 Mar 2013 17:30:02 +0100 Subject: [PATCH] Fix bad usage of panel_enabled --- qcsrc/client/hud.qh | 4 +++- qcsrc/client/hud_config.qc | 12 +++++------- 2 files changed, 8 insertions(+), 8 deletions(-) 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" : ""); } -- 2.39.2