]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud.qh
Get rid of HUD_Panel_GetStringVars
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud.qh
index 19cd36ddb0b0551bd4bc6833ef5b73f8be5da9d4..857f4173d16a3fd6d3f7266aa9cb071a6e1c1fea 100644 (file)
@@ -47,7 +47,6 @@ const float S_CTRL = 2;
 const float S_ALT = 4;
 
 float menu_enabled; // 1 showing the entire HUD, 2 showing only the clicked panel
-float menu_enabled_time;
 
 float hud_fade_alpha;
 
@@ -56,8 +55,6 @@ string hud_skin_prev;
 
 vector myteamcolors;
 
-var vector progressbar_color;
-
 entity highlightedPanel_backup;
 var vector panel_pos_backup;
 var vector panel_size_backup;
@@ -146,21 +143,6 @@ HUD_PANELS
 // ----------------------
 // Little help for the poor people who have to make sense of this: Start from the bottom ;)
 
-#define HUD_Panel_GetProgressBarColor(item) \
-               progressbar_color = stov(cvar_string("hud_progressbar_" #item "_color"))
-#define HUD_Panel_GetProgressBarColorForString(item) \
-switch(item) {\
-       case "health": HUD_Panel_GetProgressBarColor(health); break;\
-       case "armor": HUD_Panel_GetProgressBarColor(armor); break;\
-       case "strength": HUD_Panel_GetProgressBarColor(strength); break;\
-       case "shield": HUD_Panel_GetProgressBarColor(shield); break;\
-       case "fuel": HUD_Panel_GetProgressBarColor(fuel); break;\
-       case "nexball": HUD_Panel_GetProgressBarColor(nexball); break;\
-       case "speed": HUD_Panel_GetProgressBarColor(speed); break;\
-       case "acceleration": HUD_Panel_GetProgressBarColor(acceleration); break;\
-       case "acceleration_neg": HUD_Panel_GetProgressBarColor(acceleration_neg); break;\
-} ENDS_WITH_CURLY_BRACE
-
 // Get value for panel_bg: if "" fetch default, else use panel_bg_str
 // comment on last line of macro: // we probably want to see a background in config mode at all times...
 #define HUD_Panel_GetBg()\
@@ -255,13 +237,6 @@ if(panel_bg_border_str == "") {\
        panel_bg_border = stof(panel_bg_border_str);\
 } ENDS_WITH_CURLY_BRACE
 
-// Scale the pos and size vectors to absolute coordinates
-#define HUD_Panel_GetScaledVectors()\
-panel_pos_x *= vid_conwidth;\
-panel_pos_y *= vid_conheight;\
-panel_size_x *= vid_conwidth;\
-panel_size_y *= vid_conheight;
-
 // Get padding. See comments above, it's similar.
 // last line is a port of the old function, basically always make sure the panel contents are at least 5 pixels tall/wide, to disallow extreme padding values
 #define HUD_Panel_GetPadding()\
@@ -272,19 +247,6 @@ if(panel_bg_padding_str == "") {\
 }\
 panel_bg_padding = min(min(panel_size_x, panel_size_y)/2 - 5, panel_bg_padding);
 
-// Point to the macros above (stupid max macro length)
-#define HUD_Panel_GetStringVars()\
-HUD_Panel_GetBg()\
-if (panel_bg != "0") {\
-       HUD_Panel_GetColorTeam()\
-       HUD_Panel_GetColor()\
-       HUD_Panel_GetBgAlpha()\
-       HUD_Panel_GetBorder()\
-}\
-HUD_Panel_GetFgAlpha()\
-HUD_Panel_GetScaledVectors()\
-HUD_Panel_GetPadding()
-
 // return smoothly faded pos of given panel when a dialog is active
 var vector menu_enable_panelpos;
 #define HUD_Panel_GetMenuPos() \
@@ -321,19 +283,33 @@ else\
        }\
 }
 
+// Scale the pos and size vectors to absolute coordinates
+#define HUD_Panel_ScalePosSize()\
+panel_pos_x *= vid_conwidth; panel_pos_y *= vid_conheight;\
+panel_size_x *= vid_conwidth; panel_size_y *= vid_conheight;
+
 // NOTE: in hud_configure mode cvars must be reloaded every frame
 #define HUD_Panel_UpdateCvars() \
 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"))); \
+       HUD_Panel_ScalePosSize() \
        panel_bg_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg")); \
        panel_bg_color_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_color")); \
        panel_bg_color_team_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_color_team")); \
        panel_bg_alpha_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_alpha")); \
        panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border")); \
        panel_bg_padding_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_padding")); \
-       HUD_Panel_GetStringVars()\
+       HUD_Panel_GetBg()\
+       if (panel_bg != "0") {\
+               HUD_Panel_GetColorTeam()\
+               HUD_Panel_GetColor()\
+               HUD_Panel_GetBgAlpha()\
+               HUD_Panel_GetBorder()\
+       }\
+       HUD_Panel_GetFgAlpha()\
+       HUD_Panel_GetPadding()\
        if(menu_enabled == 2 && panel == highlightedPanel) {\
                HUD_Panel_GetMenuSize()\
                HUD_Panel_GetMenuPos()\
@@ -366,7 +342,7 @@ if(panel.update_time <= time) { \
 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()\
+HUD_Panel_ScalePosSize()\
 if(menu_enabled == 2 && panel == highlightedPanel) {\
        HUD_Panel_GetMenuSize()\
        HUD_Panel_GetMenuPos()\