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;
- // physics area this edict is linked into
- link_t area;
+ // 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,
+ // we should avoid extensive checking on entities already encountered
+ int areagridmarknumber;
// old entity protocol, not used
#ifdef QUAKEENTITIES
// 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;
extern int eval_pmodel;
extern int eval_punchvector;
extern int eval_viewzoom;
+extern int eval_clientcolors;
+extern int eval_tag_entity;
+extern int eval_tag_index;
+extern int eval_light_lev;
+extern int eval_color;
+extern int eval_style;
+extern int eval_pflags;
#define GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (eval_t *)((qbyte *)ed->v + fieldoffset) : NULL)
extern mfunction_t *SV_PlayerPhysicsQC;
extern mfunction_t *EndFrameQC;
+//KrimZon - SERVER COMMANDS IN QUAKEC
+extern mfunction_t *SV_ParseClientCommandQC;
//============================================================================
void PR_Profile_f (void);
+void PR_PrintState(void);
void PR_Crash (void);
+void SV_IncreaseEdicts(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
-void ED_Print (edict_t *ed);
-void ED_Write (QFile *f, edict_t *ed);
+void ED_Print(edict_t *ed);
+void ED_Write (qfile_t *f, edict_t *ed);
const char *ED_ParseEdict (const char *data, edict_t *ent);
-void ED_WriteGlobals (QFile *f);
+void ED_WriteGlobals (qfile_t *f);
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__))
+#define EDICT_NUM_UNSIGNED(n) (((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);
//============================================================================
void ED_PrintEdicts (void);
void ED_PrintNum (int ent);
-#define PR_GetString(num) (pr_strings + num)
-#define PR_SetString(s) ((int) (s - pr_strings))
+#define PR_GetString(num) (pr_strings + num)
+#define PR_SetString(s) ((int) (s) ? (s - pr_strings) : 0)
#endif