]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - progs.h
added con_notify cvar, which controls how many console notify lines are displayed...
[xonotic/darkplaces.git] / progs.h
diff --git a/progs.h b/progs.h
index a50b7af9354c1ce754e728df94ad45a4771b9e5d..a8a5f3b7d0320ed07f1db3a391abae9bc9df7756 100644 (file)
--- a/progs.h
+++ b/progs.h
@@ -30,6 +30,7 @@ typedef union eval_s
        float                   _float;
        float                   vector[3];
        func_t                  function;
+       int                             ivector[3];
        int                             _int;
        int                             edict;
 } eval_t;
@@ -39,23 +40,33 @@ typedef struct link_s
        struct link_s   *prev, *next;
 } link_t;
 
-// LordHavoc: increased number of leafs per entity limit from 16 to 256
-#define        MAX_ENT_LEAFS   256
+// the entire server entity structure
 typedef struct edict_s
 {
-       qboolean free; // true if this edict is unused
-       link_t area; // physics area this edict is linked into
-       int number; // number of this edict
+       // true if this edict is unused
+       qboolean free;
+       // physics area this edict is linked into
+       link_t area;
 
+       // old entity protocol, not used
 #ifdef QUAKEENTITIES
-       entity_state_t baseline; // baseline values
-       entity_state_t deltabaseline; // LordHavoc: previous frame
+       // baseline values
+       entity_state_t baseline;
+       // LordHavoc: previous frame
+       entity_state_t deltabaseline;
 #endif
 
-       int suspendedinairflag; // LordHavoc: gross hack to make floating items still work
-       float freetime; // sv.time when the object was freed
-       entvars_t v; // C exported fields from progs
-// other fields from progs come immediately after
+       // 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)
+       entvars_t *v;
 } edict_t;
 
 // LordHavoc: in an effort to eliminate time wasted on GetEdictFieldValue...  see pr_edict.c for the functions which use these.
@@ -94,7 +105,7 @@ extern int eval_pmodel;
 extern int eval_punchvector;
 extern int eval_viewzoom;
 
-#define GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (eval_t*)((char*)&ed->v + fieldoffset) : NULL)
+#define GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (eval_t *)((qbyte *)ed->v + fieldoffset) : NULL)
 
 
 extern dfunction_t *SV_PlayerPhysicsQC;
@@ -145,25 +156,26 @@ edict_t *EDICT_NUM_ERROR(int n);
 
 int NUM_FOR_EDICT(edict_t *e);
 
-#define        NEXT_EDICT(e) ((edict_t *)( (qbyte *)e + pr_edict_size))
+#define        NEXT_EDICT(e) ((e) + 1)
 
-#define        EDICT_TO_PROG(e) ((qbyte *)e - (qbyte *)sv.edicts)
-#define PROG_TO_EDICT(e) ((edict_t *)((qbyte *)sv.edicts + e))
+int EDICT_TO_PROG(edict_t *e);
+edict_t *PROG_TO_EDICT(int n);
 
 //============================================================================
 
 #define        G_FLOAT(o) (pr_globals[o])
 #define        G_INT(o) (*(int *)&pr_globals[o])
-#define        G_EDICT(o) ((edict_t *)((qbyte *)sv.edicts+ *(int *)&pr_globals[o]))
+#define        G_EDICT(o) (PROG_TO_EDICT(*(int *)&pr_globals[o]))
 #define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
 #define        G_VECTOR(o) (&pr_globals[o])
-#define        G_STRING(o) (pr_strings + *(string_t *)&pr_globals[o])
-#define        G_FUNCTION(o) (*(func_t *)&pr_globals[o])
+#define        G_STRING(o) (PR_GetString(*(string_t *)&pr_globals[o]))
+//#define      G_FUNCTION(o) (*(func_t *)&pr_globals[o])
 
-#define        E_FLOAT(e,o) (((float*)&e->v)[o])
-#define        E_INT(e,o) (*(int *)&((float*)&e->v)[o])
-#define        E_VECTOR(e,o) (&((float*)&e->v)[o])
-#define        E_STRING(e,o) (pr_strings + *(string_t *)&((float*)&e->v)[o])
+// FIXME: make these go away?
+#define        E_FLOAT(e,o) (((float*)e->v)[o])
+//#define      E_INT(e,o) (((int*)e->v)[o])
+//#define      E_VECTOR(e,o) (&((float*)e->v)[o])
+#define        E_STRING(e,o) (PR_GetString(*(string_t *)&((float*)e->v)[o]))
 
 extern int             type_size[8];
 
@@ -173,7 +185,7 @@ extern int pr_numbuiltins;
 
 extern int             pr_argc;
 
-extern qboolean        pr_trace;
+extern int                     pr_trace;
 extern dfunction_t     *pr_xfunction;
 extern int                     pr_xstatement;
 
@@ -184,5 +196,8 @@ void PR_Execute_ProgsLoaded(void);
 void ED_PrintEdicts (void);
 void ED_PrintNum (int ent);
 
+#define PR_GetString(num) (pr_strings + num)
+#define PR_SetString(s) ((int) (s - pr_strings))
+
 #endif