1 //////////////////////////////////////////////////////////
6 /////////////////////////////////////////////////////////
8 /////////////////////////////////////////////////////////
11 /////////////////////////////////////////////////////////
13 /////////////////////////////////////////////////////////
17 void(float keynr, float ascii) m_keydown;
22 /////////////////////////////////////////////////////////
24 ///////////////////////////
28 // these are the key numbers that should be passed to Key_Event
35 // normal keys should be passed as lowercased ascii
37 float K_BACKSPACE = 127;
38 float K_UPARROW = 128;
39 float K_DOWNARROW = 129;
40 float K_LEFTARROW = 130;
41 float K_RIGHTARROW = 131;
67 float K_NUMLOCK = 154;
68 float K_CAPSLOCK = 155;
69 float K_SCROLLLOCK = 156;
72 float K_KP_INS = K_KP_0;
74 float K_KP_END = K_KP_1;
76 float K_KP_DOWNARROW = K_KP_2;
78 float K_KP_PGDN = K_KP_3;
80 float K_KP_LEFTARROW = K_KP_4;
83 float K_KP_RIGHTARROW = K_KP_6;
85 float K_KP_HOME = K_KP_7;
87 float K_KP_UPARROW = K_KP_8;
89 float K_KP_PGUP = K_KP_9;
90 float K_KP_PERIOD = 167;
91 float K_KP_DEL = K_KP_PERIOD;
92 float K_KP_DIVIDE = 168;
93 float K_KP_SLASH = K_KP_DIVIDE;
94 float K_KP_MULTIPLY = 169;
95 float K_KP_MINUS = 170;
96 float K_KP_PLUS = 171;
97 float K_KP_ENTER = 172;
98 float K_KP_EQUALS = 173;
100 // mouse buttons generate virtual keys
102 float K_MOUSE1 = 512;
103 float K_MOUSE2 = 513;
104 float K_MOUSE3 = 514;
105 float K_MOUSE4 = 515;
106 float K_MWHEELUP = K_MOUSE4;
107 float K_MOUSE5 = 516;
108 float K_MWHEELDOWN = K_MOUSE5;
109 float K_MOUSE6 = 517;
110 float K_MOUSE7 = 518;
111 float K_MOUSE8 = 519;
112 float K_MOUSE9 = 520;
113 float K_MOUSE10 = 521;
114 float K_MOUSE11 = 522;
115 float K_MOUSE12 = 523;
116 float K_MOUSE13 = 524;
117 float K_MOUSE14 = 525;
118 float K_MOUSE15 = 526;
119 float K_MOUSE16 = 527;
131 // aux keys are for multi-buttoned joysticks to generate so they can use
132 // the normal binding process
167 ///////////////////////////
168 // key dest constants
172 float KEY_UNKNOWN = 3;
174 ///////////////////////////
178 float FILE_APPEND = 1;
179 float FILE_WRITE = 2;
181 ///////////////////////////
182 // logical constants (just for completeness)
187 ///////////////////////////
193 ///////////////////////////
196 float MSG_BROADCAST = 0; // unreliable to all
197 float MSG_ONE = 1; // reliable to one (msg_entity)
198 float MSG_ALL = 2; // reliable to all
199 float MSG_INIT = 3; // write to the init string
201 /////////////////////////////
202 // mouse target constants
207 /////////////////////////
208 // client state constants
210 float CS_DEDICATED = 0;
211 float CS_DISCONNECTED = 1;
212 float CS_CONNECTED = 2;
214 ///////////////////////////
217 float DRAWFLAG_NORMAL = 0;
218 float DRAWFLAG_ADDITIVE = 1;
219 float DRAWFLAG_MODULATE = 2;
220 float DRAWFLAG_2XMODULATE = 3;
222 ///////////////////////////
223 // null entity (actually it is the same like the world entity)
227 ///////////////////////////
231 float ERR_CANNOTOPEN = -1; // fopen
232 float ERR_NOTENOUGHFILEHANDLES = -2; // fopen
233 float ERR_INVALIDMODE = -3; // fopen
234 float ERR_BADFILENAME = -4; // fopen
238 float ERR_NULLSTRING = -1;
239 float ERR_BADDRAWFLAG = -2;
240 float ERR_BADSCALE = -3;
241 float ERR_BADSIZE = ERR_BADSCALE;
242 float ERR_NOTCACHED = -4;
244 /* not supported at the moment
245 ///////////////////////////
248 float OS_WINDOWS = 0;
262 //////////////////////////////////////////////////
264 //////////////////////////////////////////////////
265 // AK FIXME: Create perhaps a special builtin file for the common cmds
267 void checkextension(string ext) = #1;
270 void error(string err,...) = #2;
271 void objerror(string err,...) = #3;
275 void print(string text,...) = #4;
276 void bprint(string text,...) = #5;
277 void sprint(float clientnum, string text,...) = #6;
278 void centerprint(string text,...) = #7;
282 vector normalize(vector v) = #8;
283 float vlen(vector v) = #9;
284 float vectoyaw(vector v) = #10;
285 vector vectoangles(vector v) = #11;
287 float random(void) = #12;
289 void cmd(string command) = #13;
293 float cvar(string name) = #14;
294 const string str_cvar(string name) = #71;
295 void cvar_set(string name, string value) = #15;
297 void dprint(string text,...) = #16;
299 // conversion functions
301 string ftos(float f) = #17;
302 float fabs(float f) = #18;
303 string vtos(vector v) = #19;
304 string etos(entity e) = #20;
306 float stof(string val,...) = #21;
308 entity spawn(void) = #22;
309 void remove(entity e) = #23;
311 entity findstring(entity start, .string field, string match) = #24;
312 entity findfloat(entity start, .float field, float match) = #25;
313 entity findentity(entity start, .entity field, entity match) = #25;
315 entity findchainstring(.string field, string match) = #26;
316 entity findchainfloat(.float field, float match) = #27;
317 entity findchainentity(.entity field, entity match) = #27;
319 string precache_file(string file) = #28;
320 string precache_sound(string sample) = #29;
322 void crash(void) = #72;
323 void coredump(void) = #30;
324 void stackdump(void) = #73;
325 void traceon(void) = #31;
326 void traceoff(void) = #32;
328 void eprint(entity e) = #33;
329 float rint(float f) = #34;
330 float floor(float f) = #35;
331 float ceil(float f) = #36;
332 entity nextent(entity e) = #37;
333 float sin(float f) = #38;
334 float cos(float f) = #39;
335 float sqrt(float f) = #40;
336 vector randomvec(void) = #41;
338 float registercvar(string name, string value, float flags) = #42; // returns 1 if success
340 float min(float f,...) = #43;
341 float max(float f,...) = #44;
343 float bound(float min,float value, float max) = #45;
344 float pow(float a, float b) = #46;
346 void copyentity(entity src, entity dst) = #47;
348 float fopen(string filename, float mode) = #48;
349 void fclose(float fhandle) = #49;
350 string fgets(float fhandle) = #50;
351 void fputs(float fhandle, string s) = #51;
353 float strlen(string s) = #52;
354 string strcat(string s1,string s2,...) = #53;
355 string substring(string s, float start, float length) = #54;
357 vector stov(string s) = #55;
359 string strzone(string s) = #56;
360 void strunzone(string s) = #57;
362 float tokenize(string s) = #58
363 string argv(float n) = #59;
365 float isserver(void) = #60;
366 float clientcount(void) = #61;
367 float clientstate(void) = #62;
368 void clientcommand(float client, string s) = #63;
369 void changelevel(string map) = #64;
370 void localsound(string sample) = #65;
371 vector getmousepos(void) = #66;
372 float gettime(void) = #67;
373 void loadfromdata(string data) = #68;
374 void loadfromfile(string file) = #69;
376 float mod(float val, float m) = #70;
378 float search_begin(string pattern, float caseinsensitive, float quiet) = #74;
379 void search_end(float handle) = #75;
380 float search_getsize(float handle) = #76;
381 string search_getfilename(float handle, float num) = #77;
383 string chr(float ascii) = #78;
385 /////////////////////////////////////////////////
387 /////////////////////////////////////////////////
388 void WriteByte(float data, float dest, float desto) = #401;
389 void WriteChar(float data, float dest, float desto) = #402;
390 void WriteShort(float data, float dest, float desto) = #403;
391 void WriteLong(float data, float dest, float desto) = #404;
392 void WriteAngle(float data, float dest, float desto) = #405;
393 void WriteCoord(float data, float dest, float desto) = #406;
394 void WriteString(string data, float dest, float desto)= #407;
395 void WriteEntity(entity data, float dest, float desto) = #408;
397 //////////////////////////////////////////////////
399 //////////////////////////////////////////////////
401 float iscachedpic(string name) = #451;
402 string precache_pic(string name) = #452;
403 void freepic(string name) = #453;
405 float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
407 float drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
409 float drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag) = #467;
411 vector drawcolorcodedstring2(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #467;
413 float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
415 float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
417 void drawsetcliparea(float x, float y, float width, float height) = #458;
419 void drawresetcliparea(void) = #459;
421 vector drawgetimagesize(string pic) = #460;
423 ////////////////////////////////////////////////
425 ////////////////////////////////////////////////
427 void setkeydest(float dest) = #601;
428 float getkeydest(void) = #602;
430 void setmousetarget(float trg) = #603;
431 float getmousetarget(void) = #604;
433 float isfunction(string function_name) = #607;
434 void callfunction(...) = #605;
435 void writetofile(float fhandle, entity ent) = #606;
436 vector getresolution(float number) = #608;
437 string keynumtostring(float keynum) = #609;
439 float gethostcachevalue(float type) = #611;
440 string gethostcachestring(float type, float hostnr) = #612;
443 //idea: daemon, motorsep
444 //darkplaces implementation: divVerent
445 //builtin definitions:
446 string(float key, float bindmap) getkeybind_bindmap = #342;
447 float(float key, string bind, float bindmap) setkeybind_bindmap = #630;
448 vector(void) getbindmaps = #631;
449 float(vector bm) setbindmaps = #632;
450 string(string command, float bindmap) findkeysforcommand = #610;
451 float(string key) stringtokeynum = #341;
452 //<also allowed builtin number to match EXT_CSQC> string(float keynum) keynumtostring = #340;
453 //description: key bind setting/getting including support for switchable
458 //darkplaces implementation: divVerent
459 //field definitions: (MENUQC)
460 string(string serveraddress) crypto_getkeyfp = #633; // retrieves the cached host key's CA fingerprint of a server given by IP address
461 string(string serveraddress) crypto_getidfp = #634; // retrieves the cached host key fingerprint of a server given by IP address
462 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
463 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
464 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
465 float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513;
467 //use -1 as buffer handle to justs end delim as postdata
470 //idea: Res2k, BlackHC
471 //darkplaces implementation: Res2k, BlackHC
472 //constant definitions:
473 float GECKO_BUTTON_DOWN = 0;
474 float GECKO_BUTTON_UP = 1;
475 // either use down and up or just press but not all of them!
476 float GECKO_BUTTON_PRESS = 2;
477 // use this for mouse events if needed?
478 float GECKO_BUTTON_DOUBLECLICK = 3;
479 //builtin definitions:
480 float gecko_create( string name ) = #487;
481 void gecko_destroy( string name ) = #488;
482 void gecko_navigate( string name, string URI ) = #489;
483 float gecko_keyevent( string name, float key, float eventtype ) = #490;
484 void gecko_mousemove( string name, float x, float y ) = #491;
485 void gecko_resize( string name, float w, float h ) = #492;
486 vector gecko_get_texture_extent( string name ) = #493;
487 //engine-called QC prototypes:
488 //string(string name, string query) Qecko_Query;
490 //provides an interface to the offscreengecko library and allows for internet browsing in games