1 #include "shockwave.qh"
3 REGISTER_NET_TEMP(TE_CSQC_SHOCKWAVEPARTICLE)
6 METHOD(Shockwave, m_spawnfunc_hookreplace, Weapon(Shockwave this, entity e))
8 //if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO
9 if(autocvar_sv_q3acompat_machineshotgunswap)
10 if(e.classname != "droppedweapon")
12 return WEP_MACHINEGUN;
17 const float MAX_SHOCKWAVE_HITS = 10;
18 //#define DEBUG_SHOCKWAVE
21 .entity swing_alreadyhit;
22 .float shockwave_blasttime;
23 entity shockwave_hit[MAX_SHOCKWAVE_HITS];
24 float shockwave_hit_damage[MAX_SHOCKWAVE_HITS];
25 vector shockwave_hit_force[MAX_SHOCKWAVE_HITS];
28 void W_Shockwave_Melee_Think(entity this)
31 float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
35 // check to see if we can still continue, otherwise give up now
36 if(IS_DEAD(this.realowner) && WEP_CVAR(shockwave, melee_no_doubleslap))
42 // set start time of melee
46 W_PlayStrengthSound(this.realowner);
49 // update values for v_* vectors
50 makevectors(this.realowner.v_angle);
52 // calculate swing percentage based on time
53 meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor(this.realowner);
54 swing = bound(0, (this.cnt + meleetime - time) / meleetime, 10);
55 f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces));
57 // perform the traces needed for this frame
58 for(i=this.swing_prev; i < f; ++i)
60 swing_factor = ((1 - (i / WEP_CVAR(shockwave, melee_traces))) * 2 - 1);
62 targpos = (this.realowner.origin + this.realowner.view_ofs
63 + (v_forward * WEP_CVAR(shockwave, melee_range))
64 + (v_up * swing_factor * WEP_CVAR(shockwave, melee_swing_up))
65 + (v_right * swing_factor * WEP_CVAR(shockwave, melee_swing_side)));
67 WarpZone_traceline_antilag(
69 (this.realowner.origin + this.realowner.view_ofs),
73 ANTILAG_LATENCY(this.realowner)
76 // draw lightning beams for debugging
77 #ifdef DEBUG_SHOCKWAVE
78 te_lightning2(NULL, targpos, this.realowner.origin + this.realowner.view_ofs + v_forward * 5 - v_up * 5);
79 te_customflash(targpos, 40, 2, '1 1 1');
82 is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || IS_MONSTER(trace_ent));
84 if((trace_fraction < 1) // if trace is good, apply the damage and remove this if necessary
85 && (trace_ent.takedamage == DAMAGE_AIM)
86 && (trace_ent != this.swing_alreadyhit)
87 && (is_player || WEP_CVAR(shockwave, melee_nonplayerdamage)))
89 target_victim = trace_ent; // so it persists through other calls
91 if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught
92 swing_damage = (WEP_CVAR(shockwave, melee_damage) * min(1, swing_factor + 1));
94 swing_damage = (WEP_CVAR(shockwave, melee_nonplayerdamage) * min(1, swing_factor + 1));
96 // trigger damage with this calculated info
102 (WEP_SHOCKWAVE.m_id | HITTYPE_SECONDARY),
103 (this.realowner.origin + this.realowner.view_ofs),
104 (v_forward * WEP_CVAR(shockwave, melee_force))
108 if(accuracy_isgooddamage(this.realowner, target_victim))
109 { accuracy_add(this.realowner, WEP_SHOCKWAVE.m_id, 0, swing_damage); }
111 #ifdef DEBUG_SHOCKWAVE
113 "MELEE: %s hitting %s with %f damage (factor: %f) at %f time.",
114 this.realowner.netname,
115 target_victim.netname,
122 // allow multiple hits with one swing, but not against the same player twice
123 if(WEP_CVAR(shockwave, melee_multihit))
125 this.swing_alreadyhit = target_victim;
126 continue; // move along to next trace
136 if(time >= this.cnt + meleetime)
146 this.nextthink = time;
150 void W_Shockwave_Melee(Weapon thiswep, entity actor, .entity weaponentity, int fire)
152 sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTN_NORM);
153 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
155 entity meleetemp = new_pure(meleetemp);
156 meleetemp.owner = meleetemp.realowner = actor;
157 setthink(meleetemp, W_Shockwave_Melee_Think);
158 meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor(actor);
159 W_SetupShot_Range(actor, weaponentity, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
162 // SHOCKWAVE ATTACK MODE
163 float W_Shockwave_Attack_CheckSpread(
165 vector nearest_on_line,
167 vector attack_endpos)
170 float distance_of_attack = vlen(sw_shotorg - attack_endpos);
171 float distance_from_line = vlen(targetorg - nearest_on_line);
173 spreadlimit = (distance_of_attack ? min(1, (vlen(sw_shotorg - nearest_on_line) / distance_of_attack)) : 1);
176 (WEP_CVAR(shockwave, blast_spread_min) * (1 - spreadlimit))
178 (WEP_CVAR(shockwave, blast_spread_max) * spreadlimit)
182 (spreadlimit && (distance_from_line <= spreadlimit))
184 ((vlen(normalize(targetorg - sw_shotorg) - normalize(attack_endpos - sw_shotorg)) * RAD2DEG) <= 90)
186 { return bound(0, (distance_from_line / spreadlimit), 1); }
191 float W_Shockwave_Attack_IsVisible(
194 vector nearest_on_line,
196 vector attack_endpos)
198 vector nearest_to_attacker = head.WarpZone_findradius_nearest;
199 vector center = (head.origin + (head.mins + head.maxs) * 0.5);
203 // STEP ONE: Check if the nearest point is clear
204 if(W_Shockwave_Attack_CheckSpread(nearest_to_attacker, nearest_on_line, sw_shotorg, attack_endpos))
206 WarpZone_TraceLine(sw_shotorg, nearest_to_attacker, MOVE_NOMONSTERS, actor);
207 if(trace_fraction == 1) { return true; } // yes, the nearest point is clear and we can allow the damage
210 // STEP TWO: Check if shotorg to center point is clear
211 if(W_Shockwave_Attack_CheckSpread(center, nearest_on_line, sw_shotorg, attack_endpos))
213 WarpZone_TraceLine(sw_shotorg, center, MOVE_NOMONSTERS, actor);
214 if(trace_fraction == 1) { return true; } // yes, the center point is clear and we can allow the damage
217 // STEP THREE: Check each corner to see if they are clear
220 corner = get_corner_position(head, i);
221 if(W_Shockwave_Attack_CheckSpread(corner, nearest_on_line, sw_shotorg, attack_endpos))
223 WarpZone_TraceLine(sw_shotorg, corner, MOVE_NOMONSTERS, actor);
224 if(trace_fraction == 1) { return true; } // yes, this corner is clear and we can allow the damage
231 float W_Shockwave_Attack_CheckHit(
237 if(!head) { return false; }
240 for(i = 0; i <= queue; ++i)
242 if(shockwave_hit[i] == head)
244 if(vlen2(final_force) > vlen2(shockwave_hit_force[i])) { shockwave_hit_force[i] = final_force; }
245 if(final_damage > shockwave_hit_damage[i]) { shockwave_hit_damage[i] = final_damage; }
250 shockwave_hit[queue] = head;
251 shockwave_hit_force[queue] = final_force;
252 shockwave_hit_damage[queue] = final_damage;
256 void W_Shockwave_Send(entity actor)
258 WriteHeader(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE);
259 WriteCoord(MSG_BROADCAST, w_shotorg.x);
260 WriteCoord(MSG_BROADCAST, w_shotorg.y);
261 WriteCoord(MSG_BROADCAST, w_shotorg.z);
262 WriteCoord(MSG_BROADCAST, w_shotdir.x);
263 WriteCoord(MSG_BROADCAST, w_shotdir.y);
264 WriteCoord(MSG_BROADCAST, w_shotdir.z);
265 WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance));
266 WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255));
267 WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255));
268 WriteByte(MSG_BROADCAST, etof(actor));
271 void W_Shockwave_Attack(entity actor, .entity weaponentity)
274 float multiplier, multiplier_from_accuracy, multiplier_from_distance;
276 vector final_force, center, vel;
281 // set up the shot direction
282 W_SetupShot(actor, weaponentity, true, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
283 vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
284 WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, actor);
285 vector attack_hitpos = trace_endpos;
286 float distance_to_end = vlen(w_shotorg - attack_endpos);
287 float distance_to_hit = vlen(w_shotorg - attack_hitpos);
288 //entity transform = WarpZone_trace_transform;
290 // do the firing effect now
291 W_Shockwave_Send(actor);
294 WEP_CVAR(shockwave, blast_splash_damage),
295 WEP_CVAR(shockwave, blast_splash_edgedamage),
296 WEP_CVAR(shockwave, blast_splash_radius),
297 w_shotdir * WEP_CVAR(shockwave, blast_splash_force),
303 // splash damage/jumping trace
304 head = WarpZone_FindRadius(
307 WEP_CVAR(shockwave, blast_splash_radius),
308 WEP_CVAR(shockwave, blast_jump_radius)
313 float lag = ((IS_REAL_CLIENT(actor)) ? ANTILAG_LATENCY(actor) : 0);
314 bool noantilag = ((IS_CLIENT(actor)) ? CS(actor).cvar_cl_noantilag : false);
317 if(autocvar_g_antilag == 0 || noantilag)
318 lag = 0; // only do hitscan, but no antilag
321 FOREACH_CLIENT(IS_PLAYER(it) && it != actor, antilag_takeback(it, CS(it), time - lag));
322 IL_EACH(g_monsters, it != actor,
324 antilag_takeback(it, it, time - lag);
332 float distance_to_head = vlen(attack_hitpos - head.WarpZone_findradius_nearest);
334 if((head == actor) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius)))
336 // ========================
337 // BLAST JUMP CALCULATION
338 // ========================
340 // calculate importance of distance and accuracy for this attack
341 multiplier_from_accuracy = (1 -
343 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_jump_radius)))
348 multiplier_from_distance = (1 -
350 min(1, (distance_to_hit / distance_to_end))
357 WEP_CVAR(shockwave, blast_jump_multiplier_min),
359 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_jump_multiplier_accuracy))
361 (multiplier_from_distance * WEP_CVAR(shockwave, blast_jump_multiplier_distance))
365 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
368 (WEP_CVAR(shockwave, blast_jump_damage) * multiplier)
370 (WEP_CVAR(shockwave, blast_jump_edgedamage) * (1 - multiplier))
373 // figure out the direction of force
374 vel = normalize(vec2(head.velocity));
377 bound(0, (vlen(vel) / autocvar_sv_maxspeed), 1)
379 WEP_CVAR(shockwave, blast_jump_force_velocitybias)
381 final_force = normalize((CENTER_OR_VIEWOFS(head) - attack_hitpos) + vel);
383 // now multiply the direction by force units
384 final_force *= (WEP_CVAR(shockwave, blast_jump_force) * multiplier);
385 final_force.z *= WEP_CVAR(shockwave, blast_jump_force_zscale);
387 // trigger damage with this calculated info
398 #ifdef DEBUG_SHOCKWAVE
400 "SELF HIT: multiplier = %f, damage = %f, force = %f... "
401 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
405 multiplier_from_accuracy,
406 multiplier_from_distance
410 else if(distance_to_head <= WEP_CVAR(shockwave, blast_splash_radius))
412 // ==========================
413 // BLAST SPLASH CALCULATION
414 // ==========================
416 // calculate importance of distance and accuracy for this attack
417 multiplier_from_accuracy = (1 -
419 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_splash_radius)))
424 multiplier_from_distance = (1 -
426 min(1, (distance_to_hit / distance_to_end))
433 WEP_CVAR(shockwave, blast_splash_multiplier_min),
435 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_splash_multiplier_accuracy))
437 (multiplier_from_distance * WEP_CVAR(shockwave, blast_splash_multiplier_distance))
441 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
444 (WEP_CVAR(shockwave, blast_splash_damage) * multiplier)
446 (WEP_CVAR(shockwave, blast_splash_edgedamage) * (1 - multiplier))
449 // figure out the direction of force
450 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_splash_force_forwardbias));
451 final_force = normalize(CENTER_OR_VIEWOFS(head) - (attack_hitpos - final_force));
452 //te_lightning2(NULL, attack_hitpos, (attack_hitpos + (final_force * 200)));
454 // now multiply the direction by force units
455 final_force *= (WEP_CVAR(shockwave, blast_splash_force) * multiplier);
456 final_force.z *= WEP_CVAR(shockwave, blast_force_zscale);
458 // queue damage with this calculated info
459 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
461 #ifdef DEBUG_SHOCKWAVE
463 "SPLASH HIT: multiplier = %f, damage = %f, force = %f... "
464 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
468 multiplier_from_accuracy,
469 multiplier_from_distance
478 head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(shockwave, blast_distance), false);
481 if((head != actor) && head.takedamage)
483 // ========================
484 // BLAST CONE CALCULATION
485 // ========================
487 // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
488 center = CENTER_OR_VIEWOFS(head);
490 // find the closest point on the enemy to the center of the attack
491 float h; // hypotenuse, which is the distance between attacker to head
492 float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
494 h = vlen(center - actor.origin);
495 a = h * (normalize(center - actor.origin) * w_shotdir);
496 // WEAPONTODO: replace with simpler method
498 vector nearest_on_line = (w_shotorg + a * w_shotdir);
499 vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
501 if((vdist(head.WarpZone_findradius_dist, <=, WEP_CVAR(shockwave, blast_distance)))
502 && (W_Shockwave_Attack_IsVisible(actor, head, nearest_on_line, w_shotorg, attack_endpos)))
504 // calculate importance of distance and accuracy for this attack
505 multiplier_from_accuracy = (1 -
506 W_Shockwave_Attack_CheckSpread(
513 multiplier_from_distance = (1 -
515 min(1, (vlen(head.WarpZone_findradius_dist) / distance_to_end))
522 WEP_CVAR(shockwave, blast_multiplier_min),
524 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_multiplier_accuracy))
526 (multiplier_from_distance * WEP_CVAR(shockwave, blast_multiplier_distance))
530 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
533 (WEP_CVAR(shockwave, blast_damage) * multiplier)
535 (WEP_CVAR(shockwave, blast_edgedamage) * (1 - multiplier))
538 // figure out the direction of force
539 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_force_forwardbias));
540 final_force = normalize(center - (nearest_on_line - final_force));
541 //te_lightning2(NULL, nearest_on_line, (attack_hitpos + (final_force * 200)));
543 // now multiply the direction by force units
544 final_force *= (WEP_CVAR(shockwave, blast_force) * multiplier);
545 final_force.z *= WEP_CVAR(shockwave, blast_force_zscale);
547 // queue damage with this calculated info
548 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
550 #ifdef DEBUG_SHOCKWAVE
552 "BLAST HIT: multiplier = %f, damage = %f, force = %f... "
553 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
557 multiplier_from_accuracy,
558 multiplier_from_distance
566 for(i = 1; i <= queue; ++i)
568 head = shockwave_hit[i-1];
569 final_force = shockwave_hit_force[i-1];
570 final_damage = shockwave_hit_damage[i-1];
582 if(accuracy_isgooddamage(actor, head))
583 accuracy_add(actor, WEP_SHOCKWAVE.m_id, 0, final_damage);
585 #ifdef DEBUG_SHOCKWAVE
587 "SHOCKWAVE by %s: damage = %f, force = %f.",
594 shockwave_hit[i-1] = NULL;
595 shockwave_hit_force[i-1] = '0 0 0';
596 shockwave_hit_damage[i-1] = 0;
601 FOREACH_CLIENT(IS_PLAYER(it) && it != actor, antilag_restore(it, CS(it)));
602 IL_EACH(g_monsters, it != actor,
604 antilag_restore(it, it);
609 METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
611 if(vdist(actor.origin - actor.enemy.origin, <=, WEP_CVAR(shockwave, melee_range)))
612 { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false); }
614 { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false); }
616 METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
620 if(time >= actor.(weaponentity).shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
622 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
624 W_Shockwave_Attack(actor, weaponentity);
625 actor.(weaponentity).shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor(actor);
626 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
632 //if(actor.clip_load >= 0) // we are not currently reloading
633 if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
635 // attempt forcing playback of the anim by switching to another anim (that we never play) here...
636 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
640 METHOD(Shockwave, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
642 return true; // infinite ammo
644 METHOD(Shockwave, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
646 // shockwave has infinite ammo
649 METHOD(Shockwave, wr_suicidemessage, Notification(entity thiswep))
651 return WEAPON_THINKING_WITH_PORTALS;
653 METHOD(Shockwave, wr_killmessage, Notification(entity thiswep))
655 if(w_deathtype & HITTYPE_SECONDARY)
656 return WEAPON_SHOCKWAVE_MURDER_SLAP;
658 return WEAPON_SHOCKWAVE_MURDER;
663 // WEAPONTODO: add client side settings for these
664 const float SW_MAXALPHA = 0.5;
665 const float SW_FADETIME = 0.4;
666 const float SW_DISTTOMIN = 200;
667 void Draw_Shockwave(entity this)
669 // fading/removal control
670 float a = bound(0, (SW_MAXALPHA - ((time - this.sw_time) / SW_FADETIME)), SW_MAXALPHA);
671 if(a < ALPHA_MIN_VISIBLE) { delete(this); }
673 // WEAPONTODO: save this only once when creating the entity
674 vector sw_color = entcs_GetColor(this.sv_entnum - 1); // GetTeamRGB(entcs_GetTeam(this.sv_entnum));
676 // WEAPONTODO: trace to find what we actually hit
677 vector endpos = (this.sw_shotorg + (this.sw_shotdir * this.sw_distance));
679 vectorvectors(this.sw_shotdir);
680 vector right = v_right; // save this for when we do makevectors later
681 vector up = v_up; // save this for when we do makevectors later
683 // WEAPONTODO: combine and simplify these calculations
684 vector min_end = ((this.sw_shotorg + (this.sw_shotdir * SW_DISTTOMIN)) + (up * this.sw_spread_min));
685 vector max_end = (endpos + (up * this.sw_spread_max));
686 float spread_to_min = vlen(normalize(min_end - this.sw_shotorg) - this.sw_shotdir);
687 float spread_to_max = vlen(normalize(max_end - min_end) - this.sw_shotdir);
689 vector first_min_end = '0 0 0', prev_min_end = '0 0 0', new_min_end = '0 0 0';
690 vector first_max_end = '0 0 0', prev_max_end = '0 0 0', new_max_end = '0 0 0';
691 float new_max_dist, new_min_dist;
693 vector deviation, angle = '0 0 0';
694 float counter, divisions = 20;
695 for(counter = 0; counter < divisions; ++counter)
697 // perfect circle effect lines
698 makevectors('0 360 0' * (0.75 + (counter - 0.5) / divisions));
699 angle.y = v_forward.x;
700 angle.z = v_forward.y;
702 // first do the spread_to_min effect
703 deviation = angle * spread_to_min;
704 deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
705 new_min_dist = SW_DISTTOMIN;
706 new_min_end = (this.sw_shotorg + (deviation * new_min_dist));
707 //te_lightning2(NULL, new_min_end, this.sw_shotorg);
709 // then calculate spread_to_max effect
710 deviation = angle * spread_to_max;
711 deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
712 new_max_dist = vlen(new_min_end - endpos);
713 new_max_end = (new_min_end + (deviation * new_max_dist));
714 //te_lightning2(NULL, new_end, prev_min_end);
719 first_min_end = new_min_end;
720 first_max_end = new_max_end;
725 // draw from shot origin to min spread radius
726 R_BeginPolygon("", DRAWFLAG_NORMAL);
727 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
728 R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
729 R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
732 // draw from min spread radius to max spread radius
733 R_BeginPolygon("", DRAWFLAG_NORMAL);
734 R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
735 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
736 R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
737 R_PolygonVertex(new_max_end, '0 0 0', sw_color, a);
741 prev_min_end = new_min_end;
742 prev_max_end = new_max_end;
744 // last division only
745 if((counter + 1) == divisions)
747 // draw from shot origin to min spread radius
748 R_BeginPolygon("", DRAWFLAG_NORMAL);
749 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
750 R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
751 R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
754 // draw from min spread radius to max spread radius
755 R_BeginPolygon("", DRAWFLAG_NORMAL);
756 R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
757 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
758 R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
759 R_PolygonVertex(first_max_end, '0 0 0', sw_color, a);
765 NET_HANDLE(TE_CSQC_SHOCKWAVEPARTICLE, bool isNew)
767 Net_ReadShockwaveParticle();
771 void Net_ReadShockwaveParticle()
775 shockwave.draw = Draw_Shockwave;
776 IL_PUSH(g_drawables, shockwave);
778 shockwave.sw_shotorg_x = ReadCoord(); shockwave.sw_shotorg_y = ReadCoord(); shockwave.sw_shotorg_z = ReadCoord();
779 shockwave.sw_shotdir_x = ReadCoord(); shockwave.sw_shotdir_y = ReadCoord(); shockwave.sw_shotdir_z = ReadCoord();
781 shockwave.sw_distance = ReadShort();
782 shockwave.sw_spread_max = ReadByte();
783 shockwave.sw_spread_min = ReadByte();
785 shockwave.sv_entnum = ReadByte();
787 shockwave.sw_time = time;
790 METHOD(Shockwave, wr_impacteffect, void(entity thiswep, entity actor))
792 // handled by Net_ReadShockwaveParticle
794 //org2 = w_org + w_backoff * 2;
795 //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);