1 //////////////////////////////////////////////////
3 //////////////////////////////////////////////////
4 // AK FIXME: Create perhaps a special builtin file for the common cmds
6 //#define PROFILESTRZONE
9 float checkextension(string ext) = #1;
12 void error(string err,...) = #2;
13 void objerror(string err,...) = #3;
17 void print(string text,...) = #4;
18 void bprint(string text,...) = #5;
19 void sprint(float clientnum, string text,...) = #6;
20 void centerprint(string text,...) = #7;
24 vector normalize(vector v) = #8;
25 float vlen(vector v) = #9;
26 float vectoyaw(vector v) = #10;
27 vector vectoangles(vector v) = #11;
29 float random(void) = #12;
31 void cmd(string command, ...) = #13;
35 float cvar(string name) = #14;
36 const string cvar_string(string name) = #71;
37 const string cvar_defstring(string name) = #89;
38 void cvar_set(string name, string value) = #15;
40 void dprint(string text,...) = #16;
42 // conversion functions
44 string ftos(float f) = #17;
45 float fabs(float f) = #18;
46 string vtos(vector v) = #19;
47 string etos(entity e) = #20;
49 float stof(string val,...) = #21;
51 entity spawn(void) = #22;
52 void remove(entity e) = #23;
54 entity findstring(entity start, .string _field, string match) = #24;
55 entity findfloat(entity start, .float _field, float match) = #25;
56 entity findentity(entity start, .entity _field, entity match) = #25;
58 entity findchainstring(.string _field, string match) = #26;
59 entity findchainfloat(.float _field, float match) = #27;
60 entity findchainentity(.entity _field, entity match) = #27;
62 entity findflags(entity start, .float field, float match) = #87;
63 entity findchainflags(.float field, float match) = #88;
65 string precache_file(string file) = #28;
66 string precache_sound(string sample) = #29;
68 void crash(void) = #72;
69 void coredump(void) = #30;
70 void stackdump(void) = #73;
71 void traceon(void) = #31;
72 void traceoff(void) = #32;
74 void eprint(entity e) = #33;
75 float rint(float f) = #34;
76 float floor(float f) = #35;
77 float ceil(float f) = #36;
78 entity nextent(entity e) = #37;
79 float sin(float f) = #38;
80 float cos(float f) = #39;
81 float sqrt(float f) = #40;
82 vector randomvec(void) = #41;
84 float registercvar(string name, string value, float flags) = #42; // returns 1 if success
85 float min(float f,...) = #43;
86 float (float a, float b, float c) min3 = #43;
87 float (float a, float b, float c, float d) min4 = #43;
88 float (float a, float b, float c, float d, float e) min5 = #43;
89 float (float a, float b, float c, float d, float e, float f) min6 = #43;
90 float (float a, float b, float c, float d, float e, float f, float g) min7 = #43;
91 float (float a, float b, float c, float d, float e, float f, float g, float h) min8 = #43;
92 float max(float f,...) = #44;
93 float (float a, float b, float c) max3 = #44;
94 float (float a, float b, float c, float d) max4 = #44;
95 float (float a, float b, float c, float d, float e) max5 = #44;
96 float (float a, float b, float c, float d, float e, float f) max6 = #44;
97 float (float a, float b, float c, float d, float e, float f, float g) max7 = #44;
98 float (float a, float b, float c, float d, float e, float f, float g, float h) max8 = #44;
99 float bound(float min,float value, float max) = #45;
100 float pow(float a, float b) = #46;
101 void copyentity(entity src, entity dst) = #47;
104 float _fopen( string filename, float mode ) = #48;
106 float fopen(string filename, float mode) = #48;
108 void fclose(float fhandle) = #49;
109 string fgets(float fhandle) = #50;
110 void fputs(float fhandle, string s) = #51;
112 float strlen(string s) = #52;
113 //string strcat(string s1,string s2,...) = #53;
114 string strcat(string s1, ...) = #53;
115 string substring(string s, float start, float length) = #54;
117 vector stov(string s) = #55;
119 #ifdef PROFILESTRZONE
120 string _strzone(string s) = #56;
121 void _strunzone(string s) = #57;
123 string( string s ) strzone =
125 return _strzone( s );
128 void( string s ) strunzone =
130 return _strunzone( s );
133 string strzone(string s) = #56;
134 void strunzone(string s) = #57;
137 float tokenize(string s) = #58;
138 float(string s, string separator1, ...) tokenizebyseparator = #479;
139 string argv(float n) = #59;
141 float isserver(void) = #60;
142 float clientcount(void) = #61;
143 float clientstate(void) = #62;
144 void clientcommand(float client, string s) = #63;
145 void changelevel(string map) = #64;
146 void localsound(string sample) = #65;
147 vector getmousepos(void) = #66;
148 float gettime(void) = #67;
149 void loadfromdata(string data) = #68;
150 void loadfromfile(string file) = #69;
152 float mod(float val, float m) = #70;
154 float search_begin(string pattern, float caseinsensitive, float quiet) = #74;
155 void search_end(float handle) = #75;
156 float search_getsize(float handle) = #76;
157 string search_getfilename(float handle, float num) = #77;
159 string chr(float ascii) = #78;
161 float etof(entity ent) = #79;
162 entity ftoe(float num) = #80;
164 float validstring(string str) = #81;
166 float altstr_count(string str) = #82;
167 string altstr_prepare(string str) = #83;
168 string altstr_get(string str, float num) = #84;
169 string altstr_set(string str, float num, string set) = #85;
170 string altstr_ins(string str, float num, string set) = #86;
172 float isdemo() = #349;
174 /////////////////////////////////////////////////
176 /////////////////////////////////////////////////
177 void WriteByte(float data, float dest, float desto) = #401;
178 void WriteChar(float data, float dest, float desto) = #402;
179 void WriteShort(float data, float dest, float desto) = #403;
180 void WriteLong(float data, float dest, float desto) = #404;
181 void WriteAngle(float data, float dest, float desto) = #405;
182 void WriteCoord(float data, float dest, float desto) = #406;
183 void WriteString(string data, float dest, float desto)= #407;
184 void WriteEntity(entity data, float dest, float desto) = #408;
186 //////////////////////////////////////////////////
188 //////////////////////////////////////////////////
190 float iscachedpic(string name) = #451;
191 string precache_pic(string name) = #452;
192 void freepic(string name) = #453;
194 float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
196 float drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
197 float drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag) = #467;
198 float stringwidth(string text, float handleColors, vector size) = #468;
200 float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
201 float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #469;
203 float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
205 void drawsetcliparea(float x, float y, float width, float height) = #458;
207 void drawresetcliparea(void) = #459;
209 vector drawgetimagesize(string pic) = #460;
211 float cin_open(string file, string name) = #461;
212 void cin_close(string name) = #462;
213 void cin_setstate(string name, float type) = #463;
214 float cin_getstate(string name) = #464;
216 ////////////////////////////////////////////////
218 ////////////////////////////////////////////////
220 void setkeydest(float dest) = #601;
221 float getkeydest(void) = #602;
223 void setmousetarget(float trg) = #603;
224 float getmousetarget(void) = #604;
226 float isfunction(string function_name) = #607;
227 void callfunction(...) = #605;
228 void writetofile(float fhandle, entity ent) = #606;
229 vector getresolution(float number, ...) = #608; // optional argument "isfullscreen"
230 string keynumtostring(float keynum) = #609;
231 string findkeysforcommand(string command) = #610;
233 float gethostcachevalue(float type) = #611;
234 string gethostcachestring(float type, float hostnr) = #612;
236 void parseentitydata(entity ent, string data) = #613;
238 float stringtokeynum(string key) = #614;
240 void resethostcachemasks(void) = #615;
241 void sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
242 void sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
243 void resorthostcache(void) = #618;
244 void sethostcachesort(float fld, float descending) = #619;
245 void refreshhostcache(void) = #620;
246 float gethostcachenumber(float fld, float hostnr) = #621;
247 float gethostcacheindexforkey(string key) = #622;
248 void addwantedhostcachekey(string key) = #623;
249 string getextresponse(void) = #624;
251 // AK the builtin numbers may change - the code might be removed again
252 float gecko_create( string name ) = #487;
253 void gecko_destroy( string name ) = #488;
254 void gecko_navigate( string name, string URI ) = #489;
255 float gecko_keyevent( string name, float key, float eventtype ) = #490;
256 void gecko_mousemove( string name, float x, float y ) = #491;
257 void gecko_resize( string name, float w, float h ) = #492;
258 vector gecko_get_texture_extent( string name ) = #493;
262 //darkplaces implementation: KrimZon
264 //various string manipulation functions
265 float(string str, string sub, float startpos) strstrofs = #221;
266 float(string str, float ofs) str2chr = #222;
267 string(float c, ...) chr2str = #223;
268 string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
269 string(float chars, string s, ...) strpad = #225;
270 string(string info, string key, string value, ...) infoadd = #226;
271 string(string info, string key) infoget = #227;
272 float(string s1, string s2, float len) strncmp = #228;
273 float(string s1, string s2) strcasecmp = #229;
274 float(string s1, string s2, float len) strncasecmp = #230;
276 string(string s) strdecolorize = #477;
278 //DP_QC_STRINGBUFFERS
280 //darkplaces implementation: LordHavoc
281 //functions to manage string buffer objects - that is, arbitrary length string arrays that are handled by the engine
282 float() buf_create = #440;
283 void(float bufhandle) buf_del = #441;
284 float(float bufhandle) buf_getsize = #442;
285 void(float bufhandle_from, float bufhandle_to) buf_copy = #443;
286 void(float bufhandle, float sortpower, float backward) buf_sort = #444;
287 string(float bufhandle, string glue) buf_implode = #445;
288 string(float bufhandle, float string_index) bufstr_get = #446;
289 void(float bufhandle, float string_index, string str) bufstr_set = #447;
290 float(float bufhandle, string str, float order) bufstr_add = #448;
291 void(float bufhandle, float string_index) bufstr_free = #449;
292 void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517;
293 string(string name) cvar_description = #518;
297 //darkplaces implementation: div0
298 //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.
299 //When caseinsensitive is set, the CRC is calculated of the lower cased string.
300 float(float caseinsensitive, string s, ...) crc16 = #494;
303 float(string name) cvar_type = #495;
304 float CVAR_TYPEFLAG_EXISTS = 1;
305 float CVAR_TYPEFLAG_SAVED = 2;
306 float CVAR_TYPEFLAG_PRIVATE = 4;
307 float CVAR_TYPEFLAG_ENGINE = 8;
308 float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
309 float CVAR_TYPEFLAG_READONLY = 32;
313 //darkplaces implementation: div0
314 //URI::Escape's functionality
315 string(string in) uri_escape = #510;
316 string(string in) uri_unescape = #511;
318 string(string, float) netaddress_resolve = #625;
319 string(string search, string replace, string subject) strreplace = #484;
321 string(float uselocaltime, string format, ...) strftime = #478;
324 float fopen( string filename, float mode ) =
327 if( mode == FILE_READ ) {
328 return _fopen( filename, mode );
332 filename = strzone( filename );
333 if( substring( filename, 0, 5 ) != "data/" ) {
334 print( "menu: fopen: all output must go into data/!\n" );
337 handle = _fopen( substring( filename, 5, 10000 ), mode );
338 strunzone( filename );
343 float(string s) tokenize_console = #514;
344 float(float i) argv_start_index = #515;
345 float(float i) argv_end_index = #516;
347 string(float, float) getgamedirinfo = #626;
348 #define GETGAMEDIRINFO_NAME 0
349 #define GETGAMEDIRINFO_DESCRIPTION 1
350 float log(float f) = #532;
352 string(string format, ...) sprintf = #627;