-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdpextensions.qc
2668 lines (2448 loc) · 127 KB
/
dpextensions.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
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//DarkPlaces supported extension list, draft version 1.04
//definitions that id Software left out:
//these are passed as the 'nomonsters' parameter to traceline/tracebox (yes really this was supported in all quake engines, nomonsters is misnamed)
float MOVE_NORMAL = 0; // same as FALSE
float MOVE_NOMONSTERS = 1; // same as TRUE
float MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE
//checkextension function
//idea: expected by almost everyone
//darkplaces implementation: LadyHavoc
float(string s) checkextension = #99;
//description:
//check if (cvar("pr_checkextension")) before calling this, this is the only
//guaranteed extension to be present in the extension system, it allows you
//to check if an extension is available, by name, to check for an extension
//use code like this:
//// (it is recommended this code be placed in worldspawn or a worldspawn called function somewhere)
//if (cvar("pr_checkextension"))
//if (checkextension("DP_SV_SETCOLOR"))
// ext_setcolor = TRUE;
//from then on you can check ext_setcolor to know if that extension is available
//BX_WAL_SUPPORT
//idea: id Software
//darkplaces implementation: LadyHavoc
//description:
//indicates the engine supports .wal textures for filenames in the textures/ directory
//(note: DarkPlaces has supported this since 2001 or 2002, but did not advertise it as an extension, then I noticed Betwix was advertising it and added the extension accordingly)
//DP_BUTTONCHAT
//idea: Vermeulen
//darkplaces implementation: LadyHavoc
//field definitions:
.float buttonchat;
//description:
//true if the player is currently chatting (in messagemode, menus or console)
//DP_BUTTONUSE
//idea: id Software
//darkplaces implementation: LadyHavoc
//field definitions:
.float buttonuse;
//client console commands:
//+use
//-use
//description:
//made +use and -use commands work, they now control the .buttonuse field (.button1 was used by many mods for other purposes).
//DP_CL_LOADSKY
//idea: Nehahra, LadyHavoc
//darkplaces implementation: LadyHavoc
//client console commands:
//"loadsky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, use "" to revert to quake sky, note: this is the same as Quake2 skybox naming)
//description:
//sets global skybox for the map for this client (can be stuffed to a client by QC), does not hurt much to repeatedly execute this command, please don't use this in mods if it can be avoided (only if changing skybox is REALLY needed, otherwise please use DP_GFX_SKYBOX).
//DP_CON_SET
//idea: id Software
//darkplaces implementation: LadyHavoc
//description:
//indicates this engine supports the "set" console command which creates or sets a non-archived cvar (not saved to config.cfg on exit), it is recommended that set and seta commands be placed in default.cfg for mod-specific cvars.
//DP_CON_SETA
//idea: id Software
//darkplaces implementation: LadyHavoc
//description:
//indicates this engine supports the "seta" console command which creates or sets an archived cvar (saved to config.cfg on exit), it is recommended that set and seta commands be placed in default.cfg for mod-specific cvars.
//DP_CON_ALIASPARAMETERS
//idea: many
//darkplaces implementation: Black
//description:
//indicates this engine supports aliases containing $1 through $9 parameter macros (which when called will expand to the parameters passed to the alias, for example alias test "say $2 $1", then you can type test hi there and it will execute say there hi), as well as $0 (name of the alias) and $* (all parameters $1 onward).
//DP_CON_EXPANDCVAR
//idea: many, PHP
//darkplaces implementation: Black
//description:
//indicates this engine supports console commandlines containing $cvarname which will expand to the contents of that cvar as a parameter, for instance say my fov is $fov, will say "my fov is 90", or similar.
//DP_CON_STARTMAP
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//description:
//adds two engine-called aliases named startmap_sp and startmap_dm which are called when the engine tries to start a singleplayer game from the menu (startmap_sp) or the -listen or -dedicated options are used or the engine is a dedicated server (uses startmap_dm), these allow a mod or game to specify their own map instead of start, and also distinguish between singleplayer and -listen/-dedicated, also these need not be a simple "map start" command, they can do other things if desired, startmap_sp and startmap_dm both default to "map start".
//DP_EF_ADDITIVE
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//effects bit:
float EF_ADDITIVE = 32;
//description:
//additive blending when this object is rendered
//DP_EF_BLUE
//idea: id Software
//darkplaces implementation: LadyHavoc
//effects bit:
float EF_BLUE = 64;
//description:
//entity emits blue light (used for quad)
//DP_EF_DOUBLESIDED
//idea: LadyHavoc
//darkplaces implementation: [515] and LadyHavoc
//effects bit:
float EF_DOUBLESIDED = 32768;
//description:
//render entity as double sided (backfaces are visible, I.E. you see the 'interior' of the model, rather than just the front), can be occasionally useful on transparent stuff.
//DP_EF_DYNAMICMODELLIGHT
//idea: C.Brutail, divVerent, maikmerten
//darkplaces implementation: divVerent
//effects bit:
float EF_DYNAMICMODELLIGHT = 131072;
//description:
//force dynamic model light on the entity, even if it's a BSP model (or anything else with lightmaps or light colors)
//DP_EF_FLAME
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//effects bit:
float EF_FLAME = 1024;
//description:
//entity is on fire
//DP_EF_FULLBRIGHT
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//effects bit:
float EF_FULLBRIGHT = 512;
//description:
//entity is always brightly lit
//DP_EF_NODEPTHTEST
//idea: Supa
//darkplaces implementation: LadyHavoc
//effects bit:
float EF_NODEPTHTEST = 8192;
//description:
//makes entity show up to client even through walls, useful with EF_ADDITIVE for special indicators like where team bases are in a map, so that people don't get lost
//DP_EF_NODRAW
//idea: id Software
//darkplaces implementation: LadyHavoc
//effects bit:
float EF_NODRAW = 16;
//description:
//prevents server from sending entity to client (forced invisible, even if it would have been a light source or other such things)
//DP_EF_NOGUNBOB
//idea: Chris Page, Dresk
//darkplaces implementation: LadyHavoc
//effects bit:
float EF_NOGUNBOB = 256;
//description:
//this has different meanings depending on the entity it is used on:
//player entity - prevents gun bobbing on player.viewmodel
//viewmodelforclient entity - prevents gun bobbing on an entity attached to the player's view
//other entities - no effect
//uses:
//disabling gun bobbing on a diving mask or other model used as a .viewmodel.
//disabling gun bobbing on view-relative models meant to be part of the heads up display. (note: if fov is changed these entities may be off-screen, or too near the center of the screen, so use fov 90 in this case)
//DP_EF_NOSHADOW
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//effects bit:
float EF_NOSHADOW = 4096;
//description:
//realtime lights will not cast shadows from this entity (but can still illuminate it)
//DP_EF_RED
//idea: id Software
//darkplaces implementation: LadyHavoc
//effects bit:
float EF_RED = 128;
//description:
//entity emits red light (used for invulnerability)
//DP_EF_RESTARTANIM_BIT
//idea: id software
//darkplaces implementation: divVerent
//effects bit:
float EF_RESTARTANIM_BIT = 1048576;
//description:
//when toggled, the current animation is restarted. Useful for weapon animation.
//to toggle this bit in QC, you can do:
// self.effects += (EF_RESTARTANIM_BIT - 2 * (self.effects & EF_RESTARTANIM_BIT));
//DP_EF_STARDUST
//idea: MythWorks Inc
//darkplaces implementation: LadyHavoc
//effects bit:
float EF_STARDUST = 2048;
//description:
//entity emits bouncing sparkles in every direction
//DP_EF_TELEPORT_BIT
//idea: id software
//darkplaces implementation: divVerent
//effects bit:
float EF_TELEPORT_BIT = 2097152;
//description:
//when toggled, interpolation of the entity is skipped for one frame. Useful for teleporting.
//to toggle this bit in QC, you can do:
// self.effects += (EF_TELEPORT_BIT - 2 * (self.effects & EF_TELEPORT_BIT));
//DP_ENT_ALPHA
//idea: Nehahra
//darkplaces implementation: LadyHavoc
//fields:
.float alpha;
//description:
//controls opacity of the entity, 0.0 is forced to be 1.0 (otherwise everything would be invisible), use -1 if you want to make something invisible, 1.0 is solid (like normal).
//DP_ENT_COLORMOD
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//field definition:
.vector colormod;
//description:
//controls color of the entity, '0 0 0', is forced to be '1 1 1' (otherwise everything would be black), used for tinting objects, for instance using '1 0.6 0.4' on an ogre would give you an orange ogre (order is red green blue), note the colors can go up to '8 8 8' (8x as bright as normal).
//DP_ENT_CUSTOMCOLORMAP
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//description:
//if .colormap is set to 1024 + pants + shirt * 16, those colors will be used for colormapping the entity, rather than looking up a colormap by player number.
/*
//NOTE: no longer supported by darkplaces because all entities are delta compressed now
//DP_ENT_DELTACOMPRESS // no longer supported
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//effects bit:
float EF_DELTA = 8388608;
//description:
//(obsolete) applies delta compression to the network updates of the entity, making updates smaller, this might cause some unreliable behavior in packet loss situations, so it should only be used on numerous (nails/plasma shots/etc) or unimportant objects (gibs/shell casings/bullet holes/etc).
*/
//DP_ENT_EXTERIORMODELTOCLIENT
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//fields:
.entity exteriormodeltoclient;
//description:
//the entity is visible to all clients with one exception: if the specified client is using first person view (not using chase_active) the entity will not be shown. Also if tag attachments are supported any entities attached to the player entity will not be drawn in first person.
//DP_ENT_GLOW
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//field definitions:
.float glow_color;
.float glow_size;
.float glow_trail;
//description:
//customizable glowing light effect on the entity, glow_color is a paletted (8bit) color in the range 0-255 (note: 0 and 254 are white), glow_size is 0 or higher (up to the engine what limit to cap it to, darkplaces imposes a 1020 limit), if glow_trail is true it will leave a trail of particles of the same color as the light.
//DP_ENT_GLOWMOD
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//field definition:
.vector glowmod;
//description:
//controls color of the entity's glow texture (fullbrights), '0 0 0', is forced to be '1 1 1' (otherwise everything would be black), used for tinting objects, see colormod (same color restrictions apply).
//DP_ENT_LOWPRECISION
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//effects bit:
float EF_LOWPRECISION = 4194304;
//description:
//uses low quality origin coordinates, reducing network traffic compared to the default high precision, intended for numerous objects (projectiles/gibs/bullet holes/etc).
//DP_ENT_SCALE
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//field definitions:
.float scale;
//description:
//controls rendering scale of the object, 0 is forced to be 1, darkplaces uses 1/16th accuracy and a limit of 15.9375, can be used to make an object larger or smaller.
//DP_ENT_TRAILEFFECTNUM
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//field definitions:
.float traileffectnum;
//description:
//use a custom effectinfo.txt effect on this entity, assign it like this:
//self.traileffectnum = particleeffectnum("mycustomeffect");
//this will do both the dlight and particle trail as described in the effect, basically equivalent to trailparticles() in CSQC but performed on a server entity.
//DP_ENT_VIEWMODEL
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//field definitions:
.entity viewmodelforclient;
//description:
//this is a very special capability, attachs the entity to the view of the client specified, origin and angles become relative to the view of that client, all effects can be used (multiple skins on a weapon model etc)... the entity is not visible to any other client.
//DP_GFX_EXTERNALTEXTURES
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//description:
//loads external textures found in various directories (tenebrae compatible)...
/*
in all examples .tga is merely the base texture, it can be any of these:
.tga (base texture)
_glow.tga (fullbrights or other glowing overlay stuff, NOTE: this is done using additive blend, not alpha)
_pants.tga (pants overlay for colormapping on models, this should be shades of grey (it is tinted by pants color) and black wherever the base texture is not black, as this is an additive blend)
_shirt.tga (same idea as pants, but for shirt color)
_diffuse.tga (this may be used instead of base texture for per pixel lighting)
_gloss.tga (specular texture for per pixel lighting, note this can be in color (tenebrae only supports greyscale))
_norm.tga (normalmap texture for per pixel lighting)
_bump.tga (bumpmap, converted to normalmap at load time, supported only for reasons of tenebrae compatibility)
_luma.tga (same as _glow but supported only for reasons of tenebrae compatibility)
due to glquake's incomplete Targa(r) loader, this section describes
required Targa(r) features support:
types:
type 1 (uncompressed 8bit paletted with 24bit/32bit palette)
type 2 (uncompressed 24bit/32bit true color, glquake supported this)
type 3 (uncompressed 8bit greyscale)
type 9 (RLE compressed 8bit paletted with 24bit/32bit palette)
type 10 (RLE compressed 24bit/32bit true color, glquake supported this)
type 11 (RLE compressed 8bit greyscale)
attribute bit 0x20 (Origin At Top Left, top to bottom, left to right)
image formats guaranteed to be supported: tga, pcx, lmp
image formats that are optional: png, jpg
mdl/spr/spr32 examples:
skins are named _A (A being a number) and skingroups are named like _A_B
these act as suffixes on the model name...
example names for skin _2_1 of model "progs/armor.mdl":
game/override/progs/armor.mdl_2_1.tga
game/textures/progs/armor.mdl_2_1.tga
game/progs/armor.mdl_2_1.tga
example names for skin _0 of the model "progs/armor.mdl":
game/override/progs/armor.mdl_0.tga
game/textures/progs/armor.mdl_0.tga
game/progs/armor.mdl_0.tga
note that there can be more skins files (of the _0 naming) than the mdl
contains, this is only useful to save space in the .mdl file if classic quake
compatibility is not a concern.
bsp/md2/md3 examples:
example names for the texture "quake" of model "maps/start.bsp":
game/override/quake.tga
game/textures/quake.tga
game/quake.tga
sbar/menu/console textures: for example the texture "conchars" (console font) in gfx.wad
game/override/gfx/conchars.tga
game/textures/gfx/conchars.tga
game/gfx/conchars.tga
*/
//DP_GFX_EXTERNALTEXTURES_PERMAPTEXTURES
//idea: Fuh?
//darkplaces implementation: LadyHavoc
//description:
//Q1BSP and HLBSP map loading loads external textures found in textures/<mapname>/ as well as textures/.
//Where mapname is the bsp filename minus the extension (typically .bsp) and minus maps/ if it is in maps/ (any other path is not removed)
//example:
//maps/e1m1.bsp uses textures in the directory textures/e1m1/ and falls back to textures/
//maps/b_batt0.bsp uses textures in the directory textures/b_batt0.bsp and falls back to textures/
//as a more extreme example:
//progs/something/blah.bsp uses textures in the directory textures/progs/something/blah/ and falls back to textures/
//DP_GFX_FOG
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//worldspawn fields:
//"fog" (parameters: "density red green blue", example: "0.1 0.3 0.3 0.3")
//description:
//global fog for the map, can not be changed by QC
//DP_GFX_QUAKE3MODELTAGS
//idea: id Software
//darkplaces implementation: LadyHavoc
//field definitions:
.entity tag_entity; // entity this is attached to (call setattachment to set this)
.float tag_index; // which tag on that entity (0 is relative to the entity, > 0 is an index into the tags on the model if it has any) (call setattachment to set this)
//builtin definitions:
void(entity e, entity tagentity, string tagname) setattachment = #443; // attachs e to a tag on tagentity (note: use "" to attach to entity origin/angles instead of a tag)
//description:
//allows entities to be visually attached to model tags (which follow animations perfectly) on other entities, for example attaching a weapon to a player's hand, or upper body attached to lower body, allowing it to change angles and frame separately (note: origin and angles are relative to the tag, use '0 0 0' for both if you want it to follow exactly, this is similar to viewmodelforclient's behavior).
//note 2: if the tag is not found, it defaults to "" (attach to origin/angles of entity)
//note 3: attaching to world turns off attachment
//note 4: the entity that this is attached to must be visible for this to work
//note 5: if an entity is attached to the player entity it will not be drawn in first person.
//DP_GFX_SKINFILES
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//description:
//alias models (mdl, md2, md3) can have .skin files to replace conventional texture naming, these have a naming format such as:
//progs/test.md3_0.skin
//progs/test.md3_1.skin
//...
//
//these files contain replace commands (replace meshname shadername), example:
//replace "helmet" "progs/test/helmet1.tga" // this is a mesh shader replacement
//replace "teamstripes" "progs/test/redstripes.tga"
//replace "visor" "common/nodraw" // this makes the visor mesh invisible
////it is not possible to rename tags using this format
//
//Or the Quake3 syntax (100% compatible with Quake3's .skin files):
//helmet,progs/test/helmet1.tga // this is a mesh shader replacement
//teamstripes,progs/test/redstripes.tga
//visor,common/nodraw // this makes the visor mesh invisible
//tag_camera, // this defines that the first tag in the model is called tag_camera
//tag_test, // this defines that the second tag in the model is called tag_test
//
//any names that are not replaced are automatically show up as a grey checkerboard to indicate the error status, and "common/nodraw" is a special case that is invisible.
//this feature is intended to allow multiple skin sets on md3 models (which otherwise only have one skin set).
//other commands might be added someday but it is not expected.
//DP_GFX_SKYBOX
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//worldspawn fields:
//"sky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, note: "sky" is also used the same way by Quake2)
//description:
//global skybox for the map, can not be changed by QC
//DP_UTF8
//idea: Blub\0, divVerent
//darkplaces implementation: Blub\0
//cvar definitions:
// utf8_enable: enable utf8 encoding
//description: utf8 characters are allowed inside cvars, protocol strings, files, progs strings, etc.,
//and count as 1 char for string functions like strlen, substring, etc.
// note: utf8_enable is run-time cvar, could be changed during execution
// note: beware that str2chr() could return value bigger than 255 once utf8 is enabled
//DP_HALFLIFE_MAP
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//description:
//simply indicates that the engine supports HalfLife maps (BSP version 30, NOT the QER RGBA ones which are also version 30).
//DP_HALFLIFE_MAP_CVAR
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//cvars:
//halflifebsp 0/1
//description:
//engine sets this cvar when loading a map to indicate if it is halflife format or not.
//DP_HALFLIFE_SPRITE
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//description:
//simply indicates that the engine supports HalfLife sprites.
//DP_INPUTBUTTONS
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//field definitions:
.float button3;
.float button4;
.float button5;
.float button6;
.float button7;
.float button8;
.float button9;
.float button10;
.float button11;
.float button12;
.float button13;
.float button14;
.float button15;
.float button16;
//description:
//set to the state of the +button3, +button4, +button5, +button6, +button7, and +button8 buttons from the client, this does not involve protocol changes (the extra 6 button bits were simply not used).
//the exact mapping of protocol button bits on the server is:
//self.button0 = (bits & 1) != 0;
///* button1 is skipped because mods abuse it as a variable, and accordingly it has no bit */
//self.button2 = (bits & 2) != 0;
//self.button3 = (bits & 4) != 0;
//self.button4 = (bits & 8) != 0;
//self.button5 = (bits & 16) != 0;
//self.button6 = (bits & 32) != 0;
//self.button7 = (bits & 64) != 0;
//self.button8 = (bits & 128) != 0;
// DP_LIGHTSTYLE_STATICVALUE
// idea: VorteX
// darkplaces implementation: VorteX
// description: allows alternative 'static' lightstyle syntax : "=value"
// examples: "=0.5", "=2.0", "=2.75"
// could be used to control switchable lights or making styled lights with brightness > 2
// Warning: this extension is experimental. It safely works in CSQC, but SVQC use is limited by the fact
// that other engines (which do not support this extension) could connect to a game and misunderstand this kind of lightstyle syntax
//DP_LITSPRITES
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//description:
//indicates this engine supports lighting on sprites, any sprite with ! in its filename (both on disk and in the qc) will be lit rather than having forced EF_FULLBRIGHT (EF_FULLBRIGHT on the entity can still force these sprites to not be lit).
//DP_LITSUPPORT
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//description:
//indicates this engine loads .lit files for any quake1 format .bsp files it loads to enhance maps with colored lighting.
//implementation description: these files begin with the header QLIT followed by version number 1 (as little endian 32bit), the rest of the file is a replacement lightmaps lump, except being 3x as large as the lightmaps lump of the map it matches up with (and yes the between-lightmap padding is expanded 3x to keep this consistent), so the lightmap offset in each surface is simply multiplied by 3 during loading to properly index the lit data, and the lit file is loaded instead of the lightmap lump, other renderer changes are needed to display these of course... see the litsupport.zip sample code (almost a tutorial) at http://icculus.org/twilight/darkplaces for more information.
//DP_MONSTERWALK
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//description:
//MOVETYPE_WALK is permitted on non-clients, so bots can move smoothly, run off ledges, etc, just like a real player.
//DP_MOVETYPEBOUNCEMISSILE
//idea: id Software
//darkplaces implementation: id Software
//movetype definitions:
//float MOVETYPE_BOUNCEMISSILE = 11; // already in defs.qc
//description:
//MOVETYPE_BOUNCE but without gravity, and with full reflection (no speed loss like grenades have), in other words - bouncing laser bolts.
//DP_MOVETYPEFLYWORLDONLY
//idea: Samual
//darkplaces implementation: Samual
//movetype definitions:
float MOVETYPE_FLY_WORLDONLY = 33;
//description:
//like MOVETYPE_FLY, but does all traces with MOVE_WORLDONLY, and is ignored by MOVETYPE_PUSH. Should only be combined with SOLID_NOT and SOLID_TRIGGER.
//DP_NULL_MODEL
//idea: Chris
//darkplaces implementation: divVerent
//definitions:
//string dp_null_model = "null";
//description:
//setmodel(e, "null"); makes an entity invisible, have a zero bbox, but
//networked. useful for shared CSQC entities.
//DP_MOVETYPEFOLLOW
//idea: id Software, LadyHavoc (redesigned)
//darkplaces implementation: LadyHavoc
//movetype definitions:
float MOVETYPE_FOLLOW = 12;
//description:
//MOVETYPE_FOLLOW implemented, this uses existing entity fields in unusual ways:
//aiment - the entity this is attached to.
//punchangle - the original angles when the follow began.
//view_ofs - the relative origin (note that this is un-rotated by punchangle, and that is actually the only purpose of punchangle).
//v_angle - the relative angles.
//here's an example of how you would set a bullet hole sprite to follow a bmodel it was created on, even if the bmodel rotates:
//hole.movetype = MOVETYPE_FOLLOW; // make the hole follow
//hole.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid
//hole.aiment = bmodel; // make the hole follow bmodel
//hole.punchangle = bmodel.angles; // the original angles of bmodel
//hole.view_ofs = hole.origin - bmodel.origin; // relative origin
//hole.v_angle = hole.angles - bmodel.angles; // relative angles
//DP_QC_ASINACOSATANATAN2TAN
//idea: Urre
//darkplaces implementation: LadyHavoc
//constant definitions:
float DEG2RAD = 0.0174532925199432957692369076848861271344287188854172545609719144;
float RAD2DEG = 57.2957795130823208767981548141051703324054724665643215491602438612;
float PI = 3.1415926535897932384626433832795028841971693993751058209749445923;
//builtin definitions:
float(float s) asin = #471; // returns angle in radians for a given sin() value, the result is in the range -PI*0.5 to PI*0.5
float(float c) acos = #472; // returns angle in radians for a given cos() value, the result is in the range 0 to PI
float(float t) atan = #473; // returns angle in radians for a given tan() value, the result is in the range -PI*0.5 to PI*0.5
float(float c, float s) atan2 = #474; // returns angle in radians for a given cos() and sin() value pair, the result is in the range -PI to PI (this is identical to vectoyaw except it returns radians rather than degrees)
float(float a) tan = #475; // returns tangent value (which is simply sin(a)/cos(a)) for the given angle in radians, the result is in the range -infinity to +infinity
//description:
//useful math functions for analyzing vectors, note that these all use angles in radians (just like the cos/sin functions) not degrees unlike makevectors/vectoyaw/vectoangles, so be sure to do the appropriate conversions (multiply by DEG2RAD or RAD2DEG as needed).
//note: atan2 can take unnormalized vectors (just like vectoyaw), and the function was included only for completeness (more often you want vectoyaw or vectoangles), atan2(v_x,v_y) * RAD2DEG gives the same result as vectoyaw(v)
//DP_QC_AUTOCVARS
//idea: divVerent
//darkplaces implementation: divVerent
//description:
//allows QC variables to be bound to cvars
//(works for float, string, vector types)
//example:
// float autocvar_developer;
// float autocvar_registered;
// string autocvar__cl_name;
//NOTE: copying a string-typed autocvar to another variable/field, and then
//changing the cvar or returning from progs is UNDEFINED. Writing to autocvar
//globals is UNDEFINED. Accessing autocvar globals after changing that cvar in
//the same frame by any means other than cvar_set() from the same QC VM is
//IMPLEMENTATION DEFINED (an implementation may either yield the previous, or
//the current, value). Changing them via cvar_set() in the same QC VM
//immediately must reflect on the autocvar globals. Whether autocvar globals,
//after restoring a savegame, have the cvar's current value, or the original
//value at time of saving, is UNDEFINED. Restoring a savegame however must not
//restore the cvar values themselves.
//In case the cvar does NOT exist, then it is automatically created with the
//value of the autocvar initializer, if given. This is possible with e.g.
//frikqcc and fteqcc the following way:
// var float autocvar_whatever = 42;
//If no initializer is given, the cvar will be initialized to a string
//equivalent to the NULL value of the given data type, that is, the empty
//string, 0, or '0 0 0'. However, when automatic cvar creation took place, a
//warning is printed to the game console.
//NOTE: to prevent an ambiguity with float names for vector types, autocvar
//names MUST NOT end with _x, _y or _z!
//DP_QC_CHANGEPITCH
//idea: id Software
//darkplaces implementation: id Software
//field definitions:
.float idealpitch;
.float pitch_speed;
//builtin definitions:
void(entity ent) changepitch = #63;
//description:
//equivalent to changeyaw, ent is normally self. (this was a Q2 builtin)
//DP_QC_COPYENTITY
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//builtin definitions:
void(entity from, entity to) copyentity = #400;
//description:
//copies all data in the entity to another entity.
//DP_QC_CRC16
//idea: divVerent
//darkplaces implementation: divVerent
//Some hash function to build hash tables with. This has to be be the CRC-16-CCITT that is also required for the QuakeWorld download protocol.
//When caseinsensitive is set, the CRC is calculated of the lower cased string.
float(float caseinsensitive, string s, ...) crc16 = #494;
//DP_QC_CVAR_DEFSTRING
//idea: id Software (Doom3), LadyHavoc
//darkplaces implementation: LadyHavoc
//builtin definitions:
string(string s) cvar_defstring = #482;
//description:
//returns the default value of a cvar, as a tempstring.
//DP_QC_CVAR_DESCRIPTION
//idea: divVerent
//DarkPlaces implementation: divVerent
//builtin definitions:
string(string name) cvar_description = #518;
//description:
//returns the description of a cvar
//DP_QC_CVAR_STRING
//idea: VorteX
//DarkPlaces implementation: VorteX, LadyHavoc
//builtin definitions:
string(string s) cvar_string = #448;
//description:
//returns the value of a cvar, as a tempstring.
//DP_QC_CVAR_TYPE
//idea: divVerent
//DarkPlaces implementation: divVerent
//builtin definitions:
float(string name) cvar_type = #495;
float CVAR_TYPEFLAG_EXISTS = 1;
float CVAR_TYPEFLAG_SAVED = 2;
float CVAR_TYPEFLAG_PRIVATE = 4;
float CVAR_TYPEFLAG_ENGINE = 8;
float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
float CVAR_TYPEFLAG_READONLY = 32;
//DP_QC_DIGEST
//idea: motorsep, Spike
//DarkPlaces implementation: divVerent
//builtin definitions:
string(string digest, string data, ...) digest_hex = #639;
//description:
//returns a given hex digest of given data
//the returned digest is always encoded in hexadecimal
//only the "MD4" digest is always supported!
//if the given digest is not supported, string_null is returned
//the digest string is matched case sensitively, use "MD4", not "md4"!
//DP_QC_DIGEST_SHA256
//idea: motorsep, Spike
//DarkPlaces implementation: divVerent
//description:
//"SHA256" is also an allowed digest type
//DP_QC_EDICT_NUM
//idea: 515
//DarkPlaces implementation: LadyHavoc
//builtin definitions:
entity(float entnum) edict_num = #459;
float(entity ent) wasfreed = #353; // same as in EXT_CSQC extension
//description:
//edict_num returns the entity corresponding to a given number, this works even for freed entities, but you should call wasfreed(ent) to see if is currently active.
//wasfreed returns whether an entity slot is currently free (entities that have never spawned are free, entities that have had remove called on them are also free).
//DP_QC_ENTITYDATA
//idea: KrimZon
//darkplaces implementation: KrimZon
//builtin definitions:
float() numentityfields = #496;
string(float fieldnum) entityfieldname = #497;
float(float fieldnum) entityfieldtype = #498;
string(float fieldnum, entity ent) getentityfieldstring = #499;
float(float fieldnum, entity ent, string s) putentityfieldstring = #500;
//constants:
//Returned by entityfieldtype
float FIELD_STRING = 1;
float FIELD_FLOAT = 2;
float FIELD_VECTOR = 3;
float FIELD_ENTITY = 4;
float FIELD_FUNCTION = 6;
//description:
//Versatile functions intended for storing data from specific entities between level changes, but can be customized for some kind of partial savegame.
//WARNING: .entity fields cannot be saved and restored between map loads as they will leave dangling pointers.
//numentityfields returns the number of entity fields. NOT offsets. Vectors comprise 4 fields: v, v_x, v_y and v_z.
//entityfieldname returns the name as a string, eg. "origin" or "classname" or whatever.
//entityfieldtype returns a value that the constants represent, but the field may be of another type in more exotic progs.dat formats or compilers.
//getentityfieldstring returns data as would be written to a savegame, eg... "0.05" (float), "0 0 1" (vector), or "Hello World!" (string). Function names can also be returned.
//putentityfieldstring puts the data returned by getentityfieldstring back into the entity.
//DP_QC_ENTITYSTRING
void(string s) loadfromdata = #529;
void(string s) loadfromfile = #530;
void(string s) callfunction = #605;
void(float fh, entity e) writetofile = #606;
float(string s) isfunction = #607;
void(entity e, string s) parseentitydata = #608;
//DP_QC_ETOS
//idea: id Software
//darkplaces implementation: id Software
//builtin definitions:
string(entity ent) etos = #65;
//description:
//prints "entity 1" or similar into a string. (this was a Q2 builtin)
//DP_QC_EXTRESPONSEPACKET
//idea: divVerent
//darkplaces implementation: divVerent
//builtin definitions:
string(void) getextresponse = #624;
//description:
//returns a string of the form "\"ipaddress:port\" data...", or the NULL string
//if no packet was found. Packets can be queued into the client/server by
//sending a packet starting with "\xFF\xFF\xFF\xFFextResponse " to the
//listening port.
//DP_QC_FINDCHAIN
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//builtin definitions:
entity(.string fld, string match) findchain = #402;
//description:
//similar to find() but returns a chain of entities like findradius.
//DP_QC_FINDCHAIN_TOFIELD
//idea: divVerent
//darkplaces implementation: divVerent
//builtin definitions:
entity(vector org, float rad, .entity tofield) findradius_tofield = #22;
entity(.string fld, string match, .entity tofield) findchain_tofield = #402;
entity(.float fld, float match, .entity tofield) findchainflags_tofield = #450;
entity(.float fld, float match, .entity tofield) findchainfloat_tofield = #403;
//description:
//similar to findchain() etc, but stores the chain into .tofield instead of .chain
//actually, the .entity tofield is an optional field of the the existing findchain* functions
//DP_QC_FINDCHAINFLAGS
//idea: Sajt
//darkplaces implementation: LadyHavoc
//builtin definitions:
entity(.float fld, float match) findchainflags = #450;
//description:
//similar to findflags() but returns a chain of entities like findradius.
//DP_QC_FINDCHAINFLOAT
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//builtin definitions:
entity(.entity fld, entity match) findchainentity = #403;
entity(.float fld, float match) findchainfloat = #403;
//description:
//similar to findentity()/findfloat() but returns a chain of entities like findradius.
//DP_QC_FINDFLAGS
//idea: Sajt
//darkplaces implementation: LadyHavoc
//builtin definitions:
entity(entity start, .float fld, float match) findflags = #449;
//description:
//finds an entity with the specified flag set in the field, similar to find()
//DP_QC_FINDFLOAT
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//builtin definitions:
entity(entity start, .entity fld, entity match) findentity = #98;
entity(entity start, .float fld, float match) findfloat = #98;
//description:
//finds an entity or float field value, similar to find(), but for entity and float fields.
//DP_QC_FS_SEARCH
//idea: Black
//darkplaces implementation: Black
//builtin definitions:
float(string pattern, float caseinsensitive, float quiet) search_begin = #444;
void(float handle) search_end = #445;
float(float handle) search_getsize = #446;
string(float handle, float num) search_getfilename = #447;
//description:
//search_begin performs a filename search with the specified pattern (for example "maps/*.bsp") and stores the results in a search slot (minimum of 128 supported by any engine with this extension), the other functions take this returned search slot number, be sure to search_free when done (they are also freed on progs reload).
//search_end frees a search slot (also done at progs reload).
//search_getsize returns how many filenames were found.
//search_getfilename returns a filename from the search.
//DP_QC_GETLIGHT
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//builtin definitions:
vector(vector org) getlight = #92;
//description:
//returns the lighting at the requested location (in color), 0-255 range (can exceed 255).
//DP_QC_GETSURFACE
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//builtin definitions:
float(entity e, float s) getsurfacenumpoints = #434;
vector(entity e, float s, float n) getsurfacepoint = #435;
vector(entity e, float s) getsurfacenormal = #436;
string(entity e, float s) getsurfacetexture = #437;
float(entity e, vector p) getsurfacenearpoint = #438;
vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
//description:
//functions to query surface information.
//DP_QC_GETSURFACEPOINTATTRIBUTE
//idea: BlackHC
//darkplaces implementation: BlackHC
// constants
float SPA_POSITION = 0;
float SPA_S_AXIS = 1;
float SPA_T_AXIS = 2;
float SPA_R_AXIS = 3; // same as SPA_NORMAL
float SPA_TEXCOORDS0 = 4;
float SPA_LIGHTMAP0_TEXCOORDS = 5;
float SPA_LIGHTMAP0_COLOR = 6;
//builtin definitions:
vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
//description:
//function to query extended information about a point on a certain surface
//DP_QC_GETSURFACETRIANGLE
//idea: divVerent
//darkplaces implementation: divVerent
//builtin definitions:
float(entity e, float s) getsurfacenumtriangles = #628;
vector(entity e, float s, float n) getsurfacetriangle = #629;
//description:
//function to query triangles of a surface
//DP_QC_GETTAGINFO
//idea: VorteX, LadyHavoc
//DarkPlaces implementation: VorteX
//builtin definitions:
float(entity ent, string tagname) gettagindex = #451;
vector(entity ent, float tagindex) gettaginfo = #452;
//description:
//gettagindex returns the number of a tag on an entity, this number is the same as set by setattachment (in the .tag_index field), allowing the qc to save a little cpu time by keeping the number around if it wishes (this could already be done by calling setattachment and saving off the tag_index).
//gettaginfo returns the origin of the tag in worldspace and sets v_forward, v_right, and v_up to the current orientation of the tag in worldspace, this automatically resolves all dependencies (attachments, including viewmodelforclient), this means you could fire a shot from a tag on a gun entity attached to the view for example.
//DP_QC_GETTAGINFO_BONEPROPERTIES
//idea: daemon
//DarkPlaces implementation: divVerent
//global definitions:
float gettaginfo_parent;
string gettaginfo_name;
vector gettaginfo_offset;
vector gettaginfo_forward;
vector gettaginfo_right;
vector gettaginfo_up;
//description:
//when this extension is present, gettaginfo fills in some globals with info about the bone that had been queried
//gettaginfo_parent is set to the number of the parent bone, or 0 if it is a root bone
//gettaginfo_name is set to the name of the bone whose index had been specified in gettaginfo
//gettaginfo_offset, gettaginfo_forward, gettaginfo_right, gettaginfo_up contain the transformation matrix of the bone relative to its parent. Note that the matrix may contain a scaling component.
//DP_QC_GETTIME
//idea: tZork
//darkplaces implementation: tZork, divVerent
//constant definitions:
float GETTIME_FRAMESTART = 0; // time of start of frame relative to an arbitrary point in time
float GETTIME_REALTIME = 1; // current absolute time (OS specific)
float GETTIME_HIRES = 2; // like REALTIME, but may reset between QC invocations and thus can be higher precision
float GETTIME_UPTIME = 3; // time of start of frame since start of the engine
//builtin definitions:
float(float tmr) gettime = #519;
//description:
//some timers to query...
//DP_QC_GETTIME_CDTRACK
//idea: divVerent
//darkplaces implementation: divVerent
//constant definitions:
float GETTIME_CDTRACK = 4;
//description:
//returns the playing time of the current cdtrack when passed to gettime()
//see DP_END_GETSOUNDTIME for similar functionality but for entity sound channels
//DP_QC_I18N
//idea: divVerent
//darkplaces implementation: divVerent
//description:
//
//The engine supports translating by gettext compatible .po files.
//progs.dat uses progs.dat.<LANGUAGE>.po
//menu.dat uses menu.dat.<LANGUAGE>.po
//csprogs.dat uses csprogs.dat.<LANGUAGE>.po
//
//To create a string that can be translated, define it as
// string dotranslate_FILENOTFOUND = "File not found";
//Note: if the compiler does constant folding, this will only work if there is
//no other "File not found" string in the progs!
//
//Alternatively, if using the Xonotic patched fteqcc compiler, you can simplify
//this by using _("File not found") directly in the source code.
//
//The language is set by the "prvm_language" cvar: if prvm_language is set to
//"de", it will read progs.dat.de.po for translating strings in progs.dat.
//
//If prvm_language is set to the special name "dump", progs.dat.pot will be
//written, which is a translation template to be edited by filling out the
//msgstr entries.
//DP_QC_LOG
//darkplaces implementation: divVerent
//builtin definitions:
float log(float f) = #532;
//description:
//logarithm
//DP_QC_MINMAXBOUND
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//builtin definitions:
float(float a, float b, ...) min = #94;
float(float a, float b, float c) min3 = #94;
float(float a, float b, float c, float d) min4 = #94;
float(float a, float b, float c, float d, float e) min5 = #94;
float(float a, float b, float c, float d, float e, float f) min6 = #94;
float(float a, float b, float c, float d, float e, float f, float g) min7 = #94;
float(float a, float b, float c, float d, float e, float f, float g, float h) min8 = #94;
float(float a, float b, ...) max = #95;
float(float a, float b, float c) max3 = #95;
float(float a, float b, float c, float d) max4 = #95;
float(float a, float b, float c, float d, float e) max5 = #95;
float(float a, float b, float c, float d, float e, float f) max6 = #95;
float(float a, float b, float c, float d, float e, float f, float g) max7 = #95;
float(float a, float b, float c, float d, float e, float f, float g, float h) max8 = #95;
float(float minimum, float val, float maximum) bound = #96;
//description:
//min returns the lowest of all the supplied numbers.
//max returns the highest of all the supplied numbers.
//bound clamps the value to the range and returns it.
//DP_QC_MULTIPLETEMPSTRINGS
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//description:
//this extension makes all builtins returning tempstrings (ftos for example)
//cycle through a pool of multiple tempstrings (at least 16), allowing
//multiple ftos results to be gathered before putting them to use, normal
//quake only had 1 tempstring, causing many headaches.
//
//Note that for longer term storage (or compatibility on engines having
//FRIK_FILE but not this extension) the FRIK_FILE extension's
//strzone/strunzone builtins provide similar functionality (slower though).
//
//NOTE: this extension is superseded by DP_QC_UNLIMITEDTEMPSTRINGS
//DP_QC_NUM_FOR_EDICT
//idea: Blub\0
//darkplaces implementation: Blub\0
//Function to get the number of an entity - a clean way.
float(entity num) num_for_edict = #512;
//DP_QC_RANDOMVEC
//idea: LadyHavoc
//darkplaces implementation: LadyHavoc
//builtin definitions:
vector() randomvec = #91;
//description:
//returns a vector of length < 1, much quicker version of this QC: do {v_x = random()*2-1;v_y = random()*2-1;v_z = random()*2-1;} while(vlen(v) > 1)