]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/defs.qh
Viewmodels: CSQC rendering
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / defs.qh
1 #ifndef SERVER_DEFS_H
2 #define SERVER_DEFS_H
3
4 #include "../common/weapons/all.qh"
5
6 #define INDEPENDENT_ATTACK_FINISHED 1
7
8 #define BUTTON_ATCK       button0
9 #define BUTTON_JUMP       button2
10 #define BUTTON_ATCK2      button3
11 #define BUTTON_ZOOM       button4
12 #define BUTTON_CROUCH     button5
13 #define BUTTON_HOOK       button6
14 #define BUTTON_INFO       button7
15 #define BUTTON_CHAT       buttonchat
16 #define BUTTON_USE        buttonuse
17 #define BUTTON_DRAG       button8
18 #define BUTTON_ZOOMSCRIPT button9
19 #define BUTTON_JETPACK    button10
20
21 // Globals
22
23 float g_cloaked, g_footsteps, g_grappling_hook, g_instagib;
24 float g_warmup_limit;
25 float g_warmup_allguns;
26 float g_warmup_allow_timeout;
27 float warmup_stage;
28 PROPERTY(float, g_pickup_respawntime_weapon)
29 PROPERTY(float, g_pickup_respawntime_superweapon)
30 PROPERTY(float, g_pickup_respawntime_ammo)
31 PROPERTY(float, g_pickup_respawntime_short)
32 PROPERTY(float, g_pickup_respawntime_medium)
33 PROPERTY(float, g_pickup_respawntime_long)
34 PROPERTY(float, g_pickup_respawntime_powerup)
35 PROPERTY(float, g_pickup_respawntimejitter_weapon)
36 PROPERTY(float, g_pickup_respawntimejitter_superweapon)
37 PROPERTY(float, g_pickup_respawntimejitter_ammo)
38 PROPERTY(float, g_pickup_respawntimejitter_short)
39 PROPERTY(float, g_pickup_respawntimejitter_medium)
40 PROPERTY(float, g_pickup_respawntimejitter_long)
41 PROPERTY(float, g_pickup_respawntimejitter_powerup)
42 float g_jetpack;
43
44 float sv_clones;
45 float sv_foginterval;
46
47 float player_count;
48 float currentbots;
49 float bots_would_leave;
50
51 void UpdateFrags(entity player, float f);
52 .float totalfrags;
53
54 float team1_score, team2_score, team3_score, team4_score;
55
56 float maxclients;
57
58 // flag set on worldspawn so that the code knows if it is dedicated or not
59 float server_is_dedicated;
60
61 // Fields
62
63 .void(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage;
64
65 //.string       wad;
66 //.string       map;
67
68 //.float        worldtype;
69 // Needed for dynamic clientwalls
70 .float inactive; // Clientwall disappears when inactive
71 .float alpha_max, alpha_min;
72 .float fade_start, fade_end, fade_vertical_offset;
73 .float default_solid; // Variable to store default self.solid for clientwalls
74
75 .float  pain_finished;                  //Added by Supajoe
76 .float  pain_frame;                     //"
77 .float  crouch; // Crouching or not?
78
79 .float  strength_finished;
80 .float  invincible_finished;
81 .float  superweapons_finished;
82
83 .float cnt; // used in too many places
84 .float count;
85 //.float cnt2;
86
87 .float play_time;
88 .int respawn_flags;
89 .float respawn_time;
90 .float respawn_time_max;
91 .float death_time;
92 .float fade_time;
93 .float fade_rate;
94
95 void() player_setupanimsformodel;
96 void setanim(entity e, vector anim, float looping, float override, float restart);
97
98 .string mdl;
99
100 .string playermodel;
101 .string playerskin;
102
103 .float species;
104
105 .float  scheduledrespawntime;
106 .float  respawntime;
107 .float  respawntimejitter;
108 //.float        chasecam;
109
110 .float  damageforcescale;
111 const float MIN_DAMAGEEXTRARADIUS = 2;
112 const float MAX_DAMAGEEXTRARADIUS = 16;
113 .float damageextraradius;
114
115 //.float          gravity;
116
117 .float          dmg;
118
119 // for railgun damage (hitting multiple enemies)
120 .float railgunhit;
121 .float railgunhitsolidbackup;
122 .vector railgunhitloc;
123
124 .float          air_finished;
125 .float          dmgtime;
126
127 .float          killcount;
128 .float damage_dealt, typehitsound;
129
130 .float watersound_finished;
131 .float iscreature;
132 .float damagedbycontents;
133 .float damagedbytriggers;
134 .float pushable;
135 .float teleportable;
136 .vector oldvelocity;
137
138 .float pauseregen_finished;
139 .float pauserothealth_finished;
140 .float pauserotarmor_finished;
141 .float pauserotfuel_finished;
142 // string overrides entity
143 .string item_pickupsound;
144 .entity item_pickupsound_ent;
145 .entity item_model_ent;
146
147 // WEAPONTODO
148 .float autoswitch;
149 float client_hasweapon(entity cl, float wpn, float andammo, float complain);
150 void w_clear(Weapon thiswep, entity actor, int slot, int fire);
151 void w_ready(Weapon thiswep, entity actor, int slot, int fire);
152 // VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies)
153 .float weapon_nextthink;
154 .void(Weapon thiswep, entity actor, int slot, int fire) weapon_think;
155
156
157 // weapon states (self.weaponentity.state)
158 const int WS_CLEAR                      = 0; // no weapon selected
159 const int WS_RAISE                      = 1; // raise frame
160 const int WS_DROP                               = 2; // deselecting frame
161 const int WS_INUSE                      = 3; // fire state
162 const int WS_READY                      = 4; // idle frame
163
164 // there is 2 weapon tics that can run in one server frame
165 const int W_TICSPERFRAME = 2;
166
167 void weapon_defaultspawnfunc(entity this, Weapon e);
168
169 float gameover;
170 float intermission_running;
171 float intermission_exittime;
172 float alreadychangedlevel;
173
174 .float version;
175
176 // footstep interval
177 .float nextstep;
178
179 float blockSpectators; //if set, new or existing spectators or observers will be removed unless they become a player within g_maxplayers_spectator_blocktime seconds
180 .float spectatortime; //point in time since the client is spectating or observing
181 void checkSpectatorBlock();
182
183 float game_completion_ratio; // 0 at start, 1 near end
184 .float winning;
185 .float jointime; // time of joining
186 .float alivetime; // time of being alive
187 .float motd_actived_time; // used for both motd and campaign_message
188
189 float nJoinAllowed(entity ignore);
190
191 .float spawnshieldtime;
192 .float item_spawnshieldtime;
193
194 .entity flagcarried;
195
196 .int playerid;
197 float playerid_last;
198 .float noalign;         // if set to 1, the item or spawnpoint won't be dropped to the floor
199
200 .vector death_origin;
201 .vector killer_origin;
202
203 float default_player_alpha;
204 float default_weapon_alpha;
205
206 .float() customizeentityforclient;
207 .float cvar_cl_handicap;
208 .float cvar_cl_clippedspectating;
209 .float cvar_cl_autoscreenshot;
210 .float cvar_cl_jetpack_jump;
211 .float cvar_cl_movement_track_canjump;
212 .float cvar_cl_newusekeysupported;
213
214 .string cvar_g_xonoticversion;
215 .string cvar_cl_weaponpriority;
216 .string cvar_cl_weaponpriorities[10];
217 .float cvar_cl_gunalign;
218 .float cvar_cl_noantilag;
219
220 .string weaponorder_byimpulse;
221
222 .float cvar_cl_allow_uid2name;
223 .float cvar_cl_allow_uidtracking;
224 .string stored_netname;
225
226 .float version_nagtime;
227
228 string gamemode_name;
229
230 float startitem_failed;
231
232 string W_Apply_Weaponreplace(string in);
233
234 void FixIntermissionClient(entity e);
235 void FixClientCvars(entity e);
236
237 // WEAPONTODO: remove this
238 WepSet weaponsInMap;
239
240 .WepSet weaponsinmap;
241
242 .float respawn_countdown; // next number to count
243
244 float bot_waypoints_for_items;
245
246 .float attack_finished_for[Weapons_MAX * MAX_WEAPONSLOTS];
247 .float attack_finished_single[MAX_WEAPONSLOTS];
248 #if INDEPENDENT_ATTACK_FINISHED
249 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).(attack_finished_for[((w) - WEP_FIRST) * MAX_WEAPONSLOTS + (slot)]))
250 #else
251 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
252 #endif
253 #define ATTACK_FINISHED(ent, slot) ATTACK_FINISHED_FOR(ent, (ent).weapon, slot)
254
255 // assault game mode: Which team is attacking in this round?
256 float assault_attacker_team;
257
258 // speedrun: when 1, player auto teleports back when capture timeout happens
259 .float speedrunning;
260
261 // database
262 float ServerProgsDB;
263 float TemporaryDB;
264
265 .float team_saved;
266
267 float some_spawn_has_been_used;
268 float have_team_spawns; // 0 = no team spawns requested, -1 = team spawns requested but none found, 1 = team spawns requested and found
269 float have_team_spawns_forteam[17]; // 0 = this team has no spawns, 1 = this team has spawns; team 0 is the "no-team"
270
271 // set when showing a kill countdown
272 .entity killindicator;
273 .float killindicator_teamchange;
274
275 void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
276
277 float lockteams;
278
279 .float parm_idlesince;
280 float sv_maxidle;
281 float sv_maxidle_spectatorsareidle;
282
283 float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end);
284
285 float next_pingtime;
286
287 // player sounds, voice messages
288 // TODO implemented fall and falling
289 #define ALLPLAYERSOUNDS \
290                 _VOICEMSG(death) \
291                 _VOICEMSG(drown) \
292                 _VOICEMSG(fall) \
293                 _VOICEMSG(falling) \
294                 _VOICEMSG(gasp) \
295                 _VOICEMSG(jump) \
296                 _VOICEMSG(pain100) \
297                 _VOICEMSG(pain25) \
298                 _VOICEMSG(pain50) \
299                 _VOICEMSG(pain75)
300
301 #define ALLVOICEMSGS \
302                 _VOICEMSG(attack) \
303                 _VOICEMSG(attackinfive) \
304                 _VOICEMSG(coverme) \
305                 _VOICEMSG(defend) \
306                 _VOICEMSG(freelance) \
307                 _VOICEMSG(incoming) \
308                 _VOICEMSG(meet) \
309                 _VOICEMSG(needhelp) \
310                 _VOICEMSG(seenflag) \
311                 _VOICEMSG(taunt) \
312                 _VOICEMSG(teamshoot)
313
314 #define _VOICEMSG(m) .string playersound_##m;
315 ALLPLAYERSOUNDS
316 ALLVOICEMSGS
317 #undef _VOICEMSG
318
319 // reserved sound names for the future (some models lack sounds for them):
320 //              _VOICEMSG(flagcarriertakingdamage) \
321 //              _VOICEMSG(getflag) \
322 // reserved sound names for the future (ALL models lack sounds for them):
323 //              _VOICEMSG(affirmative) \
324 //              _VOICEMSG(attacking) \
325 //              _VOICEMSG(defending) \
326 //              _VOICEMSG(roaming) \
327 //              _VOICEMSG(onmyway) \
328 //              _VOICEMSG(droppedflag) \
329 //              _VOICEMSG(negative) \
330 //              _VOICEMSG(seenenemy) \
331 //      /**/
332
333 string globalsound_fall;
334 string globalsound_metalfall;
335 string globalsound_step;
336 string globalsound_metalstep;
337
338 const float VOICETYPE_PLAYERSOUND = 10;
339 const float VOICETYPE_TEAMRADIO = 11;
340 const float VOICETYPE_LASTATTACKER = 12;
341 const float VOICETYPE_LASTATTACKER_ONLY = 13;
342 const float VOICETYPE_AUTOTAUNT = 14;
343 const float VOICETYPE_TAUNT = 15;
344
345 void PrecachePlayerSounds(string f);
346 void PrecacheGlobalSound(string samplestring);
347 void UpdatePlayerSounds();
348 void ClearPlayerSounds();
349 void PlayerSound(.string samplefield, float channel, float voicetype);
350 void GlobalSound(string samplestring, float channel, float voicetype);
351 void FakeGlobalSound(string samplestring, float channel, float voicetype);
352 void VoiceMessage(string type, string message);
353 float GetPlayerSoundSampleField_notFound;
354 .string GetVoiceMessageSampleField(string type);
355
356 // autotaunt system
357 .float cvar_cl_autotaunt;
358 .float cvar_cl_voice_directional;
359 .float cvar_cl_voice_directional_taunt_attenuation;
360
361 .float version_mismatch;
362
363 int autocvar__independent_players;
364 bool independent_players;
365 #define INDEPENDENT_PLAYERS (autocvar__independent_players ? (autocvar__independent_players > 0) : independent_players)
366 #define IS_INDEPENDENT_PLAYER(e) ((e).solid == SOLID_TRIGGER)
367 #define MAKE_INDEPENDENT_PLAYER(e) (((e).solid = SOLID_TRIGGER), ((e).frags = FRAGS_PLAYER_NONSOLID))
368
369 string clientstuff;
370 .float phase;
371 .int pressedkeys;
372
373 .string fog;
374
375 string cvar_changes;
376 string cvar_purechanges;
377 float cvar_purechanges_count;
378
379 float game_starttime; //point in time when the countdown to game start is over
380 float round_starttime; //point in time when the countdown to round start is over
381 .float stat_game_starttime;
382 .float stat_round_starttime;
383
384 void W_Porto_Remove (entity p);
385
386 .int projectiledeathtype;
387
388 .string message2;
389
390 .float stat_allow_oldvortexbeam;
391
392 // reset to 0 on weapon switch
393 // may be useful to all weapons
394 .float bulletcounter;
395
396 // Nexball
397 .entity ballcarried; // Also used for keepaway
398 float g_nexball_meter_period;
399
400 void SUB_DontUseTargets();
401 void SUB_UseTargets();
402
403 .void() reset; // if set, an entity is reset using this
404 .void() reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
405
406 void ClientData_Touch(entity e);
407
408 //vector debug_shotorg; // if non-zero, overrides the shot origin of all weapons
409
410 .float wasplayer;
411
412 float servertime, serverprevtime, serverframetime;
413
414 .float ammo_fuel;
415
416 .vector prevorigin;
417
418 //flood fields
419 .float nickspamtime; // time of last nick change
420 .float nickspamcount;
421 .float floodcontrol_chat;
422 .float floodcontrol_chatteam;
423 .float floodcontrol_chattell;
424 .float floodcontrol_voice;
425 .float floodcontrol_voiceteam;
426
427 .float stat_shotorg; // networked stat for trueaim HUD
428
429 string matchid;
430
431 .float last_pickup;
432
433 .float hit_time;
434 .float typehit_time;
435
436 .float damage_dealt_total;
437
438 .float stat_leadlimit;
439
440 bool radar_showennemies;
441
442 #ifdef PROFILING
443 float client_cefc_accumulator;
444 float client_cefc_accumulatortime;
445 #endif
446
447 .float weapon_load[Weapons_MAX];
448 .int ammo_none; // used by the reloading system, must always be 0
449 .float clip_load;
450 .float old_clip_load;
451 .float clip_size;
452
453 .float minelayer_mines;
454 .float vortex_charge;
455 .float vortex_charge_rottime;
456 .float vortex_chargepool_ammo;
457 .float hagar_load;
458
459 .int grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab
460
461 #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE
462 // when doing this, hagar can go through clones
463 // #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_BBOX
464
465 .float spectatee_status;
466 .float zoomstate;
467 .float restriction;
468
469 .entity clientdata;
470 .entity personal;
471
472 string deathmessage;
473
474 .float just_joined;
475
476 .float cvar_cl_weaponimpulsemode;
477 .float selectweapon; // last selected weapon of the player
478
479 .float ballistics_density; // wall piercing factor, larger = bullet can pass through more
480
481 const float ACTIVE_NOT          = 0;
482 const float ACTIVE_ACTIVE       = 1;
483 const float ACTIVE_IDLE         = 2;
484 const float ACTIVE_BUSY         = 2;
485 const float ACTIVE_TOGGLE       = 3;
486 .float active;
487 .void (float act_state) setactive;
488 .entity realowner;
489
490 //float serverflags;
491
492 .float team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
493
494 .float player_blocked;
495 .float weapon_blocked; // weapon use disabled
496
497 .float frozen; // for freeze attacks
498 .float revive_progress;
499 .float revival_time; // time at which player was last revived
500 .float revive_speed; // NOTE: multiplier (anything above 1 is instaheal)
501 .entity iceblock;
502 .entity frozen_by; // for ice fields
503
504 .entity muzzle_flash;
505 .float misc_bulletcounter;      // replaces uzi & hlac bullet counter.
506
507 .float stat_respawn_time; // shows respawn time, and is negative when awaiting respawn
508
509 void PlayerUseKey();
510
511 typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t;
512 .spawn_evalfunc_t spawn_evalfunc;
513
514 string modname;
515
516 .float missile_flags;
517 const int MIF_SPLASH = BIT(1);
518 const int MIF_ARC = BIT(2);
519 const int MIF_PROXY = BIT(3);
520 const int MIF_GUIDED_MANUAL = BIT(4);
521 const int MIF_GUIDED_HEAT = BIT(5);
522 const int MIF_GUIDED_LASER = BIT(6);
523 const int MIF_GUIDED_AI = BIT(7);
524 const int MIF_GUIDED_TAG = BIT(7);
525 const int MIF_GUIDED_ALL = MIF_GUIDED_MANUAL | MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG;
526 const int MIF_GUIDED_TRACKING = MIF_GUIDED_HEAT | MIF_GUIDED_LASER | MIF_GUIDED_AI | MIF_GUIDED_TAG;
527 const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI;
528
529 #define MISSILE_IS_CONFUSABLE(m) ((m.missile_flags & MIF_GUIDED_CONFUSABLE) ? true : false)
530 #define MISSILE_IS_GUIDED(m) ((m.missile_flags & MIF_GUIDED_ALL) ? true : false)
531 #define MISSILE_IS_TRACKING(m) ((m.missile_flags & MIF_GUIDED_TRACKING) ? true : false)
532
533
534 ////
535
536 .entity player_stats;
537 //.float playerid;
538 .string playernick;
539 .float elos;
540 .float ranks;
541
542 .string cvar_cl_physics;
543
544 .float init_for_player_needed;
545 .void(entity) init_for_player;
546
547 #endif