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) \
15 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_damage) \
16 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_distance) \
17 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_edgedamage) \
18 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_force) \
19 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_force_forwardbias) \
20 /*w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_force_velocitybias)*/ \
21 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_force_zscale) \
22 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_damage) \
23 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_edgedamage) \
24 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_force) \
25 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_force_velocitybias) \
26 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_force_zscale) \
27 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_multiplier_accuracy) \
28 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_multiplier_distance) \
29 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_multiplier_min) \
30 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_radius) \
31 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_multiplier_accuracy) \
32 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_multiplier_distance) \
33 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_multiplier_min) \
34 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_damage) \
35 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_edgedamage) \
36 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_force) \
37 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_force_forwardbias) \
38 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_multiplier_accuracy) \
39 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_multiplier_distance) \
40 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_multiplier_min) \
41 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_radius) \
42 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_spread_max) \
43 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_spread_min) \
44 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_animtime) \
45 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_damage) \
46 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_delay) \
47 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_force) \
48 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_multihit) \
49 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_no_doubleslap) \
50 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_nonplayerdamage) \
51 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_range) \
52 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_refire) \
53 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_swing_side) \
54 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_swing_up) \
55 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_time) \
56 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_traces) \
57 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_ammo) \
58 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_animtime) \
59 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_bulletconstant) \
60 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_bullets) \
61 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_damage) \
62 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_force) \
63 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_refire) \
64 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_speed) \
65 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_spread) \
66 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, primary) \
67 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, secondary) \
68 w_prop(WEP_SHOCKWAVE, shockwave, float, reloading_ammo, reload_ammo) \
69 w_prop(WEP_SHOCKWAVE, shockwave, float, reloading_time, reload_time) \
70 w_prop(WEP_SHOCKWAVE, shockwave, float, switchdelay_raise, switchdelay_raise) \
71 w_prop(WEP_SHOCKWAVE, shockwave, float, switchdelay_drop, switchdelay_drop) \
72 w_prop(WEP_SHOCKWAVE, shockwave, string, weaponreplace, weaponreplace) \
73 w_prop(WEP_SHOCKWAVE, shockwave, float, weaponstart, weaponstart) \
74 w_prop(WEP_SHOCKWAVE, shockwave, float, weaponstartoverride, weaponstartoverride)
77 SHOCKWAVE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
81 void spawnfunc_weapon_shockwave()
83 //if(autocvar_sv_q3acompat_machineshockwaveswap)
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/shockwave_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("shockwave_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 if(!self.cnt) // set start time of melee
172 W_PlayStrengthSound(self.realowner);
175 makevectors(self.realowner.v_angle); // update values for v_* vectors
177 // calculate swing percentage based on time
178 meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor();
179 swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10);
180 f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces));
182 // check to see if we can still continue, otherwise give up now
183 if((self.realowner.deadflag != DEAD_NO) && WEP_CVAR(shockwave, melee_no_doubleslap))
189 // if okay, perform the traces needed for this frame
190 for(i=self.swing_prev; i < f; ++i)
192 swing_factor = ((1 - (i / WEP_CVAR(shockwave, melee_traces))) * 2 - 1);
194 targpos = (self.realowner.origin + self.realowner.view_ofs
195 + (v_forward * WEP_CVAR(shockwave, melee_range))
196 + (v_up * swing_factor * WEP_CVAR(shockwave, melee_swing_up))
197 + (v_right * swing_factor * WEP_CVAR(shockwave, melee_swing_side)));
199 WarpZone_traceline_antilag(self.realowner, self.realowner.origin + self.realowner.view_ofs, targpos, FALSE, self.realowner, ANTILAG_LATENCY(self.realowner));
201 // draw lightning beams for debugging
202 te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5);
203 te_customflash(targpos, 40, 2, '1 1 1');
205 is_player = (trace_ent.classname == "player" || trace_ent.classname == "body");
207 if((trace_fraction < 1) // if trace is good, apply the damage and remove self
208 && (trace_ent.takedamage == DAMAGE_AIM)
209 && (trace_ent != self.swing_alreadyhit)
210 && (is_player || WEP_CVAR(shockwave, melee_nonplayerdamage)))
212 target_victim = trace_ent; // so it persists through other calls
214 if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught.
215 swing_damage = (WEP_CVAR(shockwave, melee_damage * min(1, swing_factor + 1)));
217 swing_damage = (WEP_CVAR(shockwave, melee_nonplayerdamage * min(1, swing_factor + 1)));
219 //print(strcat(self.realowner.netname, " hitting ", target_victim.netname, " with ", strcat(ftos(swing_damage), " damage (factor: ", ftos(swing_factor), ") at "), ftos(time), " seconds.\n"));
221 Damage(target_victim, self.realowner, self.realowner,
222 swing_damage, WEP_SHOCKWAVE | HITTYPE_SECONDARY,
223 self.realowner.origin + self.realowner.view_ofs,
224 v_forward * WEP_CVAR(shockwave, melee_force));
226 if(accuracy_isgooddamage(self.realowner, target_victim)) { accuracy_add(self.realowner, WEP_SHOCKWAVE, 0, swing_damage); }
228 if(WEP_CVAR(shockwave, melee_multihit)) // allow multiple hits with one swing, but not against the same player twice.
230 self.swing_alreadyhit = target_victim;
231 continue; // move along to next trace
241 if(time >= self.cnt + meleetime)
251 self.nextthink = time;
255 void W_Shockwave_Melee()
257 sound(self, CH_WEAPON_A, "weapons/shotgun_melee.wav", VOL_BASE, ATTN_NORM);
258 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
262 meleetemp.owner = meleetemp.realowner = self;
263 meleetemp.think = W_Shockwave_Melee_Think;
264 meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
265 W_SetupShot_Range(self, TRUE, 0, "", 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
268 // SHOCKWAVE ATTACK MODE
269 float W_Shockwave_Attack_CheckSpread(
271 vector nearest_on_line,
273 vector attack_endpos)
276 float distance_of_attack = vlen(sw_shotorg - attack_endpos);
277 float distance_from_line = vlen(targetorg - nearest_on_line);
279 spreadlimit = (distance_of_attack ? min(1, (vlen(sw_shotorg - nearest_on_line) / distance_of_attack)) : 1);
282 (WEP_CVAR(shockwave, blast_spread_min) * (1 - spreadlimit))
284 (WEP_CVAR(shockwave, blast_spread_max) * spreadlimit)
288 (spreadlimit && (distance_from_line <= spreadlimit))
290 ((vlen(normalize(targetorg - sw_shotorg) - normalize(attack_endpos - sw_shotorg)) * RAD2DEG) <= 90)
292 { return bound(0, (distance_from_line / spreadlimit), 1); }
297 float W_Shockwave_Attack_IsVisible(
299 vector nearest_on_line,
301 vector attack_endpos)
303 vector nearest_to_attacker = head.WarpZone_findradius_nearest;
304 vector center = (head.origin + (head.mins + head.maxs) * 0.5);
308 // STEP ONE: Check if the nearest point is clear
309 if(W_Shockwave_Attack_CheckSpread(nearest_to_attacker, nearest_on_line, sw_shotorg, attack_endpos))
311 WarpZone_TraceLine(sw_shotorg, nearest_to_attacker, MOVE_NOMONSTERS, self);
312 if(trace_fraction == 1) { return TRUE; } // yes, the nearest point is clear and we can allow the damage
315 // STEP TWO: Check if shotorg to center point is clear
316 if(W_Shockwave_Attack_CheckSpread(center, nearest_on_line, sw_shotorg, attack_endpos))
318 WarpZone_TraceLine(sw_shotorg, center, MOVE_NOMONSTERS, self);
319 if(trace_fraction == 1) { return TRUE; } // yes, the center point is clear and we can allow the damage
322 // STEP THREE: Check each corner to see if they are clear
325 corner = get_corner_position(head, i);
326 if(W_Shockwave_Attack_CheckSpread(corner, nearest_on_line, sw_shotorg, attack_endpos))
328 WarpZone_TraceLine(sw_shotorg, corner, MOVE_NOMONSTERS, self);
329 if(trace_fraction == 1) { return TRUE; } // yes, this corner is clear and we can allow the damage
336 float W_Shockwave_Attack_CheckHit(
342 if(!head) { return FALSE; }
347 for(i = 1; i <= queue; ++i)
349 if(shockwave_hit[i] == head)
351 if(vlen(final_force) > vlen(shockwave_hit_force[i])) { shockwave_hit_force[i] = final_force; }
352 if(final_damage > shockwave_hit_damage[i]) { shockwave_hit_damage[i] = final_damage; }
357 shockwave_hit[queue] = head;
358 shockwave_hit_force[queue] = final_force;
359 shockwave_hit_damage[queue] = final_damage;
363 void W_Shockwave_Attack()
366 float multiplier, multiplier_from_accuracy, multiplier_from_distance;
368 vector final_force, center, vel;
373 // set up the shot direction
374 W_SetupShot(self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
375 vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
376 WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, self);
377 vector attack_hitpos = trace_endpos;
378 float distance_to_end = vlen(w_shotorg - attack_endpos);
379 float distance_to_hit = vlen(w_shotorg - attack_hitpos);
380 //entity transform = WarpZone_trace_transform;
382 // do the firing effect now
383 //SendCSQCShockwaveParticle(attack_endpos); // WEAPONTODO
386 WEP_CVAR(shockwave, blast_splash_damage),
387 WEP_CVAR(shockwave, blast_splash_edgedamage),
388 WEP_CVAR(shockwave, blast_splash_radius),
389 w_shotdir * WEP_CVAR(shockwave, blast_splash_force),
395 // splash damage/jumping trace
396 head = WarpZone_FindRadius(
399 WEP_CVAR(shockwave, blast_splash_radius),
400 WEP_CVAR(shockwave, blast_jump_radius)
409 float distance_to_head = vlen(attack_hitpos - head.WarpZone_findradius_nearest);
411 if((head == self) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius)))
413 // ========================
414 // BLAST JUMP CALCULATION
415 // ========================
417 // calculate importance of distance and accuracy for this attack
418 multiplier_from_accuracy = (1 -
420 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_jump_radius)))
425 multiplier_from_distance = (1 -
427 min(1, (distance_to_hit / distance_to_end))
434 WEP_CVAR(shockwave, blast_jump_multiplier_min),
436 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_jump_multiplier_accuracy))
438 (multiplier_from_distance * WEP_CVAR(shockwave, blast_jump_multiplier_distance))
442 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
445 (WEP_CVAR(shockwave, blast_jump_damage) * multiplier)
447 (WEP_CVAR(shockwave, blast_jump_edgedamage) * (1 - multiplier))
450 // figure out the direction of force
451 vel = normalize(combine_to_vector(head.velocity_x, head.velocity_y, 0));
454 bound(0, (vlen(vel) / autocvar_sv_maxspeed), 1)
456 WEP_CVAR(shockwave, blast_jump_force_velocitybias)
458 final_force = normalize((CENTER_OR_VIEWOFS(head) - attack_hitpos) + vel);
460 // now multiply the direction by force units
461 final_force *= (WEP_CVAR(shockwave, blast_jump_force) * multiplier);
462 final_force_z *= WEP_CVAR(shockwave, blast_jump_force_zscale);
464 // trigger damage with this calculated info
475 #ifdef DEBUG_SHOCKWAVE
477 "SELF HIT: multiplier = %f, damage = %f, force = %f... "
478 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
482 multiplier_from_accuracy,
483 multiplier_from_distance
487 else if(distance_to_head <= WEP_CVAR(shockwave, blast_splash_radius))
489 // ==========================
490 // BLAST SPLASH CALCULATION
491 // ==========================
493 // calculate importance of distance and accuracy for this attack
494 multiplier_from_accuracy = (1 -
496 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_splash_radius)))
501 multiplier_from_distance = (1 -
503 min(1, (distance_to_hit / distance_to_end))
510 WEP_CVAR(shockwave, blast_splash_multiplier_min),
512 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_splash_multiplier_accuracy))
514 (multiplier_from_distance * WEP_CVAR(shockwave, blast_splash_multiplier_distance))
518 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
521 (WEP_CVAR(shockwave, blast_splash_damage) * multiplier)
523 (WEP_CVAR(shockwave, blast_splash_edgedamage) * (1 - multiplier))
526 // figure out the direction of force
527 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_splash_force_forwardbias));
528 final_force = normalize(CENTER_OR_VIEWOFS(head) - (attack_hitpos - final_force));
529 //te_lightning2(world, attack_hitpos, (attack_hitpos + (final_force * 200)));
531 // now multiply the direction by force units
532 final_force *= (WEP_CVAR(shockwave, blast_splash_force) * multiplier);
533 final_force_z *= WEP_CVAR(shockwave, blast_force_zscale);
535 // queue damage with this calculated info
536 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { ++queue; }
538 #ifdef DEBUG_SHOCKWAVE
540 "SPLASH HIT: multiplier = %f, damage = %f, force = %f... "
541 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
545 multiplier_from_accuracy,
546 multiplier_from_distance
555 head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(shockwave, blast_distance), FALSE);
558 if((head != self) && head.takedamage)
560 // ========================
561 // BLAST CONE CALCULATION
562 // ========================
564 // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
565 center = CENTER_OR_VIEWOFS(head);
567 // find the closest point on the enemy to the center of the attack
568 float ang; // angle between shotdir and h
569 float h; // hypotenuse, which is the distance between attacker to head
570 float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
572 h = vlen(center - self.origin);
573 ang = acos(dotproduct(normalize(center - self.origin), w_shotdir));
575 // WEAPONTODO: replace with simpler method
577 vector nearest_on_line = (w_shotorg + a * w_shotdir);
578 vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
579 float distance_to_target = vlen(w_shotorg - nearest_to_attacker); // todo: use the findradius function for this
581 if((distance_to_target <= WEP_CVAR(shockwave, blast_distance))
582 && (W_Shockwave_Attack_IsVisible(head, nearest_on_line, w_shotorg, attack_endpos)))
584 // calculate importance of distance and accuracy for this attack
585 multiplier_from_accuracy = (1 -
586 W_Shockwave_Attack_CheckSpread(
593 multiplier_from_distance = (1 -
595 min(1, (distance_to_target / distance_to_end))
602 WEP_CVAR(shockwave, blast_multiplier_min),
604 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_multiplier_accuracy))
606 (multiplier_from_distance * WEP_CVAR(shockwave, blast_multiplier_distance))
610 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
613 (WEP_CVAR(shockwave, blast_damage) * multiplier)
615 (WEP_CVAR(shockwave, blast_edgedamage) * (1 - multiplier))
618 // figure out the direction of force
619 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_force_forwardbias));
620 final_force = normalize(center - (nearest_on_line - final_force));
621 //te_lightning2(world, nearest_on_line, (attack_hitpos + (final_force * 200)));
623 // now multiply the direction by force units
624 final_force *= (WEP_CVAR(shockwave, blast_force) * multiplier);
625 final_force_z *= WEP_CVAR(shockwave, blast_force_zscale);
627 // queue damage with this calculated info
628 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { ++queue; }
630 #ifdef DEBUG_SHOCKWAVE
632 "BLAST HIT: multiplier = %f, damage = %f, force = %f... "
633 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
637 multiplier_from_accuracy,
638 multiplier_from_distance
646 for(i = 1; i <= queue; ++i)
648 head = shockwave_hit[i];
649 final_force = shockwave_hit_force[i];
650 final_damage = shockwave_hit_damage[i];
662 #ifdef DEBUG_SHOCKWAVE
664 "SHOCKWAVE by %s: damage = %f, force = %f.\n",
671 shockwave_hit[i] = world;
672 shockwave_hit_force[i] = '0 0 0';
673 shockwave_hit_damage[i] = 0;
677 float W_Shockwave(float req)
684 if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
685 { self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE); }
687 { self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE); }
693 if(WEP_CVAR(shockwave, reload_ammo) && self.clip_load < WEP_CVAR(shockwave, pellets_ammo)) // forced reload
695 // don't force reload an empty shockwave if its melee attack is active
696 if(!(WEP_CVAR(shockwave, secondary) && self.ammo_shells < WEP_CVAR(shockwave, pellets_ammo)))
697 WEP_ACTION(self.weapon, WR_RELOAD);
703 switch(WEP_CVAR(shockwave, primary))
707 if(time >= self.shockwave_pelletstime) // handle refire separately so the secondary can be fired straight after a primary
709 if(weapon_prepareattack(0, WEP_CVAR(shockwave, pellets_animtime)))
711 W_Shockwave_Attack();
712 self.shockwave_pelletstime = time + WEP_CVAR(shockwave, pellets_refire) * W_WeaponRateFactor();
713 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(shockwave, pellets_animtime), w_ready);
720 if(time >= self.shockwave_pelletstime) // handle refire separately so the secondary can be fired straight after a primary
722 if(weapon_prepareattack(0, WEP_CVAR(shockwave, pellets_animtime)))
724 W_Shockwave_Pellets();
725 self.shockwave_pelletstime = time + WEP_CVAR(shockwave, pellets_refire) * W_WeaponRateFactor();
726 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(shockwave, pellets_animtime), w_ready);
734 if(self.clip_load >= 0) // we are not currently reloading
735 if(!self.crouch) // no crouchmelee please
736 if(self.BUTTON_ATCK2 && WEP_CVAR(shockwave, secondary))
737 if(weapon_prepareattack(1, WEP_CVAR(shockwave, melee_refire)))
739 // attempt forcing playback of the anim by switching to another anim (that we never play) here...
740 weapon_thinkf(WFRAME_FIRE1, 0, W_Shockwave_Melee);
748 precache_model("models/uziflash.md3");
749 precache_model("models/weapons/g_shockwave.md3");
750 precache_model("models/weapons/v_shockwave.md3");
751 precache_model("models/weapons/h_shockwave.iqm");
752 precache_sound("misc/itempickup.wav");
753 precache_sound("weapons/shockwave_fire.wav");
754 precache_sound("weapons/shockwave_melee.wav");
755 SHOCKWAVE_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
760 self.current_ammo = ammo_shells;
765 ammo_amount = self.ammo_shells >= WEP_CVAR(shockwave, pellets_ammo);
766 ammo_amount += self.(weapon_load[WEP_SHOCKWAVE]) >= WEP_CVAR(shockwave, pellets_ammo);
771 // melee attack is always available
776 SHOCKWAVE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
781 W_Reload(WEP_CVAR(shockwave, pellets_ammo), "weapons/reload.wav");
784 case WR_SUICIDEMESSAGE:
786 return WEAPON_THINKING_WITH_PORTALS;
790 if(w_deathtype & HITTYPE_SECONDARY)
791 return WEAPON_SHOCKWAVE_MURDER_SLAP;
793 return WEAPON_SHOCKWAVE_MURDER;
800 float W_Shockwave(float req)
804 case WR_IMPACTEFFECT:
807 org2 = w_org + w_backoff * 2;
808 pointparticles(particleeffectnum("shockwave_impact"), org2, w_backoff * 1000, 1);
813 //precache_sound("weapons/ric1.wav");
814 //precache_sound("weapons/ric2.wav");
815 //precache_sound("weapons/ric3.wav");