-
Notifications
You must be signed in to change notification settings - Fork 17
/
defs.qc
584 lines (459 loc) · 17.8 KB
/
defs.qc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
/*
==============================================================================
SOURCE FOR GLOBALVARS_T C STRUCTURE
==============================================================================
*/
//
// system globals
//
entity self;
entity other;
entity world;
float time;
float frametime;
float force_retouch; // force all entities to touch triggers
// next frame. this is needed because
// non-moving things don't normally scan
// for triggers, and when a trigger is
// created (like a teleport trigger), it
// needs to catch everything.
// decremented each frame, so set to 2
// to guarantee everything is touched
string mapname;
float deathmatch;
float coop;
float teamplay;
float serverflags; // propagated from level to level, used to
// keep track of completed episodes
float total_secrets;
float total_monsters;
float found_secrets; // number of secrets found
float killed_monsters; // number of monsters killed
// spawnparms are used to encode information about clients across server level changes
float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
// global variables set by built in functions
vector v_forward, v_up, v_right; // set by makevectors()
// set by traceline / tracebox
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vector trace_endpos;
vector trace_plane_normal;
float trace_plane_dist;
entity trace_ent;
float trace_inopen;
float trace_inwater;
entity msg_entity; // destination of single entity writes
// required prog functions
void() main; // only for testing
void() StartFrame;
void() PlayerPreThink;
void() PlayerPostThink;
void() ClientKill;
void() ClientConnect;
void() PutClientInServer; // call after setting the parm1... parms
void() ClientDisconnect;
void() SetNewParms; // called when a client first connects to
// a server. sets parms so they can be
// saved off for restarts
void() SetChangeParms; // call to set parms for self so they can
// be saved for a level transition
//================================================
void end_sys_globals; // flag for structure dumping
//================================================
/*
==============================================================================
SOURCE FOR ENTVARS_T C STRUCTURE
==============================================================================
*/
//
// system fields (*** = do not set in prog code, maintained by C code)
//
.float modelindex; // *** model index in the precached list
.vector absmin, absmax; // *** origin + mins / maxs
.float ltime; // local time for entity
.float movetype;
.float solid;
.vector origin; // ***
.vector oldorigin; // ***
.vector velocity;
.vector angles;
.vector avelocity;
.vector punchangle; // temp angle adjust from damage or recoil
.string classname; // spawn function
.string model;
.float frame;
.float skin;
.float effects;
.vector mins, maxs; // bounding box extents reletive to origin
.vector size; // maxs - mins
.void() touch;
.void() use;
.void() think;
.void() blocked; // for doors or plats, called when can't push other
.float nextthink;
.entity groundentity;
// stats
.float health;
.float frags;
.float weapon; // one of the IT_SHOTGUN, etc flags
.string weaponmodel;
.float weaponframe;
.float currentammo;
.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
.float items; // bit flags
.float takedamage;
.entity chain;
.float deadflag;
.vector view_ofs; // add to origin to get eye point
.float button0; // fire
.float button1; // use
.float button2; // jump
.float impulse; // weapon changes
.float fixangle;
.vector v_angle; // view / targeting angle for players
.float idealpitch; // calculated pitch angle for lookup up slopes
.string netname;
.entity enemy;
.float flags;
.float colormap;
.float team;
.float max_health;
.float teleport_time; // don't back up
.float armortype; // save this fraction of incoming damage
.float armorvalue;
.float waterlevel; // 0 = not in, 1 = feet, 2 = wast, 3 = eyes, 4 = entire bbox
.float watertype; // a contents value
.float ideal_yaw;
.float yaw_speed;
.entity aiment;
.entity goalentity; // a movetarget or an enemy
.float spawnflags;
.string target;
.string targetname;
// damage is accumulated through a frame. and sent as one single
// message, so the super shotgun doesn't generate huge messages
.float dmg_take;
.float dmg_save;
.entity dmg_inflictor;
.entity owner; // who launched a missile
.vector movedir; // mostly for doors, but also used for waterjump
.string message; // trigger messages
.float sounds; // either a cd track number or sound number
.string noise, noise1, noise2, noise3; // contains names of wavs to play
//================================================
void end_sys_fields; // flag for structure dumping
//================================================
/*
==============================================================================
VARS NOT REFERENCED BY C CODE
==============================================================================
*/
// globals
#pragma noref 1
float gameover; // set when a rule exits
string nextmap; // used by changelevel code in t_level.qc - 'mapname' is current map
string inter_text; // used by changelevel code in t_level.qc
nosave string string_null; // null string, nothing should be held here
entity activator; // the entity that activated a trigger or brush
entity damage_attacker; // set by T_Damage
float framecount;
float reset_flag;
float startingserverflags;
nosave float gamestarted;
nosave float initCleanup;
nosave float clients;
nosave float clientsAlive;
nosave float clientsAliveMask;
nosave float globalStatSupported;
float skill;
string skill_str; // for preserving skill across death/reloads
float coop_time;
// for balancing: total monster HP/ammo -HP/zombies/grenades in the level
float monster_health;
float ammo_total;
float num_zombies;
float num_rockets;
float trace_debug;
// moved from ai.qc or maybe combat.qc - used for target finding
float enemy_vis, enemy_range;//, enemy_infront;
// when a monster becomes angry at a player, that monster will be used
// as the sight target the next frame so that monsters near that one
// will wake up even if they wouldn't have noticed the player
entity sight_entity;
float sight_entity_time;
// moved from world.qc
entity lastspawn, bodyqueue_head;
// moved from client.qc
float intermission, intermission_exittime;
float modelindex_eyes, modelindex_player;
float icantsee;
// these are set in worldspawn() and thus reset every game start
nosave float isKex; // running the quake rerelease
nosave float isCSQC; // running something with passable csqc support
string keyType;
float *cdtrack; // fteqcc supports pointers. madness. see void() worldspawn
float sandyMadeThis; // for special-casing SOMEBODY's stale keyvalues and clumsy mapping
//================================================
// world fields
.string wad;
.string map;
.float worldtype; // 0=medieval 1=metal 2=base
.string killtarget;
.string target2;
.string target3;
.string target4;
.float alpha, alpha2;
// lights
.float style;
.float oldstyle;
.float switchshadstyle; // was "shadowstyle" too clear and easy to type or something
// monster ai
.void() th_stand;
.void() th_walk;
.void() th_run;
.void() th_missile;
.void() th_melee;
.void(entity attacker, float damage) th_pain;
.void() th_die;
.float() th_checkattack;
.entity oldenemy; // mad at this player before taking damage
.float attack_finished;
.float pain_finished;
.float search_time;
.float attack_state;
.float pausetime;
// player only fields
.float walkframe;
.float invincible_time, invincible_sound, invincible_finished;
.float invisible_time, invisible_sound, invisible_finished;
.float super_time, super_sound, super_damage_finished;
.float rad_time, radsuit_finished;
.float nextmovesound; // replaces swim_flag and fly_sound, both of which were timers
.float show_hostile; // set to time+0.2 whenever a client fires a
// weapon or takes damage. Used to alert
// monsters that otherwise would let the player go
.float jump_flag; // player jump "flag"
.float air_finished; // when time > air_finished, start drowning
.float bubble_count; // keeps track of the number of bubbles
.float healthtime;
.string deathtype; // keeps track of how the player died
#ifndef NO_CSQC
// fields for csqc HUD stats
.float clientdata;
.float tint;
.vector tint_color;
#endif
// fog
.vector fog_color, fog_color2;
.float fog_density, fog_density2;
.float fog_sky, fog_sky2;
// object stuff
//.string mdl; // only used by items to hide until respawn time
.float gravity;
.vector mangle; // angle at start
// doors/movers
.vector dest, dest1, dest2;
.vector pos1, pos2; // top and bottom positions
//.vector oldorigin; // only used by secret door
.vector finaldest;
.void() think1;
.float speed, speed2;
.float wait; // time from firing to restarting
.float delay; // time from activation to firing
.float length, width, height;
.float t_length = length; // preserve old func_door_secret maphacks
.float t_width = width;
.float touch_time;
.float lip;
.float state;
.float dmg; // damage done by door when hit
.entity trigger_field; // door's trigger entity
.string noise4;
// triggers
.float count; // for counting triggers
.float cnt; // used on grunts, enforcers, dguards, and ogres for attack refire
// reused on players for nailgun barrel cycling
// sounds
.float distance;
.float volume;
//.float inpain; // from zombie.qc, moved to .customflags
//.float lefty; // moved to .customflags
//.float axhitme; // moved to .customflags
//.float zapped; // moved to .customflags
.float customflags; // inpain, axehitme, zapped, etc, see constants.qc
.float healamount; // moved from items.qc - only used on health boxes
.float dmgtime; // moved from client.qc - used in drowning code & as a coop aggro timer
.entity multidmg_chain; // moved from combat.qc - for multidmg
.float multi_dmg;
.string type; // to make find()ing easier, and for tons of useful misc. classification
.entity buddy; // a common entity reference without the specific implications of 'owner' or 'enemy'
.float strength;
.float lifetime_finished;
.float notrace; // entity will be invisible to traceline2()
.vector oldvelocity; // necessary for getting projectiles to pass through .notrace entities
.entity trueowner; // now this is getting dumb
.void(float unlock) lock; // so entities can define their own target_lock cleanup
// OVERLOADS:
.float rand = healamount; // for trigger_timer
.float svflags = jump_flag; // for target_give and item_sigil
.vector fadecolor = fog_color; // for func_void fadeout
.string include = wad; // for monsterjump filters
.string exclude = map;
.float light_lev = bubble_count; // shuts up a stupid stupid warning
.vector rmovedir = finaldest;
.float version = worldtype;
.string model2 = wad; // for debris emitter
.string model3 = map;
//===========================================================================
// builtin functions
//===========================================================================
void(vector ang) makevectors = #1; // sets v_forward, etc globals
void(entity e, vector o) setorigin = #2;
void(entity e, string m) setmodel = #3; // set movetype and solid first
void(entity e, vector min, vector max) setsize = #4;
// #5 was removed
void() break = #6;
float() random = #7; // returns 0 - 1
void(entity e, float chan, string samp, float vol, float atten) sound = #8;
vector(vector v) normalize = #9;
void(string e) error = #10;
void(string e) objerror = #11;
float(vector v) vlen = #12;
float(vector v) vectoyaw = #13;
entity() spawn = #14;
void(entity e) remove = #15;
// sets trace_* globals
// An entity will also be ignored for testing if forent == test,
// forent->owner == test, or test->owner == forent
// a forent of world is ignored
void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
// fun fact for future self: 'nomonsters' actually means no entities. the next time you
// go out of your motherfucking mind trying to trace against an entity that isn't a monster
// and get world every time, this is why.
entity() checkclient = #17; // returns a client to look for
entity(entity start, .string fld, string match) find = #18;
string(string s) precache_sound = #19;
string(string s) precache_model = #20;
void(entity client, string s)stuffcmd = #21;
entity(vector org, float rad) findradius = #22; // findradius only works on solid entities
void(string s) bprint = #23;
void(entity client, string s) sprint = #24;
void(string s) dprint = #25;
string(float f) ftos = #26;
string(vector v) vtos = #27;
void() coredump = #28; // prints all edicts
void() traceon = #29; // turns statement trace on
void() traceoff = #30;
void(entity e) eprint = #31; // prints an entire edict
float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
// #33 was removed
float() droptofloor = #34; // TRUE if landed on floor
void(float style, string value) lightstyle = #35;
float(float v) rint = #36; // round to nearest int
float(float v) floor = #37; // largest integer <= v
float(float v) ceil = #38; // smallest integer >= v
// #39 was removed
float(entity e) checkbottom = #40; // true if self is on ground
// "Returns false if any part of the bottom of the entity is off an edge that is not a staircase."
float(vector v) pointcontents = #41; // returns a CONTENT_*
// #42 was removed
float(float f) fabs = #43;
vector(entity e, float speed) aim = #44; // returns the shooting vector
float(string s) cvar = #45; // return cvar.value
void(string s) localcmd = #46; // put string into local que
entity(entity e) nextent = #47; // for looping through all ents
void(vector org, vector dir, float color, float count) particle = #48;// start a particle effect
void() ChangeYaw = #49; // turn towards self.ideal_yaw
// at self.yaw_speed
// #50 was removed
vector(vector v) vectoangles = #51;
// direct client message generation
void(float to, float f) WriteByte = #52;
void(float to, float f) WriteChar = #53;
void(float to, float f) WriteShort = #54;
void(float to, float f) WriteLong = #55;
void(float to, float f) WriteCoord = #56;
void(float to, float f) WriteAngle = #57;
void(float to, string s) WriteString = #58;
void(float to, entity s) WriteEntity = #59;
// broadcast client message generation
// void(float f) bWriteByte = #59;
// void(float f) bWriteChar = #60;
// void(float f) bWriteShort = #61;
// void(float f) bWriteLong = #62;
// void(float f) bWriteCoord = #63;
// void(float f) bWriteAngle = #64;
// void(string s) bWriteString = #65;
// void(entity e) bWriteEntity = #66;
void(float step) movetogoal = #67;
string(string s) precache_file = #68; // no effect except for -copy
void(entity e) makestatic = #69;
void(string s) changelevel = #70;
//#71 was removed
void(string var, string val) cvar_set = #72; // sets cvar.value
void(entity client, string s) centerprint = #73; // sprint, but in middle
void(entity client, string s, string s) centerprint2 = #73; // sprint, but in middle
void(entity client, string s, string s, string s) centerprint3 = #73; // sprint, but in middle
void(entity client, string s, string s, string s, string s) centerprint4 = #73; // sprint, but in middle
void(entity client, string s, string s, string s, string s, string s) centerprint5 = #73; // sprint, but in middle
void(vector pos, string samp, float vol, float atten) ambientsound = #74;
string(string s) precache_model2 = #75; // registered version only
string(string s) precache_sound2 = #76; // registered version only
string(string s) precache_file2 = #77; // registered version only
void(entity e) setspawnparms = #78; // set parm1... to the
// values at level start
// for coop respawn
float(string s) checkextension = #99; // check cvar("pr_checkextension") before calling
#ifndef NO_CSQC
void(float num, float type, .__variant fld) clientstat = #232;
void(float num, float type, string name) globalstat = #233;
#endif
//================================================
// angles(string) : "Direction, specifically (pitch yaw roll)"
/*FGD
@baseclass = Angle [
angle(integer) : "Direction (0-360 yaw, or -1 for up/-2 for down)"
]
@baseclass = Appearflags [
spawnflags(Flags) =
[
256 : "Not on Easy" : 0
512 : "Not on Normal" : 0
1024 : "Not on Hard+" : 0
2048 : "Not in Deathmatch" : 0
4096 : "Only in Coop" : 0
8192 : "Not in Coop" : 0
]
]
@baseclass = Targetname [
targetname(target_source) : "Name"
impulse(integer) : "Can activate with this impulse" : 0
]
@baseclass = Target [
target(target_destination) : "Target: activate anything with a matching targetname"
target2(target_destination) : "Target 2: activate anything with a matching targetname"
target3(target_destination) : "Target 3: activate anything with a matching targetname"
target4(target_destination) : "Target 4: activate anything with a matching targetname"
killtarget(target_destination) : "Killtarget: REMOVE anything with a matching targetname"
delay(string) : "Delay before activating targets" : "0"
]
@baseclass = Deathtype [ deathtype(string) : "Obituary message. Printed after dead player's name, so format accordingly (ie 'was burnt to a crisp')" ]
@baseclass size(16 16 16) = Bounds [ size(string) : "Bounds size, centered (x y z)" ]
@baseclass = Phong [
_phong(integer) : "Use phong smoothing" : 0
_phong_angle(integer) : "Phong angle" : 88
]
@baseclass base(Phong) color(0 120 180) = Func []
@baseclass = FuncInvis [
spawnflags(flags) = [
128 : "Start Invisible" : 0
]
]
@baseclass = AltTarget [
spawnflags(flags) = [
16384 : "Alt Target Pattern" : 0
]
]
*/
#pragma noref 0