X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=progsvm.h;h=ac5dd22801a351b8c76b3e69b25255778e0d6256;hb=b6b3148dd653325f5018c5911f44c23bbf8be477;hp=d5477892fd3a6247f250fe91faa46d38ca011527;hpb=e96f90ea4e19b54c7fa21be2a21341c5f6908067;p=xonotic%2Fdarkplaces.git diff --git a/progsvm.h b/progsvm.h index d5477892..ac5dd228 100644 --- a/progsvm.h +++ b/progsvm.h @@ -33,6 +33,10 @@ The code uses void pointers instead. #include "progdefs.h" // generated by program cdefs #include "clprogdefs.h" // generated by program cdefs +#ifndef DP_SMALLMEMORY +#define PROFILING +#endif + // forward declaration of clgecko_t struct clgecko_s; @@ -40,6 +44,7 @@ typedef struct prvm_stack_s { int s; mfunction_t *f; + double tprofile_acc; double profile_acc; double builtinsprofile_acc; } prvm_stack_t; @@ -80,7 +85,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 +109,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 +121,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); @@ -174,9 +188,9 @@ typedef struct prvm_prog_fieldoffsets_s int dimension_hit; // ssqc / csqc int dimension_solid; // ssqc / csqc int disableclientprediction; // ssqc + int discardabledemo; // ssqc int dphitcontentsmask; // ssqc / csqc int drawonlytoclient; // ssqc - int effects; // ssqc / csqc int exteriormodeltoclient; // ssqc int fatness; // ssqc / csqc int forceshader; // csqc @@ -212,6 +226,8 @@ typedef struct prvm_prog_fieldoffsets_s int nodrawtoclient; // ssqc int pflags; // ssqc int ping; // ssqc + int ping_packetloss; // ssqc + int ping_movementloss; // ssqc int pitch_speed; // ssqc / csqc int playermodel; // ssqc int playerskin; // ssqc @@ -222,6 +238,7 @@ typedef struct prvm_prog_fieldoffsets_s int rendermode; // ssqc - HalfLife support int scale; // ssqc / csqc int shadertime; // csqc + int skeletonindex; // csqc / ssqc FTE_CSQC_SKELETONOBJECTS / DP_SKELETONOBJECTS int style; // ssqc int tag_entity; // ssqc / csqc int tag_index; // ssqc / csqc @@ -231,6 +248,7 @@ typedef struct prvm_prog_fieldoffsets_s int yaw_speed; // ssqc / csqc int bouncefactor; // ssqc int bouncestop; // ssqc + int sendcomplexanimation; // ssqc int solid; // ssqc / csqc (physics) int movetype; // ssqc / csqc (physics) @@ -246,6 +264,23 @@ typedef struct prvm_prog_fieldoffsets_s //int spinvelocity; // ssqc / csqc (physics) //int angles; // ssqc / csqc (physics) int avelocity; // ssqc / csqc (physics) + int jointtype; // ssqc / csqc (physics) + int enemy; // ssqc / csqc (physics) + int aiment; // ssqc / csqc (physics) + int movedir; // ssqc / csqc (physics) + + int camera_transform; // csqc (warpzones) + + int userwavefunc_param0; // csqc (userwavefunc) + int userwavefunc_param1; // csqc (userwavefunc) + int userwavefunc_param2; // csqc (userwavefunc) + int userwavefunc_param3; // csqc (userwavefunc) + + int crypto_keyfp; // ssqc (DP_CRYPTO) + int crypto_mykeyfp; // ssqc (DP_CRYPTO) + int crypto_idfp; // ssqc (DP_CRYPTO) + int crypto_encryptmethod; // ssqc (DP_CRYPTO) + int crypto_signmethod; // ssqc (DP_CRYPTO) } prvm_prog_fieldoffsets_t; @@ -260,6 +295,8 @@ typedef struct prvm_prog_globaloffsets_s int v_right; // ssqc / csqc int v_up; // ssqc / csqc int view_angles; // csqc + int view_punchangle; // csqc + int view_punchvector; // csqc int trace_allsolid; // ssqc / csqc int trace_startsolid; // ssqc / csqc int trace_fraction; // ssqc / csqc @@ -282,6 +319,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 @@ -294,6 +332,11 @@ typedef struct prvm_prog_globaloffsets_s int gettaginfo_right; // ssqc / csqc int gettaginfo_up; // ssqc / csqc int transparent_offset; // csqc + + int particles_alphamin; // csqc + int particles_alphamax; // csqc + int particles_colormin; // csqc + int particles_colormax; // csqc } prvm_prog_globaloffsets_t; @@ -336,15 +379,20 @@ typedef struct prvm_prog_funcoffsets_s func_t m_keyup; // mqc func_t m_shutdown; // mqc func_t m_toggle; // mqc + func_t m_newmap; // mqc } prvm_prog_funcoffsets_t; +// stringbuffer flags +#define STRINGBUFFER_SAVED 1 // saved in savegames + typedef struct prvm_stringbuffer_s { int max_strings; int num_strings; char **strings; const char *origin; + unsigned char flags; } prvm_stringbuffer_t; @@ -353,6 +401,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; @@ -360,15 +409,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; @@ -418,6 +467,7 @@ typedef struct prvm_prog_s fssearch_t *opensearches[PRVM_MAX_OPENSEARCHES]; const char * opensearches_origin[PRVM_MAX_OPENSEARCHES]; struct clgecko_s *opengeckoinstances[PRVM_MAX_GECKOINSTANCES]; + skeleton_t *skeletons[MAX_EDICTS]; // copies of some vars that were former read from sv int num_edicts; @@ -430,7 +480,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 @@ -445,12 +495,12 @@ typedef struct prvm_prog_s qboolean allowworldwrites; // name of the prog, e.g. "Server", "Client" or "Menu" (used for text output) - char *name; // [INIT] + const char *name; // [INIT] // flag - used to store general flags like PRVM_GE_SELF, etc. int flag; - char *extensionstring; // [INIT] + const char *extensionstring; // [INIT] qboolean loadintoworld; // [INIT] @@ -458,6 +508,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; @@ -512,8 +565,8 @@ extern const int vm_sv_numbuiltins; extern const int vm_cl_numbuiltins; extern const int vm_m_numbuiltins; -extern char * vm_sv_extensions; // client also uses this -extern char * vm_m_extensions; +extern const char * vm_sv_extensions; // client also uses this +extern const char * vm_m_extensions; void VM_SV_Cmd_Init(void); void VM_SV_Cmd_Reset(void); @@ -530,9 +583,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__) @@ -542,7 +601,7 @@ void *_PRVM_Alloc (size_t buffersize, 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_Profile (int maxfunctions, int mininstructions, int sortby); +void PRVM_Profile (int maxfunctions, double mintime, int sortby); void PRVM_Profile_f (void); void PRVM_ChildProfile_f (void); void PRVM_CallProfile_f (void); @@ -581,7 +640,7 @@ void PRVM_ED_ParseGlobals (const char *data); void PRVM_ED_LoadFromFile (const char *data); -unsigned int PRVM_EDICT_NUM_ERROR(unsigned int n, char *filename, int fileline); +unsigned int PRVM_EDICT_NUM_ERROR(unsigned int n, const char *filename, int fileline); #define PRVM_EDICT(n) (((unsigned)(n) < (unsigned int)prog->max_edicts) ? (unsigned int)(n) : PRVM_EDICT_NUM_ERROR((unsigned int)(n), __FILE__, __LINE__)) #define PRVM_EDICT_NUM(n) (prog->edicts + PRVM_EDICT(n)) @@ -622,6 +681,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); @@ -663,7 +723,7 @@ Load a program with LoadProgs */ void PRVM_InitProg(int prognr); // LoadProgs expects to be called right after InitProg -void PRVM_LoadProgs (const char *filename, int numrequiredfunc, char **required_func, int numrequiredfields, prvm_required_field_t *required_field, int numrequiredglobals, char **required_global); +void PRVM_LoadProgs (const char *filename, int numrequiredfunc, const char **required_func, int numrequiredfields, prvm_required_field_t *required_field, int numrequiredglobals, char **required_global); void PRVM_ResetProg(void); qboolean PRVM_ProgLoaded(int prognr); @@ -675,4 +735,9 @@ void VM_Warning(const char *fmt, ...) DP_FUNC_PRINTF(1); // TODO: fill in the params //void PRVM_Create(); +void VM_GenerateFrameGroupBlend(framegroupblend_t *framegroupblend, const prvm_edict_t *ed); +void VM_FrameBlendFromFrameGroupBlend(frameblend_t *frameblend, const framegroupblend_t *framegroupblend, const dp_model_t *model); +void VM_UpdateEdictSkeleton(prvm_edict_t *ed, const dp_model_t *edmodel, const frameblend_t *frameblend); +void VM_RemoveEdictSkeleton(prvm_edict_t *ed); + #endif