]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/dpdefs/csprogsdefs.qh
Merge branch 'master' into TimePath/experiments/csqc_prediction
[xonotic/xonotic-data.pk3dir.git] / qcsrc / dpdefs / csprogsdefs.qh
1 #ifndef CSPROGSDEFS_H
2 #define CSPROGSDEFS_H
3 /*
4 ==============================================================================
5
6                         SOURCE FOR GLOBALVARS_T C STRUCTURE
7                         MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
8
9 ==============================================================================
10 */
11
12 //
13 // system globals
14 //
15 entity          self;
16 entity          other;
17 entity          world;
18 float           time;
19 float           frametime;
20
21 int             player_localentnum;     //the entnum
22 int             player_localnum;        //the playernum
23 float           maxclients;     //a constant filled in by the engine. gah, portability eh?
24
25 float           clientcommandframe;     //player movement
26 float           servercommandframe;     //clientframe echoed off the server
27
28 string          mapname;
29
30 //
31 // global variables set by built in functions
32 //
33 vector          v_forward, v_up, v_right;       // set by makevectors()
34
35 // set by traceline / tracebox
36 float           trace_allsolid;
37 float           trace_startsolid;
38 float           trace_fraction;
39 vector          trace_endpos;
40 vector          trace_plane_normal;
41 float           trace_plane_dist;
42 entity          trace_ent;
43 float           trace_inopen;
44 float           trace_inwater;
45
46 //
47 // required prog functions
48 //
49 void()          CSQC_Init;
50 void()          CSQC_Shutdown;
51 float(float f, float t, float n)        CSQC_InputEvent;
52 void(float w, float h)          CSQC_UpdateView;
53 bool(string s)  CSQC_ConsoleCommand;
54
55 //these fields are read and set by the default player physics
56 vector          pmove_org;
57 vector          pmove_vel;
58 vector          pmove_mins;
59 vector          pmove_maxs;
60 //retrieved from the current movement commands (read by player physics)
61 float           input_timelength;
62 vector          input_angles;
63 vector          input_movevalues;       //forwards, right, up.
64 int                     input_buttons;          //attack, use, jump (default physics only uses jump)
65
66 float           movevar_gravity;
67 float           movevar_stopspeed;
68 float           movevar_maxspeed;
69 float           movevar_spectatormaxspeed;      //used by NOCLIP movetypes.
70 float           movevar_accelerate;
71 float           movevar_airaccelerate;
72 float           movevar_wateraccelerate;
73 float           movevar_friction;
74 float           movevar_waterfriction;
75 float           movevar_entgravity;     //the local player's gravity field. Is a multiple (1 is the normal value)
76
77 //================================================
78 void            end_sys_globals;                // flag for structure dumping
79 //================================================
80
81 /*
82 ==============================================================================
83
84                         SOURCE FOR ENTVARS_T C STRUCTURE
85                         MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
86
87 ==============================================================================
88 */
89
90 //
91 // system fields (*** = do not set in prog code, maintained by C code)
92 //
93 .int            modelindex;             // *** model index in the precached list
94 .vector         absmin, absmax; // *** origin + mins / maxs
95
96 .int            entnum; // *** the ent number as on the server
97 .float          drawmask;
98 .void()         predraw;
99
100 .float          movetype;
101 .float          solid;
102
103 .vector         origin;                 // ***
104 .vector         oldorigin;              // ***
105 .vector         velocity;
106 .vector         angles;
107 .vector         avelocity;
108
109 .string         classname;              // spawn function
110 .string         model;
111 .int            frame;
112 .int            skin;
113 .int            effects;
114
115 .vector         mins, maxs;             // bounding box extents reletive to origin
116 .vector         size;                   // maxs - mins
117
118 .void()         touch;
119 .void()         use;
120 .void()         think;
121 .void()         blocked;                // for doors or plats, called when can't push other
122
123 .float          nextthink;
124
125 .entity         chain;
126
127 .string         netname;
128
129 .entity         enemy;
130
131 .int            flags;
132
133 .int            colormap;
134
135 .entity         owner;          // who launched a missile
136
137 //================================================
138 void            end_sys_fields;                 // flag for structure dumping
139 //================================================
140
141 /*
142 ==============================================================================
143
144                         OPTIONAL FIELDS AND GLOBALS
145
146 ==============================================================================
147 */
148
149 // Additional OPTIONAL Fields and Globals
150 float           intermission; // indicates intermission state (0 = normal, 1 = scores, 2 = finale text)
151
152 vector          view_angles; // same as input_angles
153 vector          view_punchangle; // from server
154 vector          view_punchvector; // from server
155
156 /*
157 ==============================================================================
158
159                         CONSTANT DEFINITIONS
160
161 ==============================================================================
162 */
163
164 const int MASK_ENGINE                   = 1;
165 const int MASK_ENGINEVIEWMODELS = 2;
166 const int MASK_NORMAL                   = 4;
167
168 const int RF_VIEWMODEL                  = 1;
169 const int RF_EXTERNALMODEL              = 2;
170 const int RF_DEPTHHACK                  = 4;
171 const int RF_ADDITIVE                   = 8;
172 const int RF_USEAXIS                    = 16;
173
174 const int VF_MIN                                = 1;    //(vector)
175 const int VF_MIN_X                              = 2;    //(float)
176 const int VF_MIN_Y                              = 3;    //(float)
177 const int VF_SIZE                               = 4;    //(vector) (viewport size)
178 const int VF_SIZE_Y                             = 5;    //(float)
179 const int VF_SIZE_X                             = 6;    //(float)
180 const int VF_VIEWPORT                   = 7;    //(vector, vector)
181 const int VF_FOV                                = 8;    //(vector)
182 const int VF_FOVX                               = 9;    //(float)
183 const int VF_FOVY                               = 10;   //(float)
184 const int VF_ORIGIN                             = 11;   //(vector)
185 const int VF_ORIGIN_X                   = 12;   //(float)
186 const int VF_ORIGIN_Y                   = 13;   //(float)
187 const int VF_ORIGIN_Z                   = 14;   //(float)
188 const int VF_ANGLES                             = 15;   //(vector)
189 const int VF_ANGLES_X                   = 16;   //(float)
190 const int VF_ANGLES_Y                   = 17;   //(float)
191 const int VF_ANGLES_Z                   = 18;   //(float)
192 const int VF_DRAWWORLD                  = 19;   //(float)
193 const int VF_DRAWENGINESBAR             = 20;   //(float)
194 const int VF_DRAWCROSSHAIR              = 21;   //(float)
195
196 const int VF_CL_VIEWANGLES              = 33;   //(vector)
197 const int VF_CL_VIEWANGLES_X    = 34;   //(float)
198 const int VF_CL_VIEWANGLES_Y    = 35;   //(float)
199 const int VF_CL_VIEWANGLES_Z    = 36;   //(float)
200
201 const int VF_PERSPECTIVE        = 200;
202
203 //const int STAT_HEALTH                 = 0;
204 //const int STAT_WEAPONMODEL    = 2;
205 //const int STAT_AMMO                   = 3;
206 //const int STAT_ARMOR                  = 4;
207 //const int STAT_WEAPONFRAME    = 5;
208 //const int STAT_SHELLS                 = 6;
209 //const int STAT_NAILS                  = 7;
210 //const int STAT_ROCKETS                = 8;
211 //const int STAT_CELLS                  = 9;
212 //const int STAT_ACTIVEWEAPON   = 10;
213 //const int STAT_TOTALSECRETS   = 11;
214 //const int STAT_TOTALMONSTERS  = 12;
215 //const int STAT_SECRETS                = 13;
216 //const int STAT_MONSTERS               = 14;
217 //const int STAT_ITEMS                  = 15;
218 //const int STAT_VIEWHEIGHT             = 16;
219
220 // Quake Sound Constants
221 const int CHAN_AUTO                             = 0;
222 const int CHAN_WEAPON                   = 1;
223 const int CHAN_VOICE                    = 2;
224 const int CHAN_ITEM                             = 3;
225 const int CHAN_BODY                             = 4;
226
227 const int ATTN_NONE                             = 0;
228 const int ATTN_NORM                             = 1;
229 const int ATTN_IDLE                             = 2;
230 const int ATTN_STATIC                   = 3;
231
232 // Frik File Constants
233 const int FILE_READ                             = 0;
234 const int FILE_APPEND                   = 1;
235 const int FILE_WRITE                    = 2;
236
237 // Quake Point Contents
238 const int CONTENT_EMPTY                 = -1;
239 const int CONTENT_SOLID                 = -2;
240 const int CONTENT_WATER                 = -3;
241 const int CONTENT_SLIME                 = -4;
242 const int CONTENT_LAVA                  = -5;
243 const int CONTENT_SKY                   = -6;
244
245 // Quake Solid Constants
246 const int SOLID_NOT                             = 0;
247 const int SOLID_TRIGGER                 = 1;
248 const int SOLID_BBOX                    = 2;
249 const int SOLID_SLIDEBOX                = 3;
250 const int SOLID_BSP                             = 4;
251 const int SOLID_CORPSE                  = 5;
252
253 // Quake Move Constants
254 const int MOVE_NORMAL                   = 0;
255 const int MOVE_NOMONSTERS               = 1;
256 const int MOVE_MISSILE                  = 2;
257
258 const float EXTRA_LOW                   = -99999999;
259 const float EXTRA_HIGH                  = 99999999;
260
261 const vector VEC_1                              = '1 1 1';
262 const vector VEC_0                              = '0 0 0';
263 const vector VEC_M1                             = '-1 -1 -1';
264
265 //const float M_PI                              = 3.14159265358979323846;
266
267 vector VEC_HULL_MIN                             = '-16 -16 -24';
268 vector VEC_HULL_MAX                             = '16 16 32';
269
270 // Quake Temporary Entity Constants
271 const int TE_SPIKE                              = 0;
272 const int TE_SUPERSPIKE                 = 1;
273 const int TE_GUNSHOT                    = 2;
274 const int TE_EXPLOSION                  = 3;
275 const int TE_TAREXPLOSION               = 4;
276 const int TE_LIGHTNING1                 = 5;
277 const int TE_LIGHTNING2                 = 6;
278 const int TE_WIZSPIKE                   = 7;
279 const int TE_KNIGHTSPIKE                = 8;
280 const int TE_LIGHTNING3                 = 9;
281 const int TE_LAVASPLASH                 = 10;
282 const int TE_TELEPORT                   = 11;
283 const int TE_EXPLOSION2                 = 12;
284
285 // Darkplaces Additions
286 const int TE_EXPLOSIONRGB               = 53;
287 const int TE_GUNSHOTQUAD                = 57;
288 const int TE_EXPLOSIONQUAD              = 70;
289 const int TE_SPIKEQUAD                  = 58;
290 const int TE_SUPERSPIKEQUAD             = 59;
291
292 // PFlags for Dynamic Lights
293 const int PFLAGS_NOSHADOW               = 1;
294 const int PFLAGS_CORONA                 = 2;
295 const int PFLAGS_FULLDYNAMIC    = 128;
296
297 const int EF_ADDITIVE                   = 32;
298 const int EF_BLUE                               = 64;
299 const int EF_FLAME                              = 1024;
300 const int EF_FULLBRIGHT                 = 512;
301 const int EF_NODEPTHTEST                = 8192;
302 const int EF_NODRAW                             = 16;
303 const int EF_NOSHADOW                   = 4096;
304 const int EF_RED                                = 128;
305 const int EF_STARDUST                   = 2048;
306 const int EF_SELECTABLE                 = 16384;
307
308 const int PFL_ONGROUND                  = 1;
309 const int PFL_CROUCH                    = 2;
310 const int PFL_DEAD                              = 4;
311 const int PFL_GIBBED                    = 8;
312
313 // draw flags
314 const int DRAWFLAG_NORMAL               = 0;
315 const int DRAWFLAG_ADDITIVE     = 1;
316 const int DRAWFLAG_MODULATE     = 2;
317 const int DRAWFLAG_2XMODULATE   = 3;
318 const int DRAWFLAG_SCREEN               = 4;
319 const int DRAWFLAG_MIPMAP               = 0x100; // only for R_BeginPolygon
320
321 /*
322 ==============================================================================
323
324                         BUILTIN DEFINITIONS
325                         EXTENSIONS ARE NOT ADDED HERE, BUT BELOW!
326
327 ==============================================================================
328 */
329
330 void(vector ang) makevectors = #1;
331 void(entity e, vector o) setorigin = #2;
332 void(entity e, string m) setmodel = #3;
333 void(entity e, vector min, vector max) setsize = #4;
334
335 void() break_to_debugger = #6;
336 float() random = #7;
337 void(entity e, float chan, string samp) sound = #8;
338 vector(vector v) normalize = #9;
339 void(string e) error = #10;
340 void(string e) objerror = #11;
341 float(vector v) vlen = #12;
342 float(vector v) vectoyaw = #13;
343 entity() spawn = #14;
344 void(entity e) remove = #15;
345 float(vector v1, vector v2, float tryents, entity ignoreentity) traceline = #16;
346
347 entity(entity start, .string fld, string match) find = #18;
348 void(string s) precache_sound = #19;
349 void(string s) precache_model = #20;
350
351 entity(vector org, float rad) findradius = #22;
352
353 void(string s, ...) dprint = #25;
354 string(float f) ftos = #26;
355 string(vector v) vtos = #27;
356 void() coredump = #28;
357 void() traceon = #29;
358 void() traceoff = #30;
359 void(entity e) eprint = #31;
360 // settrace optional
361 float(float yaw, float dist, float settrace) walkmove = #32;
362
363 float() droptofloor = #34;
364 void(float style, string value) lightstyle = #35;
365 int(float v) rint       = #36;
366 int(float v) floor      = #37;
367 int(float v) ceil       = #38;
368
369 float(entity e) checkbottom = #40;
370 float(vector v) pointcontents = #41;
371
372 float(float f) fabs = #43;
373
374 float(string s) cvar = #45;
375 void(string s, ...) localcmd = #46;
376 entity(entity e) nextent = #47;
377 void(vector o, vector d, float color, float count) particle = #48;
378 void() ChangeYaw = #49;
379
380 vector(vector v) vectoangles = #51;
381 vector(vector v, vector w) vectoangles2 = #51;
382
383 float(float f) sin = #60;
384 float(float f) cos = #61;
385 float(float f) sqrt = #62;
386 void(entity ent) changepitch = #63;
387 void(entity e, entity ignore) tracetoss = #64;
388 string(entity ent) etos = #65;
389
390 string(string s) precache_file = #68;
391 void(entity e) makestatic = #69;
392
393 void(string name, string value) cvar_set = #72;
394
395 void(vector pos, string samp, float vol, float atten) ambientsound = #74;
396 string(string s) precache_model2 = #75;
397 string(string s) precache_sound2 = #76;
398 string(string s) precache_file2 = #77;
399
400 float(string s) stof = #81;
401
402
403 void(vector v1, vector min, vector max, vector v2, float nomonsters, entity forent) tracebox = #90;
404 vector() randomvec = #91;
405 vector(vector org) getlight = #92;
406 vector(vector org, float lpflags) getlight2 = #92;
407 vector getlight_dir;
408 vector getlight_ambient;
409 vector getlight_diffuse;
410 const float LP_LIGHTMAP = 1;
411 const float LP_RTWORLD = 2;
412 const float LP_DYNLIGHT = 4;
413 const float LP_COMPLETE = 7;
414
415 float(string name, string value) registercvar = #93;
416 float( float a, ... ) min = #94;
417 float( float b, ... ) max = #95;
418 float(float minimum, float val, float maximum) bound = #96;
419 float(float f, float f) pow = #97;
420 entity(entity start, .entity fld, entity match) findentity = #98;
421 entity(entity start, .float fld, float match) findfloat = #98;
422 float(string s) checkextension = #99;
423 // FrikaC and Telejano range #100-#199
424
425 int(string filename, int mode) fopen = #110;
426 void(float fhandle) fclose = #111;
427 string(float fhandle) fgets = #112;
428 void(float fhandle, string s) fputs = #113;
429 float(string s) strlen = #114;
430 string(...) strcat = #115;
431 string(string s, float start, float length) substring = #116;
432 vector(string) stov = #117;
433 string(string s) strzone = #118;
434 void(string s) strunzone = #119;
435
436 // FTEQW range #200-#299
437
438 float(float number, float quantity) bitshift = #218;
439
440 //float(string str, string sub[, float startpos]) strstrofs = #221;
441 int(string str, string sub, float startpos) strstrofs = #221;
442 int(string str, float ofs) str2chr = #222;
443 string(int c, ...) chr2str = #223;
444 string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
445 string(float chars, string s, ...) strpad = #225;
446 string(string info, string key, string value, ...) infoadd = #226;
447 string(string info, string key) infoget = #227;
448 int(string s1, string s2) strcmp = #228;
449 int(string s1, string s2, float len) strncmp = #228;
450 int(string s1, string s2) strcasecmp = #229;
451 int(string s1, string s2, float len) strncasecmp = #230;
452
453 // CSQC range #300-#399
454 void() clearscene = #300;
455 void(float mask) addentities = #301;
456 void(entity ent) addentity = #302;
457 float(float property, ...) setproperty = #303;
458 float(float property) getproperty = #309;
459 vector(float property) getpropertyvec = #309;
460 void() renderscene = #304;
461 void(vector org, float radius, vector lightcolours) adddynamiclight = #305;
462 void(vector org, float radius, vector lightcolours, float style, string cubemapname, float pflags) adddynamiclight2 = #305;
463 //void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon = #306;
464 void(string texturename, float flag, ...) R_BeginPolygon = #306;
465 void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex = #307;
466 void() R_EndPolygon = #308;
467 vector (vector v) cs_unproject = #310;
468 vector (vector v) cs_project = #311;
469
470 void(float width, vector pos1, vector pos2, float flag) drawline = #315;
471 float(string name) iscachedpic = #316;
472 string(string name, ...) precache_pic = #317;
473 string(string name) precache_cubemap = #317;
474 vector(string picname) draw_getimagesize = #318;
475 void(string name) freepic = #319;
476 float(vector position, float character, vector scale, vector rgb, float alpha, float flag) drawcharacter = #320;
477 float(vector position, string text, vector scale, vector rgb, float alpha, float flag) drawstring = #321;
478 float(vector position, string pic, vector size, vector rgb, float alpha, float flag) drawpic = #322;
479 float(vector position, vector size, vector rgb, float alpha, float flag) drawfill = #323;
480 void(float x, float y, float width, float height) drawsetcliparea = #324;
481 void(void) drawresetcliparea = #325;
482 float(vector position, string text, vector scale, float alpha, float flag) drawcolorcodedstring = #326;
483 vector(vector position, string text, vector scale, vector rgb, float alpha, float flag) drawcolorcodedstring2 = #326;
484
485 float(int stnum) getstatf = #330;
486 int(int stnum, ...) getstati = #331; // can optionally take first bit and count
487 string(float firststnum) getstats = #332;
488 void(entity e, float mdlindex) setmodelindex = #333;
489 string(float mdlindex) modelnameforindex = #334;
490 int(string effectname) particleeffectnum = #335;
491 void(entity ent, float effectnum, vector start, vector end) trailparticles = #336;
492 //void(float effectnum, vector origin [, vector dir, float count]) pointparticles = #337;
493 void(float effectnum, vector origin , vector dir, float count) pointparticles = #337;
494 void(string s, ...) centerprint = #338;
495 void(string s, ...) print = #339;
496 string(float keynum) keynumtostring = #340;
497 float(string keyname) stringtokeynum = #341;
498 string(float keynum) getkeybind = #342;
499 void(float usecursor) setcursormode = #343;
500 vector() getmousepos = #344;
501 float(float framenum) getinputstate = #345;
502 void(float sens) setsensitivityscale = #346;
503 void(...) runstandardplayerphysics = #347; // this may or may not take a player ent
504 string(float playernum, string keyname) getplayerkeyvalue = #348;
505 float() isdemo = #349;
506 float() isserver = #350;
507 void(vector origin, vector forward, vector right, vector up) SetListener = #351;
508 void(string cmdname) registercommand = #352;
509 float(entity ent) wasfreed = #353;
510 string(string key) serverkey = #354;
511
512 // Use proper case; refer to the id1 Write* functions!
513 int() ReadByte          = #360;
514 int() ReadChar          = #361;
515 int() ReadShort         = #362;
516 int() ReadLong          = #363;
517 float() ReadCoord       = #364;
518 float() ReadAngle       = #365;
519 string() ReadString     = #366;
520 float() ReadFloat       = #367;
521
522 // LordHavoc's range #400-#499
523 void(entity from, entity to) copyentity = #400;
524
525 entity(.string fld, string match) findchain = #402;
526 entity(.float fld, float match) findchainfloat = #403;
527 void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404;
528 void(vector org, vector velocity, float howmany) te_blood = #405;
529 void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406;
530 void(vector org, vector color) te_explosionrgb = #407;
531 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408;
532 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409;
533 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410;
534 void(vector org, vector vel, float howmany) te_spark = #411;
535 void(vector org) te_gunshotquad = #412;
536 void(vector org) te_spikequad = #413;
537 void(vector org) te_superspikequad = #414;
538 void(vector org) te_explosionquad = #415;
539 void(vector org) te_smallflash = #416;
540 void(vector org, float radius, float lifetime, vector color) te_customflash = #417;
541 void(vector org) te_gunshot = #418;
542 void(vector org) te_spike = #419;
543 void(vector org) te_superspike = #420;
544 void(vector org) te_explosion = #421;
545 void(vector org) te_tarexplosion = #422;
546 void(vector org) te_wizspike = #423;
547 void(vector org) te_knightspike = #424;
548 void(vector org) te_lavasplash = #425;
549 void(vector org) te_teleport = #426;
550 void(vector org, float colorstart, float colorlength) te_explosion2 = #427;
551 void(entity own, vector start, vector end) te_lightning1 = #428;
552 void(entity own, vector start, vector end) te_lightning2 = #429;
553 void(entity own, vector start, vector end) te_lightning3 = #430;
554 void(entity own, vector start, vector end) te_beam = #431;
555 void(vector dir) vectorvectors = #432;
556 void(vector org) te_plasmaburn = #433;
557 //float(entity e, float s) getsurfacenumpoints = #434;
558 //vector(entity e, float s, float n) getsurfacepoint = #435;
559 //vector(entity e, float s) getsurfacenormal = #436;
560 //string(entity e, float s) getsurfacetexture = #437;
561 //float(entity e, vector p) getsurfacenearpoint = #438;
562 //vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
563
564 int(string s) tokenize = #441;
565 string(float n) argv = #442;
566 void(entity e, entity tagentity, string tagname) setattachment = #443;
567 float(string pattern, float caseinsensitive, float quiet) search_begin = #444;
568 void(float handle) search_end = #445;
569 float(float handle) search_getsize = #446;
570 string(float handle, float num) search_getfilename = #447;
571 string(string s) cvar_string = #448;
572 entity(entity start, .float fld, float match) findflags = #449;
573 entity(.float fld, float match) findchainflags = #450;
574 int(entity ent, string tagname) gettagindex = #451;
575 vector(entity ent, float tagindex) gettaginfo = #452;
576
577 void(vector org, vector vel, float howmany) te_flamejet = #457;
578
579 entity(float num) entitybyindex = #459;
580 int() buf_create = #460;
581 void(float bufhandle) buf_del = #461;
582 float(float bufhandle) buf_getsize = #462;
583 void(float bufhandle_from, float bufhandle_to) buf_copy = #463;
584 void(float bufhandle, float sortpower, float backward) buf_sort = #464;
585 string(float bufhandle, string glue) buf_implode = #465;
586 string(float bufhandle, float string_index) bufstr_get = #466;
587 void(float bufhandle, float string_index, string str) bufstr_set = #467;
588 float(float bufhandle, string str, float order) bufstr_add = #468;
589 void(float bufhandle, float string_index) bufstr_free = #469;
590
591 //float(float s) asin = #471;
592 //float(float c) acos = #472;
593 //float(float t) atan = #473;
594 //float(float c, float s) atan2 = #474;
595 //float(float a) tan = #475;
596 float(string s) strippedstringlen = #476;
597 float(string s) strlennocol = #476; // This is the correct name for the function, but not removing the decolorizedstring mapping.
598 string(string s) decolorizedstring = #477;
599 string(string s) strdecolorize = #477; // This is the correct name for the function, but not removing the decolorizedstring mapping.
600 string(float uselocaltime, string format, ...) strftime = #478;
601 string(string s) strtolower = #480;
602 string(string s) strtoupper = #481;
603 string(string s) cvar_defstring = #482;
604 void(vector origin, string sample, float volume, float attenuation) pointsound = #483;
605 string(string search, string replace, string subject) strreplace = #484;
606 string(string search, string replace, string subject) strireplace = #485;
607 //vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
608 #ifdef SUPPORT_GECKO
609 float gecko_create( string name ) = #487;
610 void gecko_destroy( string name ) = #488;
611 void gecko_navigate( string name, string URI ) = #489;
612 float gecko_keyevent( string name, float key, float eventtype ) = #490;
613 void gecko_mousemove( string name, float x, float y ) = #491;
614 void gecko_resize( string name, float w, float h ) = #492;
615 vector gecko_get_texture_extent( string name ) = #493;
616 #else
617
618 #endif
619
620 /*
621 ==============================================================================
622
623                         EXTENSION DEFINITIONS
624
625 ==============================================================================
626 */
627
628 // DP_CSQC_SPAWNPARTICLE
629 // idea: VorteX
630 // darkplaces implementation: VorteX
631 // constant definitions:
632 // particle base behavior:
633 float PT_ALPHASTATIC = 1;
634 float PT_STATIC = 2;
635 float PT_SPARK = 3;
636 float PT_BEAM = 4;
637 float PT_RAIN = 5;
638 float PT_RAINDECAL = 6;
639 float PT_SNOW = 7;
640 float PT_BUBBLE = 8;
641 float PT_BLOOD = 9;
642 float PT_SMOKE = 10;
643 float PT_DECAL = 11;
644 float PT_ENTITYPARTICLE = 12;
645 // particle blendtypes:
646 float PBLEND_ALPHA = 0;
647 float PBLEND_ADD = 1;
648 float PBLEND_INVMOD = 2;
649 // particle orientation:
650 float PARTICLE_BILLBOARD = 0;
651 float PARTICLE_SPARK = 1;
652 float PARTICLE_ORIENTED_DOUBLESIDED = 2;
653 float PARTICLE_BEAM = 3;
654 // global definitions:
655 float particle_type; // one of PT_
656 float particle_blendmode; // one of PBLEND_ values
657 float particle_orientation; // one of PARTICLE_ values
658 vector particle_color1;
659 vector particle_color2;
660 float particle_tex; // number of chunk in particlefont
661 float particle_size;
662 float particle_sizeincrease;
663 float particle_alpha;
664 float particle_alphafade;
665 float particle_time;
666 float particle_gravity;
667 float particle_bounce;
668 float particle_airfriction;
669 float particle_liquidfriction;
670 float particle_originjitter;
671 float particle_velocityjitter;
672 float particle_qualityreduction; // enable culling of this particle when FPS is low
673 float particle_stretch;
674 vector particle_staincolor1;
675 vector particle_staincolor2;
676 float particle_staintex;
677 float particle_stainalpha;
678 float particle_stainsize;
679 float particle_delayspawn;
680 float particle_delaycollision;
681 float particle_angle;
682 float particle_spin;
683 // builtin definitions:
684 float(float max_themes) initparticlespawner = #522; // check fields/globals for integration and enable particle spawner, return 1 is succeded, otherwise returns 0
685 void() resetparticle = #523; // reset p_ globals to default theme #0
686 void(float theme) particletheme = #524; // restore p_ globals from saved theme
687 float() particlethemesave = #525; // save p_ globals to new particletheme and return it's index
688 void(float theme) particlethemeupdate = #525; // save p_ globals to new particletheme and return it's index
689 void(float theme) particlethemefree = #526; // delete a particle theme
690 float(vector org, vector vel) spawnparticle = #527; // returns 0 when failed, 1 when spawned
691 float(vector org, vector vel, float theme) quickparticle = #527; // not reading globals, just theme, returns 0 when failed, 1 when spawned
692 float(vector org, vector vel, float delay, float collisiondelay) delayedparticle = #528;
693 float(vector org, vector vel, float delay, float collisiondelay, float theme) quickdelayedparticle = #528;
694 // description: this builtin provides an easy and flexible way to spawn particles,
695 // it is not created as replace for DP_SV_POINTPARTICLES but as an addition to it.
696 // With this extension you can create a specific particles like rain particles, or entity particles
697 // notes:
698 // 1) 0 is default particle template, it could be changed
699 // 2) color vectors could have value 0-255 of each component
700 // restrictions: max themes could be between 4 and 2048
701 // warning: you should call initparticlespawner() at very beginning BEFORE all other particle spawner functions
702 // function to query particle info
703 // don't remove this function as it protects all particle_ globals from FTEQCC/FRIKQCC non-referenced removal optimisation
704 void() printparticle =
705 {
706         // vortex: this also protects from 'non-referenced' optimisation on some compilers
707         print("PARTICLE:\n");
708         print(strcat("  type: ", ftos(particle_type), "\n"));
709         print(strcat("  blendmode: ", ftos(particle_blendmode), "\n"));
710         print(strcat("  orientation: ", ftos(particle_orientation), "\n"));
711         print(strcat("  color1: ", vtos(particle_color1), "\n"));
712         print(strcat("  color2: ", vtos(particle_color2), "\n"));
713         print(strcat("  tex: ", ftos(particle_tex), "\n"));
714         print(strcat("  size: ", ftos(particle_size), "\n"));
715         print(strcat("  sizeincrease: ", ftos(particle_sizeincrease), "\n"));
716         print(strcat("  alpha: ", ftos(particle_alpha), "\n"));
717         print(strcat("  alphafade: ", ftos(particle_alphafade), "\n"));
718         print(strcat("  time: ", ftos(particle_time), "\n"));
719         print(strcat("  gravity: ", ftos(particle_gravity), "\n"));
720         print(strcat("  bounce: ", ftos(particle_bounce), "\n"));
721         print(strcat("  airfriction: ", ftos(particle_airfriction), "\n"));
722         print(strcat("  liquidfriction: ", ftos(particle_liquidfriction), "\n"));
723         print(strcat("  originjitter: ", ftos(particle_originjitter), "\n"));
724         print(strcat("  velocityjitter: ", ftos(particle_velocityjitter), "\n"));
725         print(strcat("  qualityreduction: ", ftos(particle_qualityreduction), "\n"));
726         print(strcat("  stretch: ", ftos(particle_stretch), "\n"));
727         print(strcat("  staincolor1: ", vtos(particle_staincolor1), "\n"));
728         print(strcat("  staincolor2: ", vtos(particle_staincolor2), "\n"));
729         print(strcat("  staintex: ", ftos(particle_staintex), "\n"));
730         print(strcat("  stainalpha: ", ftos(particle_stainalpha), "\n"));
731         print(strcat("  stainsize: ", ftos(particle_stainsize), "\n"));
732         print(strcat("  delayspawn: ", ftos(particle_delayspawn), "\n"));
733         print(strcat("  delaycollision: ", ftos(particle_delaycollision), "\n"));
734         print(strcat("  angle: ", ftos(particle_angle), "\n"));
735         print(strcat("  spin: ", ftos(particle_spin), "\n"));
736 }
737
738 // DP_CSQC_ENTITYTRANSPARENTSORTING_OFFSET
739 // idea: VorteX
740 // darkplaces implementation: VorteX
741 float RF_USETRANSPARENTOFFSET = 64; // enables transparent origin offsetting
742 // global definitions
743 float transparent_offset; // should be set before entity is added
744 // description: offset a model's meshes origin used for transparent sorting. Could be used to tweak sorting bugs on very large transparent entities or hacking transparent sorting order for certain objects
745 // example: transparent_offset = 1000000; // entity always appear on background of other transparents
746 // note: offset is done in view forward axis
747
748 // DP_CSQC_ENTITYWORLDOBJECT
749 // idea: VorteX
750 // darkplaces implementation: VorteX
751 const float RF_WORLDOBJECT = 128;
752 // description: when renderflag is set, engine will not use culling methods for this entity, e.g. it will always be drawn
753 // useful for large outdoor objects (like asteroids on sky horizon or sky models)
754
755 // DP_CSQC_ENTITYMODELLIGHT
756 // idea: VorteX
757 // darkplaces implementation: VorteX
758 const float RF_MODELLIGHT = 4096;
759 .vector modellight_ambient;
760 .vector modellight_diffuse;
761 .vector modellight_dir;
762 // description: allows CSQC to override directional model lightning on entity
763
764 // DP_CSQC_SETPAUSE
765 // idea: VorteX
766 // darkplaces implementation: VorteX
767 // builtin definitions:
768 void(float ispaused) setpause = #531;
769 // description: provides ability to set pause in local games (similar to one set once console is activated)
770 // not stopping sound/cd track, useful for inventory screens, ingame menus with input etc.
771
772 // DP_CSQC_QUERYRENDERENTITY
773 // idea: VorteX
774 // darkplaces implementation: VorteX
775 // constant definitions:
776 // render entity fields:
777 float E_ACTIVE      = 0; // float 0/1
778 float E_ORIGIN      = 1; // vector
779 float E_FORWARD     = 2; // vector
780 float E_RIGHT       = 3; // vector
781 float E_UP          = 4; // vector
782 float E_SCALE       = 5; // float
783 float E_ORIGINANDVECTORS = 6; // returns origin, + sets v_* vectors to orientation
784 float E_ALPHA       = 7; // float
785 float E_COLORMOD    = 8; // vector
786 float E_PANTSCOLOR  = 9; // vector
787 float E_SHIRTCOLOR  = 10; // vector
788 float E_SKIN        = 11; // float
789 float E_MINS        = 12; // vector
790 float E_MAXS        = 13; // vector
791 float E_ABSMIN      = 14; // vector
792 float E_ABSMAX      = 15; // vector
793 float E_LIGHT       = 16; // vector - modellight
794 // builtin definitions:
795 float(float entitynum, float fldnum) getentity = #504;
796 vector(float entitynum, float fldnum) getentityvec = #504;
797 // description: allows to query parms from render entities, especially useful with attaching CSQC ents to
798 // server entities networked and interpolated by engine (monsters, players), number of entity is it's SVQC number
799 // you can send it via tempentity/CSQC entity message. Note that this builtin doesnt know about entity removing/reallocating
800 // so it's meaning to work for short period of time, dont use it on missiles/grenades whatever will be removed next five seconds
801
802 //DP_GFX_FONTS
803 //idea: Blub\0, divVerent
804 //darkplaces implementation: Blub\0
805 //console commands:
806 //  loadfont fontname fontmaps size1 size2 ...
807 //   A font can simply be gfx/tgafile (freetype fonts doent need extension),
808 //   or alternatively you can specify multiple fonts and faces
809 //   Like this: gfx/vera-sans:2,gfx/fallback:1
810 //   to load face 2 of the font gfx/vera-sans and use face 1
811 //   of gfx/fallback as fallback font
812 //   You can also specify a list of font sizes to load, like this:
813 //   loadfont console gfx/conchars,gfx/fallback 8 12 16 24 32
814 //   In many cases, 8 12 16 24 32 should be a good choice.
815 //   for slots see:
816 //constant definitions:
817 float drawfont;            // set it before drawstring()/drawchar() calls
818 float FONT_DEFAULT = 0;    // 'default'
819 float FONT_CONSOLE = 1;    // 'console', REALLY should be fixed width (ls!)
820 float FONT_SBAR = 2;       // 'sbar', used on hud, must be fixed width
821 float FONT_NOTIFY = 3;     // 'notify', used on sprint/bprint
822 float FONT_CHAT = 4;       // 'chat'
823 float FONT_CENTERPRINT = 5;// 'centerprint'
824 float FONT_INFOBAR = 6;    // 'infobar'
825 float FONT_MENU = 7;       // 'menu', should be fixed width
826 float FONT_USER0 = 8;      // 'user0', userdefined fonts
827 float FONT_USER1 = 9;      // 'user1', userdefined fonts
828 float FONT_USER2 = 10;     // 'user2', userdefined fonts
829 float FONT_USER3 = 11;     // 'user3', userdefined fonts
830 float FONT_USER4 = 12;     // 'user4', userdefined fonts
831 float FONT_USER5 = 13;     // 'user5', userdefined fonts
832 float FONT_USER6 = 14;     // 'user6', userdefined fonts
833 float FONT_USER7 = 15;     // 'user7' slot, userdefined fonts
834 //builtin definitions:
835 float findfont(string s) = #356; // find font by fontname and return it's index
836 float loadfont(string fontname, string fontmaps, string sizes, float slot, float fix_scale, float fix_voffset) = #357;
837 // loads font immediately so stringwidth() function can be used just after builtin call
838 // returns a font slotnum (which is used to set drawfont to)
839 // first 3 parms are identical to "loadfont" console command ones
840 // slot could be one of FONT_ constants or result of findfont() or -1 to not use it
841 // if slot is given, font will be loaded to this slotnum and fontname become new title for it
842 // this way you can rename user* fonts to something more usable
843 // fix_* parms let you fix badly made fonts by applying some transformations to them
844 // fix_scale : per-character center-oriented scale (doesn't change line height at all)
845 // fix_voffset : vertical offset for each character, it's a multiplier to character height
846 float stringwidth(string text, float allowColorCodes, vector size) = #327; // get a width of string with given font and char size
847 float stringwidth_menu(string text, float allowColorCodes, vector size) = #468; // in menu.dat it has different builtin #
848 //description: engine support for custom fonts in console, hud, qc etc.
849 // limits:
850 //  max 128 chars for font name
851 //  max 3 font fallbacks
852 //  max 8 sizes per font
853
854 //DP_GFX_FONTS_FREETYPE
855 //idea: Blub\0, divVerent
856 //darkplaces implementation: Blub\0
857 //cvar definitions:
858 //   r_font_disable_freetype 0/1 : disable freetype fonts loading (uttetly disables freetype library initialization)
859 //   r_font_antialias 0/1 : antialiasing when loading font
860 //   r_font_hint 0/1/2/3  : hinting when loading font, 0 is no hinting, 1 light autohinting , 2 full autohinting, 3 full hinting
861 //   r_font_postprocess_blur X      : font outline blur amount
862 //   r_font_postprocess_outline X   : font outline width
863 //   r_font_postprocess_shadow_x X  : font outline shadow x shift amount, applied during outlining
864 //   r_font_postprocess_shadow_y X  : font outline shadow y shift amount, applied during outlining
865 //   r_font_postprocess_shadow_z X  : font outline shadow z shift amount, applied during blurring
866 //description: engine support for truetype/freetype fonts
867 //so .AFM+.PFB/.OTF/.TTF files could be stuffed as fontmaps in loadfont()
868 //(console command version will support them as well)
869
870 //DP_CSQC_BINDMAPS
871 //idea: daemon, motorsep
872 //darkplaces implementation: divVerent
873 //builtin definitions:
874 string(float key, float bindmap) getkeybind_bindmap = #342;
875 float(float key, string bind, float bindmap) setkeybind_bindmap = #630;
876 vector(void) getbindmaps = #631;
877 float(vector bm) setbindmaps = #632;
878 string(string command, float bindmap) findkeysforcommand = #610;
879 //<already in EXT_CSQC> float(string key) stringtokeynum = #341;
880 //<already in EXT_CSQC> string(float keynum) keynumtostring = #340;
881 //description: key bind setting/getting including support for switchable
882 //bindmaps.
883
884 //DP_CRYPTO
885 //idea: divVerent
886 //darkplaces implementation: divVerent
887 //builtin definitions: (CSQC)
888 float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513;
889 //description:
890 //use -1 as buffer handle to justs end delim as postdata
891
892 //DP_CSQC_MAINVIEW
893 //idea: divVerent
894 //darkplaces implementation: divVerent
895 //constant definitions:
896 const int VF_MAINVIEW         = 400;
897 //use setproperty(VF_MAINVIEW, 1); before calling R_RenderView for the render
898 //that shall become the "main" view, which is e.g. used by PRYDON_CLIENTCURSOR
899 //this flag is set for the first scene, and not cleared by R_ClearScene
900 //this flag is automatically cleared by R_RenderView
901 //so when not using this extension, the first view rendered is the main view
902
903 //DP_CSQC_MINFPS_QUALITY
904 //idea: divVerent
905 //darkplaces implementation: divVerent
906 //constant definitions:
907 const int VF_MINFPS_QUALITY   = 401;
908 //use getproperty(VF_MINFPS_QUALITY); to do CSQC based LOD based on cl_minfps
909 //1 should lead to an unmodified view
910
911 //DP_CSQC_V_CALCREFDEF_WIP1
912 //DP_CSQC_V_CALCREFDEF_WIP2
913 //idea: divVerent
914 //darkplaces implementation: divVerent
915 //builtin definitions:
916 void(entity e, float refdefflags) V_CalcRefdef = #640;
917 //constant definitions:
918 const int PMF_DUCKED = 4;
919 const int PMF_ONGROUND = 8;
920 const int REFDEFFLAG_TELEPORTED = 1;
921 const int REFDEFFLAG_JUMPING = 2;
922 const int REFDEFFLAG_DEAD = 4;
923 const int REFDEFFLAG_INTERMISSION = 8;
924 //- use this on the player entity after performing prediction
925 //- pass REFDEFFLAG_TELEPORTED if the player teleported since last frame
926 //- pass REFDEFFLAG_JUMPING if jump button is pressed
927 //- pass REFDEFFLAG_DEAD if dead (DP_CSQC_V_CALCREFDEF_WIP2)
928 //- pass REFDEFFLAG_INTERMISSION if in intermission (DP_CSQC_V_CALCREFDEF_WIP2)
929 //- the player entity needs to have origin, velocity, pmove_flags set according
930 //  to prediction (the above two PMF_ flags are used in the player's pmove_flags)
931 //- NOTE: to check for this, ALSO OR a check with DP_CSQC_V_CALCREFDEF to also support
932 //  the finished extension once done
933
934 // assorted builtins
935 float   drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #328;
936 vector  drawgetimagesize(string pic) = #318;
937 const float SPA_POSITION =  0;
938 const float SPA_S_AXIS =  1;
939 const float SPA_T_AXIS =  2;
940 const float SPA_R_AXIS =  3;
941 const float SPA_TEXCOORDS0 =  4;
942 const float SPA_LIGHTMAP0_TEXCOORDS =  5;
943 const float SPA_LIGHTMAP_COLOR =  6;
944 float (entity e, float s)                                               getsurfacenumpoints = #434;
945 vector (entity e, float s, float n)                                     getsurfacepoint = #435;
946 vector (entity e, float s)                                              getsurfacenormal = #436;
947 string (entity e, float s)                                              getsurfacetexture = #437;
948 float (entity e, vector p)                                              getsurfacenearpoint = #438;
949 vector (entity e, float s, vector p)                                    getsurfaceclippedpoint = #439;
950 vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
951 float(entity e, float s) getsurfacenumtriangles = #628;
952 vector(entity e, float s, float n) getsurfacetriangle = #629;
953
954 //DP_QC_ASINACOSATANATAN2TAN
955 //idea: Urre
956 //darkplaces implementation: LordHavoc
957 //constant definitions:
958 float DEG2RAD = 0.0174532925199432957692369076848861271344287188854172545609719144;
959 float RAD2DEG = 57.2957795130823208767981548141051703324054724665643215491602438612;
960 float PI      = 3.1415926535897932384626433832795028841971693993751058209749445923;
961 //builtin definitions:
962 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
963 float(float c) acos = #472; // returns angle in radians for a given cos() value, the result is in the range 0 to PI
964 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
965 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)
966 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
967 //description:
968 //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).
969 //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)
970
971 //DP_QC_SPRINTF
972 //idea: divVerent
973 //darkplaces implementation: divVerent
974 //builtin definitions:
975 string(string format, ...) sprintf = #627;
976 //description:
977 //you know sprintf :P
978 //supported stuff:
979 //  %
980 //  optional: <argpos>$ for the argument to format
981 //  flags: #0- +
982 //  optional: <width>, *, or *<argpos>$ for the field width
983 //  optional: .<precision>, .*, or .*<argpos>$ for the precision
984 //  length modifiers: h for forcing a float, l for forcing an int/entity (by default, %d etc. cast a float to int)
985 //  conversions:
986 //    d takes a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an int
987 //    i takes an int/entity if no length is specified or i is, and a float if h is specified as length, and cast it to an int
988 //    ouxXc take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to an unsigned int
989 //    eEfFgG take a float if no length is specified or h is, and an int/entity if l is specified as length, and cast it to a double
990 //    s takes a string
991 //    vV takes a vector, and processes the three components as if it were a gG for all three components, separated by space
992 //    For conversions s and c, the flag # makes precision and width interpreted
993 //      as byte count, by default it is interpreted as character count in UTF-8
994 //      enabled engines. No other conversions can create wide characters, and #
995 //      has another meaning in these.
996
997 //DP_QC_GETTIME
998 //idea: tZork
999 //darkplaces implementation: tZork, divVerent
1000 //constant definitions:
1001 float GETTIME_FRAMESTART = 0; // time of start of frame
1002 float GETTIME_REALTIME = 1; // current time (may be OS specific)
1003 float GETTIME_HIRES = 2; // like REALTIME, but may reset between QC invocations and thus can be higher precision
1004 float GETTIME_UPTIME = 3; // time since start of the engine
1005 //builtin definitions:
1006 float(float tmr) gettime = #519;
1007 //description:
1008 //some timers to query...
1009
1010 //DP_QC_GETTIME_CDTRACK
1011 //idea: divVerent
1012 //darkplaces implementation: divVerent
1013 //constant definitions:
1014 float GETTIME_CDTRACK = 4;
1015 //description:
1016 //returns the playing time of the current cdtrack when passed to gettime()
1017 //see DP_END_GETSOUNDTIME for similar functionality but for entity sound channels
1018
1019 //DP_QC_TOKENIZEBYSEPARATOR
1020 //idea: Electro, SavageX, LordHavoc
1021 //darkplaces implementation: LordHavoc
1022 //builtin definitions:
1023 int(string s, string separator1, ...) tokenizebyseparator = #479;
1024 //description:
1025 //this function returns tokens separated by any of the supplied separator strings, example:
1026 //numnumbers = tokenizebyseparator("10.2.3.4", ".");
1027 //returns 4 and the tokens are "10" "2" "3" "4"
1028 //possibly useful for parsing IPv4 addresses (such as "1.2.3.4") and IPv6 addresses (such as "[1234:5678:9abc:def0:1234:5678:9abc:def0]:26000")
1029
1030 //DP_QC_TOKENIZE_CONSOLE
1031 //idea: divVerent
1032 //darkplaces implementation: divVerent
1033 //builtin definitions:
1034 int(string s) tokenize_console = #514;
1035 int(float i) argv_start_index = #515;
1036 int(float i) argv_end_index = #516;
1037 //description:
1038 //this function returns tokens separated just like the console does
1039 //also, functions are provided to get the index of the first and last character of each token in the original string
1040 //Passing negative values to them, or to argv, will be treated as indexes from the LAST token (like lists work in Perl). So argv(-1) will return the LAST token.
1041
1042 //DP_SND_SOUND7_WIP1
1043 //DP_SND_SOUND7_WIP2
1044 //idea: divVerent
1045 //darkplaces implementation: divVerent
1046 //builtin definitions:
1047 void(entity e, float chan, string samp, float vol, float atten, float speed, float flags) sound7 = #8;
1048 float SOUNDFLAG_RELIABLE = 1;
1049 //description:
1050 //plays a sound, with some more flags
1051 //extensions to sound():
1052 //- channel may be in the range from -128 to 127; channels -128 to 0 are "auto",
1053 //  i.e. support multiple sounds at once, but cannot be stopped/restarted
1054 //- a value 0 in the speed parameter means no change; otherwise, it is a
1055 //  percentage of playback speed ("pitch shifting"). 100 is normal pitch, 50 is
1056 //  half speed, 200 is double speed, etc. (DP_SND_SOUND7_WIP2)
1057 //- the flag SOUNDFLAG_RELIABLE can be specified, which makes the sound send
1058 //  to MSG_ALL (reliable) instead of MSG_BROADCAST (unreliable, default);
1059 //  similarily, SOUNDFLAG_RELIABLE_TO_ONE sends to MSG_ONE
1060 //- channel 0 is controlled by snd_channel0volume; channel 1 and -1 by
1061 //  snd_channel1volume, etc. (so, a channel shares the cvar with its respective
1062 //  auto-channel); however, the mod MUST define snd_channel8volume and upwards
1063 //  in default.cfg if they are to be used, as the engine does not create them
1064 //  to not litter the cvar list
1065 //- this extension applies to CSQC as well; CSQC_Event_Sound will get speed and
1066 //  flags as extra 7th and 8th argument
1067 //- WIP2 ideas: SOUNDFLAG_RELIABLE_TO_ONE, SOUNDFLAG_NOPHS, SOUNDFLAG_FORCELOOP
1068 //- NOTE: to check for this, ALSO OR a check with DP_SND_SOUND7 to also support
1069 //  the finished extension once done
1070
1071 //DP_PRECACHE_PIC_FLAGS
1072 //idea: divVerent
1073 //darkplaces implementation: divVerent
1074 //constant definitions:
1075 float PRECACHE_PIC_FROMWAD = 1; // this one actually is part of EXT_CSQC
1076 float PRECACHE_PIC_NOTPERSISTENT = 2; // picture may get deallocated when unused
1077 float PRECACHE_PIC_MIPMAP = 8; // mipmap the texture for possibly better downscaling at memory expense
1078 //notes: these constants are given as optional second argument to precache_pic()
1079
1080 //DP_QC_TRACE_MOVETYPE_WORLDONLY
1081 //idea: LordHavoc
1082 //darkplaces implementation: LordHavoc
1083 //constant definitions:
1084 float MOVE_WORLDONLY = 3;
1085 //description:
1086 //allows traces to hit only world (ignoring all entities, unlike MOVE_NOMONSTERS which hits all bmodels), use as the nomonsters parameter to trace functions
1087
1088 //DP_SND_GETSOUNDTIME
1089 //idea: VorteX
1090 //darkplaces implementation: VorteX
1091 //constant definitions:
1092 float(entity e, float channel) getsoundtime = #533; // get currently sound playing position on entity channel, -1 if not playing or error
1093 float(string sample) soundlength = #534; // returns length of sound sample in seconds, -1 on error (sound not precached, sound system not initialized etc.)
1094 //description: provides opportunity to query length of sound samples and realtime tracking of sound playing on entities (similar to DP_GETTIME_CDTRACK)
1095 //note: beware dedicated server not running sound engine at all, so in dedicated mode this builtins will not work in server progs
1096 //note also: menu progs not supporting getsoundtime() (will give a warning) since it has no sound playing on entities
1097 //examples of use:
1098 //  - QC-driven looped sounds
1099 //  - QC events when sound playing is finished
1100 //  - toggleable ambientsounds
1101 //  - subtitles
1102
1103 //DP_QC_NUM_FOR_EDICT
1104 //idea: Blub\0
1105 //darkplaces implementation: Blub\0
1106 //Function to get the number of an entity - a clean way.
1107 float(entity num) num_for_edict = #512;
1108
1109 //DP_TRACE_HITCONTENTSMASK_SURFACEINFO
1110 //idea: LordHavoc
1111 //darkplaces implementation: LordHavoc
1112 //globals:
1113 .int dphitcontentsmask; // if non-zero on the entity passed to traceline/tracebox/tracetoss this will override the normal collidable contents rules and instead hit these contents values (for example AI can use tracelines that hit DONOTENTER if it wants to, by simply changing this field on the entity passed to traceline), this affects normal movement as well as trace calls
1114 float trace_dpstartcontents; // DPCONTENTS_ value at start position of trace
1115 int trace_dphitcontents; // DPCONTENTS_ value of impacted surface (not contents at impact point, just contents of the surface that was hit)
1116 int trace_dphitq3surfaceflags; // Q3SURFACEFLAG_ value of impacted surface
1117 string trace_dphittexturename; // texture name of impacted surface
1118 //constants:
1119 const int DPCONTENTS_SOLID = 1; // hit a bmodel, not a bounding box
1120 const int DPCONTENTS_WATER = 2;
1121 const int DPCONTENTS_SLIME = 4;
1122 const int DPCONTENTS_LAVA = 8;
1123 const int DPCONTENTS_SKY = 16;
1124 const int DPCONTENTS_BODY = 32; // hit a bounding box, not a bmodel
1125 const int DPCONTENTS_CORPSE = 64; // hit a SOLID_CORPSE entity
1126 const int DPCONTENTS_NODROP = 128; // an area where backpacks should not spawn
1127 const int DPCONTENTS_PLAYERCLIP = 256; // blocks player movement
1128 const int DPCONTENTS_MONSTERCLIP = 512; // blocks monster movement
1129 const int DPCONTENTS_DONOTENTER = 1024; // AI hint brush
1130 const int DPCONTENTS_LIQUIDSMASK = 14; // WATER | SLIME | LAVA
1131 const int DPCONTENTS_BOTCLIP = 2048; // AI hint brush
1132 const int DPCONTENTS_OPAQUE = 4096; // only fully opaque brushes get this (may be useful for line of sight checks)
1133 const int Q3SURFACEFLAG_NODAMAGE = 1;
1134 const int Q3SURFACEFLAG_SLICK = 2; // low friction surface
1135 const int Q3SURFACEFLAG_SKY = 4; // sky surface (also has NOIMPACT and NOMARKS set)
1136 const int Q3SURFACEFLAG_LADDER = 8; // climbable surface
1137 const int Q3SURFACEFLAG_NOIMPACT = 16; // projectiles should remove themselves on impact (this is set on sky)
1138 const int Q3SURFACEFLAG_NOMARKS = 32; // projectiles should not leave marks, such as decals (this is set on sky)
1139 const int Q3SURFACEFLAG_FLESH = 64; // projectiles should do a fleshy effect (blood?) on impact
1140 const int Q3SURFACEFLAG_NODRAW = 128; // compiler hint (not important to qc)
1141 //float Q3SURFACEFLAG_HINT = 256; // compiler hint (not important to qc)
1142 //float Q3SURFACEFLAG_SKIP = 512; // compiler hint (not important to qc)
1143 //float Q3SURFACEFLAG_NOLIGHTMAP = 1024; // compiler hint (not important to qc)
1144 //float Q3SURFACEFLAG_POINTLIGHT = 2048; // compiler hint (not important to qc)
1145 const int Q3SURFACEFLAG_METALSTEPS = 4096; // walking on this surface should make metal step sounds
1146 const int Q3SURFACEFLAG_NOSTEPS = 8192; // walking on this surface should not make footstep sounds
1147 const int Q3SURFACEFLAG_NONSOLID = 16384; // compiler hint (not important to qc)
1148 //float Q3SURFACEFLAG_LIGHTFILTER = 32768; // compiler hint (not important to qc)
1149 //float Q3SURFACEFLAG_ALPHASHADOW = 65536; // compiler hint (not important to qc)
1150 //float Q3SURFACEFLAG_NODLIGHT = 131072; // compiler hint (not important to qc)
1151 //float Q3SURFACEFLAG_DUST = 262144; // translucent 'light beam' effect (not important to qc)
1152 //description:
1153 //adds additional information after a traceline/tracebox/tracetoss call.
1154 //also (very important) sets trace_* globals before calling .touch functions,
1155 //this allows them to inspect the nature of the collision (for example
1156 //determining if a projectile hit sky), clears trace_* variables for the other
1157 //object in a touch event (that is to say, a projectile moving will see the
1158 //trace results in its .touch function, but the player it hit will see very
1159 //little information in the trace_ variables as it was not moving at the time)
1160
1161 //DP_QC_CVAR_TYPE
1162 //idea: divVerent
1163 //DarkPlaces implementation: divVerent
1164 //builtin definitions:
1165 float(string name) cvar_type = #495;
1166 const int CVAR_TYPEFLAG_EXISTS = 1;
1167 const int CVAR_TYPEFLAG_SAVED = 2;
1168 const int CVAR_TYPEFLAG_PRIVATE = 4;
1169 const int CVAR_TYPEFLAG_ENGINE = 8;
1170 const int CVAR_TYPEFLAG_HASDESCRIPTION = 16;
1171 const int CVAR_TYPEFLAG_READONLY = 32;
1172
1173 //DP_QC_CRC16
1174 //idea: divVerent
1175 //darkplaces implementation: divVerent
1176 //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.
1177 //When caseinsensitive is set, the CRC is calculated of the lower cased string.
1178 int(bool caseinsensitive, string s, ...) crc16 = #494;
1179
1180 //DP_QC_URI_ESCAPE
1181 //idea: divVerent
1182 //darkplaces implementation: divVerent
1183 //URI::Escape's functionality
1184 string(string in) uri_escape = #510;
1185 string(string in) uri_unescape = #511;
1186
1187 //DP_QC_DIGEST
1188 //idea: motorsep, Spike
1189 //DarkPlaces implementation: divVerent
1190 //builtin definitions:
1191 string(string digest, string data, ...) digest_hex = #639;
1192 //description:
1193 //returns a given hex digest of given data
1194 //the returned digest is always encoded in hexadecimal
1195 //only the "MD4" digest is always supported!
1196 //if the given digest is not supported, string_null is returned
1197 //the digest string is matched case sensitively, use "MD4", not "md4"!
1198
1199 //DP_QC_DIGEST_SHA256
1200 //idea: motorsep, Spike
1201 //DarkPlaces implementation: divVerent
1202 //description:
1203 //"SHA256" is also an allowed digest type
1204
1205 //DP_QC_LOG
1206 //darkplaces implementation: divVerent
1207 //builtin definitions:
1208 float log(float f) = #532;
1209 //description:
1210 //logarithm
1211
1212 //FTE_CSQC_SKELETONOBJECTS
1213 //idea: Spike, LordHavoc
1214 //darkplaces implementation: LordHavoc
1215 //builtin definitions:
1216 // all skeleton numbers are 1-based (0 being no skeleton)
1217 // all bone numbers are 1-based (0 being invalid)
1218 float(float modlindex) skel_create = #263; // create a skeleton (be sure to assign this value into .skeletonindex for use), returns skeleton index (1 or higher) on success, returns 0 on failure (for example if the modelindex is not skeletal), it is recommended that you create a new skeleton if you change modelindex, as the skeleton uses the hierarchy from the model.
1219 float(float skel, entity ent, float modlindex, float retainfrac, float firstbone, float lastbone) skel_build = #264; // blend in a percentage of standard animation, 0 replaces entirely, 1 does nothing, 0.5 blends half, etc, and this only alters the bones in the specified range for which out of bounds values like 0,100000 are safe (uses .frame, .frame2, .frame3, .frame4, .lerpfrac, .lerpfrac3, .lerpfrac4, .frame1time, .frame2time, .frame3time, .frame4time), returns skel on success, 0 on failure
1220 float(float skel) skel_get_numbones = #265; // returns how many bones exist in the created skeleton, 0 if skeleton does not exist
1221 string(float skel, float bonenum) skel_get_bonename = #266; // returns name of bone (as a tempstring), "" if invalid bonenum (< 1 for example) or skeleton does not exist
1222 int(float skel, float bonenum) skel_get_boneparent = #267; // returns parent num for supplied bonenum, 0 if bonenum has no parent or bone does not exist (returned value is always less than bonenum, you can loop on this)
1223 int(float skel, string tagname) skel_find_bone = #268; // get number of bone with specified name, 0 on failure, bonenum (1-based) on success, same as using gettagindex but takes modelindex instead of entity
1224 vector(float skel, float bonenum) skel_get_bonerel = #269; // get matrix of bone in skeleton relative to its parent - sets v_forward, v_right, v_up, returns origin (relative to parent bone)
1225 vector(float skel, float bonenum) skel_get_boneabs = #270; // get matrix of bone in skeleton in model space - sets v_forward, v_right, v_up, returns origin (relative to entity)
1226 void(float skel, float bonenum, vector org) skel_set_bone = #271; // set matrix of bone relative to its parent, reads v_forward, v_right, v_up, takes origin as parameter (relative to parent bone)
1227 void(float skel, float bonenum, vector org) skel_mul_bone = #272; // transform bone matrix (relative to its parent) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bone)
1228 void(float skel, float startbone, float endbone, vector org) skel_mul_bones = #273; // transform bone matrices (relative to their parents) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bones)
1229 void(float skeldst, float skelsrc, float startbone, float endbone) skel_copybones = #274; // copy bone matrices (relative to their parents) from one skeleton to another, useful for copying a skeleton to a corpse
1230 void(float skel) skel_delete = #275; // deletes skeleton at the beginning of the next frame (you can add the entity, delete the skeleton, renderscene, and it will still work)
1231 float(float modlindex, string framename) frameforname = #276; // finds number of a specified frame in the animation, returns -1 if no match found
1232 float(float modlindex, float framenum) frameduration = #277; // returns the intended play time (in seconds) of the specified framegroup, if it does not exist the result is 0, if it is a single frame it may be a small value around 0.1 or 0.
1233 //fields:
1234 .float skeletonindex; // active skeleton overriding standard animation on model
1235 .int frame; // primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
1236 .int frame2; // secondary framegroup animation (strength = lerpfrac)
1237 .int frame3; // tertiary framegroup animation (strength = lerpfrac3)
1238 .int frame4; // quaternary framegroup animation (strength = lerpfrac4)
1239 .float lerpfrac; // strength of framegroup blend
1240 .float lerpfrac3; // strength of framegroup blend
1241 .float lerpfrac4; // strength of framegroup blend
1242 .float frame1time; // start time of framegroup animation
1243 .float frame2time; // start time of framegroup animation
1244 .float frame3time; // start time of framegroup animation
1245 .float frame4time; // start time of framegroup animation
1246 //description:
1247 //this extension provides a way to do complex skeletal animation on an entity.
1248 //
1249 //see also DP_SKELETONOBJECTS (this extension implemented on server as well as client)
1250 //
1251 //notes:
1252 //each model contains its own skeleton, reusing a skeleton with incompatible models will yield garbage (or not render).
1253 //each model contains its own animation data, you can use animations from other model files (for example saving out all character animations as separate model files).
1254 //if an engine supports loading an animation-only file format such as .md5anim in FTEQW, it can be used to animate any model with a compatible skeleton.
1255 //proper use of this extension may require understanding matrix transforms (v_forward, v_right, v_up, origin), and you must keep in mind that v_right is negative for this purpose.
1256 //
1257 //features include:
1258 //multiple animations blended together.
1259 //animating a model with animations from another model with a compatible skeleton.
1260 //restricting animation blends to certain bones of a model - for example independent animation of legs, torso, head.
1261 //custom bone controllers - for example making eyes track a target location.
1262 //
1263 //
1264 //
1265 //example code follows...
1266 //
1267 //this helper function lets you identify (by parentage) what group a bone
1268 //belongs to - for example "torso", "leftarm", would return 1 ("torso") for
1269 //all children of the bone named "torso", unless they are children of
1270 //"leftarm" (which is a child of "torso") which would return 2 instead...
1271 float(float skel, float bonenum, string g1, string g2, string g3, string g4, string g5, string g6) example_skel_findbonegroup =
1272 {
1273         string bonename;
1274         while (bonenum >= 0)
1275         {
1276                 bonename = skel_get_bonename(skel, bonenum);
1277                 if (bonename == g1) return 1;
1278                 if (bonename == g2) return 2;
1279                 if (bonename == g3) return 3;
1280                 if (bonename == g4) return 4;
1281                 if (bonename == g5) return 5;
1282                 if (bonename == g6) return 6;
1283                 bonenum = skel_get_boneparent(skel, bonenum);
1284         }
1285         return 0;
1286 };
1287 // create a skeletonindex for our player using current modelindex
1288 void() example_skel_player_setup =
1289 {
1290         self.skeletonindex = skel_create(self.modelindex);
1291 };
1292 // setup bones of skeleton based on an animation
1293 // note: animmodelindex can be a different model than self.modelindex
1294 void(float animmodelindex, float framegroup, float framegroupstarttime) example_skel_player_update_begin =
1295 {
1296         // start with our standard animation
1297         self.frame = framegroup;
1298         self.frame2 = 0;
1299         self.frame3 = 0;
1300         self.frame4 = 0;
1301         self.frame1time = framegroupstarttime;
1302         self.frame2time = 0;
1303         self.frame3time = 0;
1304         self.frame4time = 0;
1305         self.lerpfrac = 0;
1306         self.lerpfrac3 = 0;
1307         self.lerpfrac4 = 0;
1308         skel_build(self.skeletonindex, self, animmodelindex, 0, 0, 100000);
1309 };
1310 // apply a different framegroup animation to bones with a specified parent
1311 void(float animmodelindex, float framegroup, float framegroupstarttime, float blendalpha, string groupbonename, string excludegroupname1, string excludegroupname2) example_skel_player_update_applyoverride =
1312 {
1313         self.frame = framegroup;
1314         self.frame2 = 0;
1315         self.frame3 = 0;
1316         self.frame4 = 0;
1317         self.frame1time = framegroupstarttime;
1318         self.frame2time = 0;
1319         self.frame3time = 0;
1320         self.frame4time = 0;
1321         self.lerpfrac = 0;
1322         self.lerpfrac3 = 0;
1323         self.lerpfrac4 = 0;
1324         float bonenum = 0;
1325         float numbones = skel_get_numbones(self.skeletonindex);
1326         while (bonenum < numbones)
1327         {
1328                 if (example_skel_findbonegroup(self.skeletonindex, bonenum, groupbonename, excludegroupname1, excludegroupname2, "", "", "") == 1)
1329                         skel_build(self.skeletonindex, self, animmodelindex, 1 - blendalpha, bonenum, bonenum + 1);
1330                 bonenum = bonenum + 1;
1331         }
1332 };
1333 // make eyes point at a target location, be sure v_forward, v_right, v_up are set correctly before calling
1334 void(vector eyetarget, string bonename) example_skel_player_update_eyetarget =
1335 {
1336         float bonenum = skel_find_bone(self.skeletonindex, bonename) - 1;
1337         if (bonenum < 0)
1338                 return;
1339         vector oldforward = v_forward;
1340         vector oldright = v_right;
1341         vector oldup = v_up;
1342         vector v = eyetarget - self.origin;
1343         vector modeleyetarget;
1344         modeleyetarget.x =   v * v_forward;
1345         modeleyetarget.y = 0-v * v_right;
1346         modeleyetarget.z =   v * v_up;
1347         // this is an eyeball, make it point at the target location
1348         // first get all the data we can...
1349         vector relorg = skel_get_bonerel(self.skeletonindex, bonenum);
1350         vector relforward = v_forward;
1351         vector relright = v_right;
1352         vector relup = v_up;
1353         vector boneorg = skel_get_boneabs(self.skeletonindex, bonenum);
1354         vector boneforward = v_forward;
1355         vector boneright = v_right;
1356         vector boneup = v_up;
1357         vector parentorg = skel_get_boneabs(self.skeletonindex, skel_get_boneparent(self.skeletonindex, bonenum));
1358         vector parentforward = v_forward;
1359         vector parentright = v_right;
1360         vector parentup = v_up;
1361         // get the vector from the eyeball to the target
1362         vector u = modeleyetarget - boneorg;
1363         // now transform it inversely by the parent matrix to produce new rel vectors
1364         v.x = u * parentforward;
1365         v.y = u * parentright;
1366         v.z = u * parentup;
1367         vector ang = vectoangles2(v, relup);
1368         ang.x = 0 - ang.x;
1369         makevectors(ang);
1370         // set the relative bone matrix
1371         skel_set_bone(self.skeletonindex, bonenum, relorg);
1372         // restore caller's v_ vectors
1373         v_forward = oldforward;
1374         v_right = oldright;
1375         v_up = oldup;
1376 };
1377 // delete skeleton when we're done with it
1378 // note: skeleton remains valid until next frame when it is really deleted
1379 void() example_skel_player_delete =
1380 {
1381         skel_delete(self.skeletonindex);
1382         self.skeletonindex = 0;
1383 };
1384 //
1385 // END OF EXAMPLES FOR FTE_CSQC_SKELETONOBJECTS
1386 //
1387
1388 //DP_QC_ENTITYDATA
1389 //idea: KrimZon
1390 //darkplaces implementation: KrimZon
1391 //builtin definitions:
1392 float() numentityfields = #496;
1393 string(float fieldnum) entityfieldname = #497;
1394 float(float fieldnum) entityfieldtype = #498;
1395 string(float fieldnum, entity ent) getentityfieldstring = #499;
1396 float(float fieldnum, entity ent, string s) putentityfieldstring = #500;
1397 //constants:
1398 //Returned by entityfieldtype
1399 float FIELD_STRING   = 1;
1400 float FIELD_FLOAT    = 2;
1401 float FIELD_VECTOR   = 3;
1402 float FIELD_ENTITY   = 4;
1403 float FIELD_FUNCTION = 6;
1404 //description:
1405 //Versatile functions intended for storing data from specific entities between level changes, but can be customized for some kind of partial savegame.
1406 //WARNING: .entity fields cannot be saved and restored between map loads as they will leave dangling pointers.
1407 //numentityfields returns the number of entity fields. NOT offsets. Vectors comprise 4 fields: v, v_x, v_y and v_z.
1408 //entityfieldname returns the name as a string, eg. "origin" or "classname" or whatever.
1409 //entityfieldtype returns a value that the constants represent, but the field may be of another type in more exotic progs.dat formats or compilers.
1410 //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.
1411 //putentityfieldstring puts the data returned by getentityfieldstring back into the entity.
1412
1413 //DP_QC_ENTITYSTRING
1414 void(string s) loadfromdata = #529;
1415 void(string s) loadfromfile = #530;
1416 void(string s) callfunction = #605;
1417 void(float fh, entity e) writetofile = #606;
1418 float(string s) isfunction = #607;
1419 void(entity e, string s) parseentitydata = #608;
1420
1421 // assorted builtins
1422 //const int STAT_MOVEVARS_TICRATE       = 240;
1423 //const int STAT_MOVEVARS_TIMESCALE     = 241;
1424 //const int STAT_FRAGLIMIT                              = 235;
1425 //const int STAT_TIMELIMIT                              = 236;
1426 //const int STAT_MOVEVARS_GRAVITY       = 242;
1427 string(void) ReadPicture                                = #501;
1428 const int PARTICLES_USEALPHA = 1;
1429 float particles_alphamin, particles_alphamax;
1430 const int PARTICLES_USECOLOR = 2;
1431 vector particles_colormin, particles_colormax;
1432 const int PARTICLES_USEFADE = 4;  // fades the COUNT (fade alpha using alphamin/alphamax)
1433 float particles_fade;
1434 const int PARTICLES_DRAWASTRAIL = 128;
1435 void(float effectindex, entity own, vector org_from, vector org_to, vector dir_from, vector dir_to, float countmultiplier, float flags) boxparticles = #502;
1436 float trace_networkentity;
1437 const int RF_FULLBRIGHT = 256;
1438 const int RF_NOSHADOW   = 512;
1439 const int RF_DYNAMICMODELLIGHT = 8192;
1440
1441 float gettaginfo_parent;
1442 string gettaginfo_name;
1443 vector gettaginfo_offset;
1444 vector gettaginfo_forward;
1445 vector gettaginfo_right;
1446 vector gettaginfo_up;
1447 float checkpvs(vector viewpos, entity viewee) = #240;
1448 #endif