]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - prvm_cmds.h
reworked collision cache to only be used by bouncegrid and only in
[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 float   cvar_type (string)
92                 crash()
93                 stackdump()
94
95 float   search_begin(string pattern, float caseinsensitive, float quiet)
96 void    search_end(float handle)
97 float   search_getsize(float handle)
98 string  search_getfilename(float handle, float num)
99
100 string  chr(float ascii)
101
102 float   itof(intt ent)
103 entity  ftoe(float num)
104
105 -------will be removed soon----------
106 float   altstr_count(string)
107 string  altstr_prepare(string)
108 string  altstr_get(string,float)
109 string  altstr_set(string altstr, float num, string set)
110 string  altstr_ins(string altstr, float num, string set)
111 --------------------------------------
112
113 entity  findflags(entity start, .float field, float match)
114 entity  findchainflags(.float field, float match)
115
116 const string    VM_cvar_defstring (string)
117
118 perhaps only : Menu : WriteMsg
119 ===============================
120
121                 WriteByte(float data, float dest, float desto)
122                 WriteChar(float data, float dest, float desto)
123                 WriteShort(float data, float dest, float desto)
124                 WriteLong(float data, float dest, float desto)
125                 WriteAngle(float data, float dest, float desto)
126                 WriteCoord(float data, float dest, float desto)
127                 WriteString(string data, float dest, float desto)
128                 WriteEntity(entity data, float dest, float desto)
129
130 Client & Menu : draw functions & video functions (& gecko functions)
131 ===================================================
132
133 float   iscachedpic(string pic)
134 string  precache_pic(string pic)
135                 freepic(string s)
136 float   drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag)
137 float   drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag)
138 float   drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag)
139 float   stringwidth(string text, float handleColors)
140 float   drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag)
141 float   drawsubpic(vector position, vector size, string pic, vector srcPos, vector srcSize, vector rgb, float alpha, float flag)
142 float   drawfill(vector position, vector size, vector rgb, float alpha, float flag)
143                 drawsetcliparea(float x, float y, float width, float height)
144                 drawresetcliparea()
145 vector  getimagesize(string pic)
146
147 float   cin_open(string file, string name)
148 void    cin_close(string name)
149 void    cin_setstate(string name, float type)
150 float   cin_getstate(string name)
151 void    cin_restart(string name)
152
153 float[bool] gecko_create( string name )
154 void gecko_destroy( string name )
155 void gecko_navigate( string name, string URI )
156 float[bool] gecko_keyevent( string name, float key, float eventtype ) 
157 void gecko_mousemove( string name, float x, float y )
158
159 ==============================================================================
160 menu cmd list:
161 ===============
162
163                 setkeydest(float dest)
164 float   getkeydest()
165                 setmousetarget(float target)
166 float   getmousetarget()
167
168                 callfunction(...,string function_name)
169                 writetofile(float fhandle, entity ent)
170 float   isfunction(string function_name)
171 vector  getresolution(float number)
172 string  keynumtostring(float keynum)
173 string  findkeysforcommand(string command)
174 float   getserverliststat(float type)
175 string  getserverliststring(float fld, float hostnr)
176
177 float   stringtokeynum(string key)
178
179                 resetserverlistmasks()
180                 setserverlistmaskstring(float mask, float fld, string str)
181                 setserverlistmasknumber(float mask, float fld, float num, float op)
182                 resortserverlist()
183                 setserverlistsort(float field, float descending)
184                 refreshserverlist()
185 float   getserverlistnumber(float fld, float hostnr)
186 float   getserverlistindexforkey(string key)
187                 addwantedserverlistkey(string key)
188 */
189
190 #include "quakedef.h"
191 #include "progdefs.h"
192 #include "progsvm.h"
193 #include "clprogdefs.h"
194 #include "mprogdefs.h"
195
196 #include "cl_video.h"
197
198 //============================================================================
199 // nice helper macros
200
201 #ifndef VM_NOPARMCHECK
202 #define VM_SAFEPARMCOUNTRANGE(p1,p2,f)  if(prog->argc < p1 || prog->argc > p2) PRVM_ERROR(#f " wrong parameter count %i (" #p1 " to " #p2 " expected ) !", prog->argc)
203 #define VM_SAFEPARMCOUNT(p,f)   if(prog->argc != p) PRVM_ERROR(#f " wrong parameter count %i (" #p " expected ) !", prog->argc)
204 #else
205 #define VM_SAFEPARMCOUNTRANGE(p1,p2,f)
206 #define VM_SAFEPARMCOUNT(p,f)
207 #endif
208
209 #define VM_RETURN_EDICT(e)              (((int *)prog->globals.generic)[OFS_RETURN] = PRVM_EDICT_TO_PROG(e))
210
211 #define VM_STRINGTEMP_LENGTH MAX_INPUTLINE
212
213 // builtins and other general functions
214
215 void VM_CheckEmptyString (const char *s);
216 void VM_VarString(int first, char *out, int outlength);
217
218 void VM_checkextension (void);
219 void VM_error (void);
220 void VM_objerror (void);
221 void VM_print (void);
222 void VM_bprint (void);
223 void VM_sprint (void);
224 void VM_centerprint (void);
225 void VM_normalize (void);
226 void VM_vlen (void);
227 void VM_vectoyaw (void);
228 void VM_vectoangles (void);
229 void VM_random (void);
230 void VM_localsound(void);
231 void VM_break (void);
232 void VM_localcmd (void);
233 void VM_cvar (void);
234 void VM_cvar_string(void);
235 void VM_cvar_type (void);
236 void VM_cvar_defstring (void);
237 void VM_cvar_set (void);
238 void VM_dprint (void);
239 void VM_ftos (void);
240 void VM_fabs (void);
241 void VM_vtos (void);
242 void VM_etos (void);
243 void VM_stof(void);
244 void VM_itof(void);
245 void VM_ftoe(void);
246 void VM_strftime(void);
247 void VM_spawn (void);
248 void VM_remove (void);
249 void VM_find (void);
250 void VM_findfloat (void);
251 void VM_findchain (void);
252 void VM_findchainfloat (void);
253 void VM_findflags (void);
254 void VM_findchainflags (void);
255 void VM_precache_file (void);
256 void VM_precache_sound (void);
257 void VM_coredump (void);
258
259 void VM_stackdump (void);
260 void VM_crash(void); // REMOVE IT
261 void VM_traceon (void);
262 void VM_traceoff (void);
263 void VM_eprint (void);
264 void VM_rint (void);
265 void VM_floor (void);
266 void VM_ceil (void);
267 void VM_nextent (void);
268
269 void VM_changelevel (void);
270 void VM_sin (void);
271 void VM_cos (void);
272 void VM_sqrt (void);
273 void VM_randomvec (void);
274 void VM_registercvar (void);
275 void VM_min (void);
276 void VM_max (void);
277 void VM_bound (void);
278 void VM_pow (void);
279 void VM_log (void);
280 void VM_asin (void);
281 void VM_acos (void);
282 void VM_atan (void);
283 void VM_atan2 (void);
284 void VM_tan (void);
285
286 void VM_Files_Init(void);
287 void VM_Files_CloseAll(void);
288
289 void VM_fopen(void);
290 void VM_fclose(void);
291 void VM_fgets(void);
292 void VM_fputs(void);
293 void VM_writetofile(void); // only used by menu
294
295 void VM_strlen(void);
296 void VM_strcat(void);
297 void VM_substring(void);
298 void VM_stov(void);
299 void VM_strzone(void);
300 void VM_strunzone(void);
301
302 // KrimZon - DP_QC_ENTITYDATA
303 void VM_numentityfields(void);
304 void VM_entityfieldname(void);
305 void VM_entityfieldtype(void);
306 void VM_getentityfieldstring(void);
307 void VM_putentityfieldstring(void);
308 // And declared these ones for VM_getentityfieldstring and VM_putentityfieldstring in prvm_cmds.c
309 // the function is from prvm_edict.c
310 char *PRVM_UglyValueString (etype_t type, prvm_eval_t *val);
311 qboolean PRVM_ED_ParseEpair(prvm_edict_t *ent, ddef_t *key, const char *s, qboolean parsebackslash);
312
313 // DRESK - String Length (not counting color codes)
314 void VM_strlennocol(void);
315 // DRESK - Decolorized String
316 void VM_strdecolorize(void);
317 // DRESK - String Uppercase and Lowercase Support
318 void VM_strtolower(void);
319 void VM_strtoupper(void);
320
321 void VM_clcommand (void);
322
323 void VM_tokenize (void);
324 void VM_tokenizebyseparator (void);
325 void VM_argv (void);
326
327 void VM_isserver(void);
328 void VM_clientcount(void);
329 void VM_clientstate(void);
330 // not used at the moment -> not included in the common list
331 void VM_getostype(void);
332 void VM_getmousepos(void);
333 void VM_gettime(void);
334 void VM_getsoundtime(void);
335 void VM_soundlength(void);
336 void VM_loadfromdata(void);
337 void VM_parseentitydata(void);
338 void VM_loadfromfile(void);
339 void VM_modulo(void);
340
341 void VM_search_begin(void);
342 void VM_search_end(void);
343 void VM_search_getsize(void);
344 void VM_search_getfilename(void);
345 void VM_chr(void);
346 void VM_iscachedpic(void);
347 void VM_precache_pic(void);
348 void VM_freepic(void);
349 void VM_drawcharacter(void);
350 void VM_drawstring(void);
351 void VM_drawcolorcodedstring(void);
352 void VM_stringwidth(void);
353 void VM_drawpic(void);
354 void VM_drawrotpic(void);
355 void VM_drawsubpic(void);
356 void VM_drawfill(void);
357 void VM_drawsetcliparea(void);
358 void VM_drawresetcliparea(void);
359 void VM_getimagesize(void);
360
361 void VM_findfont(void);
362 void VM_loadfont(void);
363
364 void VM_makevectors (void);
365 void VM_vectorvectors (void);
366
367 void VM_keynumtostring (void);
368 void VM_getkeybind (void);
369 void VM_findkeysforcommand (void);
370 void VM_stringtokeynum (void);
371 void VM_setkeybind (void);
372 void VM_getbindmaps (void);
373 void VM_setbindmaps (void);
374
375 void VM_cin_open( void );
376 void VM_cin_close( void );
377 void VM_cin_setstate( void );
378 void VM_cin_getstate( void );
379 void VM_cin_restart( void );
380
381 void VM_gecko_create( void );
382 void VM_gecko_destroy( void );
383 void VM_gecko_navigate( void );
384 void VM_gecko_keyevent( void );
385 void VM_gecko_movemouse( void );
386 void VM_gecko_resize( void );
387 void VM_gecko_get_texture_extent( void );
388
389 void VM_drawline (void);
390
391 void VM_bitshift (void);
392
393 void VM_altstr_count( void );
394 void VM_altstr_prepare( void );
395 void VM_altstr_get( void );
396 void VM_altstr_set( void );
397 void VM_altstr_ins(void);
398
399 void VM_buf_create(void);
400 void VM_buf_del (void);
401 void VM_buf_getsize (void);
402 void VM_buf_copy (void);
403 void VM_buf_sort (void);
404 void VM_buf_implode (void);
405 void VM_bufstr_get (void);
406 void VM_bufstr_set (void);
407 void VM_bufstr_add (void);
408 void VM_bufstr_free (void);
409
410 void VM_changeyaw (void);
411 void VM_changepitch (void);
412
413 void VM_uncolorstring (void);
414
415 void VM_strstrofs (void);
416 void VM_str2chr (void);
417 void VM_chr2str (void);
418 void VM_strconv (void);
419 void VM_strpad (void);
420 void VM_infoadd (void);
421 void VM_infoget (void);
422 void VM_strncmp (void);
423 void VM_strncmp (void);
424 void VM_strncasecmp (void);
425 void VM_registercvar (void);
426 void VM_wasfreed (void);
427
428 void VM_strreplace (void);
429 void VM_strireplace (void);
430
431 void VM_crc16(void);
432 void VM_digest_hex(void);
433
434 void VM_SetTraceGlobals(const trace_t *trace);
435 void VM_ClearTraceGlobals(void);
436
437 void VM_Cmd_Init(void);
438 void VM_Cmd_Reset(void);
439
440 void VM_uri_escape (void);
441 void VM_uri_unescape (void);
442 void VM_whichpack (void);
443
444 void VM_etof (void);
445 void VM_uri_get (void);
446 void VM_netaddress_resolve (void);
447
448 void VM_tokenize_console (void);
449 void VM_argv_start_index (void);
450 void VM_argv_end_index (void);
451
452 void VM_buf_cvarlist(void);
453 void VM_cvar_description(void);
454
455 void VM_CL_getextresponse (void);
456 void VM_SV_getextresponse (void);
457
458 // Common functions between menu.dat and clsprogs
459 void VM_CL_isdemo (void);
460 void VM_CL_videoplaying (void);
461
462 void VM_isfunction(void);
463 void VM_callfunction(void);
464
465 void VM_sprintf(void);
466
467 void VM_getsurfacenumpoints(void);
468 void VM_getsurfacepoint(void);
469 void VM_getsurfacepointattribute(void);
470 void VM_getsurfacenormal(void);
471 void VM_getsurfacetexture(void);
472 void VM_getsurfacenearpoint(void);
473 void VM_getsurfaceclippedpoint(void);
474 void VM_getsurfacenumtriangles(void);
475 void VM_getsurfacetriangle(void);
476
477 // physics builtins
478 void VM_physics_enable(void);
479 void VM_physics_addforce(void);
480 void VM_physics_addtorque(void);