-#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)
-#define PRVM_MAX_STACK_DEPTH 256
-#define PRVM_LOCALSTACK_SIZE 2048
+#define PRVM_MAX_STACK_DEPTH 1024
+#define PRVM_LOCALSTACK_SIZE 16384
+
+#define PRVM_MAX_OPENFILES 256
+#define PRVM_MAX_OPENSEARCHES 128
// (simple optimization of the free string search)
int firstfreeknownstring;
const char **knownstrings;
// (simple optimization of the free string search)
int firstfreeknownstring;
const char **knownstrings;
const char ***stringshash;
// all memory allocations related to this vm_prog (code, edicts, strings)
const char ***stringshash;
// all memory allocations related to this vm_prog (code, edicts, strings)
//============================================================================
// until this point everything also exists (with the pr_ prefix) in the old vm
//============================================================================
// until this point everything also exists (with the pr_ prefix) in the old vm
// copies of some vars that were former read from sv
int num_edicts;
// number of edicts for which space has been (should be) allocated
// copies of some vars that were former read from sv
int num_edicts;
// number of edicts for which space has been (should be) allocated
void (*init_cmd)(void); // [INIT] used by PRVM_InitProg
void (*reset_cmd)(void); // [INIT] used by PRVM_ResetProg
void (*init_cmd)(void); // [INIT] used by PRVM_InitProg
void (*reset_cmd)(void); // [INIT] used by PRVM_ResetProg
void _PRVM_Free (void *buffer, const char *filename, int fileline);
void _PRVM_FreeAll (const char *filename, int fileline);
void _PRVM_Free (void *buffer, const char *filename, int fileline);
void _PRVM_FreeAll (const char *filename, int fileline);
void PRVM_PrintState(void);
void PRVM_CrashAll (void);
void PRVM_Crash (void);
int PRVM_ED_FindFieldOffset(const char *field);
void PRVM_PrintState(void);
void PRVM_CrashAll (void);
void PRVM_Crash (void);
int PRVM_ED_FindFieldOffset(const char *field);
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);
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);