]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add EF_TELEPORT_BIT support too
authorRudolf Polzer <divverent@xonotic.org>
Mon, 14 Nov 2011 15:54:19 +0000 (16:54 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Mon, 14 Nov 2011 15:54:19 +0000 (16:54 +0100)
qcsrc/client/interpolate.qc
qcsrc/client/interpolate.qh
qcsrc/csqcmodel/cl_model.qc
qcsrc/csqcmodel/common.qc
qcsrc/csqcmodel/sv_model.qc

index 3d6a1033a130f86eb62fb420171ad3a851e55677..a3140c8e775d1ebce3af9cb1f5d85700ca37f695 100644 (file)
@@ -52,26 +52,28 @@ void InterpolateOrigin_Note()
                self.ivelocity2 = self.velocity;
        }
 
-       if(vlen(self.iorigin2 - self.iorigin1) > 1000)
+       if(self.iflags & IFLAG_TELEPORTED)
        {
+               self.iflags &~= IFLAG_TELEPORTED;
                self.itime1 = self.itime2 = time; // don't lerp
        }
-
-       if((self.iflags & IFLAG_VELOCITY) && (vlen(self.ivelocity2 - self.ivelocity1) > 1000))
+       else if(vlen(self.iorigin2 - self.iorigin1) > 1000)
        {
                self.itime1 = self.itime2 = time; // don't lerp
        }
-
-       if(dt < 0.2)
+       else if((self.iflags & IFLAG_VELOCITY) && (vlen(self.ivelocity2 - self.ivelocity1) > 1000))
        {
-               self.itime1 = serverprevtime;
-               self.itime2 = time;
+               self.itime1 = self.itime2 = time; // don't lerp
        }
-       else
+       else if(dt >= 0.2)
        {
-               // don't lerp
                self.itime1 = self.itime2 = time;
        }
+       else
+       {
+               self.itime1 = serverprevtime;
+               self.itime2 = time;
+       }
 }
 void InterpolateOrigin_Do()
 {
index a0488038cd55449cdcda5dcf909102305912d018..1035c99f958af19931e3750c0bd869b2cbd4cb6b 100644 (file)
@@ -4,6 +4,7 @@
 #define IFLAG_AUTOANGLES 4
 #define IFLAG_VALID 8
 #define IFLAG_PREVALID 16
+#define IFLAG_TELEPORTED 32
 #define IFLAG_INTERNALMASK (IFLAG_VALID | IFLAG_PREVALID)
 
 // call this BEFORE reading an entity update
index 791205bb33f4a7807889ab5942e1d9ce35c455e3..e5bf9c54a4223a523d5f5ece6f9d60997dce1f32 100644 (file)
@@ -176,6 +176,9 @@ void CSQCModel_Read()
        ALLPROPERTIES
 #undef PROPERTY_SCALED
 #undef PROPERTY
+
+       if(sf & PROPERTY_TELEPORTED)
+               self.iflags |= IFLAG_TELEPORTED;
        
        CSQCModel_InterpolateAnimation_Note(sf);
        InterpolateOrigin_Note();
index 7df1f295e3a0055e2376c7830b1e3fd1fe3b3874..4526749467d647fb9da9923eab1541b68b3023ff 100644 (file)
@@ -9,6 +9,7 @@
 #define PROPERTY_FRAME 32768
 #define PROPERTY_FRAME2 16384
 #define PROPERTY_LERPFRAC 8192
+#define PROPERTY_TELEPORTED 4096 // the "teleport bit" cancelling interpolation
 
 #define ALLPROPERTIES_COMMON \
        PROPERTY(PROPERTY_FRAME, ReadByte, WriteByte, frame) \
index 09df3c828ef559ed1f7973b2f0664549a884dc19..59b8b284b84eb5acd076df02672e6b2500c6bcba 100644 (file)
@@ -57,6 +57,12 @@ void CSQCModel_CheckUpdate()
                self.effects &~= EF_RESTARTANIM_BIT;
        }
 
+       if(self.effects & EF_TELEPORT_BIT)
+       {
+               self.SendFlags |= PROPERTY_TELEPORTED; // no interpolation please
+               self.effects &~= EF_TELEPORT_BIT;
+       }
+
 #define PROPERTY(flag,r,w,f) \
        tmp = self.f; \
        if(tmp != self.csqcmodel_##f) \