From da5bcd100f4932e84d25d4c9f786390363653801 Mon Sep 17 00:00:00 2001 From: FruitieX Date: Tue, 18 May 2010 23:49:20 +0300 Subject: [PATCH] make all hud_bg cvars follow the same convention ("" = use default value) --- defaultXonotic.cfg | 129 ++++++++++++++++++++++---------------------- qcsrc/client/hud.qc | 48 ++++++++++++----- 2 files changed, 99 insertions(+), 78 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index c669f3f11..3e1fc1653 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1318,10 +1318,11 @@ con_notifyalign 0 set _hud_configure 0 "1 = configure the HUD" seta hud_skin old "skin folder where to look for images" -seta hud_bg 0 "sets the default background for the panels, file must exist in data/gfx/hud/. 0 = disable background by default" -seta hud_bg_color "0 0.6 0.9" "sets the default background color for the panels" -seta hud_bg_alpha 0.8 "alpha of the background" -seta hud_bg_border 10 "sets the default border size for the panels" +seta hud_bg 0 "default background for the panels, file must exist in gfx/hud/[skin name]/, 0 = disable background by default" +seta hud_bg_color "0 0.6 0.9" "default background color for the panels" +seta hud_bg_alpha 0.8 "default alpha of the background" +seta hud_bg_border 10 "default border size for the panels" +seta hud_bg_padding 0 "default padding of contents from the border" seta hud_fg_alpha 1 "alpha of the foreground" seta hud_progressbar_alpha "0.5" "alpha of progressbars" @@ -1342,32 +1343,32 @@ seta hud_weaponicons_pos "-0.635295 -0.134116" "position of this panel" seta hud_weaponicons_size "0.352942 0.064845" "size of this panel" seta hud_weaponicons_number 1 "show number of weapon" seta hud_weaponicons_accuracy_yellow 40 "percentage at which the accuracy color is yellow" -seta hud_weaponicons_bg "" "if set to something else than \"\" = override default background, if set to 0 = disable background" -seta hud_weaponicons_bg_color "" "optional R G B string of the background color, otherwise use hud default" -seta hud_weaponicons_bg_alpha 0 "if set to something else than 0 = override default alpha" -seta hud_weaponicons_bg_border 0 "if set to something else than 0 = override size of border around the background" -seta hud_weaponicons_bg_padding 0 "padding of contents from border" +seta hud_weaponicons_bg "" "if set to something else than \"\" = override default background" +seta hud_weaponicons_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_weaponicons_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" +seta hud_weaponicons_bg_border "" "if set to something else than \"\" = override default size of border around the background" +seta hud_weaponicons_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" seta hud_inventory 1 "enable/disable this panel" seta hud_inventory_pos "0.179783 -0.092189" "position of this panel" seta hud_inventory_size "0.174227 0.092189" "size of this panel" seta hud_inventory_onlycurrent 0 "1 = show only current ammo type" -seta hud_inventory_bg "" "if set to something else than \"\" = override default background, if set to 0 = disable background" -seta hud_inventory_bg_color "" "optional R G B string of the background color, otherwise use hud default" -seta hud_inventory_bg_alpha 0 "if set to something else than 0 = override default alpha" -seta hud_inventory_bg_border 0 "if set to something else than 0 = override size of border around the background" -seta hud_inventory_bg_padding 0 "padding of contents from border" +seta hud_inventory_bg "" "if set to something else than \"\" = override default background" +seta hud_inventory_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_inventory_bg_alpha 0 "if set to something else than \"\" = override default panel background alpha" +seta hud_inventory_bg_border 0 "if set to something else than \"\" = override default size of border around the background" +seta hud_inventory_bg_padding "" "if set to something else than \"\" = override default if set to something else than \"\" = override default padding of contents from border" seta hud_powerups 1 "enable/disable this panel" seta hud_powerups_pos "-0.311922 -0.084896" "position of this panel" seta hud_powerups_size "0.086719 0.077084" "size of this panel" seta hud_powerups_flip 1 "flip strength/shield positions" seta hud_powerups_mirror 0 "mirror alignment of panel items" -seta hud_powerups_bg "" "if set to something else than \"\" = override default background, if set to 0 = disable background" -seta hud_powerups_bg_color "" "optional R G B string of the background color, otherwise use hud default" -seta hud_powerups_bg_alpha 0 "if set to something else than 0 = override default alpha" -seta hud_powerups_bg_border 0 "if set to something else than 0 = override size of border around the background" -seta hud_powerups_bg_padding 0 "padding of contents from border" +seta hud_powerups_bg "" "if set to something else than \"\" = override default background" +seta hud_powerups_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_powerups_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" +seta hud_powerups_bg_border "" "if set to something else than \"\" = override default size of border around the background" +seta hud_powerups_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" seta hud_progressbar_strength_color "0 0 0.6" "R G B vector of the progress bar background color" seta hud_progressbar_shield_color "0.6 0 0.6" "R G B vector of the progress bar background color" @@ -1376,11 +1377,11 @@ seta hud_healtharmor_pos "-0.627451 -0.066667" "position of this panel" seta hud_healtharmor_size "0.291174 0.066667" "size of this panel" seta hud_healtharmor_flip 1 "flip health/armor positions" seta hud_healtharmor_mirror 0 "mirror alignment of panel items" -seta hud_healtharmor_bg "" "if set to something else than \"\" = override default background, if set to 0 = disable background" -seta hud_healtharmor_bg_color "" "optional R G B string of the background color, otherwise use hud default" -seta hud_healtharmor_bg_alpha 0 "if set to something else than 0 = override default alpha" -seta hud_healtharmor_bg_border 0 "if set to something else than 0 = override size of border around the background" -seta hud_healtharmor_bg_padding 0 "padding of contents from border" +seta hud_healtharmor_bg "" "if set to something else than \"\" = override default background" +seta hud_healtharmor_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_healtharmor_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" +seta hud_healtharmor_bg_border "" "if set to something else than \"\" = override default size of border around the background" +seta hud_healtharmor_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" seta hud_progressbar_health_color "0.6 0 0" "R G B vector of the progress bar background color" seta hud_progressbar_armor_color "0 0.6 0" "R G B vector of the progress bar background color" seta hud_progressbar_fuel_color "0.6 0.6 0" "R G B vector of the progress bar background color" @@ -1388,77 +1389,77 @@ seta hud_progressbar_fuel_color "0.6 0.6 0" "R G B vector of the progress bar ba seta hud_notify 0 "enable/disable this panel" seta hud_notify_pos "0.1 0" "position of this base of the panel" seta hud_notify_size "0.1 0.1" "size of this panel with all notifications on" -seta hud_notify_bg "" "if set to something else than \"\" = override default background, if set to 0 = disable background" -seta hud_notify_bg_color "" "optional R G B string of the background color, otherwise use hud default" -seta hud_notify_bg_alpha 0 "if set to something else than 0 = override default alpha" -seta hud_notify_bg_border 0 "if set to something else than 0 = override size of border around the background" -seta hud_notify_bg_padding 0 "padding of contents from border" +seta hud_notify_bg "" "if set to something else than \"\" = override default background" +seta hud_notify_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_notify_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" +seta hud_notify_bg_border "" "if set to something else than \"\" = override default size of border around the background" +seta hud_notify_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" seta hud_timer 1 "enable/disable this panel" seta hud_timer_pos "-0.213725 0" "position of this base of the panel" seta hud_timer_size "0.212735 0.054427" "size of this panel" seta hud_timer_increment 0 "show elapsed time instead of remaining time" -seta hud_timer_bg border "if set to something else than \"\" = override default background, if set to 0 = disable background" -seta hud_timer_bg_color "" "optional R G B string of the background color, otherwise use hud default" -seta hud_timer_bg_alpha 0 "if set to something else than 0 = override default alpha" -seta hud_timer_bg_border 0 "if set to something else than 0 = override size of border around the background" -seta hud_timer_bg_padding 0 "padding of contents from border" +seta hud_timer_bg border "if set to something else than \"\" = override default background" +seta hud_timer_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_timer_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" +seta hud_timer_bg_border "" "if set to something else than \"\" = override default size of border around the background" +seta hud_timer_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" seta hud_radar 1 "enable/disable this panel" seta hud_radar_pos "0 0" "position of this base of the panel" seta hud_radar_size "0.215687 0.266667" "size of this panel" -seta hud_radar_bg "" "if set to something else than \"\" = override default background, if set to 0 = disable background" -seta hud_radar_bg_color "" "optional R G B string of the background color, otherwise use hud default" -seta hud_radar_bg_alpha 0 "if set to something else than 0 = override default alpha" -seta hud_radar_bg_border 0 "if set to something else than 0 = override size of border around the background" -seta hud_radar_bg_padding 0 "padding of contents from border" +seta hud_radar_bg "" "if set to something else than \"\" = override default background" +seta hud_radar_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_radar_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" +seta hud_radar_bg_border "" "if set to something else than \"\" = override default size of border around the background" +seta hud_radar_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" seta hud_score 1 "enable/disable this panel" seta hud_score_pos "-0.225469 -0.084404" "position of this base of the panel" seta hud_score_size "0.225469 0.075156" "size of this panel" -seta hud_score_bg "" "if set to something else than \"\" = override default background, if set to 0 = disable background" -seta hud_score_bg_color "" "optional R G B string of the background color, otherwise use hud default" -seta hud_score_bg_alpha 0 "if set to something else than 0 = override default alpha" -seta hud_score_bg_border 0 "if set to something else than 0 = override size of border around the background" -seta hud_score_bg_padding 0 "padding of contents from border" +seta hud_score_bg "" "if set to something else than \"\" = override default background" +seta hud_score_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_score_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" +seta hud_score_bg_border "" "if set to something else than \"\" = override default size of border around the background" +seta hud_score_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" seta hud_racetimer 1 "enable/disable this panel" seta hud_racetimer_pos "-0.614706 0" "position of this base of the panel" seta hud_racetimer_size "0.231373 0.077124" "size of this panel" -seta hud_racetimer_bg "" "if set to something else than \"\" = override default background, if set to 0 = disable background" -seta hud_racetimer_bg_color "" "optional R G B string of the background color, otherwise use hud default" -seta hud_racetimer_bg_alpha 0 "if set to something else than 0 = override default alpha" -seta hud_racetimer_bg_border 0 "if set to something else than 0 = override size of border around the background" -seta hud_racetimer_bg_padding 0 "padding of contents from border" +seta hud_racetimer_bg "" "if set to something else than \"\" = override default background" +seta hud_racetimer_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_racetimer_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" +seta hud_racetimer_bg_border "" "if set to something else than \"\" = override default size of border around the background" +seta hud_racetimer_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" seta hud_vote 1 "enable/disable this panel" seta hud_vote_pos "-0.321140 -0.268230" "position of this base of the panel" seta hud_vote_size "0.320156 0.106719" "size of this panel" seta hud_vote_alreadyvoted_alpha 0.75 "alpha of the vote dialog after you have voted" -seta hud_vote_bg "" "if set to something else than \"\" = override default background, if set to 0 = disable background" -seta hud_vote_bg_color "" "optional R G B string of the background color, otherwise use hud default" -seta hud_vote_bg_alpha 0 "if set to something else than 0 = override default alpha" -seta hud_vote_bg_border 0 "if set to something else than 0 = override size of border around the background" -seta hud_vote_bg_padding 0 "padding of contents from border" +seta hud_vote_bg "" "if set to something else than \"\" = override default background" +seta hud_vote_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_vote_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" +seta hud_vote_bg_border "" "if set to something else than \"\" = override default size of border around the background" +seta hud_vote_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" seta hud_modicons 1 "enable/disable this panel" seta hud_modicons_pos "-0.571569 -0.265625" "position of this base of the panel" seta hud_modicons_size "0.145098 0.114105" "size of this panel" -seta hud_modicons_bg "" "if set to something else than \"\" = override default background, if set to 0 = disable background" -seta hud_modicons_bg_color "" "optional R G B string of the background color, otherwise use hud default" -seta hud_modicons_bg_alpha 0 "if set to something else than 0 = override default alpha" -seta hud_modicons_bg_border 0 "if set to something else than 0 = override size of border around the background" -seta hud_modicons_bg_padding 0 "padding of contents from border" +seta hud_modicons_bg "" "if set to something else than \"\" = override default background" +seta hud_modicons_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_modicons_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" +seta hud_modicons_bg_border "" "if set to something else than \"\" = override default size of border around the background" +seta hud_modicons_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" seta hud_progressbar_nexball_color "0.7 0.1 0" "R G B vector of the progress bar background color" seta hud_pressedkeys 1 "enable/disable this panel, 1 = show only when spectating other players, 2 = show always" seta hud_pressedkeys_pos "-0.571569 -0.265625" "position of this base of the panel" seta hud_pressedkeys_size "0.145098 0.114105" "size of this panel" -seta hud_pressedkeys_bg "" "if set to something else than \"\" = override default background, if set to 0 = disable background" -seta hud_pressedkeys_bg_color "" "optional R G B string of the background color, otherwise use hud default" -seta hud_pressedkeys_bg_alpha 0 "if set to something else than 0 = override default alpha" -seta hud_pressedkeys_bg_border 0 "if set to something else than 0 = override size of border around the background" -seta hud_pressedkeys_bg_padding 0 "padding of contents from border" +seta hud_pressedkeys_bg "" "if set to something else than \"\" = override default background" +seta hud_pressedkeys_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_pressedkeys_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" +seta hud_pressedkeys_bg_border "" "if set to something else than \"\" = override default size of border around the background" +seta hud_pressedkeys_bg_padding "" "if set to something else than \"\" = override default padding of contents from border" // scoreboard seta scoreboard_border_thickness 1 "scoreboard border thickness" diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 511bfa26d..f8eccf113 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -707,11 +707,38 @@ vector HUD_Panel_GetPos(float id) float HUD_Panel_GetBorder(float id) { - float border; - border = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_border")); - if(!border) - border = cvar("hud_bg_border"); - return border; + string border; + border = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_border")); + if(border == "") + border = cvar_string("hud_bg_border"); + return stof(border); +} + +vector HUD_Panel_GetColor(float id) +{ + string color; + color = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color")); + if(color == "") + color = cvar_string("hud_bg_color"); + return stov(color); +} + +float HUD_Panel_GetAlpha(float id) +{ + string alpha; + alpha = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_alpha")); + if(alpha == "") + alpha = cvar_string("hud_bg_alpha"); + return stof(alpha); +} + +float HUD_Panel_GetPadding(float id) +{ + string padding; + padding = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_padding")); + if(padding == "") + padding = cvar_string("hud_bg_padding"); + return stof(padding); } // draw the background/borders @@ -731,17 +758,10 @@ void HUD_Panel_DrawBg(float id, vector pos, vector mySize) border = max(0.0000001, HUD_Panel_GetBorder(id)); // draw_BorderPicture does not like border = 0 vector color; - if(cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color")) != "") - color = stov(cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color"))); - else - color = stov(cvar_string("hud_bg_color")); + color = HUD_Panel_GetColor(id); float alpha; - alpha = cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_alpha")); - if(!alpha) - alpha = cvar("hud_bg_alpha"); - if(hud_configure) - alpha = max(cvar("hud_configure_bg_minalpha"), alpha); + alpha = HUD_Panel_GetAlpha(id); draw_BorderPicture(pos - '1 1 0' * border, strcat("gfx/hud/", cvar_string("hud_skin"), "/", bg), mySize + '1 1 0' * 2 * border, color, alpha, '1 1 0' * (border/BORDER_MULTIPLIER)); } -- 2.39.2