]> icculus.org git repositories - divverent/nexuiz.git/blob - data/menuqc/mbuiltin.qc
commit 1.2.1 game media
[divverent/nexuiz.git] / data / menuqc / mbuiltin.qc
1 //////////////////////////////////////////////////
2 // common cmd
3 //////////////////////////////////////////////////
4 // AK FIXME: Create perhaps a special builtin file for the common cmds
5
6 //#define PROFILESTRZONE
7 #define FIXEDFOPEN
8
9 void    checkextension(string ext) = #1;
10
11 // error cmds
12 void    error(string err,...)   = #2;
13 void    objerror(string err,...)        = #3;
14
15 // print
16
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;
21
22 // vector stuff
23
24 vector  normalize(vector v)     = #8;
25 float   vlen(vector v)                  = #9;
26 float   vectoyaw(vector v)              = #10;
27 vector  vectoangles(vector v)   = #11;
28
29 float   random(void)  = #12;
30
31 void    cmd(string command) = #13;
32
33 // cvar cmds
34
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;
39
40 void    dprint(string text,...) = #16;
41
42 // conversion functions
43
44 string  ftos(float f)  = #17;
45 float   fabs(float f)   = #18;
46 string  vtos(vector v)  = #19;
47 string  etos(entity e) = #20;
48
49 float   stof(string val,...)  = #21;
50
51 entity  spawn(void) = #22;
52 void    remove(entity e) = #23;
53
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;
57
58 entity  findchainstring(.string _field, string match) = #26;
59 entity  findchainfloat(.float _field, float match) = #27;
60 entity  findchainentity(.entity _field, entity match) = #27;
61
62 entity  findflags(entity start, .float field, float match) = #87;
63 entity  findchainflags(.float field, float match) = #88;
64
65 string  precache_file(string file) = #28;
66 string  precache_sound(string sample) = #29;
67
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;
73
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;
83
84 float   registercvar(string name, string value, float flags)  = #42; // returns 1 if success
85 float   min(float f,...)  = #43;
86 float   max(float f,...)  = #44;
87 float   bound(float min,float value, float max)  = #45;
88 float   pow(float a, float b)  = #46;
89 void    copyentity(entity src, entity dst)  = #47;
90
91 #ifdef FIXEDFOPEN
92 float   _fopen( string filename, float mode ) = #48;
93 #else
94 float   fopen(string filename, float mode)  = #48;
95 #endif
96 void    fclose(float fhandle)  = #49;
97 string  fgets(float fhandle)  = #50;
98 void    fputs(float fhandle, string s)  = #51;
99
100 float   strlen(string s)  = #52;
101 //string        strcat(string s1,string s2,...)  = #53;
102 string  strcat(string s1, ...)  = #53;
103 string  substring(string s, float start, float length)  = #54;
104
105 vector  stov(string s)  = #55;
106
107 #ifdef PROFILESTRZONE
108 string  _strzone(string s)  = #56;
109 void    _strunzone(string s) = #57;
110
111 string( string s ) strzone =
112 {
113         return _strzone( s );
114 };
115
116 void( string s ) strunzone =
117 {
118         return _strunzone( s );
119 };
120 #else
121 string  strzone(string s)  = #56;
122 void    strunzone(string s) = #57;
123 #endif
124
125 float   tokenize(string s)  = #58
126 string  argv(float n)  = #59;
127
128 float   isserver(void)  = #60;
129 float   clientcount(void)  = #61;
130 float   clientstate(void)  = #62;
131 void    clientcommand(float client, string s)  = #63;
132 void    changelevel(string map)  = #64;
133 void    localsound(string sample)  = #65;
134 vector  getmousepos(void)       = #66;
135 float   gettime(void)           = #67;
136 void    loadfromdata(string data) = #68;
137 void    loadfromfile(string file) = #69;
138
139 float   mod(float val, float m) = #70;
140
141 float   search_begin(string pattern, float caseinsensitive, float quiet) = #74;
142 void    search_end(float handle) = #75;
143 float   search_getsize(float handle) = #76;
144 string  search_getfilename(float handle, float num) = #77;
145
146 string  chr(float ascii) = #78;
147
148 float   etof(entity ent) = #79;
149 entity  ftoe(float num)  = #80;
150
151 float   validstring(string str) = #81;
152
153 float   altstr_count(string str) = #82;
154 string  altstr_prepare(string str) = #83;
155 string  altstr_get(string str, float num) = #84;
156 string  altstr_set(string str, float num, string set) = #85;
157 string  altstr_ins(string str, float num, string set) = #86;
158
159 /////////////////////////////////////////////////
160 // Write* Functions
161 /////////////////////////////////////////////////
162 void    WriteByte(float data, float dest, float desto)  = #401;
163 void    WriteChar(float data, float dest, float desto)  = #402;
164 void    WriteShort(float data, float dest, float desto) = #403;
165 void    WriteLong(float data, float dest, float desto)  = #404;
166 void    WriteAngle(float data, float dest, float desto) = #405;
167 void    WriteCoord(float data, float dest, float desto) = #406;
168 void    WriteString(string data, float dest, float desto)= #407;
169 void    WriteEntity(entity data, float dest, float desto) = #408;
170
171 //////////////////////////////////////////////////
172 // Draw funtions
173 //////////////////////////////////////////////////
174
175 float   iscachedpic(string name)        = #451;
176 string  precache_pic(string name)       = #452;
177 void    freepic(string name)            = #453;
178
179 float   drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
180
181 float   drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
182
183 float   drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
184
185 float   drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
186
187 void    drawsetcliparea(float x, float y, float width, float height) = #458;
188
189 void    drawresetcliparea(void) = #459;
190
191 vector  drawgetimagesize(string pic) = #460;
192
193 float   cin_open(string file, string name)      = #461;
194 void    cin_close(string name)                  = #462;
195 void    cin_setstate(string name, float type)   = #463;
196 float   cin_getstate(string name)               = #464;
197
198 ////////////////////////////////////////////////
199 // Menu functions
200 ////////////////////////////////////////////////
201
202 void    setkeydest(float dest)  = #601;
203 float   getkeydest(void)        = #602;
204
205 void    setmousetarget(float trg) = #603;
206 float   getmousetarget(void)      = #604;
207
208 float   isfunction(string function_name) = #607;
209 void    callfunction(...) = #605;
210 void    writetofile(float fhandle, entity ent) = #606;
211 vector  getresolution(float number) = #608;
212 string  keynumtostring(float keynum) = #609;
213 string  findkeysforcommand(string command) = #610;
214
215 float   gethostcachevalue(float type) = #611;
216 string  gethostcachestring(float type, float hostnr) = #612;
217
218 void    parseentitydata(entity ent, string data) = #613;
219
220 float   stringtokeynum(string key) = #614;
221
222 void    resethostcachemasks(void) = #615;
223 void    sethostcachemaskstring(float mask, float fld, string str, float op) = #616;
224 void    sethostcachemasknumber(float mask, float fld, float num, float op) = #617;
225 void    resorthostcache(void) = #618;
226 void    sethostcachesort(float fld, float descending) = #619;
227 void    refreshhostcache(void) = #620;
228 float   gethostcachenumber(float fld, float hostnr) = #621;
229 float   gethostcacheindexforkey(string key) = #622;
230 void    addwantedhostcachekey(string key) = #623;
231
232 #ifdef FIXEDFOPEN
233 float   fopen( string filename, float mode ) =
234 {
235         local float handle;
236         if( mode == FILE_READ ) {
237                 return _fopen( filename, mode );
238         }
239
240         // check for data/
241         filename = strzone( filename );
242         if( substring( filename, 0, 5 ) != "data/" ) {
243                 print( "menu: fopen: all output must go into data/!\n" );
244                 return -1;
245         }
246         handle = _fopen( substring( filename, 5, 10000 ), mode );
247         strunzone( filename );
248         return handle;
249 };
250 #endif