]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/dpdefs/progsdefs.qh
Declare more ints as ints
[xonotic/xonotic-data.pk3dir.git] / qcsrc / dpdefs / progsdefs.qh
1 #ifndef PROGSDEFS_H
2 #define PROGSDEFS_H
3
4 /*
5 ==============================================================================
6
7                         SOURCE FOR GLOBALVARS_T C STRUCTURE
8                         MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
9
10 ==============================================================================
11 */
12
13 //
14 // system globals
15 //
16 entity          self;
17 entity          other;
18 entity          world;
19 float           time;
20 float           frametime;
21
22 float           force_retouch;          // force all entities to touch triggers
23                                                                 // next frame.  this is needed because
24                                                                 // non-moving things don't normally scan
25                                                                 // for triggers, and when a trigger is
26                                                                 // created (like a teleport trigger), it
27                                                                 // needs to catch everything.
28                                                                 // decremented each frame, so set to 2
29                                                                 // to guarantee everything is touched
30 string          mapname;
31
32 float           deathmatch;
33 float           coop;
34 float           teamplay;
35
36 int                     serverflags;            // propagated from level to level, used to
37                                                                 // keep track of completed episodes
38
39 float           total_secrets;
40 float           total_monsters;
41
42 float           found_secrets;          // number of secrets found
43 float           killed_monsters;        // number of monsters killed
44
45
46 // spawnparms are used to encode information about clients across server
47 // level changes
48 float           parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
49
50 //
51 // global variables set by built in functions
52 //
53 vector          v_forward, v_up, v_right;       // set by makevectors()
54
55 // set by traceline / tracebox
56 float           trace_allsolid;
57 float           trace_startsolid;
58 float           trace_fraction;
59 vector          trace_endpos;
60 vector          trace_plane_normal;
61 float           trace_plane_dist;
62 entity          trace_ent;
63 float           trace_inopen;
64 float           trace_inwater;
65
66 entity          msg_entity;                             // destination of single entity writes
67
68 //
69 // required prog functions
70 //
71 void()          main;                                           // only for testing
72
73 void()          StartFrame;
74
75 void()          PlayerPreThink;
76 void()          PlayerPostThink;
77
78 void()          ClientKill;
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 .int            skin;
126 .int            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 .int            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 .int            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 .int            flags;
173
174 .int            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 .int            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 // edict.flags
232 const int FL_FLY                                = 1;
233 const int FL_SWIM                               = 2;
234 const int FL_CLIENT                             = 8;    // set for all client edicts
235 const int FL_INWATER                    = 16;   // for enter / leave water splash
236 const int FL_MONSTER                    = 32;
237 const int FL_GODMODE                    = 64;   // player cheat
238 const int FL_NOTARGET                   = 128;  // player cheat
239 const int FL_ITEM                               = 256;  // extra wide size for bonus items
240 const int FL_ONGROUND                   = 512;  // standing on something
241 const int FL_PARTIALGROUND              = 1024; // not all corners are valid
242 const int FL_WATERJUMP                  = 2048; // player jumping out of water
243 const int FL_JUMPRELEASED               = 4096; // for jump debouncing
244
245 // edict.movetype values
246 const int MOVETYPE_NONE                 = 0;    // never moves
247 //const int     MOVETYPE_ANGLENOCLIP= 1;
248 //const int     MOVETYPE_ANGLECLIP      = 2;
249 const int MOVETYPE_WALK                 = 3;    // players only
250 const int MOVETYPE_STEP                 = 4;    // discrete, not real time unless fall
251 const int MOVETYPE_FLY                  = 5;
252 const int MOVETYPE_TOSS                 = 6;    // gravity
253 const int MOVETYPE_PUSH                 = 7;    // no clip to world, push and crush
254 const int MOVETYPE_NOCLIP               = 8;
255 const int MOVETYPE_FLYMISSILE   = 9;    // fly with extra size against monsters
256 const int MOVETYPE_BOUNCE               = 10;
257 const int MOVETYPE_BOUNCEMISSILE= 11;   // bounce with extra size
258
259 // edict.solid values
260 const int SOLID_NOT                             = 0;    // no interaction with other objects
261 const int SOLID_TRIGGER                 = 1;    // touch on edge, but not blocking
262 const int SOLID_BBOX                    = 2;    // touch on edge, block
263 const int SOLID_SLIDEBOX                = 3;    // touch on edge, but not an onground
264 const int SOLID_BSP                             = 4;    // bsp clip, touch on edge, block
265
266 // range values
267 const int RANGE_MELEE                   = 0;
268 const int RANGE_NEAR                    = 1;
269 const int RANGE_MID                             = 2;
270 const int RANGE_FAR                             = 3;
271
272 // deadflag values
273
274 const int DEAD_NO                               = 0;
275 const int DEAD_DYING                    = 1;
276 const int DEAD_DEAD                             = 2;
277 const int DEAD_RESPAWNABLE              = 3;
278 const int DEAD_RESPAWNING               = 4; // dead, waiting for buttons to be released
279
280 // takedamage values
281
282 const int DAMAGE_NO                             = 0;
283 const int DAMAGE_YES                    = 1;
284 const int DAMAGE_AIM                    = 2;
285
286 // items
287 const int IT_AXE                                = 4096;
288 const int IT_SHOTGUN                    = 1;
289 const int IT_SUPER_SHOTGUN              = 2;
290 const int IT_NAILGUN                    = 4;
291 const int IT_SUPER_NAILGUN              = 8;
292 const int IT_GRENADE_LAUNCHER   = 16;
293 const int IT_ROCKET_LAUNCHER    = 32;
294 const int IT_LIGHTNING                  = 64;
295 const int IT_EXTRA_WEAPON               = 128;
296
297 //const int IT_SHELLS                   = 256;
298 //const int IT_NAILS                    = 512;
299 //const int IT_ROCKETS                  = 1024;
300 //const int IT_CELLS                    = 2048;
301
302 const int IT_ARMOR1                             = 8192;
303 const int IT_ARMOR2                             = 16384;
304 const int IT_ARMOR3                             = 32768;
305 const int IT_SUPERHEALTH                = 65536;
306
307 //const int IT_KEY1                             = 131072;
308 //const int IT_KEY2                             = 262144;
309
310 const int IT_INVISIBILITY               = 524288;
311 const int IT_INVULNERABILITY    = 1048576;
312 const int IT_SUIT                               = 2097152;
313 const int IT_QUAD                               = 4194304;
314
315 // point content values
316
317 const int CONTENT_EMPTY                 = -1;
318 const int CONTENT_SOLID                 = -2;
319 const int CONTENT_WATER                 = -3;
320 const int CONTENT_SLIME                 = -4;
321 const int CONTENT_LAVA                  = -5;
322 const int CONTENT_SKY                   = -6;
323
324 const int STATE_TOP                             = 0;
325 const int STATE_BOTTOM                  = 1;
326 const int STATE_UP                              = 2;
327 const int STATE_DOWN                    = 3;
328
329 const vector VEC_ORIGIN                 = '0 0 0';
330 const vector VEC_HULL_MIN               = '-16 -16 -24';
331 const vector VEC_HULL_MAX               = '16 16 32';
332
333 const vector VEC_HULL2_MIN              = '-32 -32 -24';
334 const vector VEC_HULL2_MAX              = '32 32 64';
335
336 // protocol bytes
337 const int SVC_TEMPENTITY                = 23;
338 const int SVC_KILLEDMONSTER             = 27;
339 const int SVC_FOUNDSECRET               = 28;
340 const int SVC_INTERMISSION              = 30;
341 const int SVC_FINALE                    = 31;
342 const int SVC_CDTRACK                   = 32;
343 const int SVC_SELLSCREEN                = 33;
344
345
346 const int TE_SPIKE                              = 0;
347 const int TE_SUPERSPIKE                 = 1;
348 const int TE_GUNSHOT                    = 2;
349 const int TE_EXPLOSION                  = 3;
350 const int TE_TAREXPLOSION               = 4;
351 const int TE_LIGHTNING1                 = 5;
352 const int TE_LIGHTNING2                 = 6;
353 const int TE_WIZSPIKE                   = 7;
354 const int TE_KNIGHTSPIKE                = 8;
355 const int TE_LIGHTNING3                 = 9;
356 const int TE_LAVASPLASH                 = 10;
357 const int TE_TELEPORT                   = 11;
358
359 // sound channels
360 // channel 0 never willingly overrides
361 // other channels (1-7) allways override a playing sound on that channel
362 const int CHAN_AUTO                             = 0;
363 const int CHAN_WEAPON                   = 1;
364 const int CHAN_VOICE                    = 2;
365 const int CHAN_ITEM                             = 3;
366 const int CHAN_BODY                             = 4;
367
368 const int ATTN_NONE                             = 0;
369 const int ATTN_NORM                             = 1;
370 const int ATTN_IDLE                             = 2;
371 const int ATTN_STATIC                   = 3;
372
373 // update types
374
375 const int UPDATE_GENERAL                = 0;
376 const int UPDATE_STATIC                 = 1;
377 const int UPDATE_BINARY                 = 2;
378 const int UPDATE_TEMP                   = 3;
379
380 // entity effects
381
382 const int EF_BRIGHTFIELD                = 1;
383 const int EF_MUZZLEFLASH                = 2;
384 const int EF_BRIGHTLIGHT                = 4;
385 const int EF_DIMLIGHT                   = 8;
386
387
388 // messages
389 const int MSG_BROADCAST                 = 0;            // unreliable to all
390 const int MSG_ONE                               = 1;            // reliable to one (msg_entity)
391 const int MSG_ALL                               = 2;            // reliable to all
392 const int MSG_INIT                              = 3;            // write to the init string
393
394 //===========================================================================
395
396 //
397 // builtin functions
398 //
399
400 void(vector ang)        makevectors             = #1;           // sets v_forward, etc globals
401 void(entity e, vector o) setorigin      = #2;
402 void(entity e, string m) setmodel       = #3;           // set movetype and solid first
403 void(entity e, vector min, vector max) setsize = #4;
404 // #5 was removed
405 void() break_to_debugger                                                = #6;
406 float() random                                          = #7;           // returns 0 - 1
407 void(entity e, float chan, string samp, float vol, float atten) sound = #8;
408 vector(vector v) normalize                      = #9;
409 void(string e, ...) error                               = #10;
410 void(string e, ...) objerror                            = #11;
411 float(vector v) vlen                            = #12;
412 float(vector v) vectoyaw                        = #13;
413 entity() spawn                                          = #14;
414 void(entity e) remove                           = #15;
415
416 // sets trace_* globals
417 // nomonsters can be:
418 // An entity will also be ignored for testing if forent == test,
419 // forent->owner == test, or test->owner == forent
420 // a forent of world is ignored
421 void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
422
423 entity() checkclient                            = #17;  // returns a client to look for
424 entity(entity start, .string fld, string match) find = #18;
425 string(string s) precache_sound         = #19;
426 string(string s) precache_model         = #20;
427 void(entity client, string s, ...)stuffcmd = #21;
428 entity(vector org, float rad) findradius = #22;
429 void(string s, ...) bprint                              = #23;
430 void(entity client, string s, ...) sprint = #24;
431 void(string s, ...) dprint                              = #25;
432 string(float f) ftos                            = #26;
433 string(vector v) vtos                           = #27;
434 void() coredump                                         = #28;          // prints all edicts
435 void() traceon                                          = #29;          // turns statment trace on
436 void() traceoff                                         = #30;
437 void(entity e) eprint                           = #31;          // prints an entire edict
438 float(float yaw, float dist) walkmove   = #32;  // returns true or false
439 // #33 was removed
440 float() droptofloor= #34;       // true if landed on floor
441 void(float style, string value) lightstyle = #35;
442 float(float v) rint                                     = #36;          // round to nearest int
443 float(float v) floor                            = #37;          // largest integer <= v
444 float(float v) ceil                                     = #38;          // smallest integer >= v
445 // #39 was removed
446 float(entity e) checkbottom                     = #40;          // true if self is on ground
447 float(vector v) pointcontents           = #41;          // returns a CONTENT_*
448 // #42 was removed
449 float(float f) fabs = #43;
450 vector(entity e, float speed) aim = #44;                // returns the shooting vector
451 float(string s) cvar = #45;                                             // return cvar.value
452 void(string s, ...) localcmd = #46;                                     // put string into local que
453 entity(entity e) nextent = #47;                                 // for looping through all ents
454 void(vector o, vector d, float color, float count) particle = #48;// start a particle effect
455 void() ChangeYaw = #49;                                         // turn towards self.ideal_yaw
456                                                                                         // at self.yaw_speed
457 // #50 was removed
458 vector(vector v) vectoangles                    = #51;
459
460 //
461 // direct client message generation
462 //
463 void(float to, float f) WriteByte               = #52;
464 void(float to, float f) WriteChar               = #53;
465 void(float to, float f) WriteShort              = #54;
466 void(float to, float f) WriteLong               = #55;
467 void(float to, float f) WriteCoord              = #56;
468 void(float to, float f) WriteAngle              = #57;
469 void(float to, string s, ...) WriteString       = #58;
470 void(float to, entity s) WriteEntity    = #59;
471
472 //
473 // broadcast client message generation
474 //
475
476 // void(float f) bWriteByte             = #59;
477 // void(float f) bWriteChar             = #60;
478 // void(float f) bWriteShort            = #61;
479 // void(float f) bWriteLong             = #62;
480 // void(float f) bWriteCoord            = #63;
481 // void(float f) bWriteAngle            = #64;
482 // void(string s) bWriteString  = #65;
483 // void(entity e) bWriteEntity = #66;
484
485 void(float step) movetogoal                             = #67;
486
487 string(string s) precache_file          = #68;  // no effect except for -copy
488 void(entity e) makestatic               = #69;
489 void(string s) changelevel = #70;
490
491 //#71 was removed
492
493 void(string name, string value) cvar_set = #72; // sets cvar.value
494
495 void(entity client, string s, ...) centerprint = #73;   // sprint, but in middle
496
497 void(vector pos, string samp, float vol, float atten) ambientsound = #74;
498
499 string(string s) precache_model2        = #75;          // registered version only
500 string(string s) precache_sound2        = #76;          // registered version only
501 string(string s) precache_file2         = #77;          // registered version only
502
503 void(entity e) setspawnparms            = #78;          // set parm1... to the
504                                                                                                 // values at level start
505                                                                                                 // for coop respawn
506
507 //============================================================================
508 #endif