]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
InterpolateOrigin: add a small description and fix 2 weirdly wrapped lines
authorterencehill <piuntn@gmail.com>
Mon, 1 Mar 2021 19:50:36 +0000 (20:50 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 1 Mar 2021 19:50:36 +0000 (20:50 +0100)
qcsrc/lib/csqcmodel/interpolate.qc
qcsrc/lib/csqcmodel/interpolate.qh

index 831ce95e9eb34432f8082f7ad9be84ffa6166a7b..f415313e719c493c2eb27df1aaeeb24724833695 100644 (file)
@@ -48,13 +48,11 @@ void InterpolateOrigin_Note(entity this)
                this.iorigin2 = this.origin;
        }
 
-       if ((this.iflags & IFLAG_AUTOANGLES)
-           && this.iorigin2
-           != this.iorigin1) this.angles = vectoangles(this.iorigin2 - this.iorigin1);
+       if ((this.iflags & IFLAG_AUTOANGLES) && this.iorigin2 != this.iorigin1)
+               this.angles = vectoangles(this.iorigin2 - this.iorigin1);
 
-       if ((this.iflags & IFLAG_AUTOVELOCITY)
-           && this.itime2
-           != this.itime1) this.velocity = (this.iorigin2 - this.iorigin1) * (1.0 / (this.itime2 - this.itime1));
+       if ((this.iflags & IFLAG_AUTOVELOCITY) && this.itime2 != this.itime1)
+               this.velocity = (this.iorigin2 - this.iorigin1) * (1.0 / (this.itime2 - this.itime1));
 
        if (this.iflags & IFLAG_ANGLES)
        {
@@ -134,7 +132,8 @@ void InterpolateOrigin_Do(entity this)
        {
                float f = bound(0, (time - this.itime1) / (this.itime2 - this.itime1), 1 + autocvar_cl_lerpexcess);
                float f_1 = 1 - f;
-               if (this.iflags & IFLAG_ORIGIN) setorigin(this, f_1 * this.iorigin1 + f * this.iorigin2);
+               if (this.iflags & IFLAG_ORIGIN)
+                       setorigin(this, f_1 * this.iorigin1 + f * this.iorigin2);
                if (this.iflags & IFLAG_ANGLES)
                {
                        vector forward = f_1 * this.iforward1 + f * this.iforward2;
@@ -151,7 +150,8 @@ void InterpolateOrigin_Do(entity this)
                {
                        this.v_angle_x = f_1 * this.ivforward1.x + f * this.ivforward2.x;
                }
-               if (this.iflags & IFLAG_VELOCITY) this.velocity = f_1 * this.ivelocity1 + f * this.ivelocity2;
+               if (this.iflags & IFLAG_VELOCITY)
+                       this.velocity = f_1 * this.ivelocity1 + f * this.ivelocity2;
        }
 }
 
index 7c6b2c3490ac492a2faee3881131551a7fd4c7f3..d02b8e827433a349c3799ac589d2ecea3736cab0 100644 (file)
@@ -36,6 +36,10 @@ const int IFLAG_V_ANGLE_X = BIT(8);
 const int IFLAG_ORIGIN = BIT(9);
 const int IFLAG_INTERNALMASK = IFLAG_VALID | IFLAG_PREVALID;
 
+// InterpolateOrigin can interpolate many things, not just origin;
+// set the appropriate flag(s) to this.iflags before
+// InterpolateOrigin_Note(this) and after InterpolateOrigin_Undo(this)
+
 // call this BEFORE reading an entity update
 void InterpolateOrigin_Undo(entity this);