mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Ruamoko builtin declaration/implementation cleanup/simplification. Incomplete,
but working.
This commit is contained in:
parent
b057b6cb26
commit
2842f4d4f1
4 changed files with 145 additions and 97 deletions
|
@ -31,61 +31,74 @@
|
||||||
#ifndef __ruamoko_debug_h
|
#ifndef __ruamoko_debug_h
|
||||||
#define __ruamoko_debug_h
|
#define __ruamoko_debug_h
|
||||||
|
|
||||||
/*
|
#ifdef __RUA_INTERNAL_IMPLEMENT
|
||||||
abort (in QuakeC, this was break)
|
# define BUILTIN(name, number, rettype, ...) \
|
||||||
|
rettype (__VA_ARGS__) name = number
|
||||||
|
#else
|
||||||
|
# define BUILTIN(name, number, rettype, ...) \
|
||||||
|
rettype (__VA_ARGS__) name
|
||||||
|
@extern {
|
||||||
|
#endif // __RUA_INTERNAL_IMPLEMENT
|
||||||
|
|
||||||
Tell the engine to abort (stop) code processing.
|
/*
|
||||||
*/
|
abort (in QuakeC, this was break)
|
||||||
@extern void () abort;
|
|
||||||
|
|
||||||
/*
|
Tell the engine to abort (stop) code processing.
|
||||||
error
|
*/
|
||||||
|
BUILTIN (abort, #6, void, void);
|
||||||
|
|
||||||
Abort (crash) the server. "e" is the message the server crashes with.
|
/*
|
||||||
*/
|
coredump
|
||||||
@extern void (string e) error;
|
|
||||||
|
|
||||||
/*
|
Tell the engine to print all edicts (entities)
|
||||||
objerror
|
*/
|
||||||
|
BUILTIN (coredump, #28, void, void);
|
||||||
|
|
||||||
Prints info on the "self" ENTITY (not object), and error message "e".
|
/*
|
||||||
The entity is freed.
|
traceon
|
||||||
*/
|
|
||||||
@extern void (string e) objerror;
|
|
||||||
|
|
||||||
/*
|
Enable instruction trace in the interpreter
|
||||||
dprint
|
*/
|
||||||
|
BUILTIN (traceon, #29, void, void);
|
||||||
|
|
||||||
Print string "e" if the developer Cvar is set to a nonzero value
|
/*
|
||||||
*/
|
traceoff
|
||||||
@extern void (string s) dprint;
|
|
||||||
|
|
||||||
/*
|
Disable instruction trace in the interpreter
|
||||||
coredump
|
*/
|
||||||
|
BUILTIN (traceoff, #30, void, void);
|
||||||
|
|
||||||
Tell the engine to print all edicts (entities)
|
/*
|
||||||
*/
|
eprint
|
||||||
@extern void () coredump;
|
|
||||||
|
|
||||||
/*
|
Print all information on an entity to the console
|
||||||
traceon
|
*/
|
||||||
|
BUILTIN (eprint, #31, void, entity e);
|
||||||
|
|
||||||
Enable instruction trace in the interpreter
|
/*
|
||||||
*/
|
dprint
|
||||||
@extern void () traceon;
|
|
||||||
|
|
||||||
/*
|
Print a string to the console if the "developer" Cvar is nonzero.
|
||||||
traceoff
|
*/
|
||||||
|
BUILTIN (dprint, #25, void, string str);
|
||||||
|
|
||||||
Disable instruction trace in the interpreter
|
/*
|
||||||
*/
|
error
|
||||||
@extern void () traceoff;
|
|
||||||
|
|
||||||
/*
|
Abort (crash) the server. "str" is the message the server crashes with.
|
||||||
eprint
|
*/
|
||||||
|
BUILTIN (error, #10, void, string str);
|
||||||
|
|
||||||
Print all information on an entity to the server console
|
/*
|
||||||
*/
|
objerror
|
||||||
@extern void (entity e) eprint;
|
|
||||||
|
Prints info on the "self" ENTITY (not object), and error message "e".
|
||||||
|
The entity is freed.
|
||||||
|
*/
|
||||||
|
BUILTIN (objerror, #10, void, string e);
|
||||||
|
|
||||||
|
#ifndef __RUA_INTERNAL_IMPLEMENT
|
||||||
|
};
|
||||||
|
#endif // __RUA_INTERNAL_IMPLEMENT
|
||||||
|
|
||||||
#endif //__ruamoko_debug_h
|
#endif //__ruamoko_debug_h
|
||||||
|
|
|
@ -31,54 +31,107 @@
|
||||||
#ifndef __ruamoko_entities_h
|
#ifndef __ruamoko_entities_h
|
||||||
#define __ruamoko_entities_h
|
#define __ruamoko_entities_h
|
||||||
|
|
||||||
/*
|
#ifdef __RUA_INTERNAL_IMPLEMENT
|
||||||
setmodel
|
# define BUILTIN(name, number, rettype, ...) \
|
||||||
|
rettype (__VA_ARGS__) name = number
|
||||||
|
#else
|
||||||
|
# define BUILTIN(name, number, rettype, ...) \
|
||||||
|
rettype (__VA_ARGS__) name
|
||||||
|
@extern {
|
||||||
|
#endif // __RUA_INTERNAL_IMPLEMENT
|
||||||
|
|
||||||
Sets the model name for entity e to string m.
|
/*
|
||||||
Set the entity's move type and solid type before calling this.
|
setmodel
|
||||||
*/
|
|
||||||
@extern void (entity e, string m) setmodel;
|
|
||||||
|
|
||||||
/*
|
Sets the model name for entity e to string m.
|
||||||
setorigin
|
Set the entity's move type and solid type before calling.
|
||||||
|
SERVER ONLY
|
||||||
|
*/
|
||||||
|
BUILTIN (setmodel, #3, void, entity e, string m);
|
||||||
|
|
||||||
Sets origin for entity e to vector o.
|
/*
|
||||||
*/
|
setorigin
|
||||||
@extern void (entity e, vector o) setorigin;
|
|
||||||
|
|
||||||
/*
|
Sets origin for entity e to vector o.
|
||||||
setsize
|
SERVER ONLY
|
||||||
|
*/
|
||||||
|
BUILTIN (setorigin, #2, void, entity e, vector o);
|
||||||
|
|
||||||
Set the size of entity e to a cube with the bounds ( x1 y1 z1 ) ( x2 y2 z2 )
|
/*
|
||||||
*/
|
setsize
|
||||||
@extern void (entity e, vector min, vector max) setsize;
|
|
||||||
|
|
||||||
/*
|
Set the size of entity e to a cube with the bounds ( x1 y1 z1 ) ( x2 y2 z2 )
|
||||||
spawn
|
SERVER ONLY
|
||||||
|
*/
|
||||||
|
BUILTIN (setsize, #4, void, entity e, vector min, vector max);
|
||||||
|
|
||||||
Creates a new entity and returns it.
|
/*
|
||||||
*/
|
spawn
|
||||||
@extern entity () spawn;
|
|
||||||
|
|
||||||
/*
|
Creates a new entity and returns it.
|
||||||
remove
|
SERVER ONLY
|
||||||
|
*/
|
||||||
|
BUILTIN (spawn, #14, entity, void);
|
||||||
|
|
||||||
Remove entity e.
|
/*
|
||||||
*/
|
remove
|
||||||
@extern void (entity e) remove;
|
|
||||||
|
|
||||||
@extern entity (entity start, .string fld, string match) find;
|
Remove entity e.
|
||||||
@extern entity (vector org, float rad) findradius;
|
SERVER ONLY
|
||||||
@extern entity (entity e) nextent;
|
*/
|
||||||
|
BUILTIN (remove, #15, void, entity e);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
makestatic
|
find
|
||||||
|
|
||||||
Make entity e static (part of the world).
|
Search all entities for a field with contents matching a value and
|
||||||
Static entities do not interact with the game.
|
return the first matching entity.
|
||||||
*/
|
|
||||||
@extern void (entity e) makestatic;
|
|
||||||
|
|
||||||
@extern void (entity e) setspawnparms;
|
start: the edict from which to start.
|
||||||
|
field: The field to search.
|
||||||
|
match: The contents to search for.
|
||||||
|
|
||||||
|
This function must be called multiple times to get multiple results.
|
||||||
|
Stupid, but functional.
|
||||||
|
*/
|
||||||
|
#ifdef __VERSION6__
|
||||||
|
BUILTIN (find, #18, entity, entity start, .string field, string match);
|
||||||
|
#else
|
||||||
|
BUILTIN (find, #18, entity, entity start, ...);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
findradius
|
||||||
|
|
||||||
|
Search for entities within radius of origin.
|
||||||
|
|
||||||
|
If none found, world is returned.
|
||||||
|
If >1 found, the next will be linked using the "chain" field.
|
||||||
|
SERVER ONLY
|
||||||
|
*/
|
||||||
|
BUILTIN (findradius, #22, entity, vector origin, float radius);
|
||||||
|
|
||||||
|
/*
|
||||||
|
nextent
|
||||||
|
|
||||||
|
Return next entity after e. Use for traversing all entities.
|
||||||
|
Entity zero (the world) is returned if no more exist.
|
||||||
|
*/
|
||||||
|
BUILTIN (nextent, #47, entity, entity e);
|
||||||
|
|
||||||
|
/*
|
||||||
|
makestatic
|
||||||
|
|
||||||
|
Make entity e static (part of the world).
|
||||||
|
Static entities do not interact with the game.
|
||||||
|
SERVER ONLY
|
||||||
|
*/
|
||||||
|
BUILTIN (makestatic, #69, void, entity e);
|
||||||
|
|
||||||
|
BUILTIN (setspawnparms, #78, void, entity e);
|
||||||
|
|
||||||
|
#ifndef __RUA_INTERNAL_IMPLEMENT
|
||||||
|
};
|
||||||
|
#endif // __RUA_INTERNAL_IMPLEMENT
|
||||||
|
|
||||||
#endif //__ruamoko_entities_h
|
#endif //__ruamoko_entities_h
|
||||||
|
|
|
@ -1,10 +1,2 @@
|
||||||
|
#define __RUA_INTERNAL_IMPLEMENT
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
//FIXME void () break = #6;
|
|
||||||
void (string e) error = #10;
|
|
||||||
void (string e) objerror = #11;
|
|
||||||
void (string s) dprint = #25;
|
|
||||||
void () coredump = #28;
|
|
||||||
void () traceon = #29;
|
|
||||||
void () traceoff = #30;
|
|
||||||
void (entity e) eprint = #31;
|
|
||||||
|
|
|
@ -1,12 +1,2 @@
|
||||||
|
#define __RUA_INTERNAL_IMPLEMENT
|
||||||
#include "entities.h"
|
#include "entities.h"
|
||||||
|
|
||||||
void (entity e, vector o) setorigin = #2;
|
|
||||||
void (entity e, string m) setmodel = #3;
|
|
||||||
void (entity e, vector min, vector max) setsize = #4;
|
|
||||||
entity () spawn = #14;
|
|
||||||
void (entity e) remove = #15;
|
|
||||||
entity (entity start, .string fld, string match) find = #18;
|
|
||||||
entity (vector org, float rad) findradius = #22;
|
|
||||||
entity (entity e) nextent = #47;
|
|
||||||
void (entity e) makestatic = #69;
|
|
||||||
void (entity e) setspawnparms = #78;
|
|
||||||
|
|
Loading…
Reference in a new issue