X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=progs.h;h=415a11d65b519ea1f1b1a7010ff03370ef65a9da;hb=31060b267734aa1a6a5dfac52a396b76d7be1b5c;hp=702c44594baa4ac3b8ed4c54685aa6eb60a85b59;hpb=57252d1b300d96b2353bf9d564b0de281552d2c5;p=xonotic%2Fdarkplaces.git diff --git a/progs.h b/progs.h index 702c4459..415a11d6 100644 --- a/progs.h +++ b/progs.h @@ -37,17 +37,20 @@ typedef union eval_s typedef struct link_s { - void *entity; + int entitynumber; struct link_s *prev, *next; } link_t; #define ENTITYGRIDAREAS 16 -// the entire server entity structure -typedef struct edict_s +typedef struct edict_engineprivate_s { // true if this edict is unused qboolean free; + // sv.time when the object was freed (to prevent early reuse which could + // mess up client interpolation or obscure severe QuakeC bugs) + float freetime; + // physics grid areas this edict is linked into link_t areagrid[ENTITYGRIDAREAS]; // since the areagrid can have multiple references to one entity, @@ -64,16 +67,23 @@ typedef struct edict_s // LordHavoc: gross hack to make floating items still work int suspendedinairflag; - // sv.time when the object was freed (to prevent early reuse which could - // mess up client interpolation or obscure severe QuakeC bugs) - float freetime; // used by PushMove to keep track of where objects were before they were // moved, in case they need to be moved back vec3_t moved_from; vec3_t moved_fromangles; - // edict fields (stored in another array) +} +edict_engineprivate_t; + +// the entire server entity structure +// NOTE: keep this small! priv and v are dynamic but this struct is not! +typedef struct edict_s +{ + // engine-private fields (stored in dynamically resized array) + edict_engineprivate_t *e; + // QuakeC fields (stored in dynamically resized array) entvars_t *v; -} edict_t; +} +edict_t; // LordHavoc: in an effort to eliminate time wasted on GetEdictFieldValue... see pr_edict.c for the functions which use these. extern int eval_gravity; @@ -144,6 +154,7 @@ void PR_Crash (void); edict_t *ED_Alloc (void); void ED_Free (edict_t *ed); +void ED_ClearEdict (edict_t *e); char *ED_NewString (const char *string); // returns a copy of the string allocated from the server's string heap @@ -157,15 +168,19 @@ void ED_ParseGlobals (const char *data); void ED_LoadFromFile (const char *data); -edict_t *EDICT_NUM_ERROR(int n); -#define EDICT_NUM(n) ((n >= 0 && n < sv.max_edicts) ? sv.edictstable[(n)] : EDICT_NUM_ERROR(n)) +edict_t *EDICT_NUM_ERROR(int n, char *filename, int fileline); +#define EDICT_NUM(n) (((n) >= 0 && (n) < sv.max_edicts) ? sv.edicts + (n) : EDICT_NUM_ERROR(n, __FILE__, __LINE__)) -int NUM_FOR_EDICT(edict_t *e); +//int NUM_FOR_EDICT_ERROR(edict_t *e); +#define NUM_FOR_EDICT(e) ((edict_t *)(e) - sv.edicts) +//int NUM_FOR_EDICT(edict_t *e); #define NEXT_EDICT(e) ((e) + 1) -int EDICT_TO_PROG(edict_t *e); -edict_t *PROG_TO_EDICT(int n); +#define EDICT_TO_PROG(e) (NUM_FOR_EDICT(e)) +//int EDICT_TO_PROG(edict_t *e); +#define PROG_TO_EDICT(n) (EDICT_NUM(n)) +//edict_t *PROG_TO_EDICT(int n); //============================================================================