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 const string NAME_TEAM_1 = _("Red");
30 const string NAME_TEAM_2 = _("Blue");
31 const string NAME_TEAM_3 = _("Yellow");
32 const string NAME_TEAM_4 = _("Pink");
33 const string NAME_TEAM = _("Team");
34 const string NAME_NEUTRAL = _("Neutral");
36 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
37 const string STATIC_NAME_TEAM_1 = "Red";
38 const string STATIC_NAME_TEAM_2 = "Blue";
39 const string STATIC_NAME_TEAM_3 = "Yellow";
40 const string STATIC_NAME_TEAM_4 = "Pink";
47 string Team_ColorCode(float teamid)
51 case NUM_TEAM_1: return COL_TEAM_1;
52 case NUM_TEAM_2: return COL_TEAM_2;
53 case NUM_TEAM_3: return COL_TEAM_3;
54 case NUM_TEAM_4: return COL_TEAM_4;
60 vector Team_ColorRGB(float teamid)
64 case NUM_TEAM_1: return '1 0.0625 0.0625'; // 0xFF0F0F
65 case NUM_TEAM_2: return '0.0625 0.0625 1'; // 0x0F0FFF
66 case NUM_TEAM_3: return '1 1 0.0625'; // 0xFFFF0F
67 case NUM_TEAM_4: return '1 0.0625 1'; // 0xFF0FFF
73 string Team_ColorName(float teamid)
77 case NUM_TEAM_1: return NAME_TEAM_1;
78 case NUM_TEAM_2: return NAME_TEAM_2;
79 case NUM_TEAM_3: return NAME_TEAM_3;
80 case NUM_TEAM_4: return NAME_TEAM_4;
86 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
87 string Static_Team_ColorName(float teamid)
91 case NUM_TEAM_1: return STATIC_NAME_TEAM_1;
92 case NUM_TEAM_2: return STATIC_NAME_TEAM_2;
93 case NUM_TEAM_3: return STATIC_NAME_TEAM_3;
94 case NUM_TEAM_4: return STATIC_NAME_TEAM_4;
100 float Team_ColorToTeam(string team_color)
102 switch(strtolower(team_color))
104 case "red": return NUM_TEAM_1;
105 case "blue": return NUM_TEAM_2;
106 case "yellow": return NUM_TEAM_3;
107 case "pink": return NUM_TEAM_4;
108 case "auto": return 0;
114 float Team_NumberToTeam(float number)
118 case 1: return NUM_TEAM_1;
119 case 2: return NUM_TEAM_2;
120 case 3: return NUM_TEAM_3;
121 case 4: return NUM_TEAM_4;
127 float Team_TeamToNumber(float teamid)
131 case NUM_TEAM_1: return 1;
132 case NUM_TEAM_2: return 2;
133 case NUM_TEAM_3: return 3;
134 case NUM_TEAM_4: return 4;
141 // legacy aliases for shitty code
142 #define TeamByColor(teamid) (Team_TeamToNumber(teamid) - 1)
143 #define ColorByTeam(number) Team_NumberToTeam(number + 1)
146 #define Team_ColorName_Lower(teamid) strtolower(Team_ColorName(teamid))
147 #define Team_ColorName_Upper(teamid) strtoupper(Team_ColorName(teamid))
149 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
150 #define Static_Team_ColorName_Lower(teamid) strtolower(Static_Team_ColorName(teamid))
151 #define Static_Team_ColorName_Upper(teamid) strtoupper(Static_Team_ColorName(teamid))
153 #define Team_FullName(teamid) strcat(Team_ColorName(teamid), " ", NAME_TEAM, "^7")
154 #define Team_ColoredFullName(teamid) strcat(Team_ColorCode(teamid), Team_ColorName(teamid), " ", NAME_TEAM, "^7")
156 #define Team_NumberToFullName(number) Team_FullName(Team_NumberToTeam(number))
157 #define Team_NumberToColoredFullName(number) Team_ColoredFullName(Team_NumberToTeam(number))
159 // replace these flags in a string with the strings provided
160 #define TCR(input,teamcolor,teamtext) strreplace("^TC", teamcolor, strreplace("^TT", teamtext, input))
162 // safe team comparisons
163 #define SAME_TEAM(a,b) (teamplay ? ((a.team == b.team) ? 1 : 0) : ((a == b) ? 1 : 0))
164 #define DIFF_TEAM(a,b) (teamplay ? ((a.team != b.team) ? 1 : 0) : ((a != b) ? 1 : 0))
166 // used for notification system multi-team identifiers
167 #define APP_TEAM_NUM_2(num,prefix) ((num == NUM_TEAM_1) ? prefix##RED : prefix##BLUE)
168 #define APP_TEAM_NUM_4(num,prefix) ((num == NUM_TEAM_1) ? prefix##RED : ((num == NUM_TEAM_2) ? prefix##BLUE : ((num == NUM_TEAM_3) ? prefix##YELLOW : prefix##PINK)))
169 #define APP_TEAM_ENT_2(ent,prefix) ((ent.team == NUM_TEAM_1) ? prefix##RED : prefix##BLUE)
170 #define APP_TEAM_ENT_4(ent,prefix) ((ent.team == NUM_TEAM_1) ? prefix##RED : ((ent.team == NUM_TEAM_2) ? prefix##BLUE : ((ent.team == NUM_TEAM_3) ? prefix##YELLOW : prefix##PINK)))