X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=progsvm.h;h=0ef7dff3fc161e6fd32102bc8d1cc08d21f767e9;hb=938076b14d524fa61920c6538115c2829baa2693;hp=ab85fe9780c91f5517064fb63be501112bb23df3;hpb=d4527afc11fcedad0de6af45db81eed0c252fa32;p=xonotic%2Fdarkplaces.git diff --git a/progsvm.h b/progsvm.h index ab85fe97..0ef7dff3 100644 --- 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,12 @@ 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) /*// this struct is the basic requirement for a qc prog typedef struct prvm_pr_globalvars_s @@ -261,14 +263,22 @@ typedef struct prvm_prog_s int edict_size; // in bytes int edictareasize; // LordHavoc: in bytes (for bound checking) + int *statement_linenums; // NULL if not available + union { float *generic; globalvars_t *server; + cl_globalvars_t *client; } globals; int maxknownstrings; int numknownstrings; + // this is updated whenever a string is removed or added + // (simple optimization of the free string search) + int firstfreeknownstring; const char **knownstrings; + unsigned char *knownstrings_freeable; + const char ***stringshash; // all memory allocations related to this vm_prog (code, edicts, strings) mempool_t *progs_mempool; // [INIT] @@ -321,6 +331,10 @@ typedef struct prvm_prog_s float *time; float _time; + // allow writing to world entity fields, this is set by server init and + // cleared before first server frame + qboolean allowworldwrites; + // name of the prog, e.g. "Server", "Client" or "Menu" (used for text output) char *name; // [INIT] @@ -478,7 +492,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); //============================================================================ @@ -497,9 +511,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