]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/dpdefs/progsdefs.qc
Hide preconnect hook behind an #ifdef
[xonotic/xonotic-data.pk3dir.git] / qcsrc / dpdefs / progsdefs.qc
1 /*
2 ==============================================================================
3
4                         SOURCE FOR GLOBALVARS_T C STRUCTURE
5                         MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
6
7 ==============================================================================
8 */
9
10 //
11 // system globals
12 //
13 entity          self;
14 entity          other;
15 entity          world;
16 float           time;
17 float           frametime;
18
19 float           force_retouch;          // force all entities to touch triggers
20                                                                 // next frame.  this is needed because
21                                                                 // non-moving things don't normally scan
22                                                                 // for triggers, and when a trigger is
23                                                                 // created (like a teleport trigger), it
24                                                                 // needs to catch everything.
25                                                                 // decremented each frame, so set to 2
26                                                                 // to guarantee everything is touched
27 string          mapname;
28
29 float           deathmatch;
30 float           coop;
31 float           teamplay;
32
33 float           serverflags;            // propagated from level to level, used to
34                                                                 // keep track of completed episodes
35
36 float           total_secrets;
37 float           total_monsters;
38
39 float           found_secrets;          // number of secrets found
40 float           killed_monsters;        // number of monsters killed
41
42
43 // spawnparms are used to encode information about clients across server
44 // level changes
45 float           parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
46
47 //
48 // global variables set by built in functions
49 //
50 vector          v_forward, v_up, v_right;       // set by makevectors()
51
52 // set by traceline / tracebox
53 float           trace_allsolid;
54 float           trace_startsolid;
55 float           trace_fraction;
56 vector          trace_endpos;
57 vector          trace_plane_normal;
58 float           trace_plane_dist;
59 entity          trace_ent;
60 float           trace_inopen;
61 float           trace_inwater;
62
63 entity          msg_entity;                             // destination of single entity writes
64
65 //
66 // required prog functions
67 //
68 void()          main;                                           // only for testing
69
70 void()          StartFrame;
71
72 void()          PlayerPreThink;
73 void()          PlayerPostThink;
74
75 void()          ClientKill;
76 #ifdef DP_EXT_PRECONNECT
77 void()          ClientPreConnect;
78 #endif
79 void()          ClientConnect;
80 void()          PutClientInServer;              // call after setting the parm1... parms
81 void()          ClientDisconnect;
82
83 void()          SetNewParms;                    // called when a client first connects to
84                                                                         // a server. sets parms so they can be
85                                                                         // saved off for restarts
86
87 void()          SetChangeParms;                 // call to set parms for self so they can
88                                                                         // be saved for a level transition
89
90
91 //================================================
92 void            end_sys_globals;                // flag for structure dumping
93 //================================================
94
95 /*
96 ==============================================================================
97
98                         SOURCE FOR ENTVARS_T C STRUCTURE
99                         MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
100
101 ==============================================================================
102 */
103
104 //
105 // system fields (*** = do not set in prog code, maintained by C code)
106 //
107 .float          modelindex;             // *** model index in the precached list
108 .vector         absmin, absmax; // *** origin + mins / maxs
109
110 .float          ltime;                  // local time for entity
111 .float          movetype;
112 .float          solid;
113
114 .vector         origin;                 // ***
115 .vector         oldorigin;              // ***
116 .vector         velocity;
117 .vector         angles;
118 .vector         avelocity;
119
120 .vector         punchangle;             // temp angle adjust from damage or recoil
121
122 .string         classname;              // spawn function
123 .string         model;
124 .float          frame;
125 .float          skin;
126 .float          effects;
127
128 .vector         mins, maxs;             // bounding box extents reletive to origin
129 .vector         size;                   // maxs - mins
130
131 .void()         touch;
132 .void()         use;
133 .void()         think;
134 .void()         blocked;                // for doors or plats, called when can't push other
135
136 .float          nextthink;
137 .entity         groundentity;
138
139 // stats
140 .float          health;
141 .float          frags;
142 .float          weapon;                 // one of the IT_SHOTGUN, etc flags
143 .string         weaponmodel;
144 .float          weaponframe;
145 .float          currentammo;
146 .float          ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
147
148 .float          items;                  // bit flags
149
150 .float          takedamage;
151 .entity         chain;
152 .float          deadflag;
153
154 .vector         view_ofs;                       // add to origin to get eye point
155
156
157 .float          button0;                // fire
158 .float          button1;                // use
159 .float          button2;                // jump
160
161 .float          impulse;                // weapon changes
162
163 .float          fixangle;
164 .vector         v_angle;                // view / targeting angle for players
165 .float          idealpitch;             // calculated pitch angle for lookup up slopes
166
167
168 .string         netname;
169
170 .entity         enemy;
171
172 .float          flags;
173
174 .float          colormap;
175 .float          team;
176
177 .float          max_health;             // players maximum health is stored here
178
179 .float          teleport_time;  // don't back up
180
181 .float          armortype;              // save this fraction of incoming damage
182 .float          armorvalue;
183
184 .float          waterlevel;             // 0 = not in, 1 = feet, 2 = wast, 3 = eyes
185 .float          watertype;              // a contents value
186
187 .float          ideal_yaw;
188 .float          yaw_speed;
189
190 .entity         aiment;
191
192 .entity         goalentity;             // a movetarget or an enemy
193
194 .float          spawnflags;
195
196 .string         target;
197 .string         targetname;
198
199 // damage is accumulated through a frame. and sent as one single
200 // message, so the super shotgun doesn't generate huge messages
201 .float          dmg_take;
202 .float          dmg_save;
203 .entity         dmg_inflictor;
204
205 .entity         owner;          // who launched a missile
206 .vector         movedir;        // mostly for doors, but also used for waterjump
207
208 .string         message;                // trigger messages
209
210 .float          sounds;         // either a cd track number or sound number
211
212 .string         noise, noise1, noise2, noise3;  // contains names of wavs to play
213
214 //================================================
215 void            end_sys_fields;                 // flag for structure dumping
216 //================================================
217
218 /*
219 ==============================================================================
220
221                                 CONSTANT DEFINITIONS
222
223 ==============================================================================
224 */
225
226
227 //
228 // constants
229 //
230
231 float   FALSE                                   = 0;
232 float   TRUE                                    = 1;
233
234 // edict.flags
235 float   FL_FLY                                  = 1;
236 float   FL_SWIM                                 = 2;
237 float   FL_CLIENT                               = 8;    // set for all client edicts
238 float   FL_INWATER                              = 16;   // for enter / leave water splash
239 float   FL_MONSTER                              = 32;
240 float   FL_GODMODE                              = 64;   // player cheat
241 float   FL_NOTARGET                             = 128;  // player cheat
242 float   FL_ITEM                                 = 256;  // extra wide size for bonus items
243 float   FL_ONGROUND                             = 512;  // standing on something
244 float   FL_PARTIALGROUND                = 1024; // not all corners are valid
245 float   FL_WATERJUMP                    = 2048; // player jumping out of water
246 float   FL_JUMPRELEASED                 = 4096; // for jump debouncing
247
248 // edict.movetype values
249 float   MOVETYPE_NONE                   = 0;    // never moves
250 //float MOVETYPE_ANGLENOCLIP    = 1;
251 //float MOVETYPE_ANGLECLIP              = 2;
252 float   MOVETYPE_WALK                   = 3;    // players only
253 float   MOVETYPE_STEP                   = 4;    // discrete, not real time unless fall
254 float   MOVETYPE_FLY                    = 5;
255 float   MOVETYPE_TOSS                   = 6;    // gravity
256 float   MOVETYPE_PUSH                   = 7;    // no clip to world, push and crush
257 float   MOVETYPE_NOCLIP                 = 8;
258 float   MOVETYPE_FLYMISSILE             = 9;    // fly with extra size against monsters
259 float   MOVETYPE_BOUNCE                 = 10;
260 float   MOVETYPE_BOUNCEMISSILE  = 11;   // bounce with extra size
261
262 // edict.solid values
263 float   SOLID_NOT                               = 0;    // no interaction with other objects
264 float   SOLID_TRIGGER                   = 1;    // touch on edge, but not blocking
265 float   SOLID_BBOX                              = 2;    // touch on edge, block
266 float   SOLID_SLIDEBOX                  = 3;    // touch on edge, but not an onground
267 float   SOLID_BSP                               = 4;    // bsp clip, touch on edge, block
268
269 // range values
270 float   RANGE_MELEE                             = 0;
271 float   RANGE_NEAR                              = 1;
272 float   RANGE_MID                               = 2;
273 float   RANGE_FAR                               = 3;
274
275 // deadflag values
276
277 float   DEAD_NO                                 = 0;
278 float   DEAD_DYING                              = 1;
279 float   DEAD_DEAD                               = 2;
280 float   DEAD_RESPAWNABLE                = 3;
281 float   DEAD_RESPAWNING                 = 4; // dead, waiting for buttons to be released
282
283 // takedamage values
284
285 float   DAMAGE_NO                               = 0;
286 float   DAMAGE_YES                              = 1;
287 float   DAMAGE_AIM                              = 2;
288
289 // items
290 float   IT_AXE                                  = 4096;
291 float   IT_SHOTGUN                              = 1;
292 float   IT_SUPER_SHOTGUN                = 2;
293 float   IT_NAILGUN                              = 4;
294 float   IT_SUPER_NAILGUN                = 8;
295 float   IT_GRENADE_LAUNCHER             = 16;
296 float   IT_ROCKET_LAUNCHER              = 32;
297 float   IT_LIGHTNING                    = 64;
298 float   IT_EXTRA_WEAPON                 = 128;
299
300 float   IT_SHELLS                               = 256;
301 float   IT_NAILS                                = 512;
302 float   IT_ROCKETS                              = 1024;
303 float   IT_CELLS                                = 2048;
304
305 float   IT_ARMOR1                               = 8192;
306 float   IT_ARMOR2                               = 16384;
307 float   IT_ARMOR3                               = 32768;
308 float   IT_SUPERHEALTH                  = 65536;
309
310 float   IT_KEY1                                 = 131072;
311 float   IT_KEY2                                 = 262144;
312
313 float   IT_INVISIBILITY                 = 524288;
314 float   IT_INVULNERABILITY              = 1048576;
315 float   IT_SUIT                                 = 2097152;
316 float   IT_QUAD                                 = 4194304;
317
318 // point content values
319
320 float   CONTENT_EMPTY                   = -1;
321 float   CONTENT_SOLID                   = -2;
322 float   CONTENT_WATER                   = -3;
323 float   CONTENT_SLIME                   = -4;
324 float   CONTENT_LAVA                    = -5;
325 float   CONTENT_SKY                             = -6;
326
327 float   STATE_TOP               = 0;
328 float   STATE_BOTTOM    = 1;
329 float   STATE_UP                = 2;
330 float   STATE_DOWN              = 3;
331
332 vector  VEC_ORIGIN = '0 0 0';
333 vector  VEC_HULL_MIN = '-16 -16 -24';
334 vector  VEC_HULL_MAX = '16 16 32';
335
336 vector  VEC_HULL2_MIN = '-32 -32 -24';
337 vector  VEC_HULL2_MAX = '32 32 64';
338
339 // protocol bytes
340 float   SVC_TEMPENTITY          = 23;
341 float   SVC_KILLEDMONSTER       = 27;
342 float   SVC_FOUNDSECRET         = 28;
343 float   SVC_INTERMISSION        = 30;
344 float   SVC_FINALE                      = 31;
345 float   SVC_CDTRACK                     = 32;
346 float   SVC_SELLSCREEN          = 33;
347
348
349 float   TE_SPIKE                = 0;
350 float   TE_SUPERSPIKE   = 1;
351 float   TE_GUNSHOT              = 2;
352 float   TE_EXPLOSION    = 3;
353 float   TE_TAREXPLOSION = 4;
354 float   TE_LIGHTNING1   = 5;
355 float   TE_LIGHTNING2   = 6;
356 float   TE_WIZSPIKE             = 7;
357 float   TE_KNIGHTSPIKE  = 8;
358 float   TE_LIGHTNING3   = 9;
359 float   TE_LAVASPLASH   = 10;
360 float   TE_TELEPORT             = 11;
361
362 // sound channels
363 // channel 0 never willingly overrides
364 // other channels (1-7) allways override a playing sound on that channel
365 float   CHAN_AUTO               = 0;
366 float   CHAN_WEAPON             = 1;
367 float   CHAN_VOICE              = 2;
368 float   CHAN_ITEM               = 3;
369 float   CHAN_BODY               = 4;
370
371 float   ATTN_NONE               = 0;
372 float   ATTN_NORM               = 1;
373 float   ATTN_IDLE               = 2;
374 float   ATTN_STATIC             = 3;
375
376 // update types
377
378 float   UPDATE_GENERAL  = 0;
379 float   UPDATE_STATIC   = 1;
380 float   UPDATE_BINARY   = 2;
381 float   UPDATE_TEMP             = 3;
382
383 // entity effects
384
385 float   EF_BRIGHTFIELD  = 1;
386 float   EF_MUZZLEFLASH  = 2;
387 float   EF_BRIGHTLIGHT  = 4;
388 float   EF_DIMLIGHT     = 8;
389
390
391 // messages
392 float   MSG_BROADCAST   = 0;            // unreliable to all
393 float   MSG_ONE                 = 1;            // reliable to one (msg_entity)
394 float   MSG_ALL                 = 2;            // reliable to all
395 float   MSG_INIT                = 3;            // write to the init string
396
397 //===========================================================================
398
399 //
400 // builtin functions
401 //
402
403 void(vector ang)        makevectors             = #1;           // sets v_forward, etc globals
404 void(entity e, vector o) setorigin      = #2;
405 void(entity e, string m) setmodel       = #3;           // set movetype and solid first
406 void(entity e, vector min, vector max) setsize = #4;
407 // #5 was removed
408 void() break_to_debugger                                                = #6;
409 float() random                                          = #7;           // returns 0 - 1
410 void(entity e, float chan, string samp, float vol, float atten) sound = #8;
411 vector(vector v) normalize                      = #9;
412 void(string e, ...) error                               = #10;
413 void(string e, ...) objerror                            = #11;
414 float(vector v) vlen                            = #12;
415 float(vector v) vectoyaw                        = #13;
416 entity() spawn                                          = #14;
417 void(entity e) remove                           = #15;
418
419 // sets trace_* globals
420 // nomonsters can be:
421 // An entity will also be ignored for testing if forent == test,
422 // forent->owner == test, or test->owner == forent
423 // a forent of world is ignored
424 void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
425
426 entity() checkclient                            = #17;  // returns a client to look for
427 entity(entity start, .string fld, string match) find = #18;
428 string(string s) precache_sound         = #19;
429 string(string s) precache_model         = #20;
430 void(entity client, string s, ...)stuffcmd = #21;
431 entity(vector org, float rad) findradius = #22;
432 void(string s, ...) bprint                              = #23;
433 void(entity client, string s, ...) sprint = #24;
434 void(string s, ...) dprint                              = #25;
435 string(float f) ftos                            = #26;
436 string(vector v) vtos                           = #27;
437 void() coredump                                         = #28;          // prints all edicts
438 void() traceon                                          = #29;          // turns statment trace on
439 void() traceoff                                         = #30;
440 void(entity e) eprint                           = #31;          // prints an entire edict
441 float(float yaw, float dist) walkmove   = #32;  // returns TRUE or FALSE
442 // #33 was removed
443 float() droptofloor= #34;       // TRUE if landed on floor
444 void(float style, string value) lightstyle = #35;
445 float(float v) rint                                     = #36;          // round to nearest int
446 float(float v) floor                            = #37;          // largest integer <= v
447 float(float v) ceil                                     = #38;          // smallest integer >= v
448 // #39 was removed
449 float(entity e) checkbottom                     = #40;          // true if self is on ground
450 float(vector v) pointcontents           = #41;          // returns a CONTENT_*
451 // #42 was removed
452 float(float f) fabs = #43;
453 vector(entity e, float speed) aim = #44;                // returns the shooting vector
454 float(string s) cvar = #45;                                             // return cvar.value
455 void(string s, ...) localcmd = #46;                                     // put string into local que
456 entity(entity e) nextent = #47;                                 // for looping through all ents
457 void(vector o, vector d, float color, float count) particle = #48;// start a particle effect
458 void() ChangeYaw = #49;                                         // turn towards self.ideal_yaw
459                                                                                         // at self.yaw_speed
460 // #50 was removed
461 vector(vector v) vectoangles                    = #51;
462
463 //
464 // direct client message generation
465 //
466 void(float to, float f) WriteByte               = #52;
467 void(float to, float f) WriteChar               = #53;
468 void(float to, float f) WriteShort              = #54;
469 void(float to, float f) WriteLong               = #55;
470 void(float to, float f) WriteCoord              = #56;
471 void(float to, float f) WriteAngle              = #57;
472 void(float to, string s, ...) WriteString       = #58;
473 void(float to, entity s) WriteEntity    = #59;
474
475 //
476 // broadcast client message generation
477 //
478
479 // void(float f) bWriteByte             = #59;
480 // void(float f) bWriteChar             = #60;
481 // void(float f) bWriteShort            = #61;
482 // void(float f) bWriteLong             = #62;
483 // void(float f) bWriteCoord            = #63;
484 // void(float f) bWriteAngle            = #64;
485 // void(string s) bWriteString  = #65;
486 // void(entity e) bWriteEntity = #66;
487
488 void(float step) movetogoal                             = #67;
489
490 string(string s) precache_file          = #68;  // no effect except for -copy
491 void(entity e) makestatic               = #69;
492 void(string s) changelevel = #70;
493
494 //#71 was removed
495
496 void(string var, string val) cvar_set = #72;    // sets cvar.value
497
498 void(entity client, string s, ...) centerprint = #73;   // sprint, but in middle
499
500 void(vector pos, string samp, float vol, float atten) ambientsound = #74;
501
502 string(string s) precache_model2        = #75;          // registered version only
503 string(string s) precache_sound2        = #76;          // registered version only
504 string(string s) precache_file2         = #77;          // registered version only
505
506 void(entity e) setspawnparms            = #78;          // set parm1... to the
507                                                                                                 // values at level start
508                                                                                                 // for coop respawn
509
510 //============================================================================