]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/teams.qh
Merge branch 'master' into z411/bai-server
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / teams.qh
index 62bb2db7cdda28a8e6e63da5cf6024e59f570a3e..e99b001b255d676b55e5b6409e61da9def8ef435 100644 (file)
@@ -3,19 +3,19 @@
 const int NUM_TEAMS = 4; ///< Number of teams in the game.
 
 #ifdef TEAMNUMBERS_THAT_ARENT_STUPID
-const int NUM_TEAM_1 = 1;  // red
+const int NUM_TEAM_1 = 1; // red
 const int NUM_TEAM_2 = 2; // blue
 const int NUM_TEAM_3 = 3; // yellow
 const int NUM_TEAM_4 = 4; // pink
 const int NUM_SPECTATOR = 5;
 #else
 #ifdef CSQC
-const int NUM_TEAM_1 = 4;  // red
+const int NUM_TEAM_1 = 4; // red
 const int NUM_TEAM_2 = 13; // blue
 const int NUM_TEAM_3 = 12; // yellow
 const int NUM_TEAM_4 = 9; // pink
 #else
-const int NUM_TEAM_1 = 5;  // red
+const int NUM_TEAM_1 = 5; // red
 const int NUM_TEAM_2 = 14; // blue
 const int NUM_TEAM_3 = 13; // yellow
 const int NUM_TEAM_4 = 10; // pink
@@ -58,6 +58,12 @@ const string STATIC_NAME_TEAM_4 = "Pink";
 #ifdef CSQC
 bool teamplay;
 int myteam;
+
+// z411 used for custom names
+string teamname_red;
+string teamname_blue;
+string teamname_yellow;
+string teamname_pink;
 #endif
 
 string Team_ColorCode(int teamid)
@@ -83,9 +89,24 @@ vector Team_ColorRGB(int teamid)
                case NUM_TEAM_4: return '1 0.0625 1'; // 0xFF0FFF
        }
 
-    return '0 0 0';
+       return '0 0 0';
 }
 
+#ifdef CSQC
+string Team_CustomName(int teamid)
+{
+       switch(teamid)
+       {
+               case NUM_TEAM_1: return ((teamname_red != "") ? teamname_red : "^1RED^7 team");
+               case NUM_TEAM_2: return ((teamname_blue != "")? teamname_blue : "^4BLUE^7 team");
+               case NUM_TEAM_3: return ((teamname_yellow != "") ? teamname_yellow : "^3YELLOW^7 team");
+               case NUM_TEAM_4: return ((teamname_pink != "") ? teamname_pink : "^6PINK^7 team");
+       }
+
+    return NAME_NEUTRAL;
+}
+#endif
+
 string Team_ColorName(int teamid)
 {
        switch(teamid)
@@ -96,7 +117,7 @@ string Team_ColorName(int teamid)
                case NUM_TEAM_4: return NAME_TEAM_4;
        }
 
-    return NAME_NEUTRAL;
+       return NAME_NEUTRAL;
 }
 
 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
@@ -110,7 +131,7 @@ string Static_Team_ColorName(int teamid)
                case NUM_TEAM_4: return STATIC_NAME_TEAM_4;
        }
 
-    return NAME_NEUTRAL;
+       return NAME_NEUTRAL;
 }
 
 float Team_ColorToTeam(string team_color)