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 drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
411 float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
413 void drawsetcliparea(float x, float y, float width, float height) = #458;
415 void drawresetcliparea(void) = #459;
417 vector drawgetimagesize(string pic) = #460;
419 ////////////////////////////////////////////////
421 ////////////////////////////////////////////////
423 void setkeydest(float dest) = #601;
424 float getkeydest(void) = #602;
426 void setmousetarget(float trg) = #603;
427 float getmousetarget(void) = #604;
429 float isfunction(string function_name) = #607;
430 void callfunction(...) = #605;
431 void writetofile(float fhandle, entity ent) = #606;
432 vector getresolution(float number) = #608;
433 string keynumtostring(float keynum) = #609;
435 float gethostcachevalue(float type) = #611;
436 string gethostcachestring(float type, float hostnr) = #612;
439 //idea: daemon, motorsep
440 //darkplaces implementation: divVerent
441 //builtin definitions:
442 string(float key, float bindmap) getkeybind_bindmap = #342;
443 float(float key, string bind, float bindmap) setkeybind_bindmap = #630;
444 vector(void) getbindmaps = #631;
445 float(vector bm) setbindmaps = #632;
446 string(string command, float bindmap) findkeysforcommand = #610;
447 float(string key) stringtokeynum = #341;
448 //<also allowed builtin number to match EXT_CSQC> string(float keynum) keynumtostring = #340;
449 //description: key bind setting/getting including support for switchable
454 //darkplaces implementation: divVerent
455 //field definitions: (MENUQC)
456 string crypto_getkeyfp(string serveraddress) = #633; // retrieves the cached host key's CA fingerprint of a server given by IP address
457 string crypto_getidfp(string serveraddress) = #634; // retrieves the cached host key fingerprint of a server given by IP address
458 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
459 string crypto_getmykeyfp(float i) = #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
460 string crypto_getmyidfp(float i) = #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