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 str_cvar(string name) = #71;
37 void cvar_set(string name, string value) = #15;
39 void dprint(string text,...) = #16;
41 // conversion functions
43 string ftos(float f) = #17;
44 float fabs(float f) = #18;
45 string vtos(vector v) = #19;
46 string etos(entity e) = #20;
48 float stof(string val,...) = #21;
50 entity spawn(void) = #22;
51 void remove(entity e) = #23;
53 entity findstring(entity start, .string _field, string match) = #24;
54 entity findfloat(entity start, .float _field, float match) = #25;
55 entity findentity(entity start, .entity _field, entity match) = #25;
57 entity findchainstring(.string _field, string match) = #26;
58 entity findchainfloat(.float _field, float match) = #27;
59 entity findchainentity(.entity _field, entity match) = #27;
61 string precache_file(string file) = #28;
62 string precache_sound(string sample) = #29;
64 void crash(void) = #72;
65 void coredump(void) = #30;
66 void stackdump(void) = #73;
67 void traceon(void) = #31;
68 void traceoff(void) = #32;
70 void eprint(entity e) = #33;
71 float rint(float f) = #34;
72 float floor(float f) = #35;
73 float ceil(float f) = #36;
74 entity nextent(entity e) = #37;
75 float sin(float f) = #38;
76 float cos(float f) = #39;
77 float sqrt(float f) = #40;
78 vector randomvec(void) = #41;
80 float registercvar(string name, string value, float flags) = #42; // returns 1 if success
81 float min(float f,...) = #43;
82 float max(float f,...) = #44;
83 float bound(float min,float value, float max) = #45;
84 float pow(float a, float b) = #46;
85 void copyentity(entity src, entity dst) = #47;
88 float _fopen( string filename, float mode ) = #48;
90 float fopen(string filename, float mode) = #48;
92 void fclose(float fhandle) = #49;
93 string fgets(float fhandle) = #50;
94 void fputs(float fhandle, string s) = #51;
96 float strlen(string s) = #52;
97 //string strcat(string s1,string s2,...) = #53;
98 string strcat(string s1, ...) = #53;
99 string substring(string s, float start, float length) = #54;
101 vector stov(string s) = #55;
103 #ifdef PROFILESTRZONE
104 string _strzone(string s) = #56;
105 void _strunzone(string s) = #57;
107 string( string s ) strzone =
109 return _strzone( s );
112 void( string s ) strunzone =
114 return _strunzone( s );
117 string strzone(string s) = #56;
118 void strunzone(string s) = #57;
121 float tokenize(string s) = #58
122 string argv(float n) = #59;
124 float isserver(void) = #60;
125 float clientcount(void) = #61;
126 float clientstate(void) = #62;
127 void clientcommand(float client, string s) = #63;
128 void changelevel(string map) = #64;
129 void localsound(string sample) = #65;
130 vector getmousepos(void) = #66;
131 float gettime(void) = #67;
132 void loadfromdata(string data) = #68;
133 void loadfromfile(string file) = #69;
135 float mod(float val, float m) = #70;
137 float search_begin(string pattern, float caseinsensitive, float quiet) = #74;
138 void search_end(float handle) = #75;
139 float search_getsize(float handle) = #76;
140 string search_getfilename(float handle, float num) = #77;
142 string chr(float ascii) = #78;
144 float etof(entity ent) = #79;
145 entity ftoe(float num) = #80;
147 float validstring(string str) = #81;
149 float altstr_count(string str) = #82;
150 string altstr_prepare(string str) = #83;
151 string altstr_get(string str, float num) = #84;
152 string altstr_set(string str, float num, string set) = #85;
153 string altstr_ins(string str, float num, string set) = #86;
155 /////////////////////////////////////////////////
157 /////////////////////////////////////////////////
158 void WriteByte(float data, float dest, float desto) = #401;
159 void WriteChar(float data, float dest, float desto) = #402;
160 void WriteShort(float data, float dest, float desto) = #403;
161 void WriteLong(float data, float dest, float desto) = #404;
162 void WriteAngle(float data, float dest, float desto) = #405;
163 void WriteCoord(float data, float dest, float desto) = #406;
164 void WriteString(string data, float dest, float desto)= #407;
165 void WriteEntity(entity data, float dest, float desto) = #408;
167 //////////////////////////////////////////////////
169 //////////////////////////////////////////////////
171 float iscachedpic(string name) = #451;
172 string precache_pic(string name) = #452;
173 void freepic(string name) = #453;
175 float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
177 float drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
179 float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
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;
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;
229 float fopen( string filename, float mode ) =
232 if( mode == FILE_READ ) {
233 return _fopen( filename, mode );
237 filename = strzone( filename );
238 if( substring( filename, 0, 5 ) != "data/" ) {
239 print( "menu: fopen: all output must go into data/!\n" );
242 handle = _fopen( substring( filename, 5, 10000 ), mode );
243 strunzone( filename );