9 //////////////////////////////////////////////////////////
14 /////////////////////////////////////////////////////////
16 /////////////////////////////////////////////////////////
19 /////////////////////////////////////////////////////////
21 /////////////////////////////////////////////////////////
25 void(float keynr, float ascii) m_keydown;
26 void(float width, float height) m_draw;
27 void(float mode) m_toggle;
29 // optional: float(float) m_gethostcachecategory;
31 /////////////////////////////////////////////////////////
33 ///////////////////////////
36 float KEY_UNKNOWN = -1;
39 float KEY_MENU_GRABBED = 3;
41 ///////////////////////////
45 float FILE_APPEND = 1;
48 ///////////////////////////
51 float MSG_BROADCAST = 0; // unreliable to all
52 float MSG_ONE = 1; // reliable to one (msg_entity)
53 float MSG_ALL = 2; // reliable to all
54 float MSG_INIT = 3; // write to the init string
56 /////////////////////////////
57 // mouse target constants
62 /////////////////////////
63 // client state constants
65 float CS_DEDICATED = 0;
66 float CS_DISCONNECTED = 1;
67 float CS_CONNECTED = 2;
69 ///////////////////////////
72 float DRAWFLAG_NORMAL = 0;
73 float DRAWFLAG_ADDITIVE = 1;
74 float DRAWFLAG_MODULATE = 2;
75 float DRAWFLAG_2XMODULATE = 3;
77 ///////////////////////////
78 // null entity (actually it is the same like the world entity)
82 ///////////////////////////
86 float ERR_CANNOTOPEN = -1; // fopen
87 float ERR_NOTENOUGHFILEHANDLES = -2; // fopen
88 float ERR_INVALIDMODE = -3; // fopen
89 float ERR_BADFILENAME = -4; // fopen
93 float ERR_NULLSTRING = -1;
94 float ERR_BADDRAWFLAG = -2;
95 float ERR_BADSCALE = -3;
96 float ERR_BADSIZE = -3; // same as ERR_BADSCALE
97 float ERR_NOTCACHED = -4;
100 float SLIST_HOSTCACHEVIEWCOUNT = 0;
101 float SLIST_HOSTCACHETOTALCOUNT = 1;
102 float SLIST_MASTERQUERYCOUNT = 2;
103 float SLIST_MASTERREPLYCOUNT = 3;
104 float SLIST_SERVERQUERYCOUNT = 4;
105 float SLIST_SERVERREPLYCOUNT = 5;
106 float SLIST_SORTFIELD = 6;
107 float SLIST_SORTDESCENDING = 7;
108 float SLIST_LEGACY_LINE1 = 1024;
109 float SLIST_LEGACY_LINE2 = 1025;
110 float SLIST_TEST_CONTAINS = 0;
111 float SLIST_TEST_NOTCONTAIN = 1;
112 float SLIST_TEST_LESSEQUAL = 2;
113 float SLIST_TEST_LESS = 3;
114 float SLIST_TEST_EQUAL = 4;
115 float SLIST_TEST_GREATER = 5;
116 float SLIST_TEST_GREATEREQUAL = 6;
117 float SLIST_TEST_NOTEQUAL = 7;
118 float SLIST_TEST_STARTSWITH = 8;
119 float SLIST_TEST_NOTSTARTSWITH = 9;
120 float SLIST_MASK_AND = 0;
121 float SLIST_MASK_OR = 512;
124 float FONT_DEFAULT = 0;
125 float FONT_CONSOLE = 1;
127 float FONT_NOTIFY = 3;
129 float FONT_CENTERPRINT = 5;
130 float FONT_INFOBAR = 6;
132 float FONT_USER = 8; // add to this the index, like FONT_USER+3 = user3. At least 8 of them are supported.
135 /* not supported at the moment
136 ///////////////////////////
139 float OS_WINDOWS = 0;
153 //////////////////////////////////////////////////
155 //////////////////////////////////////////////////
156 // AK FIXME: Create perhaps a special builtin file for the common cmds
158 void checkextension(string ext) = #1;
161 void error(string err,...) = #2;
162 void objerror(string err,...) = #3;
166 void print(string text,...) = #4;
167 void bprint(string text,...) = #5;
168 void sprint(float clientnum, string text,...) = #6;
169 void centerprint(string text,...) = #7;
173 vector normalize(vector v) = #8;
174 float vlen(vector v) = #9;
175 float vectoyaw(vector v) = #10;
176 vector vectoangles(vector v) = #11;
178 float random(void) = #12;
180 void cmd(string command, ...) = #13;
184 float cvar(string name) = #14;
185 const string str_cvar(string name) = #71;
186 void cvar_set(string name, string value) = #15;
188 void dprint(string text,...) = #16;
190 // conversion functions
192 string ftos(float f) = #17;
193 float fabs(float f) = #18;
194 string vtos(vector v) = #19;
195 string etos(entity e) = #20;
197 float stof(string val,...) = #21;
199 entity spawn(void) = #22;
200 void remove(entity e) = #23;
202 entity find(entity start, .string field, string match) = #24;
203 entity findfloat(entity start, .float field, float match) = #25;
204 entity findentity(entity start, .entity field, entity match) = #25;
206 entity findchainstring(.string field, string match) = #26;
207 entity findchainfloat(.float field, float match) = #27;
208 entity findchainentity(.entity field, entity match) = #27;
210 string precache_file(string file) = #28;
211 string precache_sound(string sample) = #29;
213 void crash(void) = #72;
214 void coredump(void) = #30;
215 void stackdump(void) = #73;
216 void traceon(void) = #31;
217 void traceoff(void) = #32;
219 void eprint(entity e) = #33;
220 float rint(float f) = #34;
221 float floor(float f) = #35;
222 float ceil(float f) = #36;
223 entity nextent(entity e) = #37;
224 float sin(float f) = #38;
225 float cos(float f) = #39;
226 float sqrt(float f) = #40;
227 vector randomvec(void) = #41;
229 float registercvar(string name, string value, float flags) = #42; // returns 1 if success
231 float min(float f,...) = #43;
232 float max(float f,...) = #44;
234 float bound(float min,float value, float max) = #45;
235 float pow(float a, float b) = #46;
237 void copyentity(entity src, entity dst) = #47;
239 float fopen(string filename, float mode) = #48;
240 void fclose(float fhandle) = #49;
241 string fgets(float fhandle) = #50;
242 void fputs(float fhandle, string s) = #51;
244 float strlen(string s) = #52;
245 string strcat(string s1,string s2,...) = #53;
246 string substring(string s, float start, float length) = #54;
248 vector stov(string s) = #55;
250 string strzone(string s) = #56;
251 void strunzone(string s) = #57;
253 float tokenize(string s) = #58;
254 string argv(float n) = #59;
256 float isserver(void) = #60;
257 float clientcount(void) = #61;
258 float clientstate(void) = #62;
259 void clientcommand(float client, string s) = #63;
260 void changelevel(string map) = #64;
261 void localsound(string sample) = #65;
262 vector getmousepos(void) = #66;
263 float gettime(void) = #67;
264 void loadfromdata(string data) = #68;
265 void loadfromfile(string file) = #69;
267 float mod(float val, float m) = #70;
269 float search_begin(string pattern, float caseinsensitive, float quiet) = #74;
270 void search_end(float handle) = #75;
271 float search_getsize(float handle) = #76;
272 string search_getfilename(float handle, float num) = #77;
274 string chr(float ascii) = #78;
276 /////////////////////////////////////////////////
278 /////////////////////////////////////////////////
279 void WriteByte(float data, float dest, float desto) = #401;
280 void WriteChar(float data, float dest, float desto) = #402;
281 void WriteShort(float data, float dest, float desto) = #403;
282 void WriteLong(float data, float dest, float desto) = #404;
283 void WriteAngle(float data, float dest, float desto) = #405;
284 void WriteCoord(float data, float dest, float desto) = #406;
285 void WriteString(string data, float dest, float desto)= #407;
286 void WriteEntity(entity data, float dest, float desto) = #408;
288 //////////////////////////////////////////////////
290 //////////////////////////////////////////////////
292 float iscachedpic(string name) = #451;
293 string precache_pic(string name, ...) = #452;
294 void freepic(string name) = #453;
296 float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
298 float drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
300 float drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag) = #467;
302 vector drawcolorcodedstring2(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #467;
304 float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
306 float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
308 void drawsetcliparea(float x, float y, float width, float height) = #458;
310 void drawresetcliparea(void) = #459;
312 vector drawgetimagesize(string pic) = #460;
314 ////////////////////////////////////////////////
316 ////////////////////////////////////////////////
318 void setkeydest(float dest) = #601;
319 float getkeydest(void) = #602;
321 void setmousetarget(float trg) = #603;
322 float getmousetarget(void) = #604;
324 float isfunction(string function_name) = #607;
325 void callfunction(...) = #605;
326 void writetofile(float fhandle, entity ent) = #606;
327 vector getresolution(float number) = #608;
328 string keynumtostring(float keynum) = #609;
330 float gethostcachevalue(float type) = #611;
331 string gethostcachestring(float type, float hostnr) = #612;
334 //idea: daemon, motorsep
335 //darkplaces implementation: divVerent
336 //builtin definitions:
337 string(float key, float bindmap) getkeybind_bindmap = #342;
338 float(float key, string bind, float bindmap) setkeybind_bindmap = #630;
339 vector(void) getbindmaps = #631;
340 float(vector bm) setbindmaps = #632;
341 string(string command, float bindmap) findkeysforcommand = #610;
342 float(string key) stringtokeynum = #341;
343 //<also allowed builtin number to match EXT_CSQC> string(float keynum) keynumtostring = #340;
344 //description: key bind setting/getting including support for switchable
349 //darkplaces implementation: divVerent
350 //field definitions: (MENUQC)
351 string(string serveraddress) crypto_getkeyfp = #633; // retrieves the cached host key's CA fingerprint of a server given by IP address
352 string(string serveraddress) crypto_getidfp = #634; // retrieves the cached host key fingerprint of a server given by IP address
353 string(string serveraddress) crypto_getencryptlevel = #635; // 0 if never encrypting, 1 supported, 2 requested, 3 required, appended by list of allowed methods in order of preference ("AES128"), preceded by a space each
354 string(float i) crypto_getmykeyfp = #636; // retrieves the CA key fingerprint of a given CA slot, or "" if slot is unused but more to come, or string_null if end of list
355 string(float i) crypto_getmyidfp = #637; // retrieves the ID fingerprint of a given CA slot, or "" if slot is unused but more to come, or string_null if end of list
356 float CRYPTO_IDSTATUS_OUTOFRANGE = -1;
357 float CRYPTO_IDSTATUS_EMPTY = 0;
358 float CRYPTO_IDSTATUS_UNSIGNED = 1;
359 float CRYPTO_IDSTATUS_SIGNED = 2;
360 float(float i) crypto_getmyidstatus = #641; // retrieves the ID's status of a given CA slot, or 0 if slot is unused but more to come, or -1 if end of list
361 float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513;
363 //use -1 as buffer handle to justs end delim as postdata
366 //idea: Res2k, BlackHC
367 //darkplaces implementation: Res2k, BlackHC
368 //constant definitions:
369 float GECKO_BUTTON_DOWN = 0;
370 float GECKO_BUTTON_UP = 1;
371 // either use down and up or just press but not all of them!
372 float GECKO_BUTTON_PRESS = 2;
373 // use this for mouse events if needed?
374 float GECKO_BUTTON_DOUBLECLICK = 3;
375 //builtin definitions:
376 float gecko_create( string name ) = #487;
377 void gecko_destroy( string name ) = #488;
378 void gecko_navigate( string name, string URI ) = #489;
379 float gecko_keyevent( string name, float key, float eventtype ) = #490;
380 void gecko_mousemove( string name, float x, float y ) = #491;
381 void gecko_resize( string name, float w, float h ) = #492;
382 vector gecko_get_texture_extent( string name ) = #493;
383 //engine-called QC prototypes:
384 //string(string name, string query) Qecko_Query;
386 //provides an interface to the offscreengecko library and allows for internet browsing in games
390 //darkplaces implementation: KrimZon
392 //various string manipulation functions
393 float(string str, string sub, float startpos) strstrofs = #221;
394 float(string str, float ofs) str2chr = #222;
395 string(float c, ...) chr2str = #223;
396 string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
397 string(float chars, string s, ...) strpad = #225;
398 string(string info, string key, string value, ...) infoadd = #226;
399 string(string info, string key) infoget = #227;
400 float(string s1, string s2) strcmp = #228;
401 float(string s1, string s2, float len) strncmp = #228;
402 float(string s1, string s2) strcasecmp = #229;
403 float(string s1, string s2, float len) strncasecmp = #230;
405 //DP_PRECACHE_PIC_FLAGS
407 //darkplaces implementation: divVerent
408 //constant definitions:
409 float PRECACHE_PIC_FROMWAD = 1; // this one actually is part of EXT_CSQC
410 float PRECACHE_PIC_NOTPERSISTENT = 2; // picture may get deallocated when unused
411 float PRECACHE_PIC_MIPMAP = 8; // mipmap the texture for possibly better downscaling at memory expense
412 //notes: these constants are given as optional second argument to precache_pic()
416 //darkplaces implementation: div0
417 //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.
418 //When caseinsensitive is set, the CRC is calculated of the lower cased string.
419 float(float caseinsensitive, string s, ...) crc16 = #494;
422 float(string name) cvar_type = #495;
423 float CVAR_TYPEFLAG_EXISTS = 1;
424 float CVAR_TYPEFLAG_SAVED = 2;
425 float CVAR_TYPEFLAG_PRIVATE = 4;
426 float CVAR_TYPEFLAG_ENGINE = 8;
427 float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
428 float CVAR_TYPEFLAG_READONLY = 32;
430 //DP_QC_STRINGBUFFERS
432 //darkplaces implementation: LordHavoc
433 //functions to manage string buffer objects - that is, arbitrary length string arrays that are handled by the engine
434 int() buf_create = #440;
435 void(float bufhandle) buf_del = #441;
436 float(float bufhandle) buf_getsize = #442;
437 void(float bufhandle_from, float bufhandle_to) buf_copy = #443;
438 void(float bufhandle, float sortpower, float backward) buf_sort = #444;
439 string(float bufhandle, string glue) buf_implode = #445;
440 string(float bufhandle, float string_index) bufstr_get = #446;
441 void(float bufhandle, float string_index, string str) bufstr_set = #447;
442 float(float bufhandle, string str, float order) bufstr_add = #448;
443 void(float bufhandle, float string_index) bufstr_free = #449;
444 void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517;
446 //DP_QC_STRING_CASE_FUNCTIONS
448 //darkplaces implementation: LordHavoc / Dresk
449 //builtin definitions:
450 string(string s) strtolower = #480; // returns the passed in string in pure lowercase form
451 string(string s) strtoupper = #481; // returns the passed in string in pure uppercase form
453 //provides simple string uppercase and lowercase functions
455 //DP_QC_CVAR_DESCRIPTION
457 //DarkPlaces implementation: divVerent
458 //builtin definitions:
459 string(string name) cvar_description = #518;
461 //returns the description of a cvar
464 //idea: motorsep, Spike
465 //DarkPlaces implementation: divVerent
466 //builtin definitions:
467 string(string digest, string data, ...) digest_hex = #639;
469 //returns a given hex digest of given data
470 //the returned digest is always encoded in hexadecimal
471 //only the "MD4" digest is always supported!
472 //if the given digest is not supported, string_null is returned
473 //the digest string is matched case sensitively, use "MD4", not "md4"!
477 //darkplaces implementation: div0
478 //URI::Escape's functionality
479 string(string in) uri_escape = #510;
480 string(string in) uri_unescape = #511;
484 //darkplaces implementation: divVerent
485 //loads text from an URL into a string
486 //returns 1 on success of initiation, 0 if there are too many concurrent
487 //connections already or if the URL is invalid
488 //the following callback will receive the data and MUST exist!
489 // void(float id, float status, string data) URI_Get_Callback;
491 // negative for an internal error,
493 // the HTTP response code on server error (e.g. 404)
494 //if 1 is returned by uri_get, the callback will be called in the future
495 float(string url, float id) uri_get = #513;
498 //darkplaces implementation: divVerent
499 //loads text from an URL into a string after POSTing via HTTP
500 //works like uri_get, but uri_post sends data with Content-Type: content_type to the server
501 //and uri_post sends the string buffer buf, joined using the delimiter delim
502 float(string url, float id, string content_type, string data) uri_post = #513;
503 float(string url, float id, string content_type, string delim, float buf) uri_postbuf = #513;
507 //darkplaces implementation: KrimZon
508 //builtin definitions:
509 float() numentityfields = #496;
510 string(float fieldnum) entityfieldname = #497;
511 float(float fieldnum) entityfieldtype = #498;
512 string(float fieldnum, entity ent) getentityfieldstring = #499;
513 float(float fieldnum, entity ent, string s) putentityfieldstring = #500;
515 //Returned by entityfieldtype
516 float FIELD_STRING = 1;
517 float FIELD_FLOAT = 2;
518 float FIELD_VECTOR = 3;
519 float FIELD_ENTITY = 4;
520 float FIELD_FUNCTION = 6;
522 //Versatile functions intended for storing data from specific entities between level changes, but can be customized for some kind of partial savegame.
523 //WARNING: .entity fields cannot be saved and restored between map loads as they will leave dangling pointers.
524 //numentityfields returns the number of entity fields. NOT offsets. Vectors comprise 4 fields: v, v_x, v_y and v_z.
525 //entityfieldname returns the name as a string, eg. "origin" or "classname" or whatever.
526 //entityfieldtype returns a value that the constants represent, but the field may be of another type in more exotic progs.dat formats or compilers.
527 //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.
528 //putentityfieldstring puts the data returned by getentityfieldstring back into the entity.
530 // assorted undocumented extensions
531 string(string, float) netaddress_resolve = #625;
532 string(string search, string replace, string subject) strreplace = #484;
533 string(float uselocaltime, string format, ...) strftime = #478;
534 float(string s) tokenize_console = #514;
535 float(float i) argv_start_index = #515;
536 float(float i) argv_end_index = #516;
537 string(float, float) getgamedirinfo = #626;
538 const float GETGAMEDIRINFO_NAME = 0;
539 const float GETGAMEDIRINFO_DESCRIPTION = 1;
540 float log(float f) = #532;
541 string(string format, ...) sprintf = #627;
542 string(string s) strdecolorize = #477;
543 entity findflags(entity start, .float field, float match) = #87;
544 entity findchainflags(.float field, float match) = #88;
545 float(string s, string separator1, ...) tokenizebyseparator = #479;
546 float etof(entity ent) = #79;
547 entity ftoe(float num) = #80;
548 float validstring(string str) = #81;
549 float altstr_count(string str) = #82;
550 string altstr_prepare(string str) = #83;
551 string altstr_get(string str, float num) = #84;
552 string altstr_set(string str, float num, string set) = #85;
553 string altstr_ins(string str, float num, string set) = #86;
554 float isdemo() = #349;
555 float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #469;
556 //vector getresolution(float number, ...) = #608; // optional argument "isfullscreen"
557 void parseentitydata(entity ent, string data) = #613;
558 void resethostcachemasks(void) = #615;
559 void sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
560 void sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
561 void resorthostcache(void) = #618;
562 float SLSF_DESCENDING = 1;
563 float SLSF_FAVORITES = 2;
564 float SLSF_CATEGORIES = 4;
565 void sethostcachesort(float fld, float slsf) = #619;
566 void refreshhostcache(...) = #620; // optional boolean argument "clear_list"
567 float gethostcachenumber(float fld, float hostnr) = #621;
568 float gethostcacheindexforkey(string key) = #622;
569 void addwantedhostcachekey(string key) = #623;
570 string getextresponse(void) = #624;
571 const string cvar_string(string name) = #71;
572 const string cvar_defstring(string name) = #89;
573 float stringwidth(string text, float handleColors, vector size) = #468;