From: terencehill Date: Fri, 30 Apr 2021 17:28:04 +0000 (+0200) Subject: Optimize code rotating prejectiles X-Git-Tag: xonotic-v0.8.5~428 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a8e2daa3060cd8838a2a64040e41eea56eb30924;p=xonotic%2Fxonotic-data.pk3dir.git Optimize code rotating prejectiles --- diff --git a/qcsrc/client/weapons/projectile.qc b/qcsrc/client/weapons/projectile.qc index 4e457daba..37efbddfa 100644 --- a/qcsrc/client/weapons/projectile.qc +++ b/qcsrc/client/weapons/projectile.qc @@ -115,7 +115,18 @@ void Projectile_Draw(entity this) if (Projectile_isnade(this.cnt)) rot = this.avelocity; - this.angles = AnglesTransform_ToAngles(AnglesTransform_Multiply(AnglesTransform_FromAngles(this.angles), rot * (t - this.spawntime))); + if (rot) + { + if (!rot.x && !rot.y) + { + // cheaper z-only rotation formula + this.angles.z = (rot.z * (t - this.spawntime)) % 360; + if (this.angles.z < 0) + this.angles.z += 360; + } + else + this.angles = AnglesTransform_ToAngles(AnglesTransform_Multiply(AnglesTransform_FromAngles(this.angles), rot * (t - this.spawntime))); + } } vector ang;