From 81e64715eeb16caaafbc186a215cdd86e8c8a370 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Tue, 18 Feb 2014 22:00:42 -0500 Subject: [PATCH] Add an elasticity setting, beam "tightness" --- bal-wep-xonotic.cfg | 1 + qcsrc/client/particles.qc | 4 +++- qcsrc/common/weapons/w_arc.qc | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bal-wep-xonotic.cfg b/bal-wep-xonotic.cfg index a0b2fa944..04bc67fd3 100644 --- a/bal-wep-xonotic.cfg +++ b/bal-wep-xonotic.cfg @@ -259,6 +259,7 @@ set g_balance_arc_beam_nonplayerdamage 80 set g_balance_arc_beam_range 1000 set g_balance_arc_beam_refire 0.5 set g_balance_arc_beam_returnspeed 8 +set g_balance_arc_beam_tightness 0.5 set g_balance_arc_switchdelay_drop 0.3 set g_balance_arc_switchdelay_raise 0.3 set g_balance_arc_weaponreplace "" diff --git a/qcsrc/client/particles.qc b/qcsrc/client/particles.qc index 07a88b992..a139ae01f 100644 --- a/qcsrc/client/particles.qc +++ b/qcsrc/client/particles.qc @@ -377,6 +377,7 @@ void Net_ReadShockwaveParticle() .float beam_maxangle; .float beam_range; .float beam_returnspeed; +.float beam_tightness; .vector beam_shotorigin; .vector beam_dir; void Draw_ArcBeam() @@ -498,7 +499,7 @@ void Draw_ArcBeam() for(i = 1; i <= segments; ++i) { // calculate this on every segment to ensure that we always reach the full length of the attack - float segmentblend = (i/segments); + float segmentblend = bound(0, (i/segments) + self.beam_tightness, 1); float segmentdist = vlen(beam_endpos_estimate - last_origin) * (i/segments); vector new_dir = normalize( (wantdir * (1 - segmentblend)) + (normalize(beam_endpos_estimate - last_origin) * segmentblend) ); @@ -588,6 +589,7 @@ void Ent_ReadArcBeam(float isnew) self.beam_maxangle = ReadShort(); self.beam_range = ReadCoord(); self.beam_returnspeed = ReadShort(); + self.beam_tightness = (ReadByte() / 10); } if(sf & 2) // starting location diff --git a/qcsrc/common/weapons/w_arc.qc b/qcsrc/common/weapons/w_arc.qc index a8b0e08da..f7f9adc9c 100644 --- a/qcsrc/common/weapons/w_arc.qc +++ b/qcsrc/common/weapons/w_arc.qc @@ -33,6 +33,7 @@ REGISTER_WEAPON( w_cvar(id, sn, NONE, beam_range) \ w_cvar(id, sn, NONE, beam_refire) \ w_cvar(id, sn, NONE, beam_returnspeed) \ + w_cvar(id, sn, NONE, beam_tightness) \ w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \ w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \ w_prop(id, sn, string, weaponreplace, weaponreplace) \ @@ -95,6 +96,7 @@ float W_Arc_Beam_Send(entity to, float sf) WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_maxangle)); WriteCoord(MSG_ENTITY, WEP_CVAR(arc, beam_range)); WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_returnspeed)); + WriteByte(MSG_ENTITY, WEP_CVAR(arc, beam_tightness) * 10); } if(sf & 2) // starting location { @@ -233,7 +235,7 @@ void W_Arc_Beam_Think(void) for(i = 1; i <= segments; ++i) { // calculate this on every segment to ensure that we always reach the full length of the attack - float segmentblend = (i/segments); + float segmentblend = bound(0, (i/segments) + WEP_CVAR(arc, beam_tightness), 1); float segmentdist = vlen(beam_endpos_estimate - last_origin) * (i/segments); vector new_dir = normalize( (w_shotdir * (1 - segmentblend)) + (normalize(beam_endpos_estimate - last_origin) * segmentblend) ); -- 2.39.2