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