]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Color picker for the HUD
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 6 Nov 2011 15:30:04 +0000 (17:30 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sun, 6 Nov 2011 15:30:04 +0000 (17:30 +0200)
data/defaultVT.cfg
data/qcsrc/client/sbar.qc
data/qcsrc/menu/voret/dialog_multiplayer_playersetup_hud.c

index 6368811c0aa16923e6568db54d41f7c93bd16307..944483fcfad5c410c01d2641daf1e7c43d25eaaa 100644 (file)
@@ -1192,9 +1192,7 @@ sbar_info_pos 50
 seta sbar_alpha_bg 0.8 "alpha value of the HUD background"\r
 seta sbar_alpha_fg 1 "alpha value of the HUD foreground items"\r
 seta sbar_border_thickness 1 "scoreboard border thickness"\r
-seta sbar_color_bg_r 0.5 "red color component of the HUD background"\r
-seta sbar_color_bg_g 0.25 "green color component of the HUD background"\r
-seta sbar_color_bg_b 1 "blue color component of the HUD background"\r
+seta sbar_color_bg "0.5 0.25 1" "default color of the HUD background"\r
 seta sbar_color_bg_team 1 "team color multiplier of the HUD background"\r
 seta sbar_scoreboard_offset 100 "scoreboard vertical position"\r
 seta sbar_scoreboard_alpha_bg 0.6 "scoreboard background alpha"\r
index 56395d20436d8cc2d630e45fdc3818045022176b..61d7e8f2801ab9d042d9d043a888cd747cfa00b4 100644 (file)
@@ -795,11 +795,9 @@ void Sbar_PrintScoreboardItem(vector pos, entity pl, float is_self, float pl_num
        float is_spec;\r
        is_spec = (GetPlayerColor(pl.sv_entnum) == COLOR_SPECTATOR);\r
        \r
-       if((rgb == '1 1 1') && (!is_spec)) {\r
-               rgb_x = cvar("sbar_color_bg_r") + 0.5;\r
-               rgb_y = cvar("sbar_color_bg_g") + 0.5;\r
-               rgb_z = cvar("sbar_color_bg_b") + 0.5; }\r
-               \r
+       if((rgb == '1 1 1') && (!is_spec))\r
+               rgb = stov(cvar_string("sbar_color_bg")) + '0.5 0.5 0.5';\r
+\r
        // Layout:\r
        tmp_x = sbwidth;\r
        tmp_y = sbar_fontsize_y * 1.25;\r
@@ -1270,9 +1268,7 @@ vector Sbar_DrawScoreboardRankings(vector pos, entity pl,  vector rgb, vector bg
        float is_spec;\r
        is_spec = (GetPlayerColor(pl.sv_entnum) == COLOR_SPECTATOR);\r
        vector hl_rgb;\r
-               hl_rgb_x = cvar("sbar_color_bg_r") + 0.5;\r
-               hl_rgb_y = cvar("sbar_color_bg_g") + 0.5;\r
-               hl_rgb_z = cvar("sbar_color_bg_b") + 0.5;\r
+               hl_rgb = stov(cvar_string("sbar_color_bg")) + '0.5 0.5 0.5';\r
 \r
        pos_y += sbar_fontsize_y;\r
        drawstring(pos, strcat("Rankings"), sbar_fontsize, '1 1 1', sbar_scoreboard_alpha_fg, DRAWFLAG_NORMAL);\r
@@ -1395,9 +1391,7 @@ void Sbar_DrawScoreboard()
        }\r
        else\r
        {\r
-               rgb_x = cvar("sbar_color_bg_r");\r
-               rgb_y = cvar("sbar_color_bg_g");\r
-               rgb_z = cvar("sbar_color_bg_b");\r
+               rgb = stov(cvar_string("sbar_color_bg"));\r
 \r
                for(tm = teams.sort_next; tm; tm = tm.sort_next)\r
                {\r
@@ -1946,9 +1940,7 @@ void Sbar_Status()
                        drawpic(bottom - '96 96 0', "gfx/hud/bg_status", '192 96 0', GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color\r
                else {\r
                        // allow for custom HUD colors in non-teamgames\r
-                       color_x = cvar("sbar_color_bg_r");\r
-                       color_y = cvar("sbar_color_bg_g");\r
-                       color_z = cvar("sbar_color_bg_b");\r
+                       color = stov(cvar_string("sbar_color_bg"));\r
 \r
                        drawpic(bottom - '96 96 0', "gfx/hud/bg_status", '192 96 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
                }\r
@@ -2093,9 +2085,7 @@ void Sbar_Timer()
                if (teamplay)\r
                        drawpic(bgpos, "gfx/hud/bg_timer", '120 30 0' * scale, GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // timer bg color = myteam color\r
                else {\r
-                       color_x = cvar("sbar_color_bg_r");\r
-                       color_y = cvar("sbar_color_bg_g");\r
-                       color_z = cvar("sbar_color_bg_b");\r
+                       color = stov(cvar_string("sbar_color_bg"));\r
 \r
                        drawpic(bgpos, "gfx/hud/bg_timer", '120 30 0' * scale, color, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
                }\r
@@ -3014,11 +3004,8 @@ void Sbar_Draw (void)
 \r
                if (teamplay)\r
                        color =  GetTeamRGB(myteam) * sbar_color_bg_team;\r
-               else {\r
-                       color_x = cvar("sbar_color_bg_r");\r
-                       color_y = cvar("sbar_color_bg_g");\r
-                       color_z = cvar("sbar_color_bg_b");\r
-               }\r
+               else\r
+                       color = stov(cvar_string("sbar_color_bg"));\r
 \r
                vector voteorigin = bottomright - '290 135 0';\r
                vector votesize = '280 70 0';\r
@@ -3099,9 +3086,7 @@ void Sbar_Draw (void)
                                        drawpic(bottomleft- '0 256 0', "gfx/hud/bg_stomach", '256 256 0', GetTeamRGB(myteam) * sbar_color_bg_team, sbar_alpha_bg, DRAWFLAG_NORMAL); // hud color = myteam color\r
                                else {\r
                                        // allow for custom HUD colors in non-teamgames\r
-                                       color_x = cvar("sbar_color_bg_r");\r
-                                       color_y = cvar("sbar_color_bg_g");\r
-                                       color_z = cvar("sbar_color_bg_b");\r
+                                       color = stov(cvar_string("sbar_color_bg"));\r
 \r
                                        drawpic(bottomleft - '0 256 0', "gfx/hud/bg_stomach", '256 256 0', color, sbar_alpha_bg, DRAWFLAG_NORMAL);\r
                                }\r
index f3c370add024275efa0f7f79b17c114b34605b6b..6c1f50cd6b679f47c02c841c9c80abb8d0129606 100644 (file)
@@ -58,19 +58,9 @@ void fillVoretHudDialog(entity me)
                        setDependent(e, "viewsize", 0, 100);\r
                me.TR(me);\r
                        me.TDempty(me, 0.2);\r
-                       me.TD(me, 1, 0.8, e = makeVoretTextLabel(0, "Default ^1red^7:"));\r
-                       me.TD(me, 1, 3, e = makeVoretSlider(0, 1, 0.01, "sbar_color_bg_r"));\r
-                               setDependent(e, "viewsize", 0, 100);\r
-               me.TR(me);\r
-                       me.TDempty(me, 0.2);\r
-                       me.TD(me, 1, 0.8, e = makeVoretTextLabel(0, "Default ^2green^7:"));\r
-                       me.TD(me, 1, 3, e = makeVoretSlider(0, 1, 0.01, "sbar_color_bg_g"));\r
-                               setDependent(e, "viewsize", 0, 100);\r
+                       me.TD(me, 1, 0.8, e = makeVoretTextLabel(0, "Default color:"));\r
+                       me.TD(me, 2, 2, e = makeVoretColorpickerString("sbar_color_bg", "sbar_color_bg"));\r
                me.TR(me);\r
-                       me.TDempty(me, 0.2);\r
-                       me.TD(me, 1, 0.8, e = makeVoretTextLabel(0, "Default ^4blue^7:"));\r
-                       me.TD(me, 1, 3, e = makeVoretSlider(0, 1, 0.01, "sbar_color_bg_b"));\r
-                               setDependent(e, "viewsize", 0, 100);\r
                me.TR(me);\r
                        me.TDempty(me, 0.2);\r
                        me.TD(me, 1, 0.8, e = makeVoretTextLabel(0, "Team color:"));\r