4 // COMMIT-TODO: Update if necessary before committing
5 // Revision 1: additional statistics sent (flag caps, returns, deaths)
6 // Revision 2: Mapvote preview pictures
7 // Revision 3: optimized map vote protocol
8 // Revision 4: CSQC config var system
9 // Revision 5: mapvote time fix
10 // Revision 6: more robust against packet loss/delays, also show not yet connected clients
11 // Revision 7: packet loss column
13 // Revision 9: race delta
14 // Revision 10: scoreboard force
15 // Revision 11: scoreboard unforce; spectator support beginning
16 // Revision 12: smaller scores updates (SERVER: requires new engine)
17 // Revision 13: pointparticles
20 // Revision 16: multi-weapons
21 // Revision 17: multi-weaponimpulses
22 // Revision 18: warmup
24 // Revision 20: naggers
25 // Revision 21: entcs for players optimized (position data down from 12 to 7 bytes); waypointsprites in csqc for team radar
26 // Revision 22: hook shot origin
27 #define CSQC_REVISION 22
29 REGISTER_NET_TEMP(TE_CSQC_PICTURE)
30 REGISTER_NET_TEMP(TE_CSQC_RACE)
31 REGISTER_NET_TEMP(TE_CSQC_TEAMNAGGER)
32 REGISTER_NET_TEMP(TE_CSQC_PINGPLREPORT)
33 REGISTER_NET_TEMP(TE_CSQC_WEAPONCOMPLAIN)
34 REGISTER_NET_TEMP(TE_CSQC_VEHICLESETUP)
36 const int RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
37 const int RACE_NET_CHECKPOINT_CLEAR = 1;
38 const int RACE_NET_CHECKPOINT_NEXT_QUALIFYING = 2; // byte nextcheckpoint, short recordtime, string recordholder
39 const int RACE_NET_CHECKPOINT_HIT_RACE = 3; // byte checkpoint, short delta, byte lapsdelta, string opponent
40 const int RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT = 4; // byte checkpoint, short delta, byte lapsdelta, string opponent
41 const int RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING = 5; // byte nextcheckpoint, float laptime, short recordtime, string recordholder
42 const int RACE_NET_PENALTY_RACE = 6; // byte penaltytime, string reason
43 const int RACE_NET_PENALTY_QUALIFYING = 7; // byte penaltytime, string reason
44 const int RACE_NET_SERVER_RECORD = 8; // server record, sent to client
45 const int RACE_NET_SPEED_AWARD = 9; // speed award, sent to client
46 const int RACE_NET_SPEED_AWARD_BEST = 10; // all time best speed award, sent to client
47 const int RACE_NET_SERVER_RANKINGS = 11;
48 const int RACE_NET_SERVER_STATUS = 12;
49 const int RANKINGS_CNT = 15;
51 REGISTER_NET_LINKED(_ENT_CLIENT_INIT)
53 NET_HANDLE(_ENT_CLIENT_INIT, bool isnew) { return true; }
55 /** Sent as a temp entity from a persistent linked entity */
56 REGISTER_NET_TEMP(ENT_CLIENT_INIT)
58 REGISTER_NET_LINKED(ENT_CLIENT_ENTCS)
59 REGISTER_NET_LINKED(ENT_CLIENT_SCORES_INFO)
60 REGISTER_NET_LINKED(ENT_CLIENT_SCORES)
61 REGISTER_NET_LINKED(ENT_CLIENT_TEAMSCORES)
62 REGISTER_NET_LINKED(ENT_CLIENT_NAGGER) // flags [votecalledvote]
63 REGISTER_NET_LINKED(ENT_CLIENT_RADARLINK) // flags [startorigin] [endorigin] [startcolor+16*endcolor]
64 REGISTER_NET_LINKED(ENT_CLIENT_PROJECTILE)
65 REGISTER_NET_LINKED(ENT_CLIENT_MAPVOTE)
66 REGISTER_NET_LINKED(ENT_CLIENT_CLIENTDATA)
67 REGISTER_NET_LINKED(ENT_CLIENT_RANDOMSEED)
68 REGISTER_NET_LINKED(ENT_CLIENT_ACCURACY)
69 REGISTER_NET_LINKED(ENT_CLIENT_ELIMINATEDPLAYERS)
71 REGISTER_NET_LINKED(ENT_CLIENT_MODEL)
73 REGISTER_NET_LINKED(ENT_CLIENT_WARPZONE)
74 REGISTER_NET_LINKED(ENT_CLIENT_WARPZONE_CAMERA)
75 REGISTER_NET_LINKED(ENT_CLIENT_WARPZONE_TELEPORTED)
77 REGISTER_NET_LINKED(ENT_CLIENT_ARC_BEAM)
78 REGISTER_NET_LINKED(ENT_CLIENT_HOOK)
79 REGISTER_NET_LINKED(ENT_CLIENT_TUBANOTE)
81 REGISTER_NET_LINKED(ENT_CLIENT_SPAWNPOINT)
82 REGISTER_NET_LINKED(ENT_CLIENT_SPAWNEVENT)
83 REGISTER_NET_LINKED(ENT_CLIENT_WALL)
85 const int SPRITERULE_DEFAULT = 0;
86 const int SPRITERULE_TEAMPLAY = 1;
87 const int SPRITERULE_SPECTATOR = 2;
89 ///////////////////////////
91 const int KEY_FORWARD = BIT(0);
92 const int KEY_BACKWARD = BIT(1);
93 const int KEY_LEFT = BIT(2);
94 const int KEY_RIGHT = BIT(3);
95 const int KEY_JUMP = BIT(4);
96 const int KEY_CROUCH = BIT(5);
97 const int KEY_ATCK = BIT(6);
98 const int KEY_ATCK2 = BIT(7);
100 ///////////////////////////
103 const int CVAR_SAVE = 1;
104 const int CVAR_NOTIFY = 2;
105 const int CVAR_READONLY = 4;
107 ///////////////////////////
108 // csqc communication stuff
110 const int HUD_NORMAL = 0;
111 const int HUD_BUMBLEBEE_GUN = 25;
113 // moved that here so the client knows the max.
114 // # of maps, I'll use arrays for them :P
115 const int MAPVOTE_COUNT = 30;
118 * Lower scores are better (e.g. suicides)
120 const int SFL_LOWER_IS_BETTER = BIT(0);
123 * Don't show zero values as scores
125 const int SFL_HIDE_ZERO = BIT(1);
128 * Allow a column to be hidden (do not automatically add it even if it is a sorting key)
130 const int SFL_ALLOW_HIDE = BIT(4);
133 * Display as a rank (with st, nd, rd, th suffix)
135 const int SFL_RANK = BIT(5);
138 * Display as mm:ss.s, value is stored as 10ths of a second (AND 0 is the worst possible value!)
140 const int SFL_TIME = BIT(6);
142 // not an extra constant yet
143 #define SFL_ZERO_IS_WORST SFL_TIME
146 * Scoring priority (NOTE: PRIMARY is used for fraglimit)
148 const int SFL_SORT_PRIO_SECONDARY = 4;
149 const int SFL_SORT_PRIO_PRIMARY = 8;
150 const int SFL_SORT_PRIO_MASK = 12;
156 #define MAX_TEAMSCORE 2
158 const int ST_SCORE = 0;
159 const int SP_KILLS = 0;
160 const int SP_DEATHS = 1;
161 const int SP_SUICIDES = 2;
162 const int SP_SCORE = 3;
163 const int SP_DMG = 10;
164 const int SP_DMGTAKEN = 11;
165 // game mode specific indices are not in common/, but in server/scores_rules.qc!
167 const int CH_INFO = 0;
168 const int CH_TRIGGER = -3;
169 const int CH_WEAPON_A = -1;
170 const int CH_WEAPON_SINGLE = 1;
171 const int CH_VOICE = -2;
172 const int CH_BGM_SINGLE = 8;
173 const int CH_AMBIENT = -9;
174 const int CH_TRIGGER_SINGLE = 3;
175 const int CH_SHOTS = -4;
176 const int CH_SHOTS_SINGLE = 4;
177 const int CH_WEAPON_B = -1;
178 const int CH_PAIN = -6;
179 const int CH_PAIN_SINGLE = 6;
180 const int CH_PLAYER = -7;
181 const int CH_PLAYER_SINGLE = 7;
182 const int CH_TUBA_SINGLE = 5;
184 const float ATTEN_NONE = 0;
185 const float ATTEN_MIN = 0.015625;
186 const float ATTEN_NORM = 0.5;
187 const float ATTEN_LARGE = 1;
188 const float ATTEN_IDLE = 2;
189 const float ATTEN_STATIC = 3;
190 const float ATTEN_MAX = 3.984375;
192 const float VOL_BASE = 0.7;
193 const float VOL_BASEVOICE = 1.0;
195 // WEAPONTODO: move this into separate/new projectile handling code // this sets sounds and other properties of the projectiles in csqc
196 const int PROJECTILE_ELECTRO = 1;
197 const int PROJECTILE_ROCKET = 2;
198 const int PROJECTILE_TAG = 3;
199 const int PROJECTILE_CRYLINK = 5;
200 const int PROJECTILE_ELECTRO_BEAM = 6;
201 const int PROJECTILE_GRENADE = 7;
202 const int PROJECTILE_GRENADE_BOUNCING = 8;
203 const int PROJECTILE_MINE = 9;
204 const int PROJECTILE_BLASTER = 10;
205 const int PROJECTILE_HLAC = 11;
206 const int PROJECTILE_SEEKER = 12;
207 const int PROJECTILE_FLAC = 13;
208 const int PROJECTILE_PORTO_RED = 14;
209 const int PROJECTILE_PORTO_BLUE = 15;
210 const int PROJECTILE_HOOKBOMB = 16;
211 const int PROJECTILE_HAGAR = 17;
212 const int PROJECTILE_HAGAR_BOUNCING = 18;
213 const int PROJECTILE_CRYLINK_BOUNCING = 20;
214 const int PROJECTILE_FIREBALL = 21;
215 const int PROJECTILE_FIREMINE = 22;
217 const int PROJECTILE_RAPTORCANNON = 24;
218 const int PROJECTILE_RAPTORBOMB = 25;
219 const int PROJECTILE_RAPTORBOMBLET = 26;
220 const int PROJECTILE_SPIDERROCKET = 27;
221 const int PROJECTILE_WAKIROCKET = 28;
222 const int PROJECTILE_WAKICANNON = 29;
224 const int PROJECTILE_BUMBLE_GUN = 30;
225 const int PROJECTILE_BUMBLE_BEAM = 31;
227 const int PROJECTILE_MAGE_SPIKE = 32;
228 const int PROJECTILE_SHAMBLER_LIGHTNING = 33;
230 const int PROJECTILE_ROCKETMINSTA_LASER = 34;
232 // projectile IDs 40-50 reserved
234 const int PROJECTILE_RPC = 60;
236 const int SPECIES_HUMAN = 0;
237 const int SPECIES_ROBOT_SOLID = 1;
238 const int SPECIES_ALIEN = 2;
239 const int SPECIES_ANIMAL = 3;
240 const int SPECIES_ROBOT_RUSTY = 4;
241 const int SPECIES_ROBOT_SHINY = 5;
242 const int SPECIES_RESERVED = 15;
244 const int FRAGS_PLAYER = 0;
245 const int FRAGS_SPECTATOR = -666;
246 const int FRAGS_LMS_LOSER = -616;
247 const int FRAGS_PLAYER_NONSOLID = -616;
248 // we can use this frags value for both
251 const int WATERLEVEL_NONE = 0;
252 const int WATERLEVEL_WETFEET = 1;
253 const int WATERLEVEL_SWIMMING = 2;
254 const int WATERLEVEL_SUBMERGED = 3;
255 const int SERVERFLAG_ALLOW_FULLBRIGHT = 1;
256 const int SERVERFLAG_TEAMPLAY = 2;
257 const int SERVERFLAG_PLAYERSTATS = 4;
259 // FIXME/EXPLAINME: why? Mario: because
260 vector autocvar_sv_player_maxs = '16 16 45';
261 vector autocvar_sv_player_mins = '-16 -16 -24';
262 vector autocvar_sv_player_viewoffset = '0 0 20';
263 vector autocvar_sv_player_crouch_maxs = '16 16 25';
264 vector autocvar_sv_player_crouch_mins = '-16 -16 -24';
265 vector autocvar_sv_player_crouch_viewoffset = '0 0 20';
266 vector autocvar_sv_player_headsize = '24 24 12';
271 #define PL_VIEW_OFS autocvar_sv_player_viewoffset
272 #define PL_MIN autocvar_sv_player_mins
273 #define PL_MAX autocvar_sv_player_maxs
274 #define PL_CROUCH_VIEW_OFS autocvar_sv_player_crouch_viewoffset
275 #define PL_CROUCH_MIN autocvar_sv_player_crouch_mins
276 #define PL_CROUCH_MAX autocvar_sv_player_crouch_maxs
277 #define PL_HEAD autocvar_sv_player_headsize
279 #define PL_VIEW_OFS vec3(getstatf(STAT_PL_VIEW_OFS1), getstatf(STAT_PL_VIEW_OFS2), getstatf(STAT_PL_VIEW_OFS3))
280 #define PL_MIN vec3(getstatf(STAT_PL_MIN1), getstatf(STAT_PL_MIN2), getstatf(STAT_PL_MIN3))
281 #define PL_MAX vec3(getstatf(STAT_PL_MAX1), getstatf(STAT_PL_MAX2), getstatf(STAT_PL_MAX3))
282 #define PL_CROUCH_VIEW_OFS vec3(getstatf(STAT_PL_CROUCH_VIEW_OFS1), getstatf(STAT_PL_CROUCH_VIEW_OFS2), getstatf(STAT_PL_CROUCH_VIEW_OFS3))
283 #define PL_CROUCH_MIN vec3(getstatf(STAT_PL_CROUCH_MIN1), getstatf(STAT_PL_CROUCH_MIN2), getstatf(STAT_PL_CROUCH_MIN3))
284 #define PL_CROUCH_MAX vec3(getstatf(STAT_PL_CROUCH_MAX1), getstatf(STAT_PL_CROUCH_MAX2), getstatf(STAT_PL_CROUCH_MAX3))
287 // a bit more constant
288 const vector PL_MAX_CONST = '16 16 45';
289 const vector PL_MIN_CONST = '-16 -16 -24';
292 const int SPAWN_PRIO_NEAR_TEAMMATE_FOUND = 200;
293 const int SPAWN_PRIO_NEAR_TEAMMATE_SAMETEAM = 100;
294 const int SPAWN_PRIO_RACE_PREVIOUS_SPAWN = 50;
295 const int SPAWN_PRIO_GOOD_DISTANCE = 10;
297 // gametype vote flags
298 const int GTV_FORBIDDEN = 0; // Cannot be voted
299 const int GTV_AVAILABLE = 1; // Can be voted
300 const int GTV_CUSTOM = 2; // Custom entry