add Q3A's EF_TELEPORT_BIT (toggle it when teleporting; interpolation gets skipped...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 17 Feb 2009 13:59:46 +0000 (13:59 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 17 Feb 2009 13:59:46 +0000 (13:59 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8718 d7cf8633-e32d-0410-b094-e92efae38249

cl_parse.c
protocol.h
svvm_cmds.c

index c21a259..45b1890 100644 (file)
@@ -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)
index 1dd989b..98cd54e 100644 (file)
@@ -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
index 107c42b..9ce38d3 100644 (file)
@@ -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 "