]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Add user defined movetypes extension
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 18 Aug 2016 15:03:55 +0000 (15:03 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 18 Aug 2016 15:03:55 +0000 (15:03 +0000)
From: Mario <mario@smbclan.net>

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12271 d7cf8633-e32d-0410-b094-e92efae38249

dpdefs/dpextensions.qc
server.h
sv_phys.c
svvm_cmds.c

index 2499673c309ba8d459d1a9c4fb3aca03720ec509..9acf04def1cc81636f2dbaa8ca1f43a189aa962d 100644 (file)
@@ -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
index 8c54f97f6f9da2ca9f9f2247f28a89a6f7e44627..2d22bdfb165beccba345160e5ce58aff8f32e41e 100644 (file)
--- 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
index 92f75c2862dc6ac7f0ed569c9b4cd7fbe4c9a12f..4ee8aa3b82402634d2f6d9528e7e42843cfd18a7 100644 (file)
--- 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;
        }
index 1c74acd07093189de97b152834485a717ee48037..befc567ba70d6f520537471f497c35a7d7afb6ef 100644 (file)
@@ -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 "