6 #include "../client/sys-pre.qh"
7 #include "../dpdefs/csprogsdefs.qc"
8 #include "../client/sys-post.qh"
9 #include "../client/Defs.qc"
10 #include "../dpdefs/keycodes.qc"
11 #include "constants.qh"
13 #include "../warpzonelib/anglestransform.qh"
14 #include "../warpzonelib/mathlib.qh"
15 #include "../warpzonelib/common.qh"
16 #include "../warpzonelib/client.qh"
17 #include "playerstats.qh"
19 #include "util-pre.qh"
20 #include "../menu/sys-pre.qh"
21 #include "../dpdefs/menudefs.qc"
22 #include "../dpdefs/keycodes.qc"
23 #include "../menu/sys-post.qh"
24 #include "../menu/config.qh"
25 #include "../warpzonelib/mathlib.qh"
28 #include "../menu/oo/base.qh"
29 #include "playerstats.qh"
31 #include "util-pre.qh"
32 #include "../server/sys-pre.qh"
33 #include "../dpdefs/progsdefs.qc"
34 #include "../dpdefs/dpextensions.qc"
35 #include "../server/sys-post.qh"
36 #include "../warpzonelib/anglestransform.qh"
37 #include "../warpzonelib/mathlib.qh"
38 #include "../warpzonelib/common.qh"
39 #include "../warpzonelib/util_server.qh"
40 #include "../warpzonelib/server.qh"
41 #include "constants.qh"
45 #ifdef TEAMNUMBERS_THAT_ARENT_STUPID
46 const int NUM_TEAM_1 = 1; // red
47 const int NUM_TEAM_2 = 2; // blue
48 const int NUM_TEAM_3 = 3; // yellow
49 const int NUM_TEAM_4 = 4; // pink
50 const int NUM_SPECTATOR = 5;
53 const int NUM_TEAM_1 = 4; // red
54 const int NUM_TEAM_2 = 13; // blue
55 const int NUM_TEAM_3 = 12; // yellow
56 const int NUM_TEAM_4 = 9; // pink
58 const int NUM_TEAM_1 = 5; // red
59 const int NUM_TEAM_2 = 14; // blue
60 const int NUM_TEAM_3 = 13; // yellow
61 const int NUM_TEAM_4 = 10; // pink
63 const int NUM_SPECTATOR = 1337;
66 const string COL_TEAM_1 = "^1";
67 const string COL_TEAM_2 = "^4";
68 const string COL_TEAM_3 = "^3";
69 const string COL_TEAM_4 = "^6";
70 const string NAME_TEAM_1 = _("Red");
71 const string NAME_TEAM_2 = _("Blue");
72 const string NAME_TEAM_3 = _("Yellow");
73 const string NAME_TEAM_4 = _("Pink");
74 const string NAME_TEAM = _("Team");
75 const string NAME_NEUTRAL = _("Neutral");
77 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
78 const string STATIC_NAME_TEAM_1 = "Red";
79 const string STATIC_NAME_TEAM_2 = "Blue";
80 const string STATIC_NAME_TEAM_3 = "Yellow";
81 const string STATIC_NAME_TEAM_4 = "Pink";
88 string Team_ColorCode(float teamid)
92 case NUM_TEAM_1: return COL_TEAM_1;
93 case NUM_TEAM_2: return COL_TEAM_2;
94 case NUM_TEAM_3: return COL_TEAM_3;
95 case NUM_TEAM_4: return COL_TEAM_4;
101 vector Team_ColorRGB(float teamid)
105 case NUM_TEAM_1: return '1 0.0625 0.0625'; // 0xFF0F0F
106 case NUM_TEAM_2: return '0.0625 0.0625 1'; // 0x0F0FFF
107 case NUM_TEAM_3: return '1 1 0.0625'; // 0xFFFF0F
108 case NUM_TEAM_4: return '1 0.0625 1'; // 0xFF0FFF
114 string Team_ColorName(float teamid)
118 case NUM_TEAM_1: return NAME_TEAM_1;
119 case NUM_TEAM_2: return NAME_TEAM_2;
120 case NUM_TEAM_3: return NAME_TEAM_3;
121 case NUM_TEAM_4: return NAME_TEAM_4;
127 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
128 string Static_Team_ColorName(float teamid)
132 case NUM_TEAM_1: return STATIC_NAME_TEAM_1;
133 case NUM_TEAM_2: return STATIC_NAME_TEAM_2;
134 case NUM_TEAM_3: return STATIC_NAME_TEAM_3;
135 case NUM_TEAM_4: return STATIC_NAME_TEAM_4;
141 float Team_ColorToTeam(string team_color)
143 switch(strtolower(team_color))
145 case "red": return NUM_TEAM_1;
146 case "blue": return NUM_TEAM_2;
147 case "yellow": return NUM_TEAM_3;
148 case "pink": return NUM_TEAM_4;
149 case "auto": return 0;
155 float Team_NumberToTeam(float number)
159 case 1: return NUM_TEAM_1;
160 case 2: return NUM_TEAM_2;
161 case 3: return NUM_TEAM_3;
162 case 4: return NUM_TEAM_4;
168 float Team_TeamToNumber(float teamid)
172 case NUM_TEAM_1: return 1;
173 case NUM_TEAM_2: return 2;
174 case NUM_TEAM_3: return 3;
175 case NUM_TEAM_4: return 4;
182 // legacy aliases for shitty code
183 #define TeamByColor(teamid) (Team_TeamToNumber(teamid) - 1)
184 #define ColorByTeam(number) Team_NumberToTeam(number + 1)
187 #define Team_ColorName_Lower(teamid) strtolower(Team_ColorName(teamid))
188 #define Team_ColorName_Upper(teamid) strtoupper(Team_ColorName(teamid))
190 // used for replacement in filenames or such where the name CANNOT be allowed to be translated
191 #define Static_Team_ColorName_Lower(teamid) strtolower(Static_Team_ColorName(teamid))
192 #define Static_Team_ColorName_Upper(teamid) strtoupper(Static_Team_ColorName(teamid))
194 #define Team_FullName(teamid) strcat(Team_ColorName(teamid), " ", NAME_TEAM, "^7")
195 #define Team_ColoredFullName(teamid) strcat(Team_ColorCode(teamid), Team_ColorName(teamid), " ", NAME_TEAM, "^7")
197 #define Team_NumberToFullName(number) Team_FullName(Team_NumberToTeam(number))
198 #define Team_NumberToColoredFullName(number) Team_ColoredFullName(Team_NumberToTeam(number))
200 // replace these flags in a string with the strings provided
201 #define TCR(input,teamcolor,teamtext) strreplace("^TC", teamcolor, strreplace("^TT", teamtext, input))
203 // safe team comparisons
204 #define SAME_TEAM(a,b) (teamplay ? ((a.team == b.team) ? 1 : 0) : ((a == b) ? 1 : 0))
205 #define DIFF_TEAM(a,b) (teamplay ? ((a.team != b.team) ? 1 : 0) : ((a != b) ? 1 : 0))
207 // used for notification system multi-team identifiers
208 #define APP_TEAM_NUM_2(num,prefix) ((num == NUM_TEAM_1) ? prefix##RED : prefix##BLUE)
209 #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)))
210 #define APP_TEAM_ENT_2(ent,prefix) ((ent.team == NUM_TEAM_1) ? prefix##RED : prefix##BLUE)
211 #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)))