]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Start working on Shockwave visual effect again
authorSamual Lenks <samual@xonotic.org>
Fri, 28 Feb 2014 19:15:03 +0000 (14:15 -0500)
committerSamual Lenks <samual@xonotic.org>
Fri, 28 Feb 2014 19:15:03 +0000 (14:15 -0500)
qcsrc/client/particles.qc
qcsrc/common/weapons/w_shockwave.qc

index 8ab746f2f1d70d07d97e0dc736f7436fb07f66c7..a4f24fbc2699d792b36ea9af2ba6acc4a0bd98f3 100644 (file)
@@ -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();
 
index d12f876b085468bfafb83ead5583f6a594386c14..c19eeed9bf47f912f9a85067532230e85450c163 100644 (file)
@@ -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),