]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - progsvm.h
fix funny menu bug (why did it never happen for me)?
[xonotic/darkplaces.git] / progsvm.h
index eb8306fb47f4d1e424292071f873d780cbe35b34..6aa6b01a779f10dc7576d76f53716c56be5aa6c0 100644 (file)
--- a/progsvm.h
+++ b/progsvm.h
@@ -80,7 +80,7 @@ typedef struct prvm_edict_s
        union
        {
                prvm_edict_private_t *required;
-               void *vp;
+               vec_t *vp;
                // FIXME: this server pointer really means world, not server
                // (it is used by both server qc and client qc, but not menu qc)
                edict_engineprivate_t *server;
@@ -104,7 +104,7 @@ typedef struct prvm_edict_s
        // QuakeC fields (stored in dynamically resized array)
        union
        {
-               void *vp;
+               vec_t *vp;
                entvars_t               *server;
                cl_entvars_t    *client;
        } fields;
@@ -116,12 +116,21 @@ typedef struct prvm_edict_s
 //============================================================================
 #define PRVM_OP_STATE          1
 
+#ifdef DP_SMALLMEMORY
+#define        PRVM_MAX_STACK_DEPTH            128
+#define        PRVM_LOCALSTACK_SIZE            2048
+
+#define PRVM_MAX_OPENFILES 16
+#define PRVM_MAX_OPENSEARCHES 8
+#define PRVM_MAX_GECKOINSTANCES 1
+#else
 #define        PRVM_MAX_STACK_DEPTH            1024
 #define        PRVM_LOCALSTACK_SIZE            16384
 
 #define PRVM_MAX_OPENFILES 256
 #define PRVM_MAX_OPENSEARCHES 128
 #define PRVM_MAX_GECKOINSTANCES 32
+#endif
 
 typedef void (*prvm_builtin_t) (void);
 
@@ -212,6 +221,8 @@ typedef struct prvm_prog_fieldoffsets_s
        int nodrawtoclient; // ssqc
        int pflags; // ssqc
        int ping; // ssqc
+       int packetloss; // ssqc
+       int movementloss; // ssqc
        int pitch_speed; // ssqc / csqc
        int playermodel; // ssqc
        int playerskin; // ssqc
@@ -287,6 +298,7 @@ typedef struct prvm_prog_globaloffsets_s
        int dmg_origin; // csqc
        int sb_showscores; // csqc
        int drawfont; // csqc / menu
+       int drawfontscale; // csqc / menu
        int require_spawnfunc_prefix; // ssqc
        int worldstatus; // ssqc
        int servertime; // csqc
@@ -358,6 +370,7 @@ prvm_stringbuffer_t;
 typedef struct prvm_prog_s
 {
        double              starttime;
+       unsigned int            id; // increasing unique id of progs instance
        dprograms_t                     *progs;
        mfunction_t                     *functions;
        char                            *strings;
@@ -365,15 +378,15 @@ typedef struct prvm_prog_s
        ddef_t                          *fielddefs;
        ddef_t                          *globaldefs;
        dstatement_t            *statements;
-       int                                     edict_size;                     // in bytes
-       int                                     edictareasize;          // LordHavoc: in bytes (for bound checking)
+       int                                     entityfields;                   // number of vec_t fields in progs (some variables are 3)
+       int                                     entityfieldsarea;               // LordHavoc: equal to max_edicts * entityfields (for bounds checking)
 
        int                                     *statement_linenums; // NULL if not available
 
        double                          *statement_profile; // only incremented if prvm_statementprofiling is on
 
        union {
-               float *generic;
+               vec_t *generic;
                globalvars_t *server;
                cl_globalvars_t *client;
        } globals;
@@ -436,7 +449,7 @@ typedef struct prvm_prog_s
        int                                     reserved_edicts; // [INIT]
 
        prvm_edict_t            *edicts;
-       void                                    *edictsfields;
+       vec_t                           *edictsfields;
        void                                    *edictprivate;
 
        // size of the engine private struct
@@ -464,6 +477,9 @@ typedef struct prvm_prog_s
        qboolean                        loaded;
        qboolean                        leaktest_active;
 
+       // translation buffer (only needs to be freed on unloading progs, type is private to prvm_edict.c)
+       void *po;
+
        // printed together with backtraces
        const char *statestring;
 
@@ -536,9 +552,15 @@ void VM_Cmd_Reset(void);
 
 void PRVM_Init (void);
 
+#ifdef PROFILING
 void MVM_ExecuteProgram (func_t fnum, const char *errormessage);
 void CLVM_ExecuteProgram (func_t fnum, const char *errormessage);
 void SVVM_ExecuteProgram (func_t fnum, const char *errormessage);
+#else
+#define MVM_ExecuteProgram SVVM_ExecuteProgram
+#define CLVM_ExecuteProgram SVVM_ExecuteProgram
+void SVVM_ExecuteProgram (func_t fnum, const char *errormessage);
+#endif
 #define PRVM_ExecuteProgram prog->ExecuteProgram
 
 #define PRVM_Alloc(buffersize) _PRVM_Alloc(buffersize, __FILE__, __LINE__)
@@ -628,6 +650,7 @@ void PRVM_ED_PrintNum (int ent, const char *wildcard_fieldname);
 
 const char *PRVM_GetString(int num);
 int PRVM_SetEngineString(const char *s);
+const char *PRVM_ChangeEngineString(int i, const char *s);
 int PRVM_SetTempString(const char *s);
 int PRVM_AllocString(size_t bufferlength, char **pointer);
 void PRVM_FreeString(int num);