3 /* WEP_##id */ SHOCKWAVE,
4 /* function */ W_Shockwave,
5 /* ammotype */ ammo_shells,
7 /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN,
8 /* rating */ BOT_PICKUP_RATING_LOW,
10 /* netname */ "shockwave",
11 /* fullname */ _("Shockwave")
14 #define SHOCKWAVE_SETTINGS(w_cvar,w_prop) SHOCKWAVE_SETTINGS_LIST(w_cvar, w_prop, SHOCKWAVE, shockwave)
15 #define SHOCKWAVE_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
16 w_cvar(id, sn, MO_NONE, blast_damage) \
17 w_cvar(id, sn, MO_NONE, blast_distance) \
18 w_cvar(id, sn, MO_NONE, blast_edgedamage) \
19 w_cvar(id, sn, MO_NONE, blast_force) \
20 w_cvar(id, sn, MO_NONE, blast_force_forwardbias) \
21 w_cvar(id, sn, MO_NONE, blast_force_zscale) \
22 w_cvar(id, sn, MO_NONE, blast_jump_damage) \
23 w_cvar(id, sn, MO_NONE, blast_jump_edgedamage) \
24 w_cvar(id, sn, MO_NONE, blast_jump_force) \
25 w_cvar(id, sn, MO_NONE, blast_jump_force_velocitybias) \
26 w_cvar(id, sn, MO_NONE, blast_jump_force_zscale) \
27 w_cvar(id, sn, MO_NONE, blast_jump_multiplier_accuracy) \
28 w_cvar(id, sn, MO_NONE, blast_jump_multiplier_distance) \
29 w_cvar(id, sn, MO_NONE, blast_jump_multiplier_min) \
30 w_cvar(id, sn, MO_NONE, blast_jump_radius) \
31 w_cvar(id, sn, MO_NONE, blast_multiplier_accuracy) \
32 w_cvar(id, sn, MO_NONE, blast_multiplier_distance) \
33 w_cvar(id, sn, MO_NONE, blast_multiplier_min) \
34 w_cvar(id, sn, MO_NONE, blast_splash_damage) \
35 w_cvar(id, sn, MO_NONE, blast_splash_edgedamage) \
36 w_cvar(id, sn, MO_NONE, blast_splash_force) \
37 w_cvar(id, sn, MO_NONE, blast_splash_force_forwardbias) \
38 w_cvar(id, sn, MO_NONE, blast_splash_multiplier_accuracy) \
39 w_cvar(id, sn, MO_NONE, blast_splash_multiplier_distance) \
40 w_cvar(id, sn, MO_NONE, blast_splash_multiplier_min) \
41 w_cvar(id, sn, MO_NONE, blast_splash_radius) \
42 w_cvar(id, sn, MO_NONE, blast_spread_max) \
43 w_cvar(id, sn, MO_NONE, blast_spread_min) \
44 w_cvar(id, sn, MO_NONE, melee_animtime) \
45 w_cvar(id, sn, MO_NONE, melee_damage) \
46 w_cvar(id, sn, MO_NONE, melee_delay) \
47 w_cvar(id, sn, MO_NONE, melee_force) \
48 w_cvar(id, sn, MO_NONE, melee_multihit) \
49 w_cvar(id, sn, MO_NONE, melee_no_doubleslap) \
50 w_cvar(id, sn, MO_NONE, melee_nonplayerdamage) \
51 w_cvar(id, sn, MO_NONE, melee_range) \
52 w_cvar(id, sn, MO_NONE, melee_refire) \
53 w_cvar(id, sn, MO_NONE, melee_swing_side) \
54 w_cvar(id, sn, MO_NONE, melee_swing_up) \
55 w_cvar(id, sn, MO_NONE, melee_time) \
56 w_cvar(id, sn, MO_NONE, melee_traces) \
57 w_cvar(id, sn, MO_NONE, pellets_ammo) \
58 w_cvar(id, sn, MO_NONE, pellets_animtime) \
59 w_cvar(id, sn, MO_NONE, pellets_bulletconstant) \
60 w_cvar(id, sn, MO_NONE, pellets_bullets) \
61 w_cvar(id, sn, MO_NONE, pellets_damage) \
62 w_cvar(id, sn, MO_NONE, pellets_force) \
63 w_cvar(id, sn, MO_NONE, pellets_refire) \
64 w_cvar(id, sn, MO_NONE, pellets_speed) \
65 w_cvar(id, sn, MO_NONE, pellets_spread) \
66 w_cvar(id, sn, MO_NONE, primary) \
67 w_cvar(id, sn, MO_NONE, secondary) \
68 w_prop(id, sn, float, reloading_ammo, reload_ammo) \
69 w_prop(id, sn, float, reloading_time, reload_time) \
70 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
71 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
72 w_prop(id, sn, string, weaponreplace, weaponreplace) \
73 w_prop(id, sn, float, weaponstart, weaponstart) \
74 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride)
77 SHOCKWAVE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
81 void spawnfunc_weapon_shockwave()
83 //if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO
84 if(autocvar_sv_q3acompat_machineshotgunswap)
85 if(self.classname != "droppedweapon")
87 weapon_defaultspawnfunc(WEP_UZI);
90 weapon_defaultspawnfunc(WEP_SHOCKWAVE);
94 .entity swing_alreadyhit;
95 .float shockwave_pelletstime;
96 entity shockwave_hit[32];
97 float shockwave_hit_damage[32];
98 vector shockwave_hit_force[32];
100 // LEGACY ATTACK MODE: Scattered bullets
101 void W_Shockwave_Pellets(void)
106 W_DecreaseAmmo(ammo_shells, WEP_CVAR(shockwave, pellets_ammo), WEP_CVAR(shockwave, reload_ammo));
108 W_SetupShot(self, TRUE, 5, "weapons/shotgun_fire.wav", CH_WEAPON_A, WEP_CVAR(shockwave, pellets_damage) * WEP_CVAR(shockwave, pellets_bullets));
110 for(sc = 0; sc < WEP_CVAR(shockwave, pellets_bullets); ++sc)
115 WEP_CVAR(shockwave, pellets_spread),
116 WEP_CVAR(shockwave, pellets_speed),
118 WEP_CVAR(shockwave, pellets_damage),
119 WEP_CVAR(shockwave, pellets_force),
122 WEP_CVAR(shockwave, pellets_bulletconstant)
125 endFireBallisticBullet();
127 pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, WEP_CVAR(shockwave, pellets_ammo));
130 if(autocvar_g_casings >= 1)
132 for(sc = 0;sc < WEP_CVAR(shockwave, pellets_ammo); ++sc)
136 ((random () * 50 + 50) * v_right)
138 (v_forward * (random () * 25 + 25))
140 ((random () * 5 - 30) * v_up)
143 vectoangles(v_forward),
152 // muzzle flash for 1st person view
154 setmodel(flash, "models/uziflash.md3"); // precision set below
155 flash.think = SUB_Remove;
156 flash.nextthink = time + 0.06;
157 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
158 W_AttachToShotorg(flash, '5 0 0');
162 void W_Shockwave_Melee_Think()
165 float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
166 entity target_victim;
169 // check to see if we can still continue, otherwise give up now
170 if((self.realowner.deadflag != DEAD_NO) && WEP_CVAR(shockwave, melee_no_doubleslap))
176 // set start time of melee
180 W_PlayStrengthSound(self.realowner);
183 // update values for v_* vectors
184 makevectors(self.realowner.v_angle);
186 // calculate swing percentage based on time
187 meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor();
188 swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10);
189 f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces));
191 // perform the traces needed for this frame
192 for(i=self.swing_prev; i < f; ++i)
194 swing_factor = ((1 - (i / WEP_CVAR(shockwave, melee_traces))) * 2 - 1);
196 targpos = (self.realowner.origin + self.realowner.view_ofs
197 + (v_forward * WEP_CVAR(shockwave, melee_range))
198 + (v_up * swing_factor * WEP_CVAR(shockwave, melee_swing_up))
199 + (v_right * swing_factor * WEP_CVAR(shockwave, melee_swing_side)));
201 WarpZone_traceline_antilag(
203 (self.realowner.origin + self.realowner.view_ofs),
207 ANTILAG_LATENCY(self.realowner)
210 // draw lightning beams for debugging
211 te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5);
212 te_customflash(targpos, 40, 2, '1 1 1');
214 is_player = (trace_ent.classname == "player" || trace_ent.classname == "body");
216 if((trace_fraction < 1) // if trace is good, apply the damage and remove self if necessary
217 && (trace_ent.takedamage == DAMAGE_AIM)
218 && (trace_ent != self.swing_alreadyhit)
219 && (is_player || WEP_CVAR(shockwave, melee_nonplayerdamage)))
221 target_victim = trace_ent; // so it persists through other calls
223 if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught
224 swing_damage = (WEP_CVAR(shockwave, melee_damage) * min(1, swing_factor + 1));
226 swing_damage = (WEP_CVAR(shockwave, melee_nonplayerdamage) * min(1, swing_factor + 1));
228 // trigger damage with this calculated info
234 (WEP_SHOCKWAVE | HITTYPE_SECONDARY),
235 (self.realowner.origin + self.realowner.view_ofs),
236 (v_forward * WEP_CVAR(shockwave, melee_force))
240 if(accuracy_isgooddamage(self.realowner, target_victim))
241 { accuracy_add(self.realowner, WEP_SHOCKWAVE, 0, swing_damage); }
243 #ifdef DEBUG_SHOCKWAVE
245 "MELEE: %s hitting %s with %f damage (factor: %f) at %f time.\n",
246 self.realowner.netname,
247 target_victim.netname,
254 // allow multiple hits with one swing, but not against the same player twice
255 if(WEP_CVAR(shockwave, melee_multihit))
257 self.swing_alreadyhit = target_victim;
258 continue; // move along to next trace
268 if(time >= self.cnt + meleetime)
278 self.nextthink = time;
282 void W_Shockwave_Melee()
284 sound(self, CH_WEAPON_A, "weapons/shotgun_melee.wav", VOL_BASE, ATTN_NORM);
285 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
289 meleetemp.owner = meleetemp.realowner = self;
290 meleetemp.think = W_Shockwave_Melee_Think;
291 meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
292 W_SetupShot_Range(self, TRUE, 0, "", 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
295 // SHOCKWAVE ATTACK MODE
296 float W_Shockwave_Attack_CheckSpread(
298 vector nearest_on_line,
300 vector attack_endpos)
303 float distance_of_attack = vlen(sw_shotorg - attack_endpos);
304 float distance_from_line = vlen(targetorg - nearest_on_line);
306 spreadlimit = (distance_of_attack ? min(1, (vlen(sw_shotorg - nearest_on_line) / distance_of_attack)) : 1);
309 (WEP_CVAR(shockwave, blast_spread_min) * (1 - spreadlimit))
311 (WEP_CVAR(shockwave, blast_spread_max) * spreadlimit)
315 (spreadlimit && (distance_from_line <= spreadlimit))
317 ((vlen(normalize(targetorg - sw_shotorg) - normalize(attack_endpos - sw_shotorg)) * RAD2DEG) <= 90)
319 { return bound(0, (distance_from_line / spreadlimit), 1); }
324 float W_Shockwave_Attack_IsVisible(
326 vector nearest_on_line,
328 vector attack_endpos)
330 vector nearest_to_attacker = head.WarpZone_findradius_nearest;
331 vector center = (head.origin + (head.mins + head.maxs) * 0.5);
335 // STEP ONE: Check if the nearest point is clear
336 if(W_Shockwave_Attack_CheckSpread(nearest_to_attacker, nearest_on_line, sw_shotorg, attack_endpos))
338 WarpZone_TraceLine(sw_shotorg, nearest_to_attacker, MOVE_NOMONSTERS, self);
339 if(trace_fraction == 1) { return TRUE; } // yes, the nearest point is clear and we can allow the damage
342 // STEP TWO: Check if shotorg to center point is clear
343 if(W_Shockwave_Attack_CheckSpread(center, nearest_on_line, sw_shotorg, attack_endpos))
345 WarpZone_TraceLine(sw_shotorg, center, MOVE_NOMONSTERS, self);
346 if(trace_fraction == 1) { return TRUE; } // yes, the center point is clear and we can allow the damage
349 // STEP THREE: Check each corner to see if they are clear
352 corner = get_corner_position(head, i);
353 if(W_Shockwave_Attack_CheckSpread(corner, nearest_on_line, sw_shotorg, attack_endpos))
355 WarpZone_TraceLine(sw_shotorg, corner, MOVE_NOMONSTERS, self);
356 if(trace_fraction == 1) { return TRUE; } // yes, this corner is clear and we can allow the damage
363 float W_Shockwave_Attack_CheckHit(
369 if(!head) { return FALSE; }
374 for(i = 1; i <= queue; ++i)
376 if(shockwave_hit[i] == head)
378 if(vlen(final_force) > vlen(shockwave_hit_force[i])) { shockwave_hit_force[i] = final_force; }
379 if(final_damage > shockwave_hit_damage[i]) { shockwave_hit_damage[i] = final_damage; }
384 shockwave_hit[queue] = head;
385 shockwave_hit_force[queue] = final_force;
386 shockwave_hit_damage[queue] = final_damage;
390 void W_Shockwave_Attack()
393 float multiplier, multiplier_from_accuracy, multiplier_from_distance;
395 vector final_force, center, vel;
400 // set up the shot direction
401 W_SetupShot(self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
402 vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
403 WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, self);
404 vector attack_hitpos = trace_endpos;
405 float distance_to_end = vlen(w_shotorg - attack_endpos);
406 float distance_to_hit = vlen(w_shotorg - attack_hitpos);
407 //entity transform = WarpZone_trace_transform;
409 // do the firing effect now
410 //SendCSQCShockwaveParticle(attack_endpos); // WEAPONTODO
413 WEP_CVAR(shockwave, blast_splash_damage),
414 WEP_CVAR(shockwave, blast_splash_edgedamage),
415 WEP_CVAR(shockwave, blast_splash_radius),
416 w_shotdir * WEP_CVAR(shockwave, blast_splash_force),
422 // splash damage/jumping trace
423 head = WarpZone_FindRadius(
426 WEP_CVAR(shockwave, blast_splash_radius),
427 WEP_CVAR(shockwave, blast_jump_radius)
436 float distance_to_head = vlen(attack_hitpos - head.WarpZone_findradius_nearest);
438 if((head == self) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius)))
440 // ========================
441 // BLAST JUMP CALCULATION
442 // ========================
444 // calculate importance of distance and accuracy for this attack
445 multiplier_from_accuracy = (1 -
447 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_jump_radius)))
452 multiplier_from_distance = (1 -
454 min(1, (distance_to_hit / distance_to_end))
461 WEP_CVAR(shockwave, blast_jump_multiplier_min),
463 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_jump_multiplier_accuracy))
465 (multiplier_from_distance * WEP_CVAR(shockwave, blast_jump_multiplier_distance))
469 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
472 (WEP_CVAR(shockwave, blast_jump_damage) * multiplier)
474 (WEP_CVAR(shockwave, blast_jump_edgedamage) * (1 - multiplier))
477 // figure out the direction of force
478 vel = normalize(combine_to_vector(head.velocity_x, head.velocity_y, 0));
481 bound(0, (vlen(vel) / autocvar_sv_maxspeed), 1)
483 WEP_CVAR(shockwave, blast_jump_force_velocitybias)
485 final_force = normalize((CENTER_OR_VIEWOFS(head) - attack_hitpos) + vel);
487 // now multiply the direction by force units
488 final_force *= (WEP_CVAR(shockwave, blast_jump_force) * multiplier);
489 final_force_z *= WEP_CVAR(shockwave, blast_jump_force_zscale);
491 // trigger damage with this calculated info
502 #ifdef DEBUG_SHOCKWAVE
504 "SELF HIT: multiplier = %f, damage = %f, force = %f... "
505 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
509 multiplier_from_accuracy,
510 multiplier_from_distance
514 else if(distance_to_head <= WEP_CVAR(shockwave, blast_splash_radius))
516 // ==========================
517 // BLAST SPLASH CALCULATION
518 // ==========================
520 // calculate importance of distance and accuracy for this attack
521 multiplier_from_accuracy = (1 -
523 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_splash_radius)))
528 multiplier_from_distance = (1 -
530 min(1, (distance_to_hit / distance_to_end))
537 WEP_CVAR(shockwave, blast_splash_multiplier_min),
539 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_splash_multiplier_accuracy))
541 (multiplier_from_distance * WEP_CVAR(shockwave, blast_splash_multiplier_distance))
545 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
548 (WEP_CVAR(shockwave, blast_splash_damage) * multiplier)
550 (WEP_CVAR(shockwave, blast_splash_edgedamage) * (1 - multiplier))
553 // figure out the direction of force
554 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_splash_force_forwardbias));
555 final_force = normalize(CENTER_OR_VIEWOFS(head) - (attack_hitpos - final_force));
556 //te_lightning2(world, attack_hitpos, (attack_hitpos + (final_force * 200)));
558 // now multiply the direction by force units
559 final_force *= (WEP_CVAR(shockwave, blast_splash_force) * multiplier);
560 final_force_z *= WEP_CVAR(shockwave, blast_force_zscale);
562 // queue damage with this calculated info
563 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { ++queue; }
565 #ifdef DEBUG_SHOCKWAVE
567 "SPLASH HIT: multiplier = %f, damage = %f, force = %f... "
568 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
572 multiplier_from_accuracy,
573 multiplier_from_distance
582 head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(shockwave, blast_distance), FALSE);
585 if((head != self) && head.takedamage)
587 // ========================
588 // BLAST CONE CALCULATION
589 // ========================
591 // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
592 center = CENTER_OR_VIEWOFS(head);
594 // find the closest point on the enemy to the center of the attack
595 float ang; // angle between shotdir and h
596 float h; // hypotenuse, which is the distance between attacker to head
597 float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
599 h = vlen(center - self.origin);
600 ang = acos(dotproduct(normalize(center - self.origin), w_shotdir));
602 // WEAPONTODO: replace with simpler method
604 vector nearest_on_line = (w_shotorg + a * w_shotdir);
605 vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
606 float distance_to_target = vlen(w_shotorg - nearest_to_attacker); // WEAPONTODO: use the findradius function for this
608 if((distance_to_target <= WEP_CVAR(shockwave, blast_distance))
609 && (W_Shockwave_Attack_IsVisible(head, nearest_on_line, w_shotorg, attack_endpos)))
611 // calculate importance of distance and accuracy for this attack
612 multiplier_from_accuracy = (1 -
613 W_Shockwave_Attack_CheckSpread(
620 multiplier_from_distance = (1 -
622 min(1, (distance_to_target / distance_to_end))
629 WEP_CVAR(shockwave, blast_multiplier_min),
631 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_multiplier_accuracy))
633 (multiplier_from_distance * WEP_CVAR(shockwave, blast_multiplier_distance))
637 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
640 (WEP_CVAR(shockwave, blast_damage) * multiplier)
642 (WEP_CVAR(shockwave, blast_edgedamage) * (1 - multiplier))
645 // figure out the direction of force
646 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_force_forwardbias));
647 final_force = normalize(center - (nearest_on_line - final_force));
648 //te_lightning2(world, nearest_on_line, (attack_hitpos + (final_force * 200)));
650 // now multiply the direction by force units
651 final_force *= (WEP_CVAR(shockwave, blast_force) * multiplier);
652 final_force_z *= WEP_CVAR(shockwave, blast_force_zscale);
654 // queue damage with this calculated info
655 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { ++queue; }
657 #ifdef DEBUG_SHOCKWAVE
659 "BLAST HIT: multiplier = %f, damage = %f, force = %f... "
660 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
664 multiplier_from_accuracy,
665 multiplier_from_distance
673 for(i = 1; i <= queue; ++i)
675 head = shockwave_hit[i];
676 final_force = shockwave_hit_force[i];
677 final_damage = shockwave_hit_damage[i];
689 #ifdef DEBUG_SHOCKWAVE
691 "SHOCKWAVE by %s: damage = %f, force = %f.\n",
698 shockwave_hit[i] = world;
699 shockwave_hit_force[i] = '0 0 0';
700 shockwave_hit_damage[i] = 0;
704 float W_Shockwave(float req)
711 if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
712 { self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE); }
714 { self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE); }
720 if(WEP_CVAR(shockwave, reload_ammo) && self.clip_load < WEP_CVAR(shockwave, pellets_ammo)) // forced reload
722 // don't force reload an empty shockwave if its melee attack is active
723 if(!(WEP_CVAR(shockwave, secondary) && self.ammo_shells < WEP_CVAR(shockwave, pellets_ammo)))
724 WEP_ACTION(self.weapon, WR_RELOAD);
730 switch(WEP_CVAR(shockwave, primary))
734 if(time >= self.shockwave_pelletstime) // handle refire separately so the secondary can be fired straight after a primary
736 if(weapon_prepareattack(0, WEP_CVAR(shockwave, pellets_animtime)))
738 W_Shockwave_Attack();
739 self.shockwave_pelletstime = time + WEP_CVAR(shockwave, pellets_refire) * W_WeaponRateFactor();
740 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(shockwave, pellets_animtime), w_ready);
747 if(time >= self.shockwave_pelletstime) // handle refire separately so the secondary can be fired straight after a primary
749 if(weapon_prepareattack(0, WEP_CVAR(shockwave, pellets_animtime)))
751 W_Shockwave_Pellets();
752 self.shockwave_pelletstime = time + WEP_CVAR(shockwave, pellets_refire) * W_WeaponRateFactor();
753 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(shockwave, pellets_animtime), w_ready);
761 if(self.clip_load >= 0) // we are not currently reloading
762 if(!self.crouch) // no crouchmelee please
763 if(self.BUTTON_ATCK2 && WEP_CVAR(shockwave, secondary))
764 if(weapon_prepareattack(1, WEP_CVAR(shockwave, melee_refire)))
766 // attempt forcing playback of the anim by switching to another anim (that we never play) here...
767 weapon_thinkf(WFRAME_FIRE1, 0, W_Shockwave_Melee);
775 precache_model("models/uziflash.md3");
776 precache_model("models/weapons/g_shockwave.md3");
777 precache_model("models/weapons/v_shockwave.md3");
778 precache_model("models/weapons/h_shockwave.iqm");
779 precache_sound("misc/itempickup.wav");
780 precache_sound("weapons/shockwave_fire.wav");
781 precache_sound("weapons/shockwave_melee.wav");
782 SHOCKWAVE_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
787 self.current_ammo = ammo_shells;
792 ammo_amount = self.ammo_shells >= WEP_CVAR(shockwave, pellets_ammo);
793 ammo_amount += self.(weapon_load[WEP_SHOCKWAVE]) >= WEP_CVAR(shockwave, pellets_ammo);
798 // melee attack is always available
803 SHOCKWAVE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
808 W_Reload(WEP_CVAR(shockwave, pellets_ammo), "weapons/reload.wav");
811 case WR_SUICIDEMESSAGE:
813 return WEAPON_THINKING_WITH_PORTALS;
817 if(w_deathtype & HITTYPE_SECONDARY)
818 return WEAPON_SHOCKWAVE_MURDER_SLAP;
820 return WEAPON_SHOCKWAVE_MURDER;
827 float W_Shockwave(float req)
831 case WR_IMPACTEFFECT:
834 org2 = w_org + w_backoff * 2;
835 pointparticles(particleeffectnum("shockwave_impact"), org2, w_backoff * 1000, 1);
840 //precache_sound("weapons/ric1.wav");
841 //precache_sound("weapons/ric2.wav");
842 //precache_sound("weapons/ric3.wav");