1 //////////////////////////////////////////////////
3 //////////////////////////////////////////////////
4 // AK FIXME: Create perhaps a special builtin file for the common cmds
6 float checkextension(string ext) = #1;
9 void error(string err,...) = #2;
10 void objerror(string err,...) = #3;
14 void print(string text,...) = #4;
15 void bprint(string text,...) = #5;
16 void sprint(float clientnum, string text,...) = #6;
17 void centerprint(string text,...) = #7;
21 vector normalize(vector v) = #8;
22 float vlen(vector v) = #9;
23 float vectoyaw(vector v) = #10;
24 vector vectoangles(vector v) = #11;
26 float random(void) = #12;
28 void cmd(string command, ...) = #13;
32 float cvar(string name) = #14;
33 const string cvar_string(string name) = #71;
34 const string cvar_defstring(string name) = #89;
35 void cvar_set(string name, string value) = #15;
37 void dprint(string text,...) = #16;
39 // conversion functions
41 string ftos(float f) = #17;
42 float fabs(float f) = #18;
43 string vtos(vector v) = #19;
44 string etos(entity e) = #20;
46 float stof(string val,...) = #21;
48 entity spawn(void) = #22;
49 void remove(entity e) = #23;
51 entity findstring(entity start, .string _field, string match) = #24;
52 entity findfloat(entity start, .float _field, float match) = #25;
53 entity findentity(entity start, .entity _field, entity match) = #25;
55 entity findchainstring(.string _field, string match) = #26;
56 entity findchainfloat(.float _field, float match) = #27;
57 entity findchainentity(.entity _field, entity match) = #27;
59 entity findflags(entity start, .float field, float match) = #87;
60 entity findchainflags(.float field, float match) = #88;
62 string precache_file(string file) = #28;
63 string precache_sound(string sample) = #29;
65 void crash(void) = #72;
66 void coredump(void) = #30;
67 void stackdump(void) = #73;
68 void traceon(void) = #31;
69 void traceoff(void) = #32;
71 void eprint(entity e) = #33;
72 float rint(float f) = #34;
73 float floor(float f) = #35;
74 float ceil(float f) = #36;
75 entity nextent(entity e) = #37;
76 float sin(float f) = #38;
77 float cos(float f) = #39;
78 float sqrt(float f) = #40;
79 vector randomvec(void) = #41;
81 float registercvar(string name, string value, float flags) = #42; // returns 1 if success
82 float min(float f,...) = #43;
83 float (float a, float b, float c) min3 = #43;
84 float (float a, float b, float c, float d) min4 = #43;
85 float (float a, float b, float c, float d, float e) min5 = #43;
86 float (float a, float b, float c, float d, float e, float f) min6 = #43;
87 float (float a, float b, float c, float d, float e, float f, float g) min7 = #43;
88 float (float a, float b, float c, float d, float e, float f, float g, float h) min8 = #43;
89 float max(float f,...) = #44;
90 float (float a, float b, float c) max3 = #44;
91 float (float a, float b, float c, float d) max4 = #44;
92 float (float a, float b, float c, float d, float e) max5 = #44;
93 float (float a, float b, float c, float d, float e, float f) max6 = #44;
94 float (float a, float b, float c, float d, float e, float f, float g) max7 = #44;
95 float (float a, float b, float c, float d, float e, float f, float g, float h) max8 = #44;
96 float bound(float min,float value, float max) = #45;
97 float pow(float a, float b) = #46;
98 void copyentity(entity src, entity dst) = #47;
100 float fopen(string filename, float mode) = #48;
101 void fclose(float fhandle) = #49;
102 string fgets(float fhandle) = #50;
103 void fputs(float fhandle, string s) = #51;
105 float strlen(string s) = #52;
106 //string strcat(string s1,string s2,...) = #53;
107 string strcat(string s1, ...) = #53;
108 string substring(string s, float start, float length) = #54;
110 vector stov(string s) = #55;
112 string strzone(string s) = #56;
113 void strunzone(string s) = #57;
115 float tokenize(string s) = #58;
116 float(string s, string separator1, ...) tokenizebyseparator = #479;
117 string argv(float n) = #59;
119 float isserver(void) = #60;
120 float clientcount(void) = #61;
121 float clientstate(void) = #62;
122 void clientcommand(float client, string s) = #63;
123 void changelevel(string map) = #64;
124 void localsound(string sample) = #65;
125 vector getmousepos(void) = #66;
126 float gettime(void) = #67;
127 void loadfromdata(string data) = #68;
128 void loadfromfile(string file) = #69;
130 float mod(float val, float m) = #70;
132 float search_begin(string pattern, float caseinsensitive, float quiet) = #74;
133 void search_end(float handle) = #75;
134 float search_getsize(float handle) = #76;
135 string search_getfilename(float handle, float num) = #77;
137 string chr(float ascii) = #78;
139 float etof(entity ent) = #79;
140 entity ftoe(float num) = #80;
142 float validstring(string str) = #81;
144 float altstr_count(string str) = #82;
145 string altstr_prepare(string str) = #83;
146 string altstr_get(string str, float num) = #84;
147 string altstr_set(string str, float num, string set) = #85;
148 string altstr_ins(string str, float num, string set) = #86;
150 float isdemo() = #349;
152 /////////////////////////////////////////////////
154 /////////////////////////////////////////////////
155 void WriteByte(float data, float dest, float desto) = #401;
156 void WriteChar(float data, float dest, float desto) = #402;
157 void WriteShort(float data, float dest, float desto) = #403;
158 void WriteLong(float data, float dest, float desto) = #404;
159 void WriteAngle(float data, float dest, float desto) = #405;
160 void WriteCoord(float data, float dest, float desto) = #406;
161 void WriteString(string data, float dest, float desto)= #407;
162 void WriteEntity(entity data, float dest, float desto) = #408;
164 //////////////////////////////////////////////////
166 //////////////////////////////////////////////////
168 float iscachedpic(string name) = #451;
169 string precache_pic(string name) = #452;
170 void freepic(string name) = #453;
172 float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
174 float drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
175 float drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag) = #467;
176 float stringwidth(string text, float handleColors, vector size) = #468;
178 float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
179 float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #469;
181 float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
183 void drawsetcliparea(float x, float y, float width, float height) = #458;
185 void drawresetcliparea(void) = #459;
187 vector drawgetimagesize(string pic) = #460;
189 float cin_open(string file, string name) = #461;
190 void cin_close(string name) = #462;
191 void cin_setstate(string name, float type) = #463;
192 float cin_getstate(string name) = #464;
194 ////////////////////////////////////////////////
196 ////////////////////////////////////////////////
198 void setkeydest(float dest) = #601;
199 float getkeydest(void) = #602;
201 void setmousetarget(float trg) = #603;
202 float getmousetarget(void) = #604;
204 float isfunction(string function_name) = #607;
205 void callfunction(...) = #605;
206 void writetofile(float fhandle, entity ent) = #606;
207 vector getresolution(float number, ...) = #608; // optional argument "isfullscreen"
208 string keynumtostring(float keynum) = #609;
209 string findkeysforcommand(string command) = #610;
211 float gethostcachevalue(float type) = #611;
212 string gethostcachestring(float type, float hostnr) = #612;
214 void parseentitydata(entity ent, string data) = #613;
216 float stringtokeynum(string key) = #614;
218 void resethostcachemasks(void) = #615;
219 void sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
220 void sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
221 void resorthostcache(void) = #618;
222 void sethostcachesort(float fld, float descending) = #619;
223 void refreshhostcache(void) = #620;
224 float gethostcachenumber(float fld, float hostnr) = #621;
225 float gethostcacheindexforkey(string key) = #622;
226 void addwantedhostcachekey(string key) = #623;
227 string getextresponse(void) = #624;
229 // AK the builtin numbers may change - the code might be removed again
230 float gecko_create( string name ) = #487;
231 void gecko_destroy( string name ) = #488;
232 void gecko_navigate( string name, string URI ) = #489;
233 float gecko_keyevent( string name, float key, float eventtype ) = #490;
234 void gecko_mousemove( string name, float x, float y ) = #491;
235 void gecko_resize( string name, float w, float h ) = #492;
236 vector gecko_get_texture_extent( string name ) = #493;
240 //darkplaces implementation: KrimZon
242 //various string manipulation functions
243 float(string str, string sub, float startpos) strstrofs = #221;
244 float(string str, float ofs) str2chr = #222;
245 string(float c, ...) chr2str = #223;
246 string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
247 string(float chars, string s, ...) strpad = #225;
248 string(string info, string key, string value, ...) infoadd = #226;
249 string(string info, string key) infoget = #227;
250 float(string s1, string s2, float len) strncmp = #228;
251 float(string s1, string s2) strcasecmp = #229;
252 float(string s1, string s2, float len) strncasecmp = #230;
254 string(string s) strdecolorize = #477;
256 //DP_QC_STRINGBUFFERS
258 //darkplaces implementation: LordHavoc
259 //functions to manage string buffer objects - that is, arbitrary length string arrays that are handled by the engine
260 float() buf_create = #440;
261 void(float bufhandle) buf_del = #441;
262 float(float bufhandle) buf_getsize = #442;
263 void(float bufhandle_from, float bufhandle_to) buf_copy = #443;
264 void(float bufhandle, float sortpower, float backward) buf_sort = #444;
265 string(float bufhandle, string glue) buf_implode = #445;
266 string(float bufhandle, float string_index) bufstr_get = #446;
267 void(float bufhandle, float string_index, string str) bufstr_set = #447;
268 float(float bufhandle, string str, float order) bufstr_add = #448;
269 void(float bufhandle, float string_index) bufstr_free = #449;
270 void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517;
271 string(string name) cvar_description = #518;
275 //darkplaces implementation: div0
276 //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.
277 //When caseinsensitive is set, the CRC is calculated of the lower cased string.
278 float(float caseinsensitive, string s, ...) crc16 = #494;
281 float(string name) cvar_type = #495;
282 float CVAR_TYPEFLAG_EXISTS = 1;
283 float CVAR_TYPEFLAG_SAVED = 2;
284 float CVAR_TYPEFLAG_PRIVATE = 4;
285 float CVAR_TYPEFLAG_ENGINE = 8;
286 float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
287 float CVAR_TYPEFLAG_READONLY = 32;
291 //darkplaces implementation: div0
292 //URI::Escape's functionality
293 string(string in) uri_escape = #510;
294 string(string in) uri_unescape = #511;
298 //darkplaces implementation: divVerent
299 //loads text from an URL into a string
300 //returns 1 on success of initiation, 0 if there are too many concurrent
301 //connections already or if the URL is invalid
302 //the following callback will receive the data and MUST exist!
303 // void(float id, float status, string data) URI_Get_Callback;
305 // negative for an internal error,
307 // the HTTP response code on server error (e.g. 404)
308 //if 1 is returned by uri_get, the callback will be called in the future
309 float(string url, float id) uri_get = #513;
312 //darkplaces implementation: divVerent
313 //loads text from an URL into a string after POSTing via HTTP
314 //works like uri_get, but uri_post sends data with Content-Type: content_type to the server
315 //and uri_post sends the string buffer buf, joined using the delimiter delim
316 float(string url, float id, string content_type, string data) uri_post = #513;
317 float(string url, float id, string content_type, string delim, float buf) uri_postbuf = #513;
319 string(string, float) netaddress_resolve = #625;
320 string(string search, string replace, string subject) strreplace = #484;
322 string(float uselocaltime, string format, ...) strftime = #478;
324 float(string s) tokenize_console = #514;
325 float(float i) argv_start_index = #515;
326 float(float i) argv_end_index = #516;
328 string(float, float) getgamedirinfo = #626;
329 #define GETGAMEDIRINFO_NAME 0
330 #define GETGAMEDIRINFO_DESCRIPTION 1
331 float log(float f) = #532;
333 string(string format, ...) sprintf = #627;
337 //darkplaces implementation: divVerent
338 //field definitions: (MENUQC)
339 string crypto_getkeyfp(string serveraddress) = #633; // retrieves the cached host key's CA fingerprint of a server given by IP address
340 string crypto_getidfp(string serveraddress) = #634; // retrieves the cached host key fingerprint of a server given by IP address
341 string crypto_getencryptlevel(string serveraddress) = #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
342 float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513;
346 //idea: motorsep, Spike
347 //DarkPlaces implementation: divVerent
348 //builtin definitions:
349 string(string digest, string data, ...) digest_hex = #639;
351 //returns a given hex digest of given data
352 //the returned digest is always encoded in hexadecimal
353 //only the "MD4" digest is always supported!
354 //if the given digest is not supported, string_null is returned
355 //the digest string is matched case sensitively, use "MD4", not "md4"!