}
.vector sw_shotorg;
-.vector sw_endpos;
+.vector sw_shotdir;
+.float sw_distance;
.float sw_spread_max;
.float sw_spread_min;
.float sw_time;
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)
{
// 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);
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();
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
//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),