Ruamoko builtin declaration/implementation cleanup/simplification. Incomplete,

but working.
This commit is contained in:
Jeff Teunissen 2004-04-28 00:42:38 +00:00
parent b057b6cb26
commit 2842f4d4f1
4 changed files with 145 additions and 97 deletions

View file

@ -31,19 +31,63 @@
#ifndef __ruamoko_debug_h
#define __ruamoko_debug_h
#ifdef __RUA_INTERNAL_IMPLEMENT
# 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
/*
abort (in QuakeC, this was break)
Tell the engine to abort (stop) code processing.
*/
@extern void () abort;
BUILTIN (abort, #6, void, void);
/*
coredump
Tell the engine to print all edicts (entities)
*/
BUILTIN (coredump, #28, void, void);
/*
traceon
Enable instruction trace in the interpreter
*/
BUILTIN (traceon, #29, void, void);
/*
traceoff
Disable instruction trace in the interpreter
*/
BUILTIN (traceoff, #30, void, void);
/*
eprint
Print all information on an entity to the console
*/
BUILTIN (eprint, #31, void, entity e);
/*
dprint
Print a string to the console if the "developer" Cvar is nonzero.
*/
BUILTIN (dprint, #25, void, string str);
/*
error
Abort (crash) the server. "e" is the message the server crashes with.
Abort (crash) the server. "str" is the message the server crashes with.
*/
@extern void (string e) error;
BUILTIN (error, #10, void, string str);
/*
objerror
@ -51,41 +95,10 @@
Prints info on the "self" ENTITY (not object), and error message "e".
The entity is freed.
*/
@extern void (string e) objerror;
BUILTIN (objerror, #10, void, string e);
/*
dprint
Print string "e" if the developer Cvar is set to a nonzero value
*/
@extern void (string s) dprint;
/*
coredump
Tell the engine to print all edicts (entities)
*/
@extern void () coredump;
/*
traceon
Enable instruction trace in the interpreter
*/
@extern void () traceon;
/*
traceoff
Disable instruction trace in the interpreter
*/
@extern void () traceoff;
/*
eprint
Print all information on an entity to the server console
*/
@extern void (entity e) eprint;
#ifndef __RUA_INTERNAL_IMPLEMENT
};
#endif // __RUA_INTERNAL_IMPLEMENT
#endif //__ruamoko_debug_h

View file

@ -31,54 +31,107 @@
#ifndef __ruamoko_entities_h
#define __ruamoko_entities_h
#ifdef __RUA_INTERNAL_IMPLEMENT
# 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
/*
setmodel
Sets the model name for entity e to string m.
Set the entity's move type and solid type before calling this.
Set the entity's move type and solid type before calling.
SERVER ONLY
*/
@extern void (entity e, string m) setmodel;
BUILTIN (setmodel, #3, void, entity e, string m);
/*
setorigin
Sets origin for entity e to vector o.
SERVER ONLY
*/
@extern void (entity e, vector o) setorigin;
BUILTIN (setorigin, #2, void, entity e, vector o);
/*
setsize
Set the size of entity e to a cube with the bounds ( x1 y1 z1 ) ( x2 y2 z2 )
SERVER ONLY
*/
@extern void (entity e, vector min, vector max) setsize;
BUILTIN (setsize, #4, void, entity e, vector min, vector max);
/*
spawn
Creates a new entity and returns it.
SERVER ONLY
*/
@extern entity () spawn;
BUILTIN (spawn, #14, entity, void);
/*
remove
Remove entity e.
SERVER ONLY
*/
@extern void (entity e) remove;
BUILTIN (remove, #15, void, entity e);
@extern entity (entity start, .string fld, string match) find;
@extern entity (vector org, float rad) findradius;
@extern entity (entity e) nextent;
/*
find
Search all entities for a field with contents matching a value and
return the first matching entity.
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
*/
@extern void (entity e) makestatic;
BUILTIN (makestatic, #69, void, entity e);
@extern void (entity e) setspawnparms;
BUILTIN (setspawnparms, #78, void, entity e);
#ifndef __RUA_INTERNAL_IMPLEMENT
};
#endif // __RUA_INTERNAL_IMPLEMENT
#endif //__ruamoko_entities_h

View file

@ -1,10 +1,2 @@
#define __RUA_INTERNAL_IMPLEMENT
#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;

View file

@ -1,12 +1,2 @@
#define __RUA_INTERNAL_IMPLEMENT
#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;