From b4617522b3a3401b30e9c95b125a706d0a8113c0 Mon Sep 17 00:00:00 2001 From: divverent Date: Tue, 17 Feb 2009 13:59:46 +0000 Subject: [PATCH] add Q3A's EF_TELEPORT_BIT (toggle it when teleporting; interpolation gets skipped for a frame after doing so) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8718 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_parse.c | 22 ++++++++++++++++++++++ protocol.h | 2 +- svvm_cmds.c | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/cl_parse.c b/cl_parse.c index c21a2594..45b1890c 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -1739,6 +1739,28 @@ void CL_MoveLerpEntityStates(entity_t *ent) ent->persistent.muzzleflash = 0; ent->persistent.trail_allowed = false; } + else if ((ent->state_previous.effects & EF_TELEPORT_BIT) != (ent->state_current.effects & EF_TELEPORT_BIT)) + { + // don't interpolate the move + ent->persistent.lerpdeltatime = 0; + ent->persistent.lerpstarttime = cl.mtime[1]; + VectorCopy(ent->state_current.origin, ent->persistent.oldorigin); + VectorCopy(ent->state_current.angles, ent->persistent.oldangles); + VectorCopy(ent->state_current.origin, ent->persistent.neworigin); + VectorCopy(ent->state_current.angles, ent->persistent.newangles); + ent->persistent.trail_allowed = false; + + if(ent->state_current.frame != ent->state_previous.frame) + { + // if we ALSO changed animation frame in the process (but ONLY then!) + // then let's reset the animation interpolation too + ent->render.frame1 = ent->render.frame2 = ent->state_current.frame; + ent->render.frame1time = ent->render.frame2time = cl.time; + ent->render.framelerp = 1; + } + + // note that this case must do everything the following case does too + } else if (DotProduct(odelta, odelta) > 1000*1000 || (cl.fixangle[0] && !cl.fixangle[1]) || (ent->state_previous.tagindex != ent->state_current.tagindex) diff --git a/protocol.h b/protocol.h index 1dd989b0..98cd54e8 100644 --- a/protocol.h +++ b/protocol.h @@ -62,7 +62,7 @@ void Protocol_Names(char *buffer, size_t buffersize); #define EF_UNUSED18 262144 #define EF_UNUSED19 524288 #define EF_UNUSED20 1048576 -#define EF_UNUSED21 2197152 +#define EF_TELEPORT_BIT 2197152 // div0: teleport bit (toggled when teleporting, prevents lerping when the bit has changed) #define EF_LOWPRECISION 4194304 // LordHavoc: entity is low precision (integer coordinates) to save network bandwidth (serverside only) #define EF_NOMODELFLAGS 8388608 // indicates the model's .effects should be ignored (allows overriding them) #define EF_ROCKET 16777216 // leave a trail diff --git a/svvm_cmds.c b/svvm_cmds.c index 107c42b1..9ce38d3b 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -31,6 +31,7 @@ char *vm_sv_extensions = "DP_EF_NOSHADOW " "DP_EF_RED " "DP_EF_STARDUST " +"DP_EF_TELEPORT_BIT " "DP_ENT_ALPHA " "DP_ENT_COLORMOD " "DP_ENT_CUSTOMCOLORMAP " -- 2.39.2