]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - progs.h
-Added the cvar sv_progs, which allows you to set the name of the server
[xonotic/darkplaces.git] / progs.h
diff --git a/progs.h b/progs.h
index 702c44594baa4ac3b8ed4c54685aa6eb60a85b59..cdae2523cc26b9c59913ae88313c9a5777049c9c 100644 (file)
--- a/progs.h
+++ b/progs.h
@@ -37,43 +37,49 @@ 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,
        // we should avoid extensive checking on entities already encountered
        int areagridmarknumber;
 
-       // old entity protocol, not used
-#ifdef QUAKEENTITIES
+       // PROTOCOL_QUAKE
        // baseline values
        entity_state_t baseline;
-       // LordHavoc: previous frame
-       entity_state_t deltabaseline;
-#endif
 
        // 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;
@@ -83,6 +89,8 @@ extern int eval_button5;
 extern int eval_button6;
 extern int eval_button7;
 extern int eval_button8;
+extern int eval_buttonuse;
+extern int eval_buttonchat;
 extern int eval_glow_size;
 extern int eval_glow_trail;
 extern int eval_glow_color;
@@ -110,12 +118,29 @@ extern int eval_movement;
 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;
+extern int eval_cursor_active;
+extern int eval_cursor_screen;
+extern int eval_cursor_trace_start;
+extern int eval_cursor_trace_endpos;
+extern int eval_cursor_trace_ent;
+extern int eval_colormod;
+extern int eval_playermodel;
+extern int eval_playerskin;
 
 #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;
 
 //============================================================================
 
@@ -136,19 +161,23 @@ extern    int                             pr_edictareasize; // LordHavoc: for bounds checking
 void PR_Init (void);
 
 void PR_ExecuteProgram (func_t fnum, const char *errormessage);
-void PR_LoadProgs (void);
+void PR_LoadProgs (const char *progsname);
 
 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_Print(edict_t *ed);
 void ED_Write (qfile_t *f, edict_t *ed);
 const char *ED_ParseEdict (const char *data, edict_t *ent);
 
@@ -157,15 +186,20 @@ 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) ((int)((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);
 
 //============================================================================
 
@@ -202,8 +236,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))
+#define PR_GetString(num) (pr_strings + num) 
+#define PR_SetString(s)   ((s) != NULL ? (int) (s - pr_strings) : 0)
 
 #endif