From: Samual Lenks Date: Fri, 28 Feb 2014 19:15:03 +0000 (-0500) Subject: Start working on Shockwave visual effect again X-Git-Tag: xonotic-v0.8.0~152^2~38 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=60484e63e0fcdc59daf98d7a52c04e79bc13a3c3;p=xonotic%2Fxonotic-data.pk3dir.git Start working on Shockwave visual effect again --- diff --git a/qcsrc/client/particles.qc b/qcsrc/client/particles.qc index 8ab746f2f..a4f24fbc2 100644 --- a/qcsrc/client/particles.qc +++ b/qcsrc/client/particles.qc @@ -246,7 +246,8 @@ void Net_ReadVortexBeamParticle() } .vector sw_shotorg; -.vector sw_endpos; +.vector sw_shotdir; +.float sw_distance; .float sw_spread_max; .float sw_spread_min; .float sw_time; @@ -266,18 +267,20 @@ void Draw_Shockwave() float new_max_dist, new_min_dist; - vector shotdir = normalize(self.sw_endpos - self.sw_shotorg); - vectorvectors(shotdir); + //vector shotdir = normalize(self.sw_endpos - self.sw_shotorg); + vectorvectors(self.sw_shotdir); vector right = v_right; vector up = v_up; + + vector endpos = (self.sw_shotorg + (self.sw_shotdir * self.sw_distance)); float counter, dist_before_normal = 200, shots = 20; - vector min_end = ((self.sw_shotorg + (shotdir * dist_before_normal)) + (up * self.sw_spread_min)); - vector max_end = (self.sw_endpos + (up * self.sw_spread_max)); + vector min_end = ((self.sw_shotorg + (self.sw_shotdir * dist_before_normal)) + (up * self.sw_spread_min)); + vector max_end = (endpos + (up * self.sw_spread_max)); - float spread_to_min = vlen(normalize(min_end - self.sw_shotorg) - shotdir); - float spread_to_max = vlen(normalize(max_end - min_end) - shotdir); + float spread_to_min = vlen(normalize(min_end - self.sw_shotorg) - self.sw_shotdir); + float spread_to_max = vlen(normalize(max_end - min_end) - self.sw_shotdir); for(counter = 0; counter < shots; ++counter) { @@ -289,15 +292,15 @@ void Draw_Shockwave() // first do the spread_to_min effect deviation = angle * spread_to_min; - deviation = ((shotdir + (right * deviation_y) + (up * deviation_z))); + deviation = ((self.sw_shotdir + (right * deviation_y) + (up * deviation_z))); new_min_dist = dist_before_normal; new_min_end = (self.sw_shotorg + (deviation * new_min_dist)); //te_lightning2(world, new_min_end, self.sw_shotorg); // then calculate spread_to_max effect deviation = angle * spread_to_max; - deviation = ((shotdir + (right * deviation_y) + (up * deviation_z))); - new_max_dist = vlen(new_min_end - self.sw_endpos); + deviation = ((self.sw_shotdir + (right * deviation_y) + (up * deviation_z))); + new_max_dist = vlen(new_min_end - endpos); new_max_end = (new_min_end + (deviation * new_max_dist)); //te_lightning2(world, new_end, prev_min_end); @@ -352,8 +355,9 @@ void Net_ReadShockwaveParticle() shockwave.draw = Draw_Shockwave; shockwave.sw_shotorg_x = ReadCoord(); shockwave.sw_shotorg_y = ReadCoord(); shockwave.sw_shotorg_z = ReadCoord(); - shockwave.sw_endpos_x = ReadCoord(); shockwave.sw_endpos_y = ReadCoord(); shockwave.sw_endpos_z = ReadCoord(); - + shockwave.sw_shotdir_x = ReadCoord(); shockwave.sw_shotdir_y = ReadCoord(); shockwave.sw_shotdir_z = ReadCoord(); + + shockwave.sw_distance = ReadShort(); shockwave.sw_spread_max = ReadByte(); shockwave.sw_spread_min = ReadByte(); diff --git a/qcsrc/common/weapons/w_shockwave.qc b/qcsrc/common/weapons/w_shockwave.qc index d12f876b0..c19eeed9b 100644 --- a/qcsrc/common/weapons/w_shockwave.qc +++ b/qcsrc/common/weapons/w_shockwave.qc @@ -321,6 +321,22 @@ float W_Shockwave_Attack_CheckHit( return TRUE; } +void W_Shockwave_Send(void) +{ + WriteByte(MSG_BROADCAST, SVC_TEMPENTITY); + WriteByte(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE); + WriteCoord(MSG_BROADCAST, w_shotorg_x); + WriteCoord(MSG_BROADCAST, w_shotorg_y); + WriteCoord(MSG_BROADCAST, w_shotorg_z); + WriteCoord(MSG_BROADCAST, w_shotdir_x); + WriteCoord(MSG_BROADCAST, w_shotdir_y); + WriteCoord(MSG_BROADCAST, w_shotdir_z); + WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance)); + WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255)); + WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255)); + WriteByte(MSG_BROADCAST, num_for_edict(self)); +} + void W_Shockwave_Attack(void) { // declarations @@ -341,7 +357,7 @@ void W_Shockwave_Attack(void) //entity transform = WarpZone_trace_transform; // do the firing effect now - //SendCSQCShockwaveParticle(attack_endpos); // WEAPONTODO + W_Shockwave_Send(); Damage_DamageInfo( attack_hitpos, WEP_CVAR(shockwave, blast_splash_damage),