4 #ifdef TEAMNUMBERS_THAT_ARENT_STUPID
5 const int NUM_TEAM_1 = 1; // red
6 const int NUM_TEAM_2 = 2; // blue
7 const int NUM_TEAM_3 = 3; // yellow
8 const int NUM_TEAM_4 = 4; // pink
9 const int NUM_SPECTATOR = 5;
12 const int NUM_TEAM_1 = 4; // red
13 const int NUM_TEAM_2 = 13; // blue
14 const int NUM_TEAM_3 = 12; // yellow
15 const int NUM_TEAM_4 = 9; // pink
17 const int NUM_TEAM_1 = 5; // red
18 const int NUM_TEAM_2 = 14; // blue
19 const int NUM_TEAM_3 = 13; // yellow
20 const int NUM_TEAM_4 = 10; // pink
22 const int NUM_SPECTATOR = 1337;
25 const string COL_TEAM_1 = "^1";
26 const string COL_TEAM_2 = "^4";
27 const string COL_TEAM_3 = "^3";
28 const string COL_TEAM_4 = "^6";
29 // must be #defined, const globals drop the translation attribute
30 #define NAME_TEAM_1 CTX(_("TEAM^Red"))
31 #define NAME_TEAM_2 CTX(_("TEAM^Blue"))
32 #define NAME_TEAM_3 CTX(_("TEAM^Yellow"))
33 #define NAME_TEAM_4 CTX(_("TEAM^Pink"))
34 #define NAME_TEAM _("Team")
35 #define NAME_NEUTRAL _("Neutral")
37 // items colors, so they are handled properly in languages which decline things with grammatical gender
38 #define KEY_TEAM_1 CTX(_("KEY^Red"))
39 #define KEY_TEAM_2 CTX(_("KEY^Blue"))
40 #define KEY_TEAM_3 CTX(_("KEY^Yellow"))
41 #define KEY_TEAM_4 CTX(_("KEY^Pink"))
42 #define FLAG_TEAM_1 CTX(_("FLAG^Red"))
43 #define FLAG_TEAM_2 CTX(_("FLAG^Blue"))
44 #define FLAG_TEAM_3 CTX(_("FLAG^Yellow"))
45 #define FLAG_TEAM_4 CTX(_("FLAG^Pink"))
46 #define GENERATOR_TEAM_1 CTX(_("GENERATOR^Red"))
47 #define GENERATOR_TEAM_2 CTX(_("GENERATOR^Blue"))
48 #define GENERATOR_TEAM_3 CTX(_("GENERATOR^Yellow"))
49 #define GENERATOR_TEAM_4 CTX(_("GENERATOR^Pink"))
51 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
52 const string STATIC_NAME_TEAM_1 = "Red";
53 const string STATIC_NAME_TEAM_2 = "Blue";
54 const string STATIC_NAME_TEAM_3 = "Yellow";
55 const string STATIC_NAME_TEAM_4 = "Pink";
62 string Team_ColorCode(float teamid)
66 case NUM_TEAM_1: return COL_TEAM_1;
67 case NUM_TEAM_2: return COL_TEAM_2;
68 case NUM_TEAM_3: return COL_TEAM_3;
69 case NUM_TEAM_4: return COL_TEAM_4;
75 vector Team_ColorRGB(float teamid)
79 case NUM_TEAM_1: return '1 0.0625 0.0625'; // 0xFF0F0F
80 case NUM_TEAM_2: return '0.0625 0.0625 1'; // 0x0F0FFF
81 case NUM_TEAM_3: return '1 1 0.0625'; // 0xFFFF0F
82 case NUM_TEAM_4: return '1 0.0625 1'; // 0xFF0FFF
88 string Team_ColorName(float teamid)
92 case NUM_TEAM_1: return NAME_TEAM_1;
93 case NUM_TEAM_2: return NAME_TEAM_2;
94 case NUM_TEAM_3: return NAME_TEAM_3;
95 case NUM_TEAM_4: return NAME_TEAM_4;
101 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
102 string Static_Team_ColorName(float teamid)
106 case NUM_TEAM_1: return STATIC_NAME_TEAM_1;
107 case NUM_TEAM_2: return STATIC_NAME_TEAM_2;
108 case NUM_TEAM_3: return STATIC_NAME_TEAM_3;
109 case NUM_TEAM_4: return STATIC_NAME_TEAM_4;
115 float Team_ColorToTeam(string team_color)
117 switch(strtolower(team_color))
119 case "red": return NUM_TEAM_1;
120 case "blue": return NUM_TEAM_2;
121 case "yellow": return NUM_TEAM_3;
122 case "pink": return NUM_TEAM_4;
123 case "auto": return 0;
129 float Team_NumberToTeam(float number)
133 case 1: return NUM_TEAM_1;
134 case 2: return NUM_TEAM_2;
135 case 3: return NUM_TEAM_3;
136 case 4: return NUM_TEAM_4;
142 float Team_TeamToNumber(float teamid)
146 case NUM_TEAM_1: return 1;
147 case NUM_TEAM_2: return 2;
148 case NUM_TEAM_3: return 3;
149 case NUM_TEAM_4: return 4;
156 // legacy aliases for shitty code
157 #define TeamByColor(teamid) (Team_TeamToNumber(teamid) - 1)
158 #define ColorByTeam(number) Team_NumberToTeam(number + 1)
161 #define Team_ColorName_Lower(teamid) strtolower(Team_ColorName(teamid))
162 #define Team_ColorName_Upper(teamid) strtoupper(Team_ColorName(teamid))
164 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
165 #define Static_Team_ColorName_Lower(teamid) strtolower(Static_Team_ColorName(teamid))
166 #define Static_Team_ColorName_Upper(teamid) strtoupper(Static_Team_ColorName(teamid))
168 #define Team_FullName(teamid) strcat(Team_ColorName(teamid), " ", NAME_TEAM, "^7")
169 #define Team_ColoredFullName(teamid) strcat(Team_ColorCode(teamid), Team_ColorName(teamid), " ", NAME_TEAM, "^7")
171 #define Team_NumberToFullName(number) Team_FullName(Team_NumberToTeam(number))
172 #define Team_NumberToColoredFullName(number) Team_ColoredFullName(Team_NumberToTeam(number))
174 // replace these flags in a string with the strings provided
175 #define TCR(input,type,team) strreplace("^TC", COL_TEAM_##team, strreplace("^TT", strtoupper(type##_TEAM_##team), input))
177 // safe team comparisons
178 #define SAME_TEAM(a,b) (teamplay ? (a.team == b.team) : (a == b))
179 #define DIFF_TEAM(a,b) (teamplay ? (a.team != b.team) : (a != b))