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