From: Mario Date: Sun, 30 Sep 2018 11:06:52 +0000 (+1000) Subject: If arc's beam direction is the same as shot direction, snap it, reduces bandwidth... X-Git-Tag: xonotic-v0.8.5~1813 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=24aa6bdc6ba0b926339296f77195e30db04cbb5c;p=xonotic%2Fxonotic-data.pk3dir.git If arc's beam direction is the same as shot direction, snap it, reduces bandwidth usage when standing still --- diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index e78e10a36..c9d12fa67 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -322,7 +322,10 @@ void W_Arc_Beam_Think(entity this) (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)), min(WEP_CVAR(arc, beam_maxangle) / angle, 1) ); - this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor)); + if(vdist(this.beam_dir - w_shotdir, <, 0.01)) + this.beam_dir = w_shotdir; + else + this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor)); } else { @@ -332,7 +335,10 @@ void W_Arc_Beam_Think(entity this) (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)), 1 ); - this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor)); + if(vdist(this.beam_dir - w_shotdir, <, 0.01)) + this.beam_dir = w_shotdir; + else + this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor)); } // network information: beam direction