1 #include "shockwave.qh"
3 REGISTER_NET_TEMP(TE_CSQC_SHOCKWAVEPARTICLE)
6 spawnfunc(weapon_shockwave)
8 //if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO
9 if(autocvar_sv_q3acompat_machineshotgunswap)
10 if(this.classname != "droppedweapon")
12 weapon_defaultspawnfunc(this, WEP_MACHINEGUN);
15 weapon_defaultspawnfunc(this, WEP_SHOCKWAVE);
18 const float MAX_SHOCKWAVE_HITS = 10;
19 //#define DEBUG_SHOCKWAVE
22 .entity swing_alreadyhit;
23 .float shockwave_blasttime;
24 entity shockwave_hit[MAX_SHOCKWAVE_HITS];
25 float shockwave_hit_damage[MAX_SHOCKWAVE_HITS];
26 vector shockwave_hit_force[MAX_SHOCKWAVE_HITS];
29 void W_Shockwave_Melee_Think(entity this)
32 float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
36 // check to see if we can still continue, otherwise give up now
37 if(IS_DEAD(this.realowner) && WEP_CVAR(shockwave, melee_no_doubleslap))
43 // set start time of melee
47 W_PlayStrengthSound(this.realowner);
50 // update values for v_* vectors
51 makevectors(this.realowner.v_angle);
53 // calculate swing percentage based on time
54 meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor(this.realowner);
55 swing = bound(0, (this.cnt + meleetime - time) / meleetime, 10);
56 f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces));
58 // perform the traces needed for this frame
59 for(i=this.swing_prev; i < f; ++i)
61 swing_factor = ((1 - (i / WEP_CVAR(shockwave, melee_traces))) * 2 - 1);
63 targpos = (this.realowner.origin + this.realowner.view_ofs
64 + (v_forward * WEP_CVAR(shockwave, melee_range))
65 + (v_up * swing_factor * WEP_CVAR(shockwave, melee_swing_up))
66 + (v_right * swing_factor * WEP_CVAR(shockwave, melee_swing_side)));
68 WarpZone_traceline_antilag(
70 (this.realowner.origin + this.realowner.view_ofs),
74 ANTILAG_LATENCY(this.realowner)
77 // draw lightning beams for debugging
78 #ifdef DEBUG_SHOCKWAVE
79 te_lightning2(NULL, targpos, this.realowner.origin + this.realowner.view_ofs + v_forward * 5 - v_up * 5);
80 te_customflash(targpos, 40, 2, '1 1 1');
83 is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || IS_MONSTER(trace_ent));
85 if((trace_fraction < 1) // if trace is good, apply the damage and remove this if necessary
86 && (trace_ent.takedamage == DAMAGE_AIM)
87 && (trace_ent != this.swing_alreadyhit)
88 && (is_player || WEP_CVAR(shockwave, melee_nonplayerdamage)))
90 target_victim = trace_ent; // so it persists through other calls
92 if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught
93 swing_damage = (WEP_CVAR(shockwave, melee_damage) * min(1, swing_factor + 1));
95 swing_damage = (WEP_CVAR(shockwave, melee_nonplayerdamage) * min(1, swing_factor + 1));
97 // trigger damage with this calculated info
103 (WEP_SHOCKWAVE.m_id | HITTYPE_SECONDARY),
104 (this.realowner.origin + this.realowner.view_ofs),
105 (v_forward * WEP_CVAR(shockwave, melee_force))
109 if(accuracy_isgooddamage(this.realowner, target_victim))
110 { accuracy_add(this.realowner, WEP_SHOCKWAVE.m_id, 0, swing_damage); }
112 #ifdef DEBUG_SHOCKWAVE
114 "MELEE: %s hitting %s with %f damage (factor: %f) at %f time.",
115 this.realowner.netname,
116 target_victim.netname,
123 // allow multiple hits with one swing, but not against the same player twice
124 if(WEP_CVAR(shockwave, melee_multihit))
126 this.swing_alreadyhit = target_victim;
127 continue; // move along to next trace
137 if(time >= this.cnt + meleetime)
147 this.nextthink = time;
151 void W_Shockwave_Melee(Weapon thiswep, entity actor, .entity weaponentity, int fire)
153 sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTN_NORM);
154 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
156 entity meleetemp = new_pure(meleetemp);
157 meleetemp.owner = meleetemp.realowner = actor;
158 setthink(meleetemp, W_Shockwave_Melee_Think);
159 meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor(actor);
160 W_SetupShot_Range(actor, weaponentity, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
163 // SHOCKWAVE ATTACK MODE
164 float W_Shockwave_Attack_CheckSpread(
166 vector nearest_on_line,
168 vector attack_endpos)
171 float distance_of_attack = vlen(sw_shotorg - attack_endpos);
172 float distance_from_line = vlen(targetorg - nearest_on_line);
174 spreadlimit = (distance_of_attack ? min(1, (vlen(sw_shotorg - nearest_on_line) / distance_of_attack)) : 1);
177 (WEP_CVAR(shockwave, blast_spread_min) * (1 - spreadlimit))
179 (WEP_CVAR(shockwave, blast_spread_max) * spreadlimit)
183 (spreadlimit && (distance_from_line <= spreadlimit))
185 ((vlen(normalize(targetorg - sw_shotorg) - normalize(attack_endpos - sw_shotorg)) * RAD2DEG) <= 90)
187 { return bound(0, (distance_from_line / spreadlimit), 1); }
192 float W_Shockwave_Attack_IsVisible(
195 vector nearest_on_line,
197 vector attack_endpos)
199 vector nearest_to_attacker = head.WarpZone_findradius_nearest;
200 vector center = (head.origin + (head.mins + head.maxs) * 0.5);
204 // STEP ONE: Check if the nearest point is clear
205 if(W_Shockwave_Attack_CheckSpread(nearest_to_attacker, nearest_on_line, sw_shotorg, attack_endpos))
207 WarpZone_TraceLine(sw_shotorg, nearest_to_attacker, MOVE_NOMONSTERS, actor);
208 if(trace_fraction == 1) { return true; } // yes, the nearest point is clear and we can allow the damage
211 // STEP TWO: Check if shotorg to center point is clear
212 if(W_Shockwave_Attack_CheckSpread(center, nearest_on_line, sw_shotorg, attack_endpos))
214 WarpZone_TraceLine(sw_shotorg, center, MOVE_NOMONSTERS, actor);
215 if(trace_fraction == 1) { return true; } // yes, the center point is clear and we can allow the damage
218 // STEP THREE: Check each corner to see if they are clear
221 corner = get_corner_position(head, i);
222 if(W_Shockwave_Attack_CheckSpread(corner, nearest_on_line, sw_shotorg, attack_endpos))
224 WarpZone_TraceLine(sw_shotorg, corner, MOVE_NOMONSTERS, actor);
225 if(trace_fraction == 1) { return true; } // yes, this corner is clear and we can allow the damage
232 float W_Shockwave_Attack_CheckHit(
238 if(!head) { return false; }
241 for(i = 0; i <= queue; ++i)
243 if(shockwave_hit[i] == head)
245 if(vlen2(final_force) > vlen2(shockwave_hit_force[i])) { shockwave_hit_force[i] = final_force; }
246 if(final_damage > shockwave_hit_damage[i]) { shockwave_hit_damage[i] = final_damage; }
251 shockwave_hit[queue] = head;
252 shockwave_hit_force[queue] = final_force;
253 shockwave_hit_damage[queue] = final_damage;
257 void W_Shockwave_Send(entity actor)
259 WriteHeader(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE);
260 WriteCoord(MSG_BROADCAST, w_shotorg.x);
261 WriteCoord(MSG_BROADCAST, w_shotorg.y);
262 WriteCoord(MSG_BROADCAST, w_shotorg.z);
263 WriteCoord(MSG_BROADCAST, w_shotdir.x);
264 WriteCoord(MSG_BROADCAST, w_shotdir.y);
265 WriteCoord(MSG_BROADCAST, w_shotdir.z);
266 WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance));
267 WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255));
268 WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255));
269 WriteByte(MSG_BROADCAST, etof(actor));
272 void W_Shockwave_Attack(entity actor, .entity weaponentity)
275 float multiplier, multiplier_from_accuracy, multiplier_from_distance;
277 vector final_force, center, vel;
282 // set up the shot direction
283 W_SetupShot(actor, weaponentity, true, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
284 vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
285 WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, actor);
286 vector attack_hitpos = trace_endpos;
287 float distance_to_end = vlen(w_shotorg - attack_endpos);
288 float distance_to_hit = vlen(w_shotorg - attack_hitpos);
289 //entity transform = WarpZone_trace_transform;
291 // do the firing effect now
292 W_Shockwave_Send(actor);
295 WEP_CVAR(shockwave, blast_splash_damage),
296 WEP_CVAR(shockwave, blast_splash_edgedamage),
297 WEP_CVAR(shockwave, blast_splash_radius),
298 w_shotdir * WEP_CVAR(shockwave, blast_splash_force),
304 // splash damage/jumping trace
305 head = WarpZone_FindRadius(
308 WEP_CVAR(shockwave, blast_splash_radius),
309 WEP_CVAR(shockwave, blast_jump_radius)
314 float lag = ((IS_REAL_CLIENT(actor)) ? ANTILAG_LATENCY(actor) : 0);
315 bool noantilag = ((IS_CLIENT(actor)) ? CS(actor).cvar_cl_noantilag : false);
318 if(autocvar_g_antilag == 0 || noantilag)
319 lag = 0; // only do hitscan, but no antilag
322 FOREACH_CLIENT(IS_PLAYER(it) && it != actor, antilag_takeback(it, CS(it), time - lag));
323 IL_EACH(g_monsters, it != actor,
325 antilag_takeback(it, it, time - lag);
333 float distance_to_head = vlen(attack_hitpos - head.WarpZone_findradius_nearest);
335 if((head == actor) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius)))
337 // ========================
338 // BLAST JUMP CALCULATION
339 // ========================
341 // calculate importance of distance and accuracy for this attack
342 multiplier_from_accuracy = (1 -
344 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_jump_radius)))
349 multiplier_from_distance = (1 -
351 min(1, (distance_to_hit / distance_to_end))
358 WEP_CVAR(shockwave, blast_jump_multiplier_min),
360 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_jump_multiplier_accuracy))
362 (multiplier_from_distance * WEP_CVAR(shockwave, blast_jump_multiplier_distance))
366 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
369 (WEP_CVAR(shockwave, blast_jump_damage) * multiplier)
371 (WEP_CVAR(shockwave, blast_jump_edgedamage) * (1 - multiplier))
374 // figure out the direction of force
375 vel = normalize(vec2(head.velocity));
378 bound(0, (vlen(vel) / autocvar_sv_maxspeed), 1)
380 WEP_CVAR(shockwave, blast_jump_force_velocitybias)
382 final_force = normalize((CENTER_OR_VIEWOFS(head) - attack_hitpos) + vel);
384 // now multiply the direction by force units
385 final_force *= (WEP_CVAR(shockwave, blast_jump_force) * multiplier);
386 final_force.z *= WEP_CVAR(shockwave, blast_jump_force_zscale);
388 // trigger damage with this calculated info
399 #ifdef DEBUG_SHOCKWAVE
401 "SELF HIT: multiplier = %f, damage = %f, force = %f... "
402 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
406 multiplier_from_accuracy,
407 multiplier_from_distance
411 else if(distance_to_head <= WEP_CVAR(shockwave, blast_splash_radius))
413 // ==========================
414 // BLAST SPLASH 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_splash_radius)))
425 multiplier_from_distance = (1 -
427 min(1, (distance_to_hit / distance_to_end))
434 WEP_CVAR(shockwave, blast_splash_multiplier_min),
436 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_splash_multiplier_accuracy))
438 (multiplier_from_distance * WEP_CVAR(shockwave, blast_splash_multiplier_distance))
442 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
445 (WEP_CVAR(shockwave, blast_splash_damage) * multiplier)
447 (WEP_CVAR(shockwave, blast_splash_edgedamage) * (1 - multiplier))
450 // figure out the direction of force
451 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_splash_force_forwardbias));
452 final_force = normalize(CENTER_OR_VIEWOFS(head) - (attack_hitpos - final_force));
453 //te_lightning2(NULL, attack_hitpos, (attack_hitpos + (final_force * 200)));
455 // now multiply the direction by force units
456 final_force *= (WEP_CVAR(shockwave, blast_splash_force) * multiplier);
457 final_force.z *= WEP_CVAR(shockwave, blast_force_zscale);
459 // queue damage with this calculated info
460 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
462 #ifdef DEBUG_SHOCKWAVE
464 "SPLASH HIT: multiplier = %f, damage = %f, force = %f... "
465 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
469 multiplier_from_accuracy,
470 multiplier_from_distance
479 head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(shockwave, blast_distance), false);
482 if((head != actor) && head.takedamage)
484 // ========================
485 // BLAST CONE CALCULATION
486 // ========================
488 // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
489 center = CENTER_OR_VIEWOFS(head);
491 // find the closest point on the enemy to the center of the attack
492 float h; // hypotenuse, which is the distance between attacker to head
493 float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
495 h = vlen(center - actor.origin);
496 a = h * (normalize(center - actor.origin) * w_shotdir);
497 // WEAPONTODO: replace with simpler method
499 vector nearest_on_line = (w_shotorg + a * w_shotdir);
500 vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
502 if((vdist(head.WarpZone_findradius_dist, <=, WEP_CVAR(shockwave, blast_distance)))
503 && (W_Shockwave_Attack_IsVisible(actor, head, nearest_on_line, w_shotorg, attack_endpos)))
505 // calculate importance of distance and accuracy for this attack
506 multiplier_from_accuracy = (1 -
507 W_Shockwave_Attack_CheckSpread(
514 multiplier_from_distance = (1 -
516 min(1, (vlen(head.WarpZone_findradius_dist) / distance_to_end))
523 WEP_CVAR(shockwave, blast_multiplier_min),
525 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_multiplier_accuracy))
527 (multiplier_from_distance * WEP_CVAR(shockwave, blast_multiplier_distance))
531 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
534 (WEP_CVAR(shockwave, blast_damage) * multiplier)
536 (WEP_CVAR(shockwave, blast_edgedamage) * (1 - multiplier))
539 // figure out the direction of force
540 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_force_forwardbias));
541 final_force = normalize(center - (nearest_on_line - final_force));
542 //te_lightning2(NULL, nearest_on_line, (attack_hitpos + (final_force * 200)));
544 // now multiply the direction by force units
545 final_force *= (WEP_CVAR(shockwave, blast_force) * multiplier);
546 final_force.z *= WEP_CVAR(shockwave, blast_force_zscale);
548 // queue damage with this calculated info
549 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
551 #ifdef DEBUG_SHOCKWAVE
553 "BLAST HIT: multiplier = %f, damage = %f, force = %f... "
554 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
558 multiplier_from_accuracy,
559 multiplier_from_distance
567 for(i = 1; i <= queue; ++i)
569 head = shockwave_hit[i-1];
570 final_force = shockwave_hit_force[i-1];
571 final_damage = shockwave_hit_damage[i-1];
583 if(accuracy_isgooddamage(actor, head))
584 accuracy_add(actor, WEP_SHOCKWAVE.m_id, 0, final_damage);
586 #ifdef DEBUG_SHOCKWAVE
588 "SHOCKWAVE by %s: damage = %f, force = %f.",
595 shockwave_hit[i-1] = NULL;
596 shockwave_hit_force[i-1] = '0 0 0';
597 shockwave_hit_damage[i-1] = 0;
602 FOREACH_CLIENT(IS_PLAYER(it) && it != actor, antilag_restore(it, CS(it)));
603 IL_EACH(g_monsters, it != actor,
605 antilag_restore(it, it);
610 METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
612 if(vdist(actor.origin - actor.enemy.origin, <=, WEP_CVAR(shockwave, melee_range)))
613 { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false); }
615 { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false); }
617 METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
621 if(time >= actor.(weaponentity).shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
623 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
625 W_Shockwave_Attack(actor, weaponentity);
626 actor.(weaponentity).shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor(actor);
627 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
633 //if(actor.clip_load >= 0) // we are not currently reloading
634 if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
636 // attempt forcing playback of the anim by switching to another anim (that we never play) here...
637 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
641 METHOD(Shockwave, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
643 return true; // infinite ammo
645 METHOD(Shockwave, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
647 // shockwave has infinite ammo
650 METHOD(Shockwave, wr_suicidemessage, Notification(entity thiswep))
652 return WEAPON_THINKING_WITH_PORTALS;
654 METHOD(Shockwave, wr_killmessage, Notification(entity thiswep))
656 if(w_deathtype & HITTYPE_SECONDARY)
657 return WEAPON_SHOCKWAVE_MURDER_SLAP;
659 return WEAPON_SHOCKWAVE_MURDER;
664 // WEAPONTODO: add client side settings for these
665 const float SW_MAXALPHA = 0.5;
666 const float SW_FADETIME = 0.4;
667 const float SW_DISTTOMIN = 200;
668 void Draw_Shockwave(entity this)
670 // fading/removal control
671 float a = bound(0, (SW_MAXALPHA - ((time - this.sw_time) / SW_FADETIME)), SW_MAXALPHA);
672 if(a < ALPHA_MIN_VISIBLE) { delete(this); }
674 // WEAPONTODO: save this only once when creating the entity
675 vector sw_color = entcs_GetColor(this.sv_entnum - 1); // GetTeamRGB(entcs_GetTeam(this.sv_entnum));
677 // WEAPONTODO: trace to find what we actually hit
678 vector endpos = (this.sw_shotorg + (this.sw_shotdir * this.sw_distance));
680 vectorvectors(this.sw_shotdir);
681 vector right = v_right; // save this for when we do makevectors later
682 vector up = v_up; // save this for when we do makevectors later
684 // WEAPONTODO: combine and simplify these calculations
685 vector min_end = ((this.sw_shotorg + (this.sw_shotdir * SW_DISTTOMIN)) + (up * this.sw_spread_min));
686 vector max_end = (endpos + (up * this.sw_spread_max));
687 float spread_to_min = vlen(normalize(min_end - this.sw_shotorg) - this.sw_shotdir);
688 float spread_to_max = vlen(normalize(max_end - min_end) - this.sw_shotdir);
690 vector first_min_end = '0 0 0', prev_min_end = '0 0 0', new_min_end = '0 0 0';
691 vector first_max_end = '0 0 0', prev_max_end = '0 0 0', new_max_end = '0 0 0';
692 float new_max_dist, new_min_dist;
694 vector deviation, angle = '0 0 0';
695 float counter, divisions = 20;
696 for(counter = 0; counter < divisions; ++counter)
698 // perfect circle effect lines
699 makevectors('0 360 0' * (0.75 + (counter - 0.5) / divisions));
700 angle.y = v_forward.x;
701 angle.z = v_forward.y;
703 // first do the spread_to_min effect
704 deviation = angle * spread_to_min;
705 deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
706 new_min_dist = SW_DISTTOMIN;
707 new_min_end = (this.sw_shotorg + (deviation * new_min_dist));
708 //te_lightning2(NULL, new_min_end, this.sw_shotorg);
710 // then calculate spread_to_max effect
711 deviation = angle * spread_to_max;
712 deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
713 new_max_dist = vlen(new_min_end - endpos);
714 new_max_end = (new_min_end + (deviation * new_max_dist));
715 //te_lightning2(NULL, new_end, prev_min_end);
720 first_min_end = new_min_end;
721 first_max_end = new_max_end;
726 // draw from shot origin to min spread radius
727 R_BeginPolygon("", DRAWFLAG_NORMAL);
728 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
729 R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
730 R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
733 // draw from min spread radius to max spread radius
734 R_BeginPolygon("", DRAWFLAG_NORMAL);
735 R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
736 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
737 R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
738 R_PolygonVertex(new_max_end, '0 0 0', sw_color, a);
742 prev_min_end = new_min_end;
743 prev_max_end = new_max_end;
745 // last division only
746 if((counter + 1) == divisions)
748 // draw from shot origin to min spread radius
749 R_BeginPolygon("", DRAWFLAG_NORMAL);
750 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
751 R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
752 R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
755 // draw from min spread radius to max spread radius
756 R_BeginPolygon("", DRAWFLAG_NORMAL);
757 R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
758 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
759 R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
760 R_PolygonVertex(first_max_end, '0 0 0', sw_color, a);
766 NET_HANDLE(TE_CSQC_SHOCKWAVEPARTICLE, bool isNew)
768 Net_ReadShockwaveParticle();
772 void Net_ReadShockwaveParticle()
776 shockwave.draw = Draw_Shockwave;
777 IL_PUSH(g_drawables, shockwave);
779 shockwave.sw_shotorg_x = ReadCoord(); shockwave.sw_shotorg_y = ReadCoord(); shockwave.sw_shotorg_z = ReadCoord();
780 shockwave.sw_shotdir_x = ReadCoord(); shockwave.sw_shotdir_y = ReadCoord(); shockwave.sw_shotdir_z = ReadCoord();
782 shockwave.sw_distance = ReadShort();
783 shockwave.sw_spread_max = ReadByte();
784 shockwave.sw_spread_min = ReadByte();
786 shockwave.sv_entnum = ReadByte();
788 shockwave.sw_time = time;
791 METHOD(Shockwave, wr_impacteffect, void(entity thiswep, entity actor))
793 // handled by Net_ReadShockwaveParticle
795 //org2 = w_org + w_backoff * 2;
796 //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);