From 46077554d96e137c9fe832146b4701722caf7f18 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 1 Mar 2021 20:50:36 +0100 Subject: [PATCH] InterpolateOrigin: add a small description and fix 2 weirdly wrapped lines --- qcsrc/lib/csqcmodel/interpolate.qc | 16 ++++++++-------- qcsrc/lib/csqcmodel/interpolate.qh | 4 ++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/qcsrc/lib/csqcmodel/interpolate.qc b/qcsrc/lib/csqcmodel/interpolate.qc index 831ce95e9..f415313e7 100644 --- a/qcsrc/lib/csqcmodel/interpolate.qc +++ b/qcsrc/lib/csqcmodel/interpolate.qc @@ -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; } } diff --git a/qcsrc/lib/csqcmodel/interpolate.qh b/qcsrc/lib/csqcmodel/interpolate.qh index 7c6b2c349..d02b8e827 100644 --- a/qcsrc/lib/csqcmodel/interpolate.qh +++ b/qcsrc/lib/csqcmodel/interpolate.qh @@ -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); -- 2.39.2