]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - progsvm.h
don't hexdump png images while reading them (why did it do this??)
[xonotic/darkplaces.git] / progsvm.h
index d86b0b648b985e331173b4e4fd1165fedf73e7ae..8270615d4fd830aa5256302a42364b9a99e63997 100644 (file)
--- a/progsvm.h
+++ b/progsvm.h
@@ -31,6 +31,7 @@ The code uses void pointers instead.
 
 #include "pr_comp.h"                   // defs shared with qcc
 #include "progdefs.h"                  // generated by program cdefs
+#include "clprogdefs.h"                        // generated by program cdefs
 
 /*
 typedef union vm_eval_s
@@ -203,11 +204,13 @@ typedef struct prvm_edict_s
        union
        {
                void *vp;
-               entvars_t *server;
+               entvars_t               *server;
+               cl_entvars_t    *client;
        } fields;
 } prvm_edict_t;
 
-#define PRVM_GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (prvm_eval_t *)((qbyte *)ed->fields.vp + fieldoffset) : NULL)
+#define PRVM_GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (prvm_eval_t *)((unsigned char *)ed->fields.vp + fieldoffset) : NULL)
+#define PRVM_GETGLOBALFIELDVALUE(fieldoffset) (fieldoffset ? (prvm_eval_t *)((unsigned char *)prog->globals.generic + fieldoffset) : NULL)
 
 /*// this struct is the basic requirement for a qc prog
 typedef struct prvm_pr_globalvars_s
@@ -263,9 +266,12 @@ typedef struct prvm_prog_s
 
        int                                     *statement_linenums; // NULL if not available
 
+       double                          *statement_profile; // only incremented if prvm_statementprofiling is on
+
        union {
                float *generic;
                globalvars_t *server;
+               cl_globalvars_t *client;
        } globals;
 
        int                                     maxknownstrings;
@@ -274,7 +280,7 @@ typedef struct prvm_prog_s
        // (simple optimization of the free string search)
        int                                     firstfreeknownstring;
        const char                      **knownstrings;
-       qbyte                           *knownstrings_freeable;
+       unsigned char                           *knownstrings_freeable;
        const char                      ***stringshash;
 
        // all memory allocations related to this vm_prog (code, edicts, strings)
@@ -424,12 +430,14 @@ void _PRVM_Free (void *buffer, const char *filename, int fileline);
 void _PRVM_FreeAll (const char *filename, int fileline);
 
 void PRVM_Profile_f (void);
+void PRVM_PrintFunction_f (void);
 
 void PRVM_PrintState(void);
 void PRVM_CrashAll (void);
 void PRVM_Crash (void);
 
 int PRVM_ED_FindFieldOffset(const char *field);
+int PRVM_ED_FindGlobalOffset(const char *global);
 ddef_t *PRVM_ED_FindField (const char *name);
 mfunction_t *PRVM_ED_FindFunction (const char *name);
 
@@ -439,6 +447,7 @@ prvm_edict_t *PRVM_ED_Alloc (void);
 void PRVM_ED_Free (prvm_edict_t *ed);
 void PRVM_ED_ClearEdict (prvm_edict_t *e);
 
+void PRVM_PrintFunctionStatements (const char *name);
 void PRVM_ED_Print(prvm_edict_t *ed);
 void PRVM_ED_Write (qfile_t *f, prvm_edict_t *ed);
 const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent);
@@ -489,7 +498,7 @@ void PRVM_ED_PrintNum (int ent);
 
 const char *PRVM_GetString(int num);
 int PRVM_SetEngineString(const char *s);
-int PRVM_AllocString(int bufferlength, char **pointer);
+int PRVM_AllocString(size_t bufferlength, char **pointer);
 void PRVM_FreeString(int num);
 
 //============================================================================
@@ -508,9 +517,9 @@ void PRVM_FreeString(int num);
 
 //#define PRVM_SAFENAME
 #ifndef PRVM_SAFENAME
-       #define PRVM_NAME       (prog->name)
+#      define PRVM_NAME        (prog->name)
 #else
-       #define PRVM_NAME       (prog->name ? prog->name : "Unknown prog name")
+#      define PRVM_NAME        (prog->name ? prog->name : "Unknown prog name")
 #endif
 
 // helper macro to make function pointer calls easier