1 //////////////////////////////////////////////////
3 //////////////////////////////////////////////////
4 // AK FIXME: Create perhaps a special builtin file for the common cmds
6 //#define PROFILESTRZONE
9 void 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 /////////////////////////////////////////////////
174 /////////////////////////////////////////////////
175 void WriteByte(float data, float dest, float desto) = #401;
176 void WriteChar(float data, float dest, float desto) = #402;
177 void WriteShort(float data, float dest, float desto) = #403;
178 void WriteLong(float data, float dest, float desto) = #404;
179 void WriteAngle(float data, float dest, float desto) = #405;
180 void WriteCoord(float data, float dest, float desto) = #406;
181 void WriteString(string data, float dest, float desto)= #407;
182 void WriteEntity(entity data, float dest, float desto) = #408;
184 //////////////////////////////////////////////////
186 //////////////////////////////////////////////////
188 float iscachedpic(string name) = #451;
189 string precache_pic(string name) = #452;
190 void freepic(string name) = #453;
192 float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
194 float drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
195 float drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag) = #467;
196 float stringwidth(string text, float handleColors) = #468;
198 float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
199 float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #469;
201 float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
203 void drawsetcliparea(float x, float y, float width, float height) = #458;
205 void drawresetcliparea(void) = #459;
207 vector drawgetimagesize(string pic) = #460;
209 float cin_open(string file, string name) = #461;
210 void cin_close(string name) = #462;
211 void cin_setstate(string name, float type) = #463;
212 float cin_getstate(string name) = #464;
214 ////////////////////////////////////////////////
216 ////////////////////////////////////////////////
218 void setkeydest(float dest) = #601;
219 float getkeydest(void) = #602;
221 void setmousetarget(float trg) = #603;
222 float getmousetarget(void) = #604;
224 float isfunction(string function_name) = #607;
225 void callfunction(...) = #605;
226 void writetofile(float fhandle, entity ent) = #606;
227 vector getresolution(float number) = #608;
228 string keynumtostring(float keynum) = #609;
229 string findkeysforcommand(string command) = #610;
231 float gethostcachevalue(float type) = #611;
232 string gethostcachestring(float type, float hostnr) = #612;
234 void parseentitydata(entity ent, string data) = #613;
236 float stringtokeynum(string key) = #614;
238 void resethostcachemasks(void) = #615;
239 void sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
240 void sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
241 void resorthostcache(void) = #618;
242 void sethostcachesort(float fld, float descending) = #619;
243 void refreshhostcache(void) = #620;
244 float gethostcachenumber(float fld, float hostnr) = #621;
245 float gethostcacheindexforkey(string key) = #622;
246 void addwantedhostcachekey(string key) = #623;
247 string getextresponse(void) = #624;
249 // AK the builtin numbers may change - the code might be removed again
250 float gecko_create( string name ) = #487;
251 void gecko_destroy( string name ) = #488;
252 void gecko_navigate( string name, string URI ) = #489;
253 float gecko_keyevent( string name, float key, float eventtype ) = #490;
254 void gecko_mousemove( string name, float x, float y ) = #491;
255 void gecko_resize( string name, float w, float h ) = #492;
256 vector gecko_get_texture_extent( string name ) = #493;
260 //darkplaces implementation: KrimZon
262 //various string manipulation functions
263 float(string str, string sub, float startpos) strstrofs = #221;
264 float(string str, float ofs) str2chr = #222;
265 string(float c, ...) chr2str = #223;
266 string(float ccase, float calpha, float cnum, string s, ...) strconv = #224;
267 string(float chars, string s, ...) strpad = #225;
268 string(string info, string key, string value, ...) infoadd = #226;
269 string(string info, string key) infoget = #227;
270 float(string s1, string s2, float len) strncmp = #228;
271 float(string s1, string s2) strcasecmp = #229;
272 float(string s1, string s2, float len) strncasecmp = #230;
274 string(string s) strdecolorize = #477;
276 //DP_QC_STRINGBUFFERS
278 //darkplaces implementation: LordHavoc
279 //functions to manage string buffer objects - that is, arbitrary length string arrays that are handled by the engine
280 float() buf_create = #440;
281 void(float bufhandle) buf_del = #441;
282 float(float bufhandle) buf_getsize = #442;
283 void(float bufhandle_from, float bufhandle_to) buf_copy = #443;
284 void(float bufhandle, float sortpower, float backward) buf_sort = #444;
285 string(float bufhandle, string glue) buf_implode = #445;
286 string(float bufhandle, float string_index) bufstr_get = #446;
287 void(float bufhandle, float string_index, string str) bufstr_set = #447;
288 float(float bufhandle, string str, float order) bufstr_add = #448;
289 void(float bufhandle, float string_index) bufstr_free = #449;
290 void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517;
291 string(string name) cvar_description = #518;
295 //darkplaces implementation: div0
296 //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.
297 //When caseinsensitive is set, the CRC is calculated of the lower cased string.
298 float(float caseinsensitive, string s, ...) crc16 = #494;
301 float(string name) cvar_type = #495;
302 float CVAR_TYPEFLAG_EXISTS = 1;
303 float CVAR_TYPEFLAG_SAVED = 2;
304 float CVAR_TYPEFLAG_PRIVATE = 4;
305 float CVAR_TYPEFLAG_ENGINE = 8;
306 float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
307 float CVAR_TYPEFLAG_READONLY = 32;
311 //darkplaces implementation: div0
312 //URI::Escape's functionality
313 string(string in) uri_escape = #510;
314 string(string in) uri_unescape = #511;
316 string(string, float) netaddress_resolve = #625;
317 string(string search, string replace, string subject) strreplace = #484;
320 float fopen( string filename, float mode ) =
323 if( mode == FILE_READ ) {
324 return _fopen( filename, mode );
328 filename = strzone( filename );
329 if( substring( filename, 0, 5 ) != "data/" ) {
330 print( "menu: fopen: all output must go into data/!\n" );
333 handle = _fopen( substring( filename, 5, 10000 ), mode );
334 strunzone( filename );