]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - prvm_cmds.h
-Split prvm_cmds.c into prvm_cmds.c, prvm_cmds.h and mvm_cmds.c (clvm_cmds.c
[xonotic/darkplaces.git] / prvm_cmds.h
1 // AK
2 // Basically every vm builtin cmd should be in here.
3 // All 3 builtin and extension lists can be found here
4 // cause large (I think they will) parts are from pr_cmds the same copyright like in pr_cmds
5 // also applies here
6
7
8 /*
9 ============================================================================
10 common cmd list:
11 =================
12
13                 checkextension(string)
14                 error(...[string])
15                 objerror(...[string)
16                 print(...[strings])
17                 bprint(...[string])
18                 sprint(float clientnum,...[string])
19                 centerprint(...[string])
20 vector  normalize(vector)
21 float   vlen(vector)
22 float   vectoyaw(vector)
23 vector  vectoangles(vector)
24 float   random()
25                 cmd(string)
26                 float cvar (string)
27                 cvar_set (string,string)
28                 dprint(...[string])
29 string  ftos(float)
30 float   fabs(float)
31 string  vtos(vector)
32 string  etos(entity)
33 float   stof(...[string])
34 entity  spawn()
35                 remove(entity e)
36 entity  find(entity start, .string field, string match)
37
38 entity  findfloat(entity start, .float field, float match)
39 entity  findentity(entity start, .entity field, entity match)
40
41 entity  findchain(.string field, string match)
42
43 entity  findchainfloat(.string field, float match)
44 entity  findchainentity(.string field, entity match)
45
46 string  precache_file(string)
47 string  precache_sound (string sample)
48                 coredump()
49                 traceon()
50                 traceoff()
51                 eprint(entity e)
52 float   rint(float)
53 float   floor(float)
54 float   ceil(float)
55 entity  nextent(entity)
56 float   sin(float)
57 float   cos(float)
58 float   sqrt(float)
59 vector  randomvec()
60 float   registercvar (string name, string value, float flags)
61 float   min(float a, float b, ...[float])
62 float   max(float a, float b, ...[float])
63 float   bound(float min, float value, float max)
64 float   pow(float a, float b)
65                 copyentity(entity src, entity dst)
66 float   fopen(string filename, float mode)
67                 fclose(float fhandle)
68 string  fgets(float fhandle)
69                 fputs(float fhandle, string s)
70 float   strlen(string s)
71 string  strcat(string,string,...[string])
72 string  substring(string s, float start, float length)
73 vector  stov(string s)
74 string  strzone(string s)
75                 strunzone(string s)
76 float   tokenize(string s)
77 string  argv(float n)
78 float   isserver()
79 float   clientcount()
80 float   clientstate()
81                 clientcommand(float client, string s) (for client and menu)
82                 changelevel(string map)
83                 localsound(string sample)
84 vector  getmousepos()
85 float   gettime()
86                 loadfromdata(string data)
87                 loadfromfile(string file)
88                 parseentitydata(entity ent, string data)
89 float   mod(float val, float m)
90 const string    cvar_string (string)
91                 crash()
92                 stackdump()
93
94 float   search_begin(string pattern, float caseinsensitive, float quiet)
95 void    search_end(float handle)
96 float   search_getsize(float handle)
97 string  search_getfilename(float handle, float num)
98
99 string  chr(float ascii)
100
101 float   itof(intt ent)
102 intt    ftoi(float num)
103
104 float   altstr_count(string)
105 string  altstr_prepare(string)
106 string  altstr_get(string,float)
107 string  altstr_set(string altstr, float num, string set)
108 string  altstr_ins(string altstr, float num, string set)
109
110 perhaps only : Menu : WriteMsg
111 ===============================
112
113                 WriteByte(float data, float dest, float desto)
114                 WriteChar(float data, float dest, float desto)
115                 WriteShort(float data, float dest, float desto)
116                 WriteLong(float data, float dest, float desto)
117                 WriteAngle(float data, float dest, float desto)
118                 WriteCoord(float data, float dest, float desto)
119                 WriteString(string data, float dest, float desto)
120                 WriteEntity(entity data, float dest, float desto)
121
122 Client & Menu : draw functions & video functions
123 ===================================================
124
125 float   iscachedpic(string pic)
126 string  precache_pic(string pic)
127                 freepic(string s)
128 float   drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag)
129 float   drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag)
130 float   drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag)
131 float   drawfill(vector position, vector size, vector rgb, float alpha, float flag)
132                 drawsetcliparea(float x, float y, float width, float height)
133                 drawresetcliparea()
134 vector  getimagesize(string pic)
135
136 float   cin_open(string file, string name)
137 void    cin_close(string name)
138 void    cin_setstate(string name, float type)
139 float   cin_getstate(string name)
140 void    cin_restart(string name)
141
142 ==============================================================================
143 menu cmd list:
144 ===============
145
146                 setkeydest(float dest)
147 float   getkeydest()
148                 setmousetarget(float target)
149 float   getmousetarget()
150
151                 callfunction(...,string function_name)
152                 writetofile(float fhandle, entity ent)
153 float   isfunction(string function_name)
154 vector  getresolution(float number)
155 string  keynumtostring(float keynum)
156 string  findkeysforcommand(string command)
157 float   getserverliststat(float type)
158 string  getserverliststring(float fld, float hostnr)
159
160 float   stringtokeynum(string key)
161
162                 resetserverlistmasks()
163                 setserverlistmaskstring(float mask, float fld, string str)
164                 setserverlistmasknumber(float mask, float fld, float num, float op)
165                 resortserverlist()
166                 setserverlistsort(float field, float descending)
167                 refreshserverlist()
168 float   getserverlistnumber(float fld, float hostnr)
169 float   getserverlistindexforkey(string key)
170                 addwantedserverlistkey(string key)
171 */
172
173 #include "quakedef.h"
174 #include "progdefs.h"
175 #include "progsvm.h"
176 #include "clprogdefs.h"
177 #include "mprogdefs.h"
178
179 #include "cl_video.h"
180
181 //============================================================================
182 // nice helper macros
183
184 #ifndef VM_NOPARMCHECK
185 #define VM_SAFEPARMCOUNT(p,f)   if(prog->argc != p) PRVM_ERROR(#f " wrong parameter count (" #p " expected ) !\n")
186 #else
187 #define VM_SAFEPARMCOUNT(p,f)
188 #endif
189
190 #define VM_RETURN_EDICT(e)              (((int *)prog->globals)[OFS_RETURN] = PRVM_EDICT_TO_PROG(e))
191
192 #define e10 0,0,0,0,0,0,0,0,0,0
193 #define e100 e10,e10,e10,e10,e10,e10,e10,e10,e10,e10
194 #define e1000 e100,e100,e100,e100,e100,e100,e100,e100,e100,e100
195
196 // builtins and other general functions
197
198 char *VM_GetTempString(void);
199 void VM_CheckEmptyString (const char *s);
200 void VM_VarString(int first, char *out, int outlength);
201
202 void VM_checkextension (void);
203 void VM_error (void);
204 void VM_objerror (void);
205 void VM_print (void);
206 void VM_bprint (void);
207 void VM_sprint (void);
208 void VM_centerprint (void);
209 void VM_normalize (void);
210 void VM_vlen (void);
211 void VM_vectoyaw (void);
212 void VM_vectoangles (void);
213 void VM_random (void);
214 void VM_localsound(void);
215 void VM_break (void);
216 void VM_localcmd (void);
217 void VM_cvar (void);
218 void VM_cvar_string(void);
219 void VM_cvar_set (void);
220 void VM_dprint (void);
221 void VM_ftos (void);
222 void VM_fabs (void);
223 void VM_vtos (void);
224 void VM_etos (void);
225 void VM_stof(void);
226 void VM_itof(void);
227 void VM_ftoi(void);
228 void VM_spawn (void);
229 void VM_remove (void);
230 void VM_find (void);
231 void VM_findfloat (void);
232 void VM_findchain (void);
233 void VM_findchainfloat (void);
234 void VM_precache_file (void);
235 void VM_precache_error (void);
236 void VM_precache_sound (void);
237 void VM_coredump (void);
238
239 void VM_stackdump (void);
240 void VM_crash(void); // REMOVE IT
241 void VM_traceon (void);
242 void VM_traceoff (void);
243 void VM_eprint (void);
244 void VM_rint (void);
245 void VM_floor (void);
246 void VM_ceil (void);
247 void VM_nextent (void);
248
249 // REMOVE THESE
250 sizebuf_t *VM_WriteDest (void);
251 void VM_WriteByte (void);
252 void VM_WriteChar (void);
253 void VM_WriteShort (void);
254 void VM_WriteLong (void);
255 void VM_WriteAngle (void);
256 void VM_WriteCoord (void);
257 void VM_WriteString (void);
258 void VM_WriteEntity (void);
259
260 void VM_changelevel (void);
261 void VM_sin (void);
262 void VM_cos (void);
263 void VM_sqrt (void);
264 void VM_randomvec (void);
265 void VM_registercvar (void);
266 void VM_min (void);
267 void VM_max (void);
268 void VM_bound (void);
269 void VM_pow (void);
270 void VM_copyentity (void);
271
272 void VM_Files_Init(void);
273 void VM_Files_CloseAll(void);
274
275 void VM_fopen(void);
276 void VM_fclose(void);
277 void VM_fgets(void);
278 void VM_fputs(void);
279 // used by M_WriteToFile
280 // should be only called from a builtin
281 qfile_t *VM_GetFileHandle( int index );
282
283 void VM_strlen(void);
284 void VM_strcat(void);
285 void VM_substring(void);
286 void VM_stov(void);
287 void VM_strzone(void);
288 void VM_strunzone(void);
289
290 void VM_clcommand (void);
291
292 void VM_tokenize (void);
293 void VM_argv (void);
294
295 void VM_isserver(void);
296 void VM_clientcount(void);
297 void VM_clientstate(void);
298 // not used at the moment -> not included in the common list
299 void VM_getostype(void);
300 void VM_getmousepos(void);
301 void VM_gettime(void);
302 void VM_loadfromdata(void);
303 void VM_parseentitydata(void);
304 void VM_loadfromfile(void);
305 void VM_modulo(void);
306
307 void VM_search_begin(void);
308 void VM_search_end(void);
309 void VM_search_getsize(void);
310 void VM_search_getfilename(void);
311 void VM_chr(void);
312 void VM_iscachedpic(void);
313 void VM_precache_pic(void);
314 void VM_freepic(void);
315 void VM_drawcharacter(void);
316 void VM_drawstring(void);
317 void VM_drawpic(void);
318 void VM_drawfill(void);
319 void VM_drawsetcliparea(void);
320 void VM_drawresetcliparea(void);
321 void VM_getimagesize(void);
322
323 void VM_cin_open( void );
324 void VM_cin_close( void );
325 void VM_cin_setstate( void );
326 void VM_cin_getstate( void );
327 void VM_cin_restart( void );
328
329 void VM_altstr_count( void );
330 void VM_altstr_prepare( void );
331 void VM_altstr_get( void );
332 void VM_altstr_set( void );
333 void VM_altstr_ins(void);
334
335 void VM_Cmd_Init(void);
336 void VM_Cmd_Reset(void);