From: FruitieX Date: Sun, 6 Jun 2010 15:05:20 +0000 (+0300) Subject: add hud_*_color_team cvars to enforce a team color in teambased games (range from... X-Git-Tag: xonotic-v0.1.0preview~541^2~106^2~9 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=40fc50566ab9476aa9cb45dc51af4f3d965ca236;p=xonotic%2Fxonotic-data.pk3dir.git add hud_*_color_team cvars to enforce a team color in teambased games (range from ]0, 1] can be given to adjust brightness) --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 4e6d1a409..4d8cf7517 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1324,6 +1324,7 @@ set _hud_configure 0 "1 = configure the HUD" seta hud_skin old "skin folder where to look for images" 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, accepts \"shirt\" and \"pants\"" +seta hud_bg_color_team 0 "default setting for overriding panel color with team color in team games, 0.5 = less saturated" 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" @@ -1338,6 +1339,7 @@ seta hud_configure_grid_y 10 "snap each Y pixels" seta hud_dock "dock" "enable a fullscreen background for the hud, useful for creating artificial docks, \"\" = disable" seta hud_dock_color "0 0.6 0.9" "dock color, accepts \"shirt\" and \"pants\"" +seta hud_dock_color_team 0.7 "override dock color with team color in team games" seta hud_dock_alpha 0.8 "alpha of the dock" seta sbar_info_pos 50 @@ -1349,6 +1351,7 @@ 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" seta hud_weaponicons_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_weaponicons_bg_color_team "" "override panel color with team color in team based games" 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" @@ -1359,6 +1362,7 @@ 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" seta hud_inventory_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_inventory_bg_color_team "" "override panel color with team color in team based games" seta hud_inventory_bg_alpha "" "if set to something else than \"\" = override default panel background alpha" seta hud_inventory_bg_border "" "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 padding of contents from border" @@ -1370,6 +1374,7 @@ 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" seta hud_powerups_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_powerups_bg_color_team "" "override panel color with team color in team based games" 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" @@ -1383,6 +1388,7 @@ 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" seta hud_healtharmor_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_healtharmor_bg_color_team "" "override panel color with team color in team based games" 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" @@ -1395,6 +1401,7 @@ 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" seta hud_notify_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_notify_bg_color_team "" "override panel color with team color in team based games" 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" @@ -1405,6 +1412,7 @@ 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" seta hud_timer_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_timer_bg_color_team "" "override panel color with team color in team based games" 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" @@ -1414,6 +1422,7 @@ 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" seta hud_radar_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_radar_bg_color_team "" "override panel color with team color in team based games" 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" @@ -1423,6 +1432,7 @@ 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" seta hud_score_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_score_bg_color_team "" "override panel color with team color in team based games" 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" @@ -1432,6 +1442,7 @@ 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" seta hud_racetimer_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_racetimer_bg_color_team "" "override panel color with team color in team based games" 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" @@ -1442,6 +1453,7 @@ 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" seta hud_vote_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_vote_bg_color_team "" "override panel color with team color in team based games" 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" @@ -1451,6 +1463,7 @@ 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" seta hud_modicons_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_modicons_bg_color_team "" "override panel color with team color in team based games" 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" @@ -1461,6 +1474,7 @@ seta hud_pressedkeys_pos "-0.571569 -0.265625" "position of this base of the pan 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" seta hud_pressedkeys_bg_color "" "if set to something else than \"\" = override default panel background color" +seta hud_pressedkeys_bg_color_team "" "override panel color with team color in team based games" 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" diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index 4e7628f3f..88d94c6a4 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -579,6 +579,7 @@ void HUD_Panel_ExportCfg(string cfgname) fputs(fh, strcat("seta hud_skin \"", cvar_string("hud_skin"), "\"", "\n")); fputs(fh, strcat("seta hud_bg \"", cvar_string("hud_bg"), "\"", "\n")); fputs(fh, strcat("seta hud_bg_color \"", cvar_string("hud_bg_color"), "\"", "\n")); + fputs(fh, strcat("seta hud_bg_color_team \"", cvar_string("hud_bg_color_team"), "\"", "\n")); fputs(fh, strcat("seta hud_bg_alpha \"", cvar_string("hud_bg_alpha"), "\"", "\n")); fputs(fh, strcat("seta hud_bg_border \"", cvar_string("hud_bg_border"), "\"", "\n")); fputs(fh, strcat("seta hud_bg_padding \"", cvar_string("hud_bg_padding"), "\"", "\n")); @@ -587,6 +588,7 @@ void HUD_Panel_ExportCfg(string cfgname) fputs(fh, strcat("seta hud_dock \"", cvar_string("hud_dock"), "\"", "\n")); fputs(fh, strcat("seta hud_dock_color \"", cvar_string("hud_dock_color"), "\"", "\n")); + fputs(fh, strcat("seta hud_dock_color_team \"", cvar_string("hud_dock_color_team"), "\"", "\n")); fputs(fh, strcat("seta hud_dock_alpha \"", ftos(cvar("hud_dock_alpha")), "\"", "\n")); fputs(fh, "\n"); @@ -608,6 +610,7 @@ void HUD_Panel_ExportCfg(string cfgname) fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_size \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_size")), "\"", "\n")); fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg")), "\"", "\n")); fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_color \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_color")), "\"", "\n")); + fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_color_team \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_color_team")), "\"", "\n")); fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_alpha \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_alpha")), "\"", "\n")); fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_border \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_border")), "\"", "\n")); fputs(fh, strcat("seta hud_", HUD_Panel_GetName(i), "_bg_padding \"", cvar_string(strcat("hud_", HUD_Panel_GetName(i), "_bg_padding")), "\"", "\n")); @@ -730,12 +733,24 @@ vector HUD_Panel_GetColor(float id) float f; vector color_vec; string color; - color = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color")); + + // fetch per-panel color + if(teamplay && cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color_team")) != "") { + f = stof(getplayerkey(self.sv_entnum, "colors")); + color = vtos(colormapPaletteColor(mod(f, 16), 1) * cvar(strcat("hud_", HUD_Panel_GetName(id), "_bg_color_team"))); + } + else + color = cvar_string(strcat("hud_", HUD_Panel_GetName(id), "_bg_color")); color_vec = stov(color); - if(color == "") { + + if(color == "") { // fetch default color color = cvar_string("hud_bg_color"); color_vec = stov(color); - if(color == "shirt") { + if(teamplay && cvar(strcat("hud_bg_color_team"))) { + f = stof(getplayerkey(self.sv_entnum, "colors")); + color_vec = colormapPaletteColor(mod(f, 16), 1) * cvar("hud_bg_color_team"); + } + else if(color == "shirt") { f = stof(getplayerkey(self.sv_entnum, "colors")); color_vec = colormapPaletteColor(floor(f / 16), 0); } @@ -762,7 +777,11 @@ vector HUD_Panel_Dock_GetColor(void) string color; color = cvar_string("hud_dock_color"); color_vec = stov(color); - if(color == "shirt") { + if(teamplay && cvar(strcat("hud_dock_color_team"))) { + f = stof(getplayerkey(self.sv_entnum, "colors")); + color_vec = colormapPaletteColor(mod(f, 16), 1) * cvar("hud_dock_color_team"); + } + else if(color == "shirt") { f = stof(getplayerkey(self.sv_entnum, "colors")); color_vec = colormapPaletteColor(floor(f / 16), 0); }