X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=progsvm.h;h=9481800e4cbbe81f6b446a9b231bf29ccf7b721e;hp=1f459d4356ff10d9c18603ad642fec002cd56c04;hb=e25ec73b388ad038b3999b26d70c03c4a1b9c482;hpb=cf128c9b9699145be0cb515a5e91e0b95b45b42f diff --git a/progsvm.h b/progsvm.h index 1f459d43..9481800e 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,8 @@ typedef struct prvm_stack_s { int s; mfunction_t *f; + double profile_acc; + double builtinsprofile_acc; } prvm_stack_t; @@ -78,7 +84,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; @@ -102,7 +108,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; @@ -114,12 +120,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); @@ -157,7 +172,9 @@ typedef struct prvm_prog_fieldoffsets_s int buttonuse; // ssqc int chain; // common - used by find builtins int classname; // common + int clientcamera; // ssqc int clientcolors; // ssqc + int clientstatus; // ssqc int color; // ssqc int colormod; // ssqc / csqc int contentstransition; // ssqc @@ -179,18 +196,24 @@ typedef struct prvm_prog_fieldoffsets_s int frame1time; // csqc int frame2; // csqc int frame2time; // csqc - int shadertime; // csqc + int frame3; // csqc + int frame3time; // csqc + int frame4; // csqc + int frame4time; // csqc int frame; // common - used by OP_STATE int fullbright; // ssqc - Nehahra support int glow_color; // ssqc int glow_size; // ssqc int glow_trail; // ssqc + int glowmod; // ssqc / csqc int gravity; // ssqc int groundentity; // ssqc / csqc int hull; // ssqc / csqc int ideal_yaw; // ssqc / csqc int idealpitch; // ssqc / csqc int items2; // ssqc + int lerpfrac3; // csqc + int lerpfrac4; // csqc int lerpfrac; // csqc int light_lev; // ssqc int message; // csqc @@ -202,6 +225,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 @@ -211,6 +236,8 @@ typedef struct prvm_prog_fieldoffsets_s int renderflags; // csqc 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 @@ -218,8 +245,27 @@ typedef struct prvm_prog_fieldoffsets_s int viewmodelforclient; // ssqc int viewzoom; // ssqc int yaw_speed; // ssqc / csqc - int clientcamera; // ssqc - int clientstatus; // ssqc + int bouncefactor; // ssqc + int bouncestop; // ssqc + + int solid; // ssqc / csqc (physics) + int movetype; // ssqc / csqc (physics) + int modelindex; // ssqc / csqc (physics) + int mins; // ssqc / csqc (physics) + int maxs; // ssqc / csqc (physics) + int mass; // ssqc / csqc (physics) + int origin; // ssqc / csqc (physics) + int velocity; // ssqc / csqc (physics) + //int axis_forward; // ssqc / csqc (physics) + //int axis_left; // ssqc / csqc (physics) + //int axis_up; // ssqc / csqc (physics) + //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) } prvm_prog_fieldoffsets_t; @@ -256,6 +302,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 @@ -267,6 +314,7 @@ typedef struct prvm_prog_globaloffsets_s int gettaginfo_forward; // ssqc / csqc int gettaginfo_right; // ssqc / csqc int gettaginfo_up; // ssqc / csqc + int transparent_offset; // csqc } prvm_prog_globaloffsets_t; @@ -300,6 +348,7 @@ typedef struct prvm_prog_funcoffsets_s func_t GameCommand; // any func_t SV_Shutdown; // ssqc func_t URI_Get_Callback; // any + func_t SV_PausedTic; //ssqc // menu qc only uses some functions, nothing else func_t m_draw; // mqc @@ -325,6 +374,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; @@ -332,15 +382,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; @@ -390,6 +440,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; @@ -402,7 +453,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 @@ -430,6 +481,12 @@ 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; + // prvm_builtin_mem_t *mem_list; // now passed as parameter of PRVM_LoadProgs @@ -458,6 +515,7 @@ typedef struct prvm_prog_s void (*error_cmd)(const char *format, ...) DP_FUNC_PRINTF(1); // [INIT] + void (*ExecuteProgram)(func_t fnum, const char *errormessage); // pointer to one of the *VM_ExecuteProgram functions } prvm_prog_t; extern prvm_prog_t * prog; @@ -498,7 +556,16 @@ void VM_Cmd_Reset(void); void PRVM_Init (void); -void PRVM_ExecuteProgram (func_t fnum, const char *errormessage); +#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__) #define PRVM_Free(buffer) _PRVM_Free(buffer, __FILE__, __LINE__) @@ -507,8 +574,9 @@ 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); +void PRVM_Profile (int maxfunctions, int mininstructions, int sortby); void PRVM_Profile_f (void); +void PRVM_ChildProfile_f (void); void PRVM_CallProfile_f (void); void PRVM_PrintFunction_f (void); @@ -516,7 +584,7 @@ void PRVM_PrintState(void); void PRVM_CrashAll (void); void PRVM_Crash (void); void PRVM_ShortStackTrace(char *buf, size_t bufsize); -const char *PRVM_AllocationOrigin(); +const char *PRVM_AllocationOrigin(void); ddef_t *PRVM_ED_FindField(const char *name); ddef_t *PRVM_ED_FindGlobal(const char *name); @@ -530,6 +598,7 @@ func_t PRVM_ED_FindFunctionOffset(const char *name); void PRVM_MEM_IncreaseEdicts(void); +qboolean PRVM_ED_CanAlloc(prvm_edict_t *e); prvm_edict_t *PRVM_ED_Alloc (void); void PRVM_ED_Free (prvm_edict_t *ed); void PRVM_ED_ClearEdict (prvm_edict_t *e); @@ -585,6 +654,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); @@ -638,4 +708,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