From a5c35efeda014336ec0919f4331f1f6807c34ec7 Mon Sep 17 00:00:00 2001 From: divverent Date: Thu, 18 Aug 2016 15:03:55 +0000 Subject: [PATCH] Add user defined movetypes extension From: Mario git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12271 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=87220e6d54034fd80f9e4b66f591233b23a18e9a --- dpdefs/dpextensions.qc | 9 +++++++++ server.h | 2 ++ sv_phys.c | 6 ++++++ svvm_cmds.c | 1 + 4 files changed, 18 insertions(+) diff --git a/dpdefs/dpextensions.qc b/dpdefs/dpextensions.qc index 2499673c..9acf04de 100644 --- a/dpdefs/dpextensions.qc +++ b/dpdefs/dpextensions.qc @@ -2599,3 +2599,12 @@ void coverage() = #642; // Reports a coverage event. The engine counts for each float(string url, float id, string content_type, string delim, float buf, float keyid) crypto_uri_postbuf = #513; //description: //use -1 as buffer handle to justs end delim as postdata + +//DP_USERMOVETYPES +//idea: divVerent +//darkplaces implementation: Mario +//movetype definitions: +float MOVETYPE_USER_FIRST = 128; +float MOVETYPE_USER_LAST = 191; +//description: +//user defined movetypes can be added between the start and end points, without producing unknown movetype warnings diff --git a/server.h b/server.h index 8c54f97f..2d22bdfb 100644 --- a/server.h +++ b/server.h @@ -335,6 +335,8 @@ typedef struct client_s #define MOVETYPE_FAKEPUSH 13 ///< tenebrae's push that doesn't push #define MOVETYPE_PHYSICS 32 ///< indicates this object is physics controlled #define MOVETYPE_FLY_WORLDONLY 33 ///< like MOVETYPE_FLY, but uses MOVE_WORLDONLY for all its traces; objects of this movetype better be SOLID_NOT or SOLID_TRIGGER please, or else... +#define MOVETYPE_USER_FIRST 128 ///< user defined movetypes +#define MOVETYPE_USER_LAST 191 // edict->solid values #define SOLID_NOT 0 ///< no interaction with other objects diff --git a/sv_phys.c b/sv_phys.c index 92f75c28..4ee8aa3b 100644 --- a/sv_phys.c +++ b/sv_phys.c @@ -2881,6 +2881,8 @@ static void SV_Physics_Entity (prvm_edict_t *ent) } break; default: + if((int) PRVM_serveredictfloat(ent, movetype) >= MOVETYPE_USER_FIRST && (int) PRVM_serveredictfloat(ent, movetype) <= MOVETYPE_USER_LAST) + break; Con_Printf ("SV_Physics: bad movetype %i\n", (int)PRVM_serveredictfloat(ent, movetype)); break; } @@ -2929,6 +2931,8 @@ static void SV_Physics_ClientEntity_NoThink (prvm_edict_t *ent) case MOVETYPE_PHYSICS: break; default: + if((int) PRVM_serveredictfloat(ent, movetype) >= MOVETYPE_USER_FIRST && (int) PRVM_serveredictfloat(ent, movetype) <= MOVETYPE_USER_LAST) + break; Con_Printf ("SV_Physics_ClientEntity_NoThink: bad movetype %i\n", (int)PRVM_serveredictfloat(ent, movetype)); break; } @@ -3117,6 +3121,8 @@ static void SV_Physics_ClientEntity(prvm_edict_t *ent) SV_RunThink (ent); break; default: + if((int) PRVM_serveredictfloat(ent, movetype) >= MOVETYPE_USER_FIRST && (int) PRVM_serveredictfloat(ent, movetype) <= MOVETYPE_USER_LAST) + break; Con_Printf ("SV_Physics_ClientEntity: bad movetype %i\n", (int)PRVM_serveredictfloat(ent, movetype)); break; } diff --git a/svvm_cmds.c b/svvm_cmds.c index 1c74acd0..befc567b 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -211,6 +211,7 @@ const char *vm_sv_extensions = "DP_TE_SPARK " "DP_TE_STANDARDEFFECTBUILTINS " "DP_TRACE_HITCONTENTSMASK_SURFACEINFO " +"DP_USERMOVETYPES " "DP_VIEWZOOM " "EXT_BITSHIFT " "FRIK_FILE " -- 2.39.2