]> icculus.org git repositories - divverent/darkplaces.git/blob - dpdefs/csprogsdefs.qc
drawcolorcodedstring: support full 6 parms (added starting rgb) and returns color...
[divverent/darkplaces.git] / dpdefs / csprogsdefs.qc
1 /*
2 ==============================================================================
3
4                         SOURCE FOR GLOBALVARS_T C STRUCTURE
5                         MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
6
7 ==============================================================================
8 */
9
10 //
11 // system globals
12 //
13 entity          self;
14 entity          other;
15 entity          world;
16 float           time;
17 float           frametime;
18
19 float           player_localentnum;     //the entnum
20 float           player_localnum;        //the playernum
21 float           maxclients;     //a constant filled in by the engine. gah, portability eh?
22
23 float           clientcommandframe;     //player movement
24 float           servercommandframe;     //clientframe echoed off the server
25
26 string          mapname;
27
28 //
29 // global variables set by built in functions
30 //
31 vector          v_forward, v_up, v_right;       // set by makevectors()
32
33 // set by traceline / tracebox
34 float           trace_allsolid;
35 float           trace_startsolid;
36 float           trace_fraction;
37 vector          trace_endpos;
38 vector          trace_plane_normal;
39 float           trace_plane_dist;
40 entity          trace_ent;
41 float           trace_inopen;
42 float           trace_inwater;
43
44 //
45 // required prog functions
46 //
47 void()          CSQC_Init;
48 void()          CSQC_Shutdown;
49 float(float f, float t, float n)        CSQC_InputEvent;
50 void(float w, float h)          CSQC_UpdateView;
51 float(string s) CSQC_ConsoleCommand;
52
53 //these fields are read and set by the default player physics
54 vector          pmove_org;
55 vector          pmove_vel;
56 vector          pmove_mins;
57 vector          pmove_maxs;
58 //retrieved from the current movement commands (read by player physics)
59 float           input_timelength;
60 vector          input_angles;
61 vector          input_movevalues;       //forwards, right, up.
62 float           input_buttons;          //attack, use, jump (default physics only uses jump)
63
64 float           movevar_gravity;
65 float           movevar_stopspeed;
66 float           movevar_maxspeed;
67 float           movevar_spectatormaxspeed;      //used by NOCLIP movetypes.
68 float           movevar_accelerate;
69 float           movevar_airaccelerate;
70 float           movevar_wateraccelerate;
71 float           movevar_friction;
72 float           movevar_waterfriction;
73 float           movevar_entgravity;     //the local player's gravity field. Is a multiple (1 is the normal value)
74
75 //================================================
76 void            end_sys_globals;                // flag for structure dumping
77 //================================================
78
79 /*
80 ==============================================================================
81
82                         SOURCE FOR ENTVARS_T C STRUCTURE
83                         MUST NOT BE MODIFIED, OR CRC ERRORS WILL APPEAR
84
85 ==============================================================================
86 */
87
88 //
89 // system fields (*** = do not set in prog code, maintained by C code)
90 //
91 .float          modelindex;             // *** model index in the precached list
92 .vector         absmin, absmax; // *** origin + mins / maxs
93
94 .float          entnum; // *** the ent number as on the server
95 .float          drawmask;
96 .void()         predraw;
97
98 .float          movetype;
99 .float          solid;
100
101 .vector         origin;                 // ***
102 .vector         oldorigin;              // ***
103 .vector         velocity;
104 .vector         angles;
105 .vector         avelocity;
106
107 .string         classname;              // spawn function
108 .string         model;
109 .float          frame;
110 .float          skin;
111 .float          effects;
112
113 .vector         mins, maxs;             // bounding box extents reletive to origin
114 .vector         size;                   // maxs - mins
115
116 .void()         touch;
117 .void()         use;
118 .void()         think;
119 .void()         blocked;                // for doors or plats, called when can't push other
120
121 .float          nextthink;
122
123 .entity         chain;
124
125 .string         netname;
126
127 .entity         enemy;
128
129 .float          flags;
130
131 .float          colormap;
132
133 .entity         owner;          // who launched a missile
134
135 //================================================
136 void            end_sys_fields;                 // flag for structure dumping
137 //================================================
138
139 /*
140 ==============================================================================
141
142                         OPTIONAL FIELDS AND GLOBALS
143
144 ==============================================================================
145 */
146
147 // Additional OPTIONAL Fields and Globals
148 float           intermission;
149
150 vector          view_angles; // same as input_angles
151 vector          view_punchangle;
152 vector          view_punchvector;
153
154 /*
155 ==============================================================================
156
157                         CONSTANT DEFINITIONS
158
159 ==============================================================================
160 */
161
162 const float MASK_ENGINE                 = 1;
163 const float MASK_ENGINEVIEWMODELS       = 2;
164 const float MASK_NORMAL                 = 4;
165
166 const float RF_VIEWMODEL        = 1;
167 const float RF_EXTERNALMODEL    = 2;
168 const float RF_DEPTHHACK        = 4;
169 const float RF_ADDATIVE         = 8;
170 const float RF_USEAXIS          = 16;
171
172 const float VF_MIN              = 1;    //(vector)
173 const float VF_MIN_X            = 2;    //(float)
174 const float VF_MIN_Y            = 3;    //(float)
175 const float VF_SIZE             = 4;    //(vector) (viewport size)
176 const float VF_SIZE_Y           = 5;    //(float)
177 const float VF_SIZE_X           = 6;    //(float)
178 const float VF_VIEWPORT         = 7;    //(vector, vector)
179 const float VF_FOV              = 8;    //(vector)
180 const float VF_FOVX             = 9;    //(float)
181 const float VF_FOVY             = 10;   //(float)
182 const float VF_ORIGIN           = 11;   //(vector)
183 const float VF_ORIGIN_X         = 12;   //(float)
184 const float VF_ORIGIN_Y         = 13;   //(float)
185 const float VF_ORIGIN_Z         = 14;   //(float)
186 const float VF_ANGLES           = 15;   //(vector)
187 const float VF_ANGLES_X         = 16;   //(float)
188 const float VF_ANGLES_Y         = 17;   //(float)
189 const float VF_ANGLES_Z         = 18;   //(float)
190 const float VF_DRAWWORLD        = 19;   //(float)
191 const float VF_DRAWENGINESBAR   = 20;   //(float)
192 const float VF_DRAWCROSSHAIR    = 21;   //(float)
193
194 const float VF_CL_VIEWANGLES    = 33;   //(vector)
195 const float VF_CL_VIEWANGLES_X  = 34;   //(float)
196 const float VF_CL_VIEWANGLES_Y  = 35;   //(float)
197 const float VF_CL_VIEWANGLES_Z  = 36;   //(float) 
198
199 const float VF_PERSPECTIVE      = 200;
200
201 const float STAT_HEALTH         = 0;
202 const float STAT_WEAPONMODEL    = 2;
203 const float STAT_AMMO           = 3;
204 const float STAT_ARMOR          = 4;
205 const float STAT_WEAPONFRAME    = 5;
206 const float STAT_SHELLS         = 6;
207 const float STAT_NAILS          = 7;
208 const float STAT_ROCKETS        = 8;
209 const float STAT_CELLS          = 9;
210 const float STAT_ACTIVEWEAPON   = 10;
211 const float STAT_TOTALSECRETS   = 11;
212 const float STAT_TOTALMONSTERS  = 12;
213 const float STAT_SECRETS                = 13;
214 const float STAT_MONSTERS               = 14;
215 const float STAT_ITEMS          = 15;
216 const float STAT_VIEWHEIGHT     = 16;
217
218 // Quake Sound Constants
219 const float CHAN_AUTO                   = 0;
220 const float CHAN_WEAPON                 = 1;
221 const float CHAN_VOICE                  = 2;
222 const float CHAN_ITEM                   = 3;
223 const float CHAN_BODY                   = 4;
224
225 const float ATTN_NONE                   = 0;
226 const float ATTN_NORM                   = 1;
227 const float ATTN_IDLE                   = 2;
228 const float ATTN_STATIC                 = 3;
229
230 // Frik File Constants
231 const float FILE_READ                   = 0;
232 const float FILE_APPEND                 = 1;
233 const float FILE_WRITE                  = 2;
234
235 // Quake Point Contents
236 const float CONTENT_EMPTY                                       = -1;
237 const float CONTENT_SOLID                                       = -2;
238 const float CONTENT_WATER                                       = -3;
239 const float CONTENT_SLIME                                       = -4;
240 const float CONTENT_LAVA                                        = -5;
241 const float CONTENT_SKY                                         = -6;
242
243 // Quake Solid Constants
244 const float SOLID_NOT                                           = 0;
245 const float SOLID_TRIGGER                                       = 1;
246 const float SOLID_BBOX                                          = 2;
247 const float SOLID_SLIDEBOX                                      = 3;
248 const float SOLID_BSP                                           = 4;
249 const float SOLID_CORPSE                                        = 5;
250
251 // Quake Move Constants
252 const float MOVE_NORMAL                                         = 0;
253 const float MOVE_NOMONSTERS                                     = 1;
254 const float MOVE_MISSILE                                        = 2;
255
256 // Boolean Constants
257 const float true        = 1;
258 const float false       = 0;
259 const float TRUE        = 1;
260 const float FALSE       = 0;
261
262 const float EXTRA_LOW = -99999999;
263 const float EXTRA_HIGH = 99999999;
264
265 const vector VEC_1      = '1 1 1';
266 const vector VEC_0      = '0 0 0';
267 const vector VEC_M1     = '-1 -1 -1';
268
269 const float M_PI = 3.14159265358979323846;
270
271 vector  VEC_HULL_MIN = '-16 -16 -24';
272 vector  VEC_HULL_MAX = '16 16 32';
273
274 // Quake Temporary Entity Constants
275 const float TE_SPIKE                                            = 0;
276 const float TE_SUPERSPIKE                                       = 1;
277 const float TE_GUNSHOT                                          = 2;
278 const float TE_EXPLOSION                                        = 3;
279 const float TE_TAREXPLOSION                                     = 4;
280 const float TE_LIGHTNING1                                       = 5;
281 const float TE_LIGHTNING2                                       = 6;
282 const float TE_WIZSPIKE                                         = 7;
283 const float TE_KNIGHTSPIKE                                      = 8;
284 const float TE_LIGHTNING3                                       = 9;
285 const float TE_LAVASPLASH                                       = 10;
286 const float TE_TELEPORT                                         = 11;
287 const float TE_EXPLOSION2                                       = 12;
288         // Darkplaces Additions
289         const float TE_EXPLOSIONRGB                                     = 53;
290         const float TE_GUNSHOTQUAD                                      = 57;
291         const float TE_EXPLOSIONQUAD                            = 70;
292         const float TE_SPIKEQUAD                                        = 58;
293         const float TE_SUPERSPIKEQUAD                           = 59;
294         
295 // PFlags for Dynamic Lights
296 const float PFLAGS_NOSHADOW                                     = 1;
297 const float PFLAGS_CORONA                                       = 2;
298 const float PFLAGS_FULLDYNAMIC                          = 128;
299
300 const float EF_ADDITIVE         = 32;
301 const float EF_BLUE             = 64;
302 const float EF_FLAME            = 1024;
303 const float EF_FULLBRIGHT       = 512;
304 const float EF_NODEPTHTEST      = 8192;
305 const float EF_NODRAW           = 16;
306 const float EF_NOSHADOW         = 4096;
307 const float EF_RED              = 128;
308 const float EF_STARDUST         = 2048;
309 const float EF_SELECTABLE       = 16384;
310
311 const float PFL_ONGROUND        = 1;
312 const float PFL_CROUCH          = 2;
313 const float PFL_DEAD            = 4;
314 const float PFL_GIBBED          = 8;
315
316 /*
317 ==============================================================================
318
319                         BUILTIN DEFINITIONS
320                         EXTENSIONS ARE NOT ADDED HERE, BUT BELOW!
321
322 ==============================================================================
323 */
324
325 void(vector ang) makevectors = #1;
326 void(entity e, vector o) setorigin = #2;
327 void(entity e, string m) setmodel = #3;
328 void(entity e, vector min, vector max) setsize = #4;
329
330 void() break = #6;
331 float() random = #7;
332 void(entity e, float chan, string samp) sound = #8;
333 vector(vector v) normalize = #9;
334 void(string e) error = #10;
335 void(string e) objerror = #11;
336 float(vector v) vlen = #12;
337 float(vector v) vectoyaw = #13;
338 entity() spawn = #14;
339 void(entity e) remove = #15;
340 float(vector v1, vector v2, float tryents, entity ignoreentity) traceline = #16;
341
342 entity(entity start, .string fld, string match) find = #18;
343 void(string s) precache_sound = #19;
344 void(string s) precache_model = #20;
345
346 entity(vector org, float rad) findradius = #22;
347
348 void(string s, ...) dprint = #25;
349 string(float f) ftos = #26;
350 string(vector v) vtos = #27;
351 void() coredump = #28;
352 void() traceon = #29;
353 void() traceoff = #30;
354 void(entity e) eprint = #31;
355 // settrace optional
356 float(float yaw, float dist, float settrace) walkmove = #32;
357
358 float() droptofloor = #34;
359 void(float style, string value) lightstyle = #35;
360 float(float v) rint = #36;
361 float(float v) floor = #37;
362 float(float v) ceil = #38;
363
364 float(entity e) checkbottom = #40;
365 float(vector v) pointcontents = #41;
366
367 float(float f) fabs = #43;
368
369 float(string s) cvar = #45;
370 void(string s, ...) localcmd = #46;
371 entity(entity e) nextent = #47;
372 void(vector o, vector d, float color, float count) particle = #48;
373 void() ChangeYaw = #49;
374
375 vector(vector v) vectoangles = #51;
376 vector(vector v, vector w) vectoangles2 = #51;
377
378 float(float f) sin = #60;
379 float(float f) cos = #61;
380 float(float f) sqrt = #62;
381 void(entity ent) changepitch = #63;
382 void(entity e, entity ignore) tracetoss = #64;
383 string(entity ent) etos = #65;
384
385 string(string s) precache_file = #68;
386 void(entity e) makestatic = #69;
387
388 void(string var, string val) cvar_set = #72;
389
390 void(vector pos, string samp, float vol, float atten) ambientsound = #74;
391 string(string s) precache_model2 = #75;
392 string(string s) precache_sound2 = #76;
393 string(string s) precache_file2 = #77;
394
395 float(string s) stof = #81;
396
397
398 void(vector v1, vector min, vector max, vector v2, float nomonsters, entity forent) tracebox = #90;
399 vector() randomvec = #91;
400 vector(vector org) getlight = #92;
401 vector(vector org, float lpflags) getlight2 = #92;
402 const float LP_LIGHTMAP = 1;
403 const float LP_RTWORLD = 2;
404 const float LP_DYNLIGHT = 4;
405 const float LP_COMPLETE = 7;
406
407 float(string name, string value) registercvar = #93;
408 float( float a, ... ) min = #94;
409 float( float b, ... ) max = #95;
410 float(float minimum, float val, float maximum) bound = #96;
411 float(float f, float f) pow = #97;
412 entity(entity start, .float fld, float match) findfloat = #98;
413 float(string s) checkextension = #99;
414 // FrikaC and Telejano range #100-#199
415
416 float(string filename, float mode) fopen = #110;
417 void(float fhandle) fclose = #111;
418 string(float fhandle) fgets = #112;
419 void(float fhandle, string s) fputs = #113;
420 float(string s) strlen = #114;
421 string(...) strcat = #115;
422 string(string s, float start, float length) substring = #116;
423 vector(string) stov = #117;
424 string(string s) strzone = #118;
425 void(string s) strunzone = #119;
426
427 // FTEQW range #200-#299
428
429 float(float number, float quantity) bitshift = #218;
430
431 //float(string str, string sub[, float startpos]) strstrofs = #221;
432 float(string str, string sub, float startpos) strstrofs = #221;
433 float(string str, float ofs) str2chr = #222;
434 string(float c, ...) chr2str = #223;
435 string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
436 string(float chars, string s, ...) strpad = #225;
437 string(string info, string key, string value, ...) infoadd = #226;
438 string(string info, string key) infoget = #227;
439 float(string s1, string s2, float len) strncmp = #228;
440 float(string s1, string s2) strcasecmp = #229;
441 float(string s1, string s2, float len) strncasecmp = #230;
442
443 // CSQC range #300-#399
444 void() clearscene = #300;
445 void(float mask) addentities = #301;
446 void(entity ent) addentity = #302;
447 float(float property, ...) setproperty = #303;
448 void() renderscene = #304;
449 void(vector org, float radius, vector lightcolours) adddynamiclight = #305;
450 void(vector org, float radius, vector lightcolours, float style, string cubemapname, float pflags) adddynamiclight2 = #305;
451 //void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon = #306;
452 void(string texturename, float flag, float is2d, float lines) R_BeginPolygon = #306;
453 void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex = #307;
454 void() R_EndPolygon = #308;
455 vector (vector v) cs_unproject = #310;
456 vector (vector v) cs_project = #311;
457
458 void(float width, vector pos1, vector pos2, float flag) drawline = #315;
459 float(string name) iscachedpic = #316;
460 string(string name, float trywad) precache_pic = #317;
461 vector(string picname) draw_getimagesize = #318;
462 void(string name) freepic = #319;
463 float(vector position, float character, vector scale, vector rgb, float alpha, float flag) drawcharacter = #320;
464 float(vector position, string text, vector scale, vector rgb, float alpha, float flag) drawstring = #321;
465 float(vector position, string pic, vector size, vector rgb, float alpha, float flag) drawpic = #322;
466 float(vector position, vector size, vector rgb, float alpha, float flag) drawfill = #323;
467 void(float x, float y, float width, float height) drawsetcliparea = #324;
468 void(void) drawresetcliparea = #325;
469 float(vector position, string text, vector scale, float alpha, float flag) drawcolorcodedstring = #326;
470 vector(vector position, string text, vector scale, vector rgb, float alpha, float flag) drawcolorcodedstring2 = #326;
471
472 float(float stnum) getstatf = #330;
473 float(float stnum) getstati = #331;
474 string(float firststnum) getstats = #332;
475 void(entity e, float mdlindex) setmodelindex = #333;
476 string(float mdlindex) modelnameforindex = #334;
477 float(string effectname) particleeffectnum = #335;
478 void(entity ent, float effectnum, vector start, vector end) trailparticles = #336;
479 //void(float effectnum, vector origin [, vector dir, float count]) pointparticles = #337;
480 void(float effectnum, vector origin , vector dir, float count) pointparticles = #337;
481 void(string s, ...) centerprint = #338;
482 void(string s, ...) print = #339;
483 string(float keynum) keynumtostring = #340;
484 float(string keyname) stringtokeynum = #341;
485 string(float keynum) getkeybind = #342;
486 void(float usecursor) setcursormode = #343;
487 vector() getmousepos = #344;
488 float(float framenum) getinputstate = #345;
489 void(float sens) setsensitivityscale = #346;
490 void() runstandardplayerphysics = #347;
491 string(float playernum, string keyname) getplayerkeyvalue = #348;
492 float() isdemo = #349;
493 float() isserver = #350;
494 void(vector origin, vector forward, vector right, vector up) SetListener = #351;
495 void(string cmdname) registercommand = #352;
496 float(entity ent) wasfreed = #353;
497 string(string key) serverkey = #354;
498
499 // Use proper case; refer to the id1 Write* functions!
500 float() ReadByte = #360;
501 float() ReadChar = #361;
502 float() ReadShort = #362;
503 float() ReadLong = #363;
504 float() ReadCoord = #364;
505 float() ReadAngle = #365;
506 string() ReadString = #366;
507 float() ReadFloat = #367;
508
509 // LordHavoc's range #400-#499
510 void(entity from, entity to) copyentity = #400;
511
512 entity(.string fld, string match) findchain = #402;
513 entity(.float fld, float match) findchainfloat = #403;
514 void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404;
515 void(vector org, vector velocity, float howmany) te_blood = #405;
516 void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406;
517 void(vector org, vector color) te_explosionrgb = #407;
518 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408;
519 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409;
520 void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410;
521 void(vector org, vector vel, float howmany) te_spark = #411;
522 void(vector org) te_gunshotquad = #412;
523 void(vector org) te_spikequad = #413;
524 void(vector org) te_superspikequad = #414;
525 void(vector org) te_explosionquad = #415;
526 void(vector org) te_smallflash = #416;
527 void(vector org, float radius, float lifetime, vector color) te_customflash = #417;
528 void(vector org) te_gunshot = #418;
529 void(vector org) te_spike = #419;
530 void(vector org) te_superspike = #420;
531 void(vector org) te_explosion = #421;
532 void(vector org) te_tarexplosion = #422;
533 void(vector org) te_wizspike = #423;
534 void(vector org) te_knightspike = #424;
535 void(vector org) te_lavasplash = #425;
536 void(vector org) te_teleport = #426;
537 void(vector org, float colorstart, float colorlength) te_explosion2 = #427;
538 void(entity own, vector start, vector end) te_lightning1 = #428;
539 void(entity own, vector start, vector end) te_lightning2 = #429;
540 void(entity own, vector start, vector end) te_lightning3 = #430;
541 void(entity own, vector start, vector end) te_beam = #431;
542 void(vector dir) vectorvectors = #432;
543 void(vector org) te_plasmaburn = #433;
544 float(entity e, float s) getsurfacenumpoints = #434;
545 vector(entity e, float s, float n) getsurfacepoint = #435;
546 vector(entity e, float s) getsurfacenormal = #436;
547 string(entity e, float s) getsurfacetexture = #437;
548 float(entity e, vector p) getsurfacenearpoint = #438;
549 vector(entity e, float s, vector p) getsurfaceclippedpoint = #439;
550
551 float(string s) tokenize = #441;
552 string(float n) argv = #442;
553 void(entity e, entity tagentity, string tagname) setattachment = #443;
554 float(string pattern, float caseinsensitive, float quiet) search_begin = #444;
555 void(float handle) search_end = #445;
556 float(float handle) search_getsize = #446;
557 string(float handle, float num) search_getfilename = #447;
558 string(string s) cvar_string = #448;
559 entity(entity start, .float fld, float match) findflags = #449;
560 entity(.float fld, float match) findchainflags = #450;
561 float(entity ent, string tagname) gettagindex = #451;
562 vector(entity ent, float tagindex) gettaginfo = #452;
563
564 void(vector org, vector vel, float howmany) te_flamejet = #457;
565
566 entity(float num) entitybyindex = #459;
567 float() buf_create = #460;
568 void(float bufhandle) buf_del = #461;
569 float(float bufhandle) buf_getsize = #462;
570 void(float bufhandle_from, float bufhandle_to) buf_copy = #463;
571 void(float bufhandle, float sortpower, float backward) buf_sort = #464;
572 string(float bufhandle, string glue) buf_implode = #465;
573 string(float bufhandle, float string_index) bufstr_get = #466;
574 void(float bufhandle, float string_index, string str) bufstr_set = #467;
575 float(float bufhandle, string str, float order) bufstr_add = #468;
576 void(float bufhandle, float string_index) bufstr_free = #469;
577
578 float(float s) asin = #471;
579 float(float c) acos = #472;
580 float(float t) atan = #473;
581 float(float c, float s) atan2 = #474;
582 float(float a) tan = #475;
583 float(string s) strippedstringlen = #476;
584 float(string s) strlennocol = #476; // This is the correct name for the function, but not removing the decolorizedstring mapping.
585 string(string s) decolorizedstring = #477;
586 string(string s) strdecolorize = #477; // This is the correct name for the function, but not removing the decolorizedstring mapping.
587 string(float uselocaltime, string format, ...) strftime = #478;
588 float(string s) tokenizebyseparator = #479;
589 string(string s) strtolower = #480;
590 string(string s) strtoupper = #481;
591 string(string s) cvar_defstring = #482;
592 void(vector origin, string sample, float volume, float attenuation) pointsound = #483;
593 string(string search, string replace, string subject) strreplace = #484;
594 string(string search, string replace, string subject) strireplace = #485;
595 vector(entity e, float s, float n, float a) getsurfacepointattribute = #486;
596 #ifdef SUPPORT_GECKO
597 float gecko_create( string name ) = #487;
598 void gecko_destroy( string name ) = #488;
599 void gecko_navigate( string name, string URI ) = #489;
600 float gecko_keyevent( string name, float key, float eventtype ) = #490;
601 void gecko_mousemove( string name, float x, float y ) = #491;
602 void gecko_resize( string name, float w, float h ) = #492;
603 vector gecko_get_texture_extent( string name ) = #493;
604 #else
605
606 #endif
607
608 /*
609 ==============================================================================
610
611                         EXTENSION DEFINITIONS
612
613 ==============================================================================
614 */
615
616 // DP_CSQC_SPAWNPARTICLE
617 // idea: VorteX
618 // darkplaces implementation: VorteX
619 // constant definitions:
620 // particle base behavior:
621 float PT_ALPHASTATIC = 1;
622 float PT_STATIC = 2;
623 float PT_SPARK = 3;
624 float PT_BEAM = 4;
625 float PT_RAIN = 5;
626 float PT_RAINDECAL = 6;
627 float PT_SNOW = 7;
628 float PT_BUBBLE = 8;
629 float PT_BLOOD = 9;
630 float PT_SMOKE = 10;
631 float PT_DECAL = 11;
632 float PT_ENTITYPARTICLE = 12;
633 // particle blendtypes:
634 float PBLEND_ALPHA = 0;
635 float PBLEND_ADD = 1;
636 float PBLEND_INVMOD = 2;
637 // particle orientation:
638 float PARTICLE_BILLBOARD = 0;
639 float PARTICLE_SPARK = 1;
640 float PARTICLE_ORIENTED_DOUBLESIDED = 2;
641 float PARTICLE_BEAM = 3;
642 // global definitions:
643 float particle_type; // one of PT_
644 float particle_blendmode; // one of PBLEND_ values
645 float particle_orientation; // one of PARTICLE_ values
646 vector particle_color1; 
647 vector particle_color2;
648 float particle_tex; // number of chunk in particlefont
649 float particle_size;
650 float particle_sizeincrease; 
651 float particle_alpha;
652 float particle_alphafade;
653 float particle_time;
654 float particle_gravity;
655 float particle_bounce;
656 float particle_airfriction;
657 float particle_liquidfriction;
658 float particle_originjitter;
659 float particle_velocityjitter;
660 float particle_qualityreduction; // enable culling of this particle when FPS is low
661 float particle_stretch;
662 vector particle_staincolor1;
663 vector particle_staincolor2;
664 float particle_staintex;
665 float particle_stainalpha;
666 float particle_stainsize;
667 float particle_delayspawn;
668 float particle_delaycollision;
669 float particle_angle;
670 float particle_spin;
671 // builtin definitions:
672 float(float max_themes) initparticlespawner = #522; // check fields/globals for integration and enable particle spawner, return 1 is succeded, otherwise returns 0
673 void() resetparticle = #523; // reset p_ globals to default theme #0
674 void(float theme) particletheme = #524; // restore p_ globals from saved theme
675 float() particlethemesave = #525; // save p_ globals to new particletheme and return it's index
676 void(float theme) particlethemeupdate = #525; // save p_ globals to new particletheme and return it's index
677 void(float theme) particlethemefree = #526; // delete a particle theme
678 float(vector org, vector vel) particle = #527; // returns 0 when failed, 1 when spawned
679 float(vector org, vector vel, float theme) quickparticle = #527; // not reading globals, just theme, returns 0 when failed, 1 when spawned
680 float(vector org, vector vel, float delay, float collisiondelay) delayedparticle = #528;
681 float(vector org, vector vel, float delay, float collisiondelay, float theme) quickdelayedparticle = #528;
682 // description: this builtin provides an easy and flexible way to spawn particles, 
683 // it is not created as replace for DP_SV_POINTPARTICLES but as an addition to it. 
684 // With this extension you can create a specific particles like rain particles, or entity particles
685 // notes: 
686 // 1) 0 is default particle template, it could be changed
687 // 2) color vectors could have value 0-255 of each component
688 // restrictions: max themes could be between 4 and 2048
689 // warning: you should call initparticlespawner() at very beginning BEFORE all other particle spawner functions
690 // function to query particle info
691 // don't remove this function as it protects all particle_ globals from FTEQCC/FRIKQCC non-referenced removal optimisation
692 void() printparticle =
693 {
694         // vortex: this also protects from 'non-referenced' optimisation on some compilers
695         print("PARTICLE:\n");
696         print(strcat("  type: ", ftos(particle_type), "\n"));
697         print(strcat("  blendmode: ", ftos(particle_blendmode), "\n"));
698         print(strcat("  orientation: ", ftos(particle_orientation), "\n"));
699         print(strcat("  color1: ", vtos(particle_color1), "\n"));
700         print(strcat("  color2: ", vtos(particle_color2), "\n"));
701         print(strcat("  tex: ", ftos(particle_tex), "\n"));
702         print(strcat("  size: ", ftos(particle_size), "\n"));
703         print(strcat("  sizeincrease: ", ftos(particle_sizeincrease), "\n"));
704         print(strcat("  alpha: ", ftos(particle_alpha), "\n"));
705         print(strcat("  alphafade: ", ftos(particle_alphafade), "\n"));
706         print(strcat("  time: ", ftos(particle_time), "\n"));
707         print(strcat("  gravity: ", ftos(particle_gravity), "\n"));
708         print(strcat("  bounce: ", ftos(particle_bounce), "\n"));
709         print(strcat("  airfriction: ", ftos(particle_airfriction), "\n"));
710         print(strcat("  liquidfriction: ", ftos(particle_liquidfriction), "\n"));
711         print(strcat("  originjitter: ", ftos(particle_originjitter), "\n"));
712         print(strcat("  velocityjitter: ", ftos(particle_velocityjitter), "\n"));
713         print(strcat("  qualityreduction: ", ftos(particle_qualityreduction), "\n"));
714         print(strcat("  stretch: ", ftos(particle_stretch), "\n"));
715         print(strcat("  staincolor1: ", vtos(particle_staincolor1), "\n"));
716         print(strcat("  staincolor2: ", vtos(particle_staincolor2), "\n"));
717         print(strcat("  staintex: ", ftos(particle_staintex), "\n"));
718         print(strcat("  stainalpha: ", ftos(particle_stainalpha), "\n"));
719         print(strcat("  stainsize: ", ftos(particle_stainsize), "\n"));
720         print(strcat("  delayspawn: ", ftos(particle_delayspawn), "\n"));
721         print(strcat("  delaycollision: ", ftos(particle_delaycollision), "\n"));
722         print(strcat("  angle: ", ftos(particle_angle), "\n"));
723         print(strcat("  spin: ", ftos(particle_spin), "\n"));
724 }
725
726 // DP_CSQC_ENTITYTRANSPARENTSORTING_OFFSET
727 // idea: VorteX
728 // darkplaces implementation: VorteX
729 float RF_USETRANSPARENTOFFSET = 64; // enables transparent origin offsetting
730 // global definitions
731 float transparent_offset; // should be set before entity is added
732 // 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
733 // example: transparent_offset = 1000000; // entity always appear on background of other transparents
734 // note: offset is done in view forward axis
735
736 // DP_CSQC_ENTITYNOCULL
737 // idea: VorteX
738 // darkplaces implementation: VorteX
739 const float RF_NOCULL = 128;
740 // description: when renderflag is set, engine will not use culling methods for this entity, e.g. it will always be drawn
741 // useful for large outdoor objects (like asteriods on sky horizont or sky models)
742 // also useful when culling is done at CSQC side
743
744 // DP_CSQC_SETPAUSE
745 // idea: VorteX
746 // darkplaces implementation: VorteX
747 // builtin definitions:
748 void(float ispaused) setpause = #531;
749 // description: provides ability to set pause in local games (similar to one set once console is activated)
750 // not stopping sound/cd track, useful for inventory screens, ingame menus with input etc.
751
752 // DP_CSQC_QUERYRENDERENTITY
753 // idea: VorteX
754 // darkplaces implementation: VorteX
755 // constant definitions:
756 // render entity fields:
757 float E_ACTIVE      = 0; // float 0/1
758 float E_ORIGIN      = 1; // vector
759 float E_FORWARD     = 2; // vector
760 float E_RIGHT       = 3; // vector
761 float E_UP          = 4; // vector
762 float E_SCALE       = 5; // float
763 float E_ORIGINANDVECTORS = 6; // returns origin, + sets v_* vectors to orientation
764 float E_ALPHA       = 7; // float
765 float E_COLORMOD    = 8; // vector
766 float E_PANTSCOLOR  = 9; // vector
767 float E_SHIRTCOLOR  = 10; // vector
768 float E_SKIN        = 11; // float
769 float E_MINS        = 12; // vector
770 float E_MAXS        = 13; // vector
771 float E_ABSMIN      = 14; // vector
772 float E_ABSMAX      = 15; // vector
773 float E_LIGHT       = 16; // vector - modellight
774 // builtin definitions:
775 float(float entitynum, float fldnum) getentity = #504;
776 vector(float entitynum, float fldnum) getentityvec = #504;
777 // description: allows to query parms from render entities, especially useful with attaching CSQC ents to
778 // server entities networked and interpolated by engine (monsters, players), number of entity is it's SVQC number
779 // you can send it via tempentity/CSQC entity message. Note that this builtin doesnt know about entity removing/reallocating
780 // so it's meaning to work for short period of time, dont use it on missiles/grenades whatever will be removed next five seconds
781
782 //DP_GFX_FONTS
783 //idea: Blub\0, divVerent
784 //darkplaces implementation: Blub\0
785 //console commands:
786 //  loadfont fontname fontmaps size1 size2 ...
787 //   A font can simply be gfx/tgafile (freetype fonts doent need extension), 
788 //   or alternatively you can specify multiple fonts and faces
789 //   Like this: gfx/vera-sans:2,gfx/fallback:1
790 //   to load face 2 of the font gfx/vera-sans and use face 1
791 //   of gfx/fallback as fallback font
792 //   You can also specify a list of font sizes to load, like this:
793 //   loadfont console gfx/conchars,gfx/fallback 8 12 16 24 32
794 //   In many cases, 8 12 16 24 32 should be a good choice.
795 //   for slots see:
796 //constant definitions:
797 float drawfont;            // set it before drawstring()/drawchar() calls
798 float FONT_DEFAULT = 0;    // 'default'
799 float FONT_CONSOLE = 1;    // 'console', REALLY should be fixed width (ls!)
800 float FONT_SBAR = 2;       // 'sbar', used on hud, must be fixed width
801 float FONT_NOTIFY = 3;     // 'notify', used on sprint/bprint
802 float FONT_CHAT = 4;       // 'chat'
803 float FONT_CENTERPRINT = 5;// 'centerprint'
804 float FONT_INFOBAR = 6;    // 'infobar'
805 float FONT_MENU = 7;       // 'menu', should be fixed width
806 float FONT_USER0 = 8;      // 'user0', userdefined fonts
807 float FONT_USER1 = 9;      // 'user1', userdefined fonts
808 float FONT_USER2 = 10;     // 'user2', userdefined fonts
809 float FONT_USER3 = 11;     // 'user3', userdefined fonts
810 float FONT_USER4 = 12;     // 'user4', userdefined fonts
811 float FONT_USER5 = 13;     // 'user5', userdefined fonts
812 float FONT_USER6 = 14;     // 'user6', userdefined fonts
813 float FONT_USER7 = 15;     // 'user7' slot, userdefined fonts
814 //builtin definitions:
815 float findfont(string s) = #356; // find font by fontname and return it's index
816 float loadfont(string fontname, string fontmaps, string sizes, float slot, float fix_scale, float fix_voffset) = #357; 
817 // loads font immediately so stringwidth() function can be used just after builtin call
818 // returns a font slotnum (which is used to set drawfont to)
819 // first 3 parms are identical to "loadfont" console command ones
820 // slot could be one of FONT_ constants or result of findfont() or -1 to not use it
821 // if slot is given, font will be loaded to this slotnum and fontname become new title for it
822 // this way you can rename user* fonts to something more usable
823 // fix_* parms let you fix badly made fonts by applying some transformations to them
824 // fix_scale : per-character center-oriented scale (doesn't change line height at all)
825 // fix_voffset : vertical offset for each character, it's a multiplier to character height
826 float stringwidth(string text, float allowColorCodes, vector size) = #327; // get a width of string with given font and char size
827 float stringwidth_menu(string text, float allowColorCodes, vector size) = #468; // in menu.dat it has different builtin #
828 //description: engine support for custom fonts in console, hud, qc etc.
829 // limits:
830 //  max 128 chars for font name
831 //  max 3 font fallbacks
832 //  max 8 sizes per font
833
834 //DP_GFX_FONTS_FREETYPE
835 //idea: Blub\0, divVerent
836 //darkplaces implementation: Blub\0
837 //cvar definitions:
838 //   r_font_disable_freetype 0/1 : disable freetype fonts loading (uttetly disables freetype library initialization)
839 //   r_font_antialias 0/1 : antialiasing when loading font
840 //   r_font_hint 0/1/2/3  : hinting when loading font, 0 is no hinting, 1 light autohinting , 2 full autohinting, 3 full hinting
841 //   r_font_postprocess_blur X      : font outline blur amount
842 //   r_font_postprocess_outline X   : font outline width
843 //   r_font_postprocess_shadow_x X  : font outline shadow x shift amount, applied during outlining
844 //   r_font_postprocess_shadow_y X  : font outline shadow y shift amount, applied during outlining
845 //   r_font_postprocess_shadow_z X  : font outline shadow z shift amount, applied during blurring
846 //description: engine support for truetype/freetype fonts
847 //so .AFM+.PFB/.OTF/.TTF files could be stuffed as fontmaps in loadfont() 
848 //(console command version will support them as well)
849
850 //DP_CSQC_BINDMAPS
851 //idea: daemon, motorsep
852 //darkplaces implementation: divVerent
853 //builtin definitions:
854 string(float key, float bindmap) getkeybind_bindmap = #342;
855 float(float key, string bind, float bindmap) setkeybind_bindmap = #630;
856 vector(void) getbindmaps = #631;
857 float(vector bm) setbindmaps = #632;
858 string(string command, float bindmap) findkeysforcommand = #610;
859 //<already in EXT_CSQC> float(string key) stringtokeynum = #341;
860 //<already in EXT_CSQC> string(float keynum) keynumtostring = #340;
861 //description: key bind setting/getting including support for switchable
862 //bindmaps.
863
864 //DP_CRYPTO
865 //idea: divVerent
866 //darkplaces implementation: divVerent
867 //builtin definitions: (CSQC)
868 float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513;
869 //description:
870 //use -1 as buffer handle to justs end delim as postdata