]> icculus.org git repositories - divverent/nexuiz.git/blob - scmenu/source/mbuiltin.qc
-Added a management window to creategame, which allows you to save and load
[divverent/nexuiz.git] / scmenu / source / 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 str_cvar(string name) = #71;
37 void    cvar_set(string name, string value) = #15;
38
39 void    dprint(string text,...) = #16;
40
41 // conversion functions
42
43 string  ftos(float f)  = #17;
44 float   fabs(float f)   = #18;
45 string  vtos(vector v)  = #19;
46 string  etos(entity e) = #20;
47
48 float   stof(string val,...)  = #21;
49
50 entity  spawn(void) = #22;
51 void    remove(entity e) = #23;
52
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;
56
57 entity  findchainstring(.string _field, string match) = #26;
58 entity  findchainfloat(.float _field, float match) = #27;
59 entity  findchainentity(.entity _field, entity match) = #27;
60
61 string  precache_file(string file) = #28;
62 string  precache_sound(string sample) = #29;
63
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;
69
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;
79
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;
86
87 #ifdef FIXEDFOPEN
88 float   _fopen( string filename, float mode ) = #48;
89 #else
90 float   fopen(string filename, float mode)  = #48;
91 #endif
92 void    fclose(float fhandle)  = #49;
93 string  fgets(float fhandle)  = #50;
94 void    fputs(float fhandle, string s)  = #51;
95
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;
100
101 vector  stov(string s)  = #55;
102
103 #ifdef PROFILESTRZONE
104 string  _strzone(string s)  = #56;
105 void    _strunzone(string s) = #57;
106
107 string( string s ) strzone =
108 {
109         return _strzone( s );
110 };
111
112 void( string s ) strunzone =
113 {
114         return _strunzone( s );
115 };
116 #else
117 string  strzone(string s)  = #56;
118 void    strunzone(string s) = #57;
119 #endif
120
121 float   tokenize(string s)  = #58
122 string  argv(float n)  = #59;
123
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;
134
135 float   mod(float val, float m) = #70;
136
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;
141
142 string  chr(float ascii) = #78;
143
144 float   etof(entity ent) = #79;
145 entity  ftoe(float num)  = #80;
146
147 float   validstring(string str) = #81;
148
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;
154
155 /////////////////////////////////////////////////
156 // Write* Functions
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;
166
167 //////////////////////////////////////////////////
168 // Draw funtions
169 //////////////////////////////////////////////////
170
171 float   iscachedpic(string name)        = #451;
172 string  precache_pic(string name)       = #452;
173 void    freepic(string name)            = #453;
174
175 float   drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454;
176
177 float   drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455;
178
179 float   drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456;
180
181 float   drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457;
182
183 void    drawsetcliparea(float x, float y, float width, float height) = #458;
184
185 void    drawresetcliparea(void) = #459;
186
187 vector  drawgetimagesize(string pic) = #460;
188
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;
193
194 ////////////////////////////////////////////////
195 // Menu functions
196 ////////////////////////////////////////////////
197
198 void    setkeydest(float dest)  = #601;
199 float   getkeydest(void)        = #602;
200
201 void    setmousetarget(float trg) = #603;
202 float   getmousetarget(void)      = #604;
203
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;
210
211 float   gethostcachevalue(float type) = #611;
212 string  gethostcachestring(float type, float hostnr) = #612;
213
214 void    parseentitydata(entity ent, string data) = #613;
215
216 float   stringtokeynum(string key) = #614;
217
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;
227
228 #ifdef FIXEDFOPEN
229 float   fopen( string filename, float mode ) =
230 {
231         local float handle;
232         if( mode == FILE_READ ) {
233                 return _fopen( filename, mode );
234         }
235
236         // check for data/
237         filename = strzone( filename );
238         if( substring( filename, 0, 5 ) != "data/" ) {
239                 print( "menu: fopen: all output must go into data/!\n" );
240                 return -1;
241         }
242         handle = _fopen( substring( filename, 5, 10000 ), mode );
243         strunzone( filename );
244         return handle;
245 };
246 #endif