]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
allow decolorization as an option, enable by default in teamgames similar to how...
authorFruitieX <fruitiex@gmail.com>
Wed, 13 Apr 2011 15:42:01 +0000 (18:42 +0300)
committerFruitieX <fruitiex@gmail.com>
Wed, 13 Apr 2011 15:42:01 +0000 (18:42 +0300)
defaultXonotic.cfg
qcsrc/client/autocvars.qh
qcsrc/client/miscfunctions.qc
qcsrc/client/progs.src
qcsrc/client/shownames.qc
qcsrc/client/teamplay.qc

index 089c11a627a9bdbf1b15f1cfb28efaef576ba5a8..ccb04f6c165304e1bc5b11ab284f55b37c3f1831 100644 (file)
@@ -1487,6 +1487,7 @@ seta hud_shownames_status 2 "1 = draw health/armor status of teammates, 2 = same
 seta hud_shownames_height 15 "height of icons"
 seta hud_shownames_aspect 8 "aspect ratio of total drawing area per name"
 seta hud_shownames_fontsize 8 "font size"
+seta hud_shownames_decolorize 1 "1 = decolorize name in team games, 2 = decolorize always"
 seta hud_shownames_alpha 0.7 "alpha"
 seta hud_shownames_resize 1 "enable resizing of the names, then the size cvars will correspond to the maximum size"
 seta hud_shownames_mindistance 1000 "start fading alpha/size at this distance"
index fc3c1f8e1c79d552f820b14fd8bd023f5a73b963..d06c31a12934ea3cf090c31a099d67bf8a25b3a1 100644 (file)
@@ -278,6 +278,7 @@ float autocvar_hud_shownames_status;
 float autocvar_hud_shownames_height;
 float autocvar_hud_shownames_aspect;
 float autocvar_hud_shownames_fontsize;
+float autocvar_hud_shownames_decolorize;
 float autocvar_hud_shownames_alpha;
 float autocvar_hud_shownames_resize;
 float autocvar_hud_shownames_mindistance;
index 1ee799a7774810117ec7c50cc5e773e55a08323b..4588ebb6c6c4ed921f06cc6b7e14e96cf9bcbc3c 100644 (file)
@@ -375,6 +375,33 @@ string ColorTranslateRGB(string s)
                return s;
 }
 
+string Team_ColorCode(float teamid)
+{
+    if (teamid == COLOR_TEAM1)
+        return "^1";
+    else if (teamid == COLOR_TEAM2)
+        return "^4";
+    else if (teamid == COLOR_TEAM3)
+        return "^3";
+    else if (teamid == COLOR_TEAM4)
+        return "^6";
+    else
+        return "^7";
+}
+
+// decolorizes and team colors the player name when needed
+string playername(string thename, float teamid)
+{
+    string t;
+    if (teamplay)
+    {
+        t = Team_ColorCode(teamid);
+        return strcat(t, strdecolorize(thename));
+    }
+    else
+        return strdecolorize(thename);
+}
+
 float cvar_or(string cv, float v)
 {
        string s;
index ba35ee2a9a21a8672b7082b7716a8f9730baaf87..4219eef16447e01372629a917b91c8e853cfcc71 100644 (file)
@@ -29,6 +29,7 @@ movetypes.qh
 prandom.qh
 bgmscript.qh
 noise.qh
+teamplay.qh
 
 main.qh
 
index 66391197ad85537a3c7e48b2c2ecfc33e0ad2aeb..5cbcfcea4bf612ba8a37d08c8576225dca2f122e 100644 (file)
@@ -111,6 +111,9 @@ void Draw_ShowNames()
 
             string s;
             s = GetPlayerName(self.the_entnum-1);
+            if((autocvar_hud_shownames_decolorize == 1 && teamplay) || autocvar_hud_shownames_decolorize == 2)
+                s = playername(s, GetPlayerColor(self.the_entnum-1));
+
             drawfontscale = '1 1 0' * resize;
             s = textShortenToWidth(s, namesize, '1 1 0' * autocvar_hud_shownames_fontsize, stringwidth_colors);
 
index 7d5031fb87321beb771bf4f72390a7fd6464e0ed..0c52f29d07f471bfb0a26a40d588ec2af644c1cf 100644 (file)
@@ -1,6 +1,3 @@
-float teamplay;
-float myteam;
-
 float TeamByColor(float color)
 {
        switch(color)