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 _("Red")
31 #define NAME_TEAM_2 _("Blue")
32 #define NAME_TEAM_3 _("Yellow")
33 #define NAME_TEAM_4 _("Pink")
34 #define NAME_TEAM _("Team")
35 #define NAME_NEUTRAL _("Neutral")
37 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
38 const string STATIC_NAME_TEAM_1 = "Red";
39 const string STATIC_NAME_TEAM_2 = "Blue";
40 const string STATIC_NAME_TEAM_3 = "Yellow";
41 const string STATIC_NAME_TEAM_4 = "Pink";
48 string Team_ColorCode(float teamid)
52 case NUM_TEAM_1: return COL_TEAM_1;
53 case NUM_TEAM_2: return COL_TEAM_2;
54 case NUM_TEAM_3: return COL_TEAM_3;
55 case NUM_TEAM_4: return COL_TEAM_4;
61 vector Team_ColorRGB(float teamid)
65 case NUM_TEAM_1: return '1 0.0625 0.0625'; // 0xFF0F0F
66 case NUM_TEAM_2: return '0.0625 0.0625 1'; // 0x0F0FFF
67 case NUM_TEAM_3: return '1 1 0.0625'; // 0xFFFF0F
68 case NUM_TEAM_4: return '1 0.0625 1'; // 0xFF0FFF
74 string Team_ColorName(float teamid)
78 case NUM_TEAM_1: return NAME_TEAM_1;
79 case NUM_TEAM_2: return NAME_TEAM_2;
80 case NUM_TEAM_3: return NAME_TEAM_3;
81 case NUM_TEAM_4: return NAME_TEAM_4;
87 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
88 string Static_Team_ColorName(float teamid)
92 case NUM_TEAM_1: return STATIC_NAME_TEAM_1;
93 case NUM_TEAM_2: return STATIC_NAME_TEAM_2;
94 case NUM_TEAM_3: return STATIC_NAME_TEAM_3;
95 case NUM_TEAM_4: return STATIC_NAME_TEAM_4;
101 float Team_ColorToTeam(string team_color)
103 switch(strtolower(team_color))
105 case "red": return NUM_TEAM_1;
106 case "blue": return NUM_TEAM_2;
107 case "yellow": return NUM_TEAM_3;
108 case "pink": return NUM_TEAM_4;
109 case "auto": return 0;
115 float Team_NumberToTeam(float number)
119 case 1: return NUM_TEAM_1;
120 case 2: return NUM_TEAM_2;
121 case 3: return NUM_TEAM_3;
122 case 4: return NUM_TEAM_4;
128 float Team_TeamToNumber(float teamid)
132 case NUM_TEAM_1: return 1;
133 case NUM_TEAM_2: return 2;
134 case NUM_TEAM_3: return 3;
135 case NUM_TEAM_4: return 4;
142 // legacy aliases for shitty code
143 #define TeamByColor(teamid) (Team_TeamToNumber(teamid) - 1)
144 #define ColorByTeam(number) Team_NumberToTeam(number + 1)
147 #define Team_ColorName_Lower(teamid) strtolower(Team_ColorName(teamid))
148 #define Team_ColorName_Upper(teamid) strtoupper(Team_ColorName(teamid))
150 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
151 #define Static_Team_ColorName_Lower(teamid) strtolower(Static_Team_ColorName(teamid))
152 #define Static_Team_ColorName_Upper(teamid) strtoupper(Static_Team_ColorName(teamid))
154 #define Team_FullName(teamid) strcat(Team_ColorName(teamid), " ", NAME_TEAM, "^7")
155 #define Team_ColoredFullName(teamid) strcat(Team_ColorCode(teamid), Team_ColorName(teamid), " ", NAME_TEAM, "^7")
157 #define Team_NumberToFullName(number) Team_FullName(Team_NumberToTeam(number))
158 #define Team_NumberToColoredFullName(number) Team_ColoredFullName(Team_NumberToTeam(number))
160 // replace these flags in a string with the strings provided
161 #define TCR(input,teamcolor,teamtext) strreplace("^TC", teamcolor, strreplace("^TT", teamtext, input))
163 // safe team comparisons
164 #define SAME_TEAM(a,b) (teamplay ? (a.team == b.team) : (a == b))
165 #define DIFF_TEAM(a,b) (teamplay ? (a.team != b.team) : (a != b))