-
Notifications
You must be signed in to change notification settings - Fork 2
/
api.qc
805 lines (708 loc) · 17.6 KB
/
api.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
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
// contains definitions that pertain to the game/server API
const int GAMEC_API_VERSION = 1;
// max bytes in a single message packet
const int MESSAGE_LIMIT = 1400;
//
// per-level limits
//
const int MAX_CLIENTS = 256; // absolute limit
const int MAX_LIGHTSTYLES = 256;
// These may be set to larger values by other engines.
API_FUNC var int MAX_EDICTS = 1024; // must change protocol to increase more
API_FUNC var int MAX_MODELS = 256; // these are sent over the net as bytes
API_FUNC var int MAX_SOUNDS = 256; // so they cannot be blindly increased
API_FUNC var int MAX_IMAGES = 256;
const int MAX_ITEMS = 256;
const int MAX_GENERAL = (MAX_CLIENTS * 2); // general config strings
// game print flags
typedef enum : int
{
PRINT_LOW, // pickup messages
PRINT_MEDIUM, // death messages
PRINT_HIGH, // critical messages
PRINT_CHAT // chat messages
} print_level_t;
// destination class for gi.multicast()
typedef enum : int
{
MULTICAST_ALL,
MULTICAST_PHS,
MULTICAST_PVS,
MULTICAST_ALL_R,
MULTICAST_PHS_R,
MULTICAST_PVS_R
} multicast_t;
//
// muzzle flashes / player effects
//
typedef enum : int
{
MZ_BLASTER,
MZ_MACHINEGUN,
MZ_SHOTGUN,
MZ_CHAINGUN1,
MZ_CHAINGUN2,
MZ_CHAINGUN3,
MZ_RAILGUN,
MZ_ROCKET,
MZ_GRENADE,
MZ_LOGIN,
MZ_LOGOUT,
MZ_RESPAWN,
MZ_BFG,
MZ_SSHOTGUN,
MZ_HYPERBLASTER,
MZ_ITEMRESPAWN,
// RAFAEL
MZ_IONRIPPER,
MZ_BLUEHYPERBLASTER,
MZ_PHALANX,
// RAFAEL
//ROGUE
MZ_ETF_RIFLE = 30,
MZ_UNUSED,
MZ_SHOTGUN2,
MZ_HEATBEAM,
MZ_BLASTER2,
MZ_TRACKER,
MZ_NUKE1,
MZ_NUKE2,
MZ_NUKE4,
MZ_NUKE8,
//ROGUE
MZ_SILENCED = 128 // bit flag ORed with one of the above numbers
} muzzleflash_t;
//
// monster muzzle flashes
//
typedef enum : int
{
MZ2_TANK_BLASTER_1 = 1,
MZ2_TANK_BLASTER_2,
MZ2_TANK_BLASTER_3,
MZ2_TANK_MACHINEGUN_1,
MZ2_TANK_MACHINEGUN_2,
MZ2_TANK_MACHINEGUN_3,
MZ2_TANK_MACHINEGUN_4,
MZ2_TANK_MACHINEGUN_5,
MZ2_TANK_MACHINEGUN_6,
MZ2_TANK_MACHINEGUN_7,
MZ2_TANK_MACHINEGUN_8,
MZ2_TANK_MACHINEGUN_9,
MZ2_TANK_MACHINEGUN_10,
MZ2_TANK_MACHINEGUN_11,
MZ2_TANK_MACHINEGUN_12,
MZ2_TANK_MACHINEGUN_13,
MZ2_TANK_MACHINEGUN_14,
MZ2_TANK_MACHINEGUN_15,
MZ2_TANK_MACHINEGUN_16,
MZ2_TANK_MACHINEGUN_17,
MZ2_TANK_MACHINEGUN_18,
MZ2_TANK_MACHINEGUN_19,
MZ2_TANK_ROCKET_1,
MZ2_TANK_ROCKET_2,
MZ2_TANK_ROCKET_3,
MZ2_INFANTRY_MACHINEGUN_1,
MZ2_INFANTRY_MACHINEGUN_2,
MZ2_INFANTRY_MACHINEGUN_3,
MZ2_INFANTRY_MACHINEGUN_4,
MZ2_INFANTRY_MACHINEGUN_5,
MZ2_INFANTRY_MACHINEGUN_6,
MZ2_INFANTRY_MACHINEGUN_7,
MZ2_INFANTRY_MACHINEGUN_8,
MZ2_INFANTRY_MACHINEGUN_9,
MZ2_INFANTRY_MACHINEGUN_10,
MZ2_INFANTRY_MACHINEGUN_11,
MZ2_INFANTRY_MACHINEGUN_12,
MZ2_INFANTRY_MACHINEGUN_13,
MZ2_SOLDIER_BLASTER_1,
MZ2_SOLDIER_BLASTER_2,
MZ2_SOLDIER_SHOTGUN_1,
MZ2_SOLDIER_SHOTGUN_2,
MZ2_SOLDIER_MACHINEGUN_1,
MZ2_SOLDIER_MACHINEGUN_2,
MZ2_GUNNER_MACHINEGUN_1,
MZ2_GUNNER_MACHINEGUN_2,
MZ2_GUNNER_MACHINEGUN_3,
MZ2_GUNNER_MACHINEGUN_4,
MZ2_GUNNER_MACHINEGUN_5,
MZ2_GUNNER_MACHINEGUN_6,
MZ2_GUNNER_MACHINEGUN_7,
MZ2_GUNNER_MACHINEGUN_8,
MZ2_GUNNER_GRENADE_1,
MZ2_GUNNER_GRENADE_2,
MZ2_GUNNER_GRENADE_3,
MZ2_GUNNER_GRENADE_4,
MZ2_CHICK_ROCKET_1,
MZ2_FLYER_BLASTER_1,
MZ2_FLYER_BLASTER_2,
MZ2_MEDIC_BLASTER_1,
MZ2_GLADIATOR_RAILGUN_1,
MZ2_HOVER_BLASTER_1,
MZ2_ACTOR_MACHINEGUN_1,
MZ2_SUPERTANK_MACHINEGUN_1,
MZ2_SUPERTANK_MACHINEGUN_2,
MZ2_SUPERTANK_M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_8,
MZ2_WIDOW2_BEAM_SWEEP_9,
MZ2_WIDOW2_BEAM_SWEEP_10,
MZ2_WIDOW2_BEAM_SWEEP_11
// ROGUE
} monster_muzzleflash_t;
// temp entity events
//
// Temp entity events are for things that happen
// at a location seperate from any existing entity.
// Temporary entity messages are explicitly constructed
// and broadcast.
typedef enum : int
{
TE_GUNSHOT,
TE_BLOOD,
TE_BLASTER,
TE_RAILTRAIL,
TE_SHOTGUN,
TE_EXPLOSION1,
TE_EXPLOSION2,
TE_ROCKET_EXPLOSION,
TE_GRENADE_EXPLOSION,
TE_SPARKS,
TE_SPLASH,
TE_BUBBLETRAIL,
TE_SCREEN_SPARKS,
TE_SHIELD_SPARKS,
TE_BULLET_SPARKS,
TE_LASER_SPARKS,
TE_PARASITE_ATTACK,
TE_ROCKET_EXPLOSION_WATER,
TE_GRENADE_EXPLOSION_WATER,
TE_MEDIC_CABLE_ATTACK,
TE_BFG_EXPLOSION,
TE_BFG_BIGEXPLOSION,
TE_BOSSTPORT, // used as '22' in a map, so DON'T RENUMBER!!!
TE_BFG_LASER,
TE_GRAPPLE_CABLE,
TE_WELDING_SPARKS,
TE_GREENBLOOD,
TE_BLUEHYPERBLASTER,
TE_PLASMA_EXPLOSION,
TE_TUNNEL_SPARKS,
//ROGUE
TE_BLASTER2,
TE_RAILTRAIL2,
TE_FLAME,
TE_LIGHTNING,
TE_DEBUGTRAIL,
TE_PLAIN_EXPLOSION,
TE_FLASHLIGHT,
TE_FORCEWALL,
TE_HEATBEAM,
TE_MONSTER_HEATBEAM,
TE_STEAM,
TE_BUBBLETRAIL2,
TE_MOREBLOOD,
TE_HEATBEAM_SPARKS,
TE_HEATBEAM_STEAM,
TE_CHAINFIST_SMOKE,
TE_ELECTRIC_SPARKS,
TE_TRACKER_EXPLOSION,
TE_TELEPORT_EFFECT,
TE_DBALL_GOAL,
TE_WIDOWBEAMOUT,
TE_NUKEBLAST,
TE_WIDOWSPLASH,
TE_EXPLOSION1_BIG,
TE_EXPLOSION1_NP,
TE_FLECHETTE,
//ROGUE
TE_NUM_ENTITIES
} temp_event_t;
// color for TE_SPLASH
typedef enum : int
{
SPLASH_UNKNOWN,
SPLASH_SPARKS,
SPLASH_BLUE_WATER,
SPLASH_BROWN_WATER,
SPLASH_SLIME,
SPLASH_LAVA,
SPLASH_BLOOD
} splash_type_t;
//
// SOUNDS
//
// sound channels
// channel 0 never willingly overrides
// other channels (1-7) allways override a playing sound on that channel
typedef enum : int
{
CHAN_AUTO,
CHAN_WEAPON,
CHAN_VOICE,
CHAN_ITEM,
CHAN_BODY,
// 3 unused IDs
// modifier flags
CHAN_NO_PHS_ADD = 8, // send to all clients, not just ones in PHS (ATTN 0 will also do this)
CHAN_RELIABLE = 16 // send by reliable message, not datagram
} sound_channel_t;
// sound attenuation values
typedef enum : float
{
ATTN_NONE, // full volume the entire level
ATTN_NORM,
ATTN_IDLE,
ATTN_STATIC // diminish very rapidly with distance
} sound_attn_t;
//
// config strings are a general means of communication from
// the server to all connected clients.
// Each config string can be at most MAX_QPATH characters.
//
typedef enum : int
{
CS_NAME,
CS_CDTRACK,
CS_SKY,
CS_SKYAXIS, // %f %f %f format
CS_SKYROTATE,
CS_STATUSBAR, // display program string
CS_AIRACCEL = 29, // air acceleration control
CS_MAXCLIENTS,
CS_MAPCHECKSUM, // for catching cheater maps
CS_MODELS
#ifdef CTF
, CONFIG_CTF_MATCH = CS_AIRACCEL - 1,
CONFIG_CTF_TEAMINFO = CS_AIRACCEL - 2
#endif
} config_string_t;
// These are non-constant because some engines (KMQ2)
// may support larger values.
var config_string_t CS_SOUNDS;
var config_string_t CS_IMAGES;
var config_string_t CS_LIGHTS;
var config_string_t CS_ITEMS;
var config_string_t CS_PLAYERSKINS;
var config_string_t CS_GENERAL;
var config_string_t MAX_CONFIGSTRINGS;
// Some mods actually exploit CS_STATUSBAR to take space up to CS_AIRACCEL
INLINE int CS_SIZE(config_string_t cs)
{
if (cs >= CS_STATUSBAR && cs < CS_AIRACCEL)
return MAX_QPATH * (CS_AIRACCEL - cs);
return MAX_QPATH;
}
/*
==========================================================
CVARS (console variables)
==========================================================
*/
typedef enumflags : int
{
CVAR_NONE = 0,
CVAR_ARCHIVE = 1, // set to cause it to be saved to vars.rc
CVAR_USERINFO, // added to userinfo when changed
CVAR_SERVERINFO, // added to serverinfo when changed
CVAR_NOSET, // don't allow change from console at all,
// but can be set from the command line
CVAR_LATCH // save changes until server restart
} cvar_flags_t;
accessor cvar_t : handle;
static string(cvar_t) cvar_get_name = #0;
static string(cvar_t) cvar_get_string = #0;
static string(cvar_t) cvar_get_latched_string = #0;
static cvar_flags_t(cvar_t) cvar_get_flags = #0;
static bool(cvar_t) cvar_get_modified = #0;
static void(cvar_t, bool) cvar_set_modified = #0;
static float(cvar_t) cvar_get_floatVal = #0;
static int(cvar_t) cvar_get_intVal = #0;
accessor cvar_t : handle
{
get string name = cvar_get_name;
get string str = cvar_get_string;
get string latched_str = cvar_get_latched_string;
get cvar_flags_t flags = cvar_get_flags;
get bool modified = cvar_get_modified;
set bool modified = cvar_set_modified;
get float floatVal = cvar_get_floatVal;
get int intVal = cvar_get_intVal;
};
/*
==============================================================
COLLISION DETECTION
==============================================================
*/
// lower bits are stronger, and will eat weaker brushes completely
typedef enumflags : int
{
CONTENTS_SOLID, // an eye is never valid in a solid
CONTENTS_WINDOW, // translucent, but not watery
CONTENTS_AUX,
CONTENTS_LAVA,
CONTENTS_SLIME,
CONTENTS_WATER,
CONTENTS_MIST,
LAST_VISIBLE_CONTENTS = CONTENTS_MIST,
// remaining contents are non-visible, and don't eat brushes
CONTENTS_AREAPORTAL = 0x8000,
CONTENTS_PLAYERCLIP,
CONTENTS_MONSTERCLIP,
// currents can be added to any other contents, and may be mixed
CONTENTS_CURRENT_0,
CONTENTS_CURRENT_90,
CONTENTS_CURRENT_180,
CONTENTS_CURRENT_270,
CONTENTS_CURRENT_UP,
CONTENTS_CURRENT_DOWN,
CONTENTS_ORIGIN, // removed before bsping an entity
CONTENTS_MONSTER, // should never be on a brush, only in game
CONTENTS_DEADMONSTER,
CONTENTS_DETAIL, // brushes to be added after vis leafs
CONTENTS_TRANSLUCENT, // auto set if any surface has trans
CONTENTS_LADDER,
MASK_ALL = -1,
// content masks
MASK_SOLID = CONTENTS_SOLID | CONTENTS_WINDOW,
MASK_PLAYERSOLID = CONTENTS_SOLID | CONTENTS_PLAYERCLIP | CONTENTS_WINDOW | CONTENTS_MONSTER,
MASK_DEADSOLID = CONTENTS_SOLID | CONTENTS_PLAYERCLIP | CONTENTS_WINDOW,
MASK_MONSTERSOLID = CONTENTS_SOLID | CONTENTS_MONSTERCLIP | CONTENTS_WINDOW | CONTENTS_MONSTER,
MASK_WATER = CONTENTS_WATER | CONTENTS_LAVA | CONTENTS_SLIME,
MASK_OPAQUE = CONTENTS_SOLID | CONTENTS_SLIME | CONTENTS_LAVA,
MASK_SHOT = CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_WINDOW | CONTENTS_DEADMONSTER,
MASK_CURRENT = CONTENTS_CURRENT_0 | CONTENTS_CURRENT_90 | CONTENTS_CURRENT_180 | CONTENTS_CURRENT_270 | CONTENTS_CURRENT_UP | CONTENTS_CURRENT_DOWN
} content_flags_t;
typedef enumflags : int
{
SURF_LIGHT, // value will hold the light strength
SURF_SLICK, // effects game physics
SURF_SKY, // don't draw, but add to skybox
SURF_WARP, // turbulent water warp
SURF_TRANS33,
SURF_TRANS66,
SURF_FLOWING, // scroll towards angle
SURF_NODRAW, // don't bother referencing the texture
SURF_ALPHATEST = 0x02000000 // used by kmquake2
} surface_flags_t;
typedef enum : int
{
AREA_SOLID = 1,
AREA_TRIGGERS = 2
} box_edicts_area_t;
struct csurface_t
{
string name;
surface_flags_t flags;
int value;
};
const csurface_t null_surface = { 0, 0, 0 };
struct trace_t
{
int allsolid;
int startsolid;
float fraction;
vector endpos;
vector normal;
csurface_t surface;
content_flags_t contents;
entity ent;
};
//
// button bits
//
typedef enum : int
{
BUTTON_ATTACK = 1,
BUTTON_USE = 2,
BUTTON_ANY = 128 // any key whatsoever
} button_bits_t;
// usercmd_t is sent to the server each client frame
struct usercmd_t
{
int msec;
button_bits_t buttons;
vector angles;
int forwardmove, sidemove, upmove;
int impulse; // remove?
int lightlevel; // light level the player is standing on
};
// This constant is used in Q2 for movement
const int STEPSIZE = 18;
// The max number of planes to clip moves against
const int MAX_CLIP_PLANES = 5;
// pmove_state_t is the information necessary for client side movement
// prediction
typedef enum : int
{
// can accelerate and turn
PM_NORMAL,
PM_SPECTATOR,
// no acceleration or turning
PM_DEAD,
PM_GIB, // different bounding box
PM_FREEZE
} pmtype_t;
// pmove.pm_flags
typedef enumflags : int
{
PMF_DUCKED,
PMF_JUMP_HELD,
PMF_ON_GROUND,
PMF_TIME_WATERJUMP, // pm_time is waterjump
PMF_TIME_LAND, // pm_time is time before rejump
PMF_TIME_TELEPORT, // pm_time is non-moving time
PMF_NO_PREDICTION, // temporarily disables prediction (used for grappling hook)
PMF_TELEPORT_BIT // used by q2pro
} pmflags_t;
struct pmove_state_t
{
pmtype_t pm_type;
vector origin;
vector velocity;
int pm_flags;
int pm_time;
int gravity;
vector delta_angles;
};
struct pmove_t
{
// inout
pmove_state_t s;
// in
usercmd_t cmd;
bool snapinitial;
entity passent;
content_flags_t mask;
// out
hashset touchents; // this hashset is owned by PMove; don't free
vector viewangles;
float viewheight;
vector mins, maxs;
entity groundentity;
content_flags_t watertype;
int waterlevel;
// in (callbacks)
void(trace_t *tr, vector start, vector mins, vector maxs, vector end) trace;
content_flags_t(vector) pointcontents;
};
// default server FPS
const int BASE_FRAMERATE = 10;
const int BASE_FRAMETIME = 100;
const float BASE_1_FRAMETIME = 1.0 / BASE_FRAMERATE;
const float BASE_FRAMETIME_1000 = BASE_FRAMETIME / 1000.f;
const float FRAMETIME = BASE_FRAMETIME_1000;
//
// server to client
//
typedef enum : int
{
svc_bad,
// these ops are known to the game dll
svc_muzzleflash,
svc_muzzleflash2,
svc_temp_entity,
svc_layout,
svc_inventory,
// the rest are private to the client and server
svc_nop,
svc_disconnect,
svc_reconnect,
svc_sound, // <see code>
svc_print, // [byte] id [string] null terminated string
svc_stufftext, // [string] stuffed into client's console buffer, should be \n terminated
svc_serverdata, // [long] protocol ...
svc_configstring, // [short] [string]
svc_spawnbaseline,
svc_centerprint, // [string] to put in center of the screen
svc_download, // [short] size [size bytes]
svc_playerinfo, // variable
svc_packetentities, // [...]
svc_deltapacketentities, // [...]
svc_frame
} svc_ops_t;
// entity_state_t.effects
// Effects are things handled on the client side (lights, particles, frame animations)
// that happen constantly on the given entity.
// An entity that has effects will be sent to the client
// even if it has a zero index model.
typedef enumflags : int
{
EF_ROTATE, // rotate (bonus items)
EF_GIB, // leave a trail
EF_UNUSED,
EF_BLASTER, // redlight + trail
EF_ROCKET, // redlight + trail
EF_GRENADE,
EF_HYPERBLASTER,
EF_BFG,
EF_COLOR_SHELL,
EF_POWERSCREEN,
EF_ANIM01, // automatically cycle between frames 0 and 1 at 2 hz
EF_ANIM23, // automatically cycle between frames 2 and 3 at 2 hz
EF_ANIM_ALL, // automatically cycle through all frames at 2hz
EF_ANIM_ALLFAST, // automatically cycle through all frames at 10hz
EF_FLIES,
EF_QUAD,
EF_PENT,
EF_TELEPORTER, // particle fountain
EF_FLAG1,
EF_FLAG2,
// RAFAEL
EF_IONRIPPER,
EF_GREENGIB,
EF_BLUEHYPERBLASTER,
EF_SPINNINGLIGHTS,
EF_PLASMA,
EF_TRAP,
// RAFAEL
//ROGUE
EF_TRACKER,
EF_DOUBLE,
EF_SPHERETRANS,
EF_TAGTRAIL,
EF_HALF_DAMAGE,
//ROGUE
EF_TRACKERTRAIL
} entity_effects_t;