3 /* WEP_##id */ SHOCKWAVE,
4 /* function */ W_Shockwave,
5 /* ammotype */ IT_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_velocitybias)*/ \
22 w_cvar(id, sn, MO_NONE, blast_force_zscale) \
23 w_cvar(id, sn, MO_NONE, blast_jump_damage) \
24 w_cvar(id, sn, MO_NONE, blast_jump_edgedamage) \
25 w_cvar(id, sn, MO_NONE, blast_jump_force) \
26 w_cvar(id, sn, MO_NONE, blast_jump_force_velocitybias) \
27 w_cvar(id, sn, MO_NONE, blast_jump_force_zscale) \
28 w_cvar(id, sn, MO_NONE, blast_jump_multiplier_accuracy) \
29 w_cvar(id, sn, MO_NONE, blast_jump_multiplier_distance) \
30 w_cvar(id, sn, MO_NONE, blast_jump_multiplier_min) \
31 w_cvar(id, sn, MO_NONE, blast_jump_radius) \
32 w_cvar(id, sn, MO_NONE, blast_multiplier_accuracy) \
33 w_cvar(id, sn, MO_NONE, blast_multiplier_distance) \
34 w_cvar(id, sn, MO_NONE, blast_multiplier_min) \
35 w_cvar(id, sn, MO_NONE, blast_splash_damage) \
36 w_cvar(id, sn, MO_NONE, blast_splash_edgedamage) \
37 w_cvar(id, sn, MO_NONE, blast_splash_force) \
38 w_cvar(id, sn, MO_NONE, blast_splash_force_forwardbias) \
39 w_cvar(id, sn, MO_NONE, blast_splash_multiplier_accuracy) \
40 w_cvar(id, sn, MO_NONE, blast_splash_multiplier_distance) \
41 w_cvar(id, sn, MO_NONE, blast_splash_multiplier_min) \
42 w_cvar(id, sn, MO_NONE, blast_splash_radius) \
43 w_cvar(id, sn, MO_NONE, blast_spread_max) \
44 w_cvar(id, sn, MO_NONE, blast_spread_min) \
45 w_cvar(id, sn, MO_NONE, melee_animtime) \
46 w_cvar(id, sn, MO_NONE, melee_damage) \
47 w_cvar(id, sn, MO_NONE, melee_delay) \
48 w_cvar(id, sn, MO_NONE, melee_force) \
49 w_cvar(id, sn, MO_NONE, melee_multihit) \
50 w_cvar(id, sn, MO_NONE, melee_no_doubleslap) \
51 w_cvar(id, sn, MO_NONE, melee_nonplayerdamage) \
52 w_cvar(id, sn, MO_NONE, melee_range) \
53 w_cvar(id, sn, MO_NONE, melee_refire) \
54 w_cvar(id, sn, MO_NONE, melee_swing_side) \
55 w_cvar(id, sn, MO_NONE, melee_swing_up) \
56 w_cvar(id, sn, MO_NONE, melee_time) \
57 w_cvar(id, sn, MO_NONE, melee_traces) \
58 w_cvar(id, sn, MO_NONE, pellets_ammo) \
59 w_cvar(id, sn, MO_NONE, pellets_animtime) \
60 w_cvar(id, sn, MO_NONE, pellets_bulletconstant) \
61 w_cvar(id, sn, MO_NONE, pellets_bullets) \
62 w_cvar(id, sn, MO_NONE, pellets_damage) \
63 w_cvar(id, sn, MO_NONE, pellets_force) \
64 w_cvar(id, sn, MO_NONE, pellets_refire) \
65 w_cvar(id, sn, MO_NONE, pellets_speed) \
66 w_cvar(id, sn, MO_NONE, pellets_spread) \
67 w_cvar(id, sn, MO_NONE, primary) \
68 w_cvar(id, sn, MO_NONE, secondary) \
69 w_prop(id, sn, float, reloading_ammo, reload_ammo) \
70 w_prop(id, sn, float, reloading_time, reload_time) \
71 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
72 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
73 w_prop(id, sn, string, weaponreplace, weaponreplace) \
74 w_prop(id, sn, float, weaponstart, weaponstart) \
75 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride)
78 SHOCKWAVE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
82 void spawnfunc_weapon_shockwave()
84 //if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO
85 if(autocvar_sv_q3acompat_machineshotgunswap)
86 if(self.classname != "droppedweapon")
88 weapon_defaultspawnfunc(WEP_UZI);
91 weapon_defaultspawnfunc(WEP_SHOCKWAVE);
95 .entity swing_alreadyhit;
96 .float shockwave_pelletstime;
97 entity shockwave_hit[32];
98 float shockwave_hit_damage[32];
99 vector shockwave_hit_force[32];
101 // LEGACY ATTACK MODE: Scattered bullets
102 void W_Shockwave_Pellets(void)
107 W_DecreaseAmmo(ammo_shells, WEP_CVAR(shockwave, pellets_ammo), WEP_CVAR(shockwave, reload_ammo));
109 W_SetupShot(self, TRUE, 5, "weapons/shotgun_fire.wav", CH_WEAPON_A, WEP_CVAR(shockwave, pellets_damage) * WEP_CVAR(shockwave, pellets_bullets));
111 for(sc = 0; sc < WEP_CVAR(shockwave, pellets_bullets); ++sc)
116 WEP_CVAR(shockwave, pellets_spread),
117 WEP_CVAR(shockwave, pellets_speed),
119 WEP_CVAR(shockwave, pellets_damage),
120 WEP_CVAR(shockwave, pellets_force),
123 WEP_CVAR(shockwave, pellets_bulletconstant)
126 endFireBallisticBullet();
128 pointparticles(particleeffectnum("shotgun_muzzleflash"), w_shotorg, w_shotdir * 1000, WEP_CVAR(shockwave, pellets_ammo));
131 if(autocvar_g_casings >= 1)
133 for(sc = 0;sc < WEP_CVAR(shockwave, pellets_ammo); ++sc)
137 ((random () * 50 + 50) * v_right)
139 (v_forward * (random () * 25 + 25))
141 ((random () * 5 - 30) * v_up)
144 vectoangles(v_forward),
153 // muzzle flash for 1st person view
155 setmodel(flash, "models/uziflash.md3"); // precision set below
156 flash.think = SUB_Remove;
157 flash.nextthink = time + 0.06;
158 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
159 W_AttachToShotorg(flash, '5 0 0');
163 void W_Shockwave_Melee_Think()
166 float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
167 entity target_victim;
170 // check to see if we can still continue, otherwise give up now
171 if((self.realowner.deadflag != DEAD_NO) && WEP_CVAR(shockwave, melee_no_doubleslap))
177 // set start time of melee
181 W_PlayStrengthSound(self.realowner);
184 // update values for v_* vectors
185 makevectors(self.realowner.v_angle);
187 // calculate swing percentage based on time
188 meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor();
189 swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10);
190 f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces));
192 // perform the traces needed for this frame
193 for(i=self.swing_prev; i < f; ++i)
195 swing_factor = ((1 - (i / WEP_CVAR(shockwave, melee_traces))) * 2 - 1);
197 targpos = (self.realowner.origin + self.realowner.view_ofs
198 + (v_forward * WEP_CVAR(shockwave, melee_range))
199 + (v_up * swing_factor * WEP_CVAR(shockwave, melee_swing_up))
200 + (v_right * swing_factor * WEP_CVAR(shockwave, melee_swing_side)));
202 WarpZone_traceline_antilag(
204 (self.realowner.origin + self.realowner.view_ofs),
208 ANTILAG_LATENCY(self.realowner)
211 // draw lightning beams for debugging
212 te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5);
213 te_customflash(targpos, 40, 2, '1 1 1');
215 is_player = (trace_ent.classname == "player" || trace_ent.classname == "body");
217 if((trace_fraction < 1) // if trace is good, apply the damage and remove self if necessary
218 && (trace_ent.takedamage == DAMAGE_AIM)
219 && (trace_ent != self.swing_alreadyhit)
220 && (is_player || WEP_CVAR(shockwave, melee_nonplayerdamage)))
222 target_victim = trace_ent; // so it persists through other calls
224 if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught
225 swing_damage = (WEP_CVAR(shockwave, melee_damage) * min(1, swing_factor + 1));
227 swing_damage = (WEP_CVAR(shockwave, melee_nonplayerdamage) * min(1, swing_factor + 1));
229 // trigger damage with this calculated info
235 (WEP_SHOCKWAVE | HITTYPE_SECONDARY),
236 (self.realowner.origin + self.realowner.view_ofs),
237 (v_forward * WEP_CVAR(shockwave, melee_force))
241 if(accuracy_isgooddamage(self.realowner, target_victim))
242 { accuracy_add(self.realowner, WEP_SHOCKWAVE, 0, swing_damage); }
244 #ifdef DEBUG_SHOCKWAVE
246 "MELEE: %s hitting %s with %f damage (factor: %f) at %f time.\n",
247 self.realowner.netname,
248 target_victim.netname,
255 // allow multiple hits with one swing, but not against the same player twice
256 if(WEP_CVAR(shockwave, melee_multihit))
258 self.swing_alreadyhit = target_victim;
259 continue; // move along to next trace
269 if(time >= self.cnt + meleetime)
279 self.nextthink = time;
283 void W_Shockwave_Melee()
285 sound(self, CH_WEAPON_A, "weapons/shotgun_melee.wav", VOL_BASE, ATTN_NORM);
286 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
290 meleetemp.owner = meleetemp.realowner = self;
291 meleetemp.think = W_Shockwave_Melee_Think;
292 meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
293 W_SetupShot_Range(self, TRUE, 0, "", 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
296 // SHOCKWAVE ATTACK MODE
297 float W_Shockwave_Attack_CheckSpread(
299 vector nearest_on_line,
301 vector attack_endpos)
304 float distance_of_attack = vlen(sw_shotorg - attack_endpos);
305 float distance_from_line = vlen(targetorg - nearest_on_line);
307 spreadlimit = (distance_of_attack ? min(1, (vlen(sw_shotorg - nearest_on_line) / distance_of_attack)) : 1);
310 (WEP_CVAR(shockwave, blast_spread_min) * (1 - spreadlimit))
312 (WEP_CVAR(shockwave, blast_spread_max) * spreadlimit)
316 (spreadlimit && (distance_from_line <= spreadlimit))
318 ((vlen(normalize(targetorg - sw_shotorg) - normalize(attack_endpos - sw_shotorg)) * RAD2DEG) <= 90)
320 { return bound(0, (distance_from_line / spreadlimit), 1); }
325 float W_Shockwave_Attack_IsVisible(
327 vector nearest_on_line,
329 vector attack_endpos)
331 vector nearest_to_attacker = head.WarpZone_findradius_nearest;
332 vector center = (head.origin + (head.mins + head.maxs) * 0.5);
336 // STEP ONE: Check if the nearest point is clear
337 if(W_Shockwave_Attack_CheckSpread(nearest_to_attacker, nearest_on_line, sw_shotorg, attack_endpos))
339 WarpZone_TraceLine(sw_shotorg, nearest_to_attacker, MOVE_NOMONSTERS, self);
340 if(trace_fraction == 1) { return TRUE; } // yes, the nearest point is clear and we can allow the damage
343 // STEP TWO: Check if shotorg to center point is clear
344 if(W_Shockwave_Attack_CheckSpread(center, nearest_on_line, sw_shotorg, attack_endpos))
346 WarpZone_TraceLine(sw_shotorg, center, MOVE_NOMONSTERS, self);
347 if(trace_fraction == 1) { return TRUE; } // yes, the center point is clear and we can allow the damage
350 // STEP THREE: Check each corner to see if they are clear
353 corner = get_corner_position(head, i);
354 if(W_Shockwave_Attack_CheckSpread(corner, nearest_on_line, sw_shotorg, attack_endpos))
356 WarpZone_TraceLine(sw_shotorg, corner, MOVE_NOMONSTERS, self);
357 if(trace_fraction == 1) { return TRUE; } // yes, this corner is clear and we can allow the damage
364 float W_Shockwave_Attack_CheckHit(
370 if(!head) { return FALSE; }
375 for(i = 1; i <= queue; ++i)
377 if(shockwave_hit[i] == head)
379 if(vlen(final_force) > vlen(shockwave_hit_force[i])) { shockwave_hit_force[i] = final_force; }
380 if(final_damage > shockwave_hit_damage[i]) { shockwave_hit_damage[i] = final_damage; }
385 shockwave_hit[queue] = head;
386 shockwave_hit_force[queue] = final_force;
387 shockwave_hit_damage[queue] = final_damage;
391 void W_Shockwave_Attack()
394 float multiplier, multiplier_from_accuracy, multiplier_from_distance;
396 vector final_force, center, vel;
401 // set up the shot direction
402 W_SetupShot(self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
403 vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
404 WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, self);
405 vector attack_hitpos = trace_endpos;
406 float distance_to_end = vlen(w_shotorg - attack_endpos);
407 float distance_to_hit = vlen(w_shotorg - attack_hitpos);
408 //entity transform = WarpZone_trace_transform;
410 // do the firing effect now
411 //SendCSQCShockwaveParticle(attack_endpos); // WEAPONTODO
414 WEP_CVAR(shockwave, blast_splash_damage),
415 WEP_CVAR(shockwave, blast_splash_edgedamage),
416 WEP_CVAR(shockwave, blast_splash_radius),
417 w_shotdir * WEP_CVAR(shockwave, blast_splash_force),
423 // splash damage/jumping trace
424 head = WarpZone_FindRadius(
427 WEP_CVAR(shockwave, blast_splash_radius),
428 WEP_CVAR(shockwave, blast_jump_radius)
437 float distance_to_head = vlen(attack_hitpos - head.WarpZone_findradius_nearest);
439 if((head == self) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius)))
441 // ========================
442 // BLAST JUMP CALCULATION
443 // ========================
445 // calculate importance of distance and accuracy for this attack
446 multiplier_from_accuracy = (1 -
448 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_jump_radius)))
453 multiplier_from_distance = (1 -
455 min(1, (distance_to_hit / distance_to_end))
462 WEP_CVAR(shockwave, blast_jump_multiplier_min),
464 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_jump_multiplier_accuracy))
466 (multiplier_from_distance * WEP_CVAR(shockwave, blast_jump_multiplier_distance))
470 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
473 (WEP_CVAR(shockwave, blast_jump_damage) * multiplier)
475 (WEP_CVAR(shockwave, blast_jump_edgedamage) * (1 - multiplier))
478 // figure out the direction of force
479 vel = normalize(combine_to_vector(head.velocity_x, head.velocity_y, 0));
482 bound(0, (vlen(vel) / autocvar_sv_maxspeed), 1)
484 WEP_CVAR(shockwave, blast_jump_force_velocitybias)
486 final_force = normalize((CENTER_OR_VIEWOFS(head) - attack_hitpos) + vel);
488 // now multiply the direction by force units
489 final_force *= (WEP_CVAR(shockwave, blast_jump_force) * multiplier);
490 final_force_z *= WEP_CVAR(shockwave, blast_jump_force_zscale);
492 // trigger damage with this calculated info
503 #ifdef DEBUG_SHOCKWAVE
505 "SELF HIT: multiplier = %f, damage = %f, force = %f... "
506 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
510 multiplier_from_accuracy,
511 multiplier_from_distance
515 else if(distance_to_head <= WEP_CVAR(shockwave, blast_splash_radius))
517 // ==========================
518 // BLAST SPLASH CALCULATION
519 // ==========================
521 // calculate importance of distance and accuracy for this attack
522 multiplier_from_accuracy = (1 -
524 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_splash_radius)))
529 multiplier_from_distance = (1 -
531 min(1, (distance_to_hit / distance_to_end))
538 WEP_CVAR(shockwave, blast_splash_multiplier_min),
540 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_splash_multiplier_accuracy))
542 (multiplier_from_distance * WEP_CVAR(shockwave, blast_splash_multiplier_distance))
546 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
549 (WEP_CVAR(shockwave, blast_splash_damage) * multiplier)
551 (WEP_CVAR(shockwave, blast_splash_edgedamage) * (1 - multiplier))
554 // figure out the direction of force
555 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_splash_force_forwardbias));
556 final_force = normalize(CENTER_OR_VIEWOFS(head) - (attack_hitpos - final_force));
557 //te_lightning2(world, attack_hitpos, (attack_hitpos + (final_force * 200)));
559 // now multiply the direction by force units
560 final_force *= (WEP_CVAR(shockwave, blast_splash_force) * multiplier);
561 final_force_z *= WEP_CVAR(shockwave, blast_force_zscale);
563 // queue damage with this calculated info
564 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { ++queue; }
566 #ifdef DEBUG_SHOCKWAVE
568 "SPLASH HIT: multiplier = %f, damage = %f, force = %f... "
569 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
573 multiplier_from_accuracy,
574 multiplier_from_distance
583 head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(shockwave, blast_distance), FALSE);
586 if((head != self) && head.takedamage)
588 // ========================
589 // BLAST CONE CALCULATION
590 // ========================
592 // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
593 center = CENTER_OR_VIEWOFS(head);
595 // find the closest point on the enemy to the center of the attack
596 float ang; // angle between shotdir and h
597 float h; // hypotenuse, which is the distance between attacker to head
598 float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
600 h = vlen(center - self.origin);
601 ang = acos(dotproduct(normalize(center - self.origin), w_shotdir));
603 // WEAPONTODO: replace with simpler method
605 vector nearest_on_line = (w_shotorg + a * w_shotdir);
606 vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
607 float distance_to_target = vlen(w_shotorg - nearest_to_attacker); // WEAPONTODO: use the findradius function for this
609 if((distance_to_target <= WEP_CVAR(shockwave, blast_distance))
610 && (W_Shockwave_Attack_IsVisible(head, nearest_on_line, w_shotorg, attack_endpos)))
612 // calculate importance of distance and accuracy for this attack
613 multiplier_from_accuracy = (1 -
614 W_Shockwave_Attack_CheckSpread(
621 multiplier_from_distance = (1 -
623 min(1, (distance_to_target / distance_to_end))
630 WEP_CVAR(shockwave, blast_multiplier_min),
632 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_multiplier_accuracy))
634 (multiplier_from_distance * WEP_CVAR(shockwave, blast_multiplier_distance))
638 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
641 (WEP_CVAR(shockwave, blast_damage) * multiplier)
643 (WEP_CVAR(shockwave, blast_edgedamage) * (1 - multiplier))
646 // figure out the direction of force
647 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_force_forwardbias));
648 final_force = normalize(center - (nearest_on_line - final_force));
649 //te_lightning2(world, nearest_on_line, (attack_hitpos + (final_force * 200)));
651 // now multiply the direction by force units
652 final_force *= (WEP_CVAR(shockwave, blast_force) * multiplier);
653 final_force_z *= WEP_CVAR(shockwave, blast_force_zscale);
655 // queue damage with this calculated info
656 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { ++queue; }
658 #ifdef DEBUG_SHOCKWAVE
660 "BLAST HIT: multiplier = %f, damage = %f, force = %f... "
661 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
665 multiplier_from_accuracy,
666 multiplier_from_distance
674 for(i = 1; i <= queue; ++i)
676 head = shockwave_hit[i];
677 final_force = shockwave_hit_force[i];
678 final_damage = shockwave_hit_damage[i];
690 #ifdef DEBUG_SHOCKWAVE
692 "SHOCKWAVE by %s: damage = %f, force = %f.\n",
699 shockwave_hit[i] = world;
700 shockwave_hit_force[i] = '0 0 0';
701 shockwave_hit_damage[i] = 0;
705 float W_Shockwave(float req)
712 if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
713 { self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE); }
715 { self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE); }
721 if(WEP_CVAR(shockwave, reload_ammo) && self.clip_load < WEP_CVAR(shockwave, pellets_ammo)) // forced reload
723 // don't force reload an empty shockwave if its melee attack is active
724 if(!(WEP_CVAR(shockwave, secondary) && self.ammo_shells < WEP_CVAR(shockwave, pellets_ammo)))
725 WEP_ACTION(self.weapon, WR_RELOAD);
731 switch(WEP_CVAR(shockwave, primary))
735 if(time >= self.shockwave_pelletstime) // handle refire separately so the secondary can be fired straight after a primary
737 if(weapon_prepareattack(0, WEP_CVAR(shockwave, pellets_animtime)))
739 W_Shockwave_Attack();
740 self.shockwave_pelletstime = time + WEP_CVAR(shockwave, pellets_refire) * W_WeaponRateFactor();
741 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(shockwave, pellets_animtime), w_ready);
748 if(time >= self.shockwave_pelletstime) // handle refire separately so the secondary can be fired straight after a primary
750 if(weapon_prepareattack(0, WEP_CVAR(shockwave, pellets_animtime)))
752 W_Shockwave_Pellets();
753 self.shockwave_pelletstime = time + WEP_CVAR(shockwave, pellets_refire) * W_WeaponRateFactor();
754 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(shockwave, pellets_animtime), w_ready);
762 if(self.clip_load >= 0) // we are not currently reloading
763 if(!self.crouch) // no crouchmelee please
764 if(self.BUTTON_ATCK2 && WEP_CVAR(shockwave, secondary))
765 if(weapon_prepareattack(1, WEP_CVAR(shockwave, melee_refire)))
767 // attempt forcing playback of the anim by switching to another anim (that we never play) here...
768 weapon_thinkf(WFRAME_FIRE1, 0, W_Shockwave_Melee);
776 precache_model("models/uziflash.md3");
777 precache_model("models/weapons/g_shockwave.md3");
778 precache_model("models/weapons/v_shockwave.md3");
779 precache_model("models/weapons/h_shockwave.iqm");
780 precache_sound("misc/itempickup.wav");
781 precache_sound("weapons/shockwave_fire.wav");
782 precache_sound("weapons/shockwave_melee.wav");
783 SHOCKWAVE_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
788 self.current_ammo = ammo_shells;
793 ammo_amount = self.ammo_shells >= WEP_CVAR(shockwave, pellets_ammo);
794 ammo_amount += self.(weapon_load[WEP_SHOCKWAVE]) >= WEP_CVAR(shockwave, pellets_ammo);
799 // melee attack is always available
804 SHOCKWAVE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
809 W_Reload(WEP_CVAR(shockwave, pellets_ammo), "weapons/reload.wav");
812 case WR_SUICIDEMESSAGE:
814 return WEAPON_THINKING_WITH_PORTALS;
818 if(w_deathtype & HITTYPE_SECONDARY)
819 return WEAPON_SHOCKWAVE_MURDER_SLAP;
821 return WEAPON_SHOCKWAVE_MURDER;
828 float W_Shockwave(float req)
832 case WR_IMPACTEFFECT:
835 org2 = w_org + w_backoff * 2;
836 pointparticles(particleeffectnum("shockwave_impact"), org2, w_backoff * 1000, 1);
841 //precache_sound("weapons/ric1.wav");
842 //precache_sound("weapons/ric2.wav");
843 //precache_sound("weapons/ric3.wav");