1 #include "shockwave.qh"
4 REGISTER_NET_TEMP(TE_CSQC_SHOCKWAVEPARTICLE)
9 const float MAX_SHOCKWAVE_HITS = 10;
10 //#define DEBUG_SHOCKWAVE
13 .entity swing_alreadyhit;
14 .float shockwave_blasttime;
15 entity shockwave_hit[MAX_SHOCKWAVE_HITS];
16 float shockwave_hit_damage[MAX_SHOCKWAVE_HITS];
17 vector shockwave_hit_force[MAX_SHOCKWAVE_HITS];
20 void W_Shockwave_Melee_Think(entity this)
23 float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
27 // check to see if we can still continue, otherwise give up now
28 if(IS_DEAD(this.realowner) && WEP_CVAR(shockwave, melee_no_doubleslap))
34 // set start time of melee
38 W_PlayStrengthSound(this.realowner);
41 // update values for v_* vectors
42 makevectors(this.realowner.v_angle);
44 // calculate swing percentage based on time
45 meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor(this.realowner);
46 swing = bound(0, (this.cnt + meleetime - time) / meleetime, 10);
47 f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces));
49 // perform the traces needed for this frame
50 for(i=this.swing_prev; i < f; ++i)
52 swing_factor = ((1 - (i / WEP_CVAR(shockwave, melee_traces))) * 2 - 1);
54 targpos = (this.realowner.origin + this.realowner.view_ofs
55 + (v_forward * WEP_CVAR(shockwave, melee_range))
56 + (v_up * swing_factor * WEP_CVAR(shockwave, melee_swing_up))
57 + (v_right * swing_factor * WEP_CVAR(shockwave, melee_swing_side)));
59 WarpZone_traceline_antilag(
61 (this.realowner.origin + this.realowner.view_ofs),
65 ANTILAG_LATENCY(this.realowner)
68 // draw lightning beams for debugging
69 #ifdef DEBUG_SHOCKWAVE
70 te_lightning2(NULL, targpos, this.realowner.origin + this.realowner.view_ofs + v_forward * 5 - v_up * 5);
71 te_customflash(targpos, 40, 2, '1 1 1');
74 is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || IS_MONSTER(trace_ent));
76 if((trace_fraction < 1) // if trace is good, apply the damage and remove this if necessary
77 && (trace_ent.takedamage == DAMAGE_AIM)
78 && (trace_ent != this.swing_alreadyhit)
79 && (is_player || WEP_CVAR(shockwave, melee_nonplayerdamage)))
81 target_victim = trace_ent; // so it persists through other calls
83 if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught
84 swing_damage = (WEP_CVAR(shockwave, melee_damage) * min(1, swing_factor + 1));
86 swing_damage = (WEP_CVAR(shockwave, melee_nonplayerdamage) * min(1, swing_factor + 1));
88 // trigger damage with this calculated info
94 (WEP_SHOCKWAVE.m_id | HITTYPE_SECONDARY),
95 this.weaponentity_fld,
96 (this.realowner.origin + this.realowner.view_ofs),
97 (v_forward * WEP_CVAR(shockwave, melee_force))
101 if(accuracy_isgooddamage(this.realowner, target_victim))
102 { accuracy_add(this.realowner, WEP_SHOCKWAVE, 0, swing_damage); }
104 #ifdef DEBUG_SHOCKWAVE
106 "MELEE: %s hitting %s with %f damage (factor: %f) at %f time.",
107 this.realowner.netname,
108 target_victim.netname,
115 // allow multiple hits with one swing, but not against the same player twice
116 if(WEP_CVAR(shockwave, melee_multihit))
118 this.swing_alreadyhit = target_victim;
119 continue; // move along to next trace
129 if(time >= this.cnt + meleetime)
139 this.nextthink = time;
143 void W_Shockwave_Melee(Weapon thiswep, entity actor, .entity weaponentity, int fire)
145 sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTN_NORM);
146 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
148 entity meleetemp = new_pure(meleetemp);
149 meleetemp.owner = meleetemp.realowner = actor;
150 setthink(meleetemp, W_Shockwave_Melee_Think);
151 meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor(actor);
152 meleetemp.weaponentity_fld = weaponentity;
153 W_SetupShot_Range(actor, weaponentity, true, 0, SND_Null, 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range), thiswep.m_id | HITTYPE_SECONDARY);
156 // SHOCKWAVE ATTACK MODE
157 float W_Shockwave_Attack_CheckSpread(
159 vector nearest_on_line,
161 vector attack_endpos)
164 float distance_of_attack = vlen(sw_shotorg - attack_endpos);
165 float distance_from_line = vlen(targetorg - nearest_on_line);
167 spreadlimit = (distance_of_attack ? min(1, (vlen(sw_shotorg - nearest_on_line) / distance_of_attack)) : 1);
170 (WEP_CVAR(shockwave, blast_spread_min) * (1 - spreadlimit))
172 (WEP_CVAR(shockwave, blast_spread_max) * spreadlimit)
176 (spreadlimit && (distance_from_line <= spreadlimit))
178 ((vlen(normalize(targetorg - sw_shotorg) - normalize(attack_endpos - sw_shotorg)) * RAD2DEG) <= 90)
180 { return bound(0, (distance_from_line / spreadlimit), 1); }
185 float W_Shockwave_Attack_IsVisible(
188 vector nearest_on_line,
190 vector attack_endpos)
192 vector nearest_to_attacker = head.WarpZone_findradius_nearest;
193 vector center = (head.origin + (head.mins + head.maxs) * 0.5);
197 // STEP ONE: Check if the nearest point is clear
198 if(W_Shockwave_Attack_CheckSpread(nearest_to_attacker, nearest_on_line, sw_shotorg, attack_endpos))
200 WarpZone_TraceLine(sw_shotorg, nearest_to_attacker, MOVE_NOMONSTERS, actor);
201 if(trace_fraction == 1) { return true; } // yes, the nearest point is clear and we can allow the damage
204 // STEP TWO: Check if shotorg to center point is clear
205 if(W_Shockwave_Attack_CheckSpread(center, nearest_on_line, sw_shotorg, attack_endpos))
207 WarpZone_TraceLine(sw_shotorg, center, MOVE_NOMONSTERS, actor);
208 if(trace_fraction == 1) { return true; } // yes, the center point is clear and we can allow the damage
211 // STEP THREE: Check each corner to see if they are clear
214 corner = get_corner_position(head, i);
215 if(W_Shockwave_Attack_CheckSpread(corner, nearest_on_line, sw_shotorg, attack_endpos))
217 WarpZone_TraceLine(sw_shotorg, corner, MOVE_NOMONSTERS, actor);
218 if(trace_fraction == 1) { return true; } // yes, this corner is clear and we can allow the damage
225 float W_Shockwave_Attack_CheckHit(
231 if(!head) { return false; }
234 for(i = 0; i <= queue; ++i)
236 if(shockwave_hit[i] == head)
238 if(vlen2(final_force) > vlen2(shockwave_hit_force[i])) { shockwave_hit_force[i] = final_force; }
239 if(final_damage > shockwave_hit_damage[i]) { shockwave_hit_damage[i] = final_damage; }
244 shockwave_hit[queue] = head;
245 shockwave_hit_force[queue] = final_force;
246 shockwave_hit_damage[queue] = final_damage;
250 void W_Shockwave_Send(entity actor)
252 WriteHeader(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE);
253 WriteVector(MSG_BROADCAST, w_shotorg);
254 WriteVector(MSG_BROADCAST, w_shotdir);
255 WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance));
256 WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255));
257 WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255));
258 WriteByte(MSG_BROADCAST, etof(actor));
261 void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity)
264 float multiplier, multiplier_from_accuracy, multiplier_from_distance;
266 vector final_force, center, vel;
271 // set up the shot direction
272 W_SetupShot(actor, weaponentity, true, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage), thiswep.m_id);
273 vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
274 WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, actor);
275 vector attack_hitpos = trace_endpos;
276 float distance_to_end = vlen(w_shotorg - attack_endpos);
277 float distance_to_hit = vlen(w_shotorg - attack_hitpos);
278 //entity transform = WarpZone_trace_transform;
280 // do the firing effect now
281 W_Shockwave_Send(actor);
284 WEP_CVAR(shockwave, blast_splash_damage),
285 WEP_CVAR(shockwave, blast_splash_edgedamage),
286 WEP_CVAR(shockwave, blast_splash_radius),
287 w_shotdir * WEP_CVAR(shockwave, blast_splash_force),
293 // splash damage/jumping trace
294 head = WarpZone_FindRadius(
297 WEP_CVAR(shockwave, blast_splash_radius),
298 WEP_CVAR(shockwave, blast_jump_radius)
303 float lag = ((IS_REAL_CLIENT(actor)) ? ANTILAG_LATENCY(actor) : 0);
304 bool noantilag = ((IS_CLIENT(actor)) ? CS_CVAR(actor).cvar_cl_noantilag : false);
307 if(autocvar_g_antilag == 0 || noantilag)
308 lag = 0; // only do hitscan, but no antilag
310 antilag_takeback_all(actor, lag);
316 float distance_to_head = vlen(attack_hitpos - head.WarpZone_findradius_nearest);
318 if((head == actor) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius)))
320 // ========================
321 // BLAST JUMP CALCULATION
322 // ========================
324 // calculate importance of distance and accuracy for this attack
325 multiplier_from_accuracy = (1 -
327 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_jump_radius)))
332 multiplier_from_distance = (1 -
334 min(1, (distance_to_hit / distance_to_end))
341 WEP_CVAR(shockwave, blast_jump_multiplier_min),
343 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_jump_multiplier_accuracy))
345 (multiplier_from_distance * WEP_CVAR(shockwave, blast_jump_multiplier_distance))
349 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
352 (WEP_CVAR(shockwave, blast_jump_damage) * multiplier)
354 (WEP_CVAR(shockwave, blast_jump_edgedamage) * (1 - multiplier))
357 // figure out the direction of force
358 vel = normalize(vec2(head.velocity));
361 bound(0, (vlen(vel) / autocvar_sv_maxspeed), 1)
363 WEP_CVAR(shockwave, blast_jump_force_velocitybias)
366 if (autocvar_g_player_damageplayercenter)
368 vector shot_origin = CENTER_OR_VIEWOFS(actor);
369 shot_origin.z += actor.(weaponentity).movedir.z;
370 //if (head == actor) // was checked for already, is true
371 final_force = normalize((shot_origin - attack_hitpos) + vel);
372 //else // use target's bbox centerpoint
373 //final_force = normalize(((head.origin + ((head.mins + head.maxs) * 0.5)) - attack_hitpos) + vel);
377 // if it's a player, use the view origin as reference
378 final_force = normalize((CENTER_OR_VIEWOFS(head) - attack_hitpos) + vel);
381 // now multiply the direction by force units
382 final_force *= (WEP_CVAR(shockwave, blast_jump_force) * multiplier);
383 final_force.z *= WEP_CVAR(shockwave, blast_jump_force_zscale);
385 // trigger damage with this calculated info
397 #ifdef DEBUG_SHOCKWAVE
399 "SELF HIT: multiplier = %f, damage = %f, force = %f... "
400 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
404 multiplier_from_accuracy,
405 multiplier_from_distance
409 else if(distance_to_head <= WEP_CVAR(shockwave, blast_splash_radius))
411 // ==========================
412 // BLAST SPLASH CALCULATION
413 // ==========================
415 // calculate importance of distance and accuracy for this attack
416 multiplier_from_accuracy = (1 -
418 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_splash_radius)))
423 multiplier_from_distance = (1 -
425 min(1, (distance_to_hit / distance_to_end))
432 WEP_CVAR(shockwave, blast_splash_multiplier_min),
434 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_splash_multiplier_accuracy))
436 (multiplier_from_distance * WEP_CVAR(shockwave, blast_splash_multiplier_distance))
440 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
443 (WEP_CVAR(shockwave, blast_splash_damage) * multiplier)
445 (WEP_CVAR(shockwave, blast_splash_edgedamage) * (1 - multiplier))
448 // figure out the direction of force
449 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_splash_force_forwardbias));
450 if (autocvar_g_player_damageplayercenter)
452 //if (head == actor) // was checked for already, is false
453 //final_force = normalize(CENTER_OR_VIEWOFS(actor) + '0 0 actor.(weaponentity).movedir.z' - (attack_hitpos - final_force));
454 //else // use target's bbox centerpoint
455 final_force = normalize((head.origin + ((head.mins + head.maxs) * 0.5)) - (attack_hitpos - final_force));
459 // if it's a player, use the view origin as reference
460 final_force = normalize(CENTER_OR_VIEWOFS(head) - (attack_hitpos - final_force));
462 //te_lightning2(NULL, attack_hitpos, (attack_hitpos + (final_force * 200)));
464 // now multiply the direction by force units
465 final_force *= (WEP_CVAR(shockwave, blast_splash_force) * multiplier);
466 final_force.z *= WEP_CVAR(shockwave, blast_force_zscale);
468 // queue damage with this calculated info
469 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
471 #ifdef DEBUG_SHOCKWAVE
473 "SPLASH HIT: multiplier = %f, damage = %f, force = %f... "
474 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
478 multiplier_from_accuracy,
479 multiplier_from_distance
488 head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(shockwave, blast_distance), false);
491 if((head != actor) && head.takedamage)
493 // ========================
494 // BLAST CONE CALCULATION
495 // ========================
497 if (autocvar_g_player_damageplayercenter)
499 //if (head == actor) // was checked for already, is false
500 //center = CENTER_OR_VIEWOFS(actor) + '0 0 actor.(weaponentity).movedir.z';
501 //else // use target's bbox centerpoint
502 center = head.origin + ((head.mins + head.maxs) * 0.5);
506 // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in damage.qc)
507 center = CENTER_OR_VIEWOFS(head);
510 // find the closest point on the enemy to the center of the attack
511 float h; // hypotenuse, which is the distance between attacker to head
512 float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
514 h = vlen(center - actor.origin);
515 a = h * (normalize(center - actor.origin) * w_shotdir);
516 // WEAPONTODO: replace with simpler method
518 vector nearest_on_line = (w_shotorg + a * w_shotdir);
519 vector nearest_to_attacker = NearestPointOnBoundingBox(center + head.mins, center + head.maxs, nearest_on_line);
521 if((vdist(head.WarpZone_findradius_dist, <=, WEP_CVAR(shockwave, blast_distance)))
522 && (W_Shockwave_Attack_IsVisible(actor, head, nearest_on_line, w_shotorg, attack_endpos)))
524 // calculate importance of distance and accuracy for this attack
525 multiplier_from_accuracy = (1 -
526 W_Shockwave_Attack_CheckSpread(
533 multiplier_from_distance = (1 -
535 min(1, (vlen(head.WarpZone_findradius_dist) / distance_to_end))
542 WEP_CVAR(shockwave, blast_multiplier_min),
544 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_multiplier_accuracy))
546 (multiplier_from_distance * WEP_CVAR(shockwave, blast_multiplier_distance))
550 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
553 (WEP_CVAR(shockwave, blast_damage) * multiplier)
555 (WEP_CVAR(shockwave, blast_edgedamage) * (1 - multiplier))
558 // figure out the direction of force
559 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_force_forwardbias));
560 final_force = normalize(center - (nearest_on_line - final_force));
561 //te_lightning2(NULL, nearest_on_line, (attack_hitpos + (final_force * 200)));
563 // now multiply the direction by force units
564 final_force *= (WEP_CVAR(shockwave, blast_force) * multiplier);
565 final_force.z *= WEP_CVAR(shockwave, blast_force_zscale);
567 // queue damage with this calculated info
568 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
570 #ifdef DEBUG_SHOCKWAVE
572 "BLAST HIT: multiplier = %f, damage = %f, force = %f... "
573 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
577 multiplier_from_accuracy,
578 multiplier_from_distance
586 for(i = 1; i <= queue; ++i)
588 head = shockwave_hit[i-1];
589 final_force = shockwave_hit_force[i-1];
590 final_damage = shockwave_hit_damage[i-1];
603 if(accuracy_isgooddamage(actor, head))
604 accuracy_add(actor, thiswep, 0, final_damage);
606 #ifdef DEBUG_SHOCKWAVE
608 "SHOCKWAVE by %s: damage = %f, force = %f.",
615 shockwave_hit[i-1] = NULL;
616 shockwave_hit_force[i-1] = '0 0 0';
617 shockwave_hit_damage[i-1] = 0;
621 antilag_restore_all(actor);
624 METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
626 if(vdist(actor.origin - actor.enemy.origin, <=, WEP_CVAR(shockwave, melee_range)))
627 { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false, false); }
629 { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false, false); }
631 METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
635 if(time >= actor.(weaponentity).shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
637 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
639 W_Shockwave_Attack(thiswep, actor, weaponentity);
640 actor.(weaponentity).shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor(actor);
641 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
647 //if(actor.clip_load >= 0) // we are not currently reloading
648 if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
650 // attempt forcing playback of the anim by switching to another anim (that we never play) here...
651 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
655 METHOD(Shockwave, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
657 return true; // infinite ammo
659 METHOD(Shockwave, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
661 // shockwave has infinite ammo
664 METHOD(Shockwave, wr_suicidemessage, Notification(entity thiswep))
666 return WEAPON_THINKING_WITH_PORTALS;
668 METHOD(Shockwave, wr_killmessage, Notification(entity thiswep))
670 if(w_deathtype & HITTYPE_SECONDARY)
671 return WEAPON_SHOCKWAVE_MURDER_SLAP;
673 return WEAPON_SHOCKWAVE_MURDER;
678 // WEAPONTODO: add client side settings for these
679 const float SW_MAXALPHA = 0.5;
680 const float SW_FADETIME = 0.4;
681 const float SW_DISTTOMIN = 200;
682 void Draw_Shockwave(entity this)
684 // fading/removal control
685 float a = bound(0, (SW_MAXALPHA - ((time - this.sw_time) / SW_FADETIME)), SW_MAXALPHA);
686 if(a < ALPHA_MIN_VISIBLE) { delete(this); }
688 // WEAPONTODO: save this only once when creating the entity
689 vector sw_color = entcs_GetColor(this.sv_entnum - 1); // Team_ColorRGB(entcs_GetTeam(this.sv_entnum));
691 // WEAPONTODO: trace to find what we actually hit
692 vector endpos = (this.sw_shotorg + (this.sw_shotdir * this.sw_distance));
694 vector _forward, right, up;
695 VECTOR_VECTORS(this.sw_shotdir, _forward, right, up);
697 // WEAPONTODO: combine and simplify these calculations
698 vector min_end = ((this.sw_shotorg + (this.sw_shotdir * SW_DISTTOMIN)) + (up * this.sw_spread_min));
699 vector max_end = (endpos + (up * this.sw_spread_max));
700 float spread_to_min = vlen(normalize(min_end - this.sw_shotorg) - this.sw_shotdir);
701 float spread_to_max = vlen(normalize(max_end - min_end) - this.sw_shotdir);
703 vector first_min_end = '0 0 0', prev_min_end = '0 0 0', new_min_end = '0 0 0';
704 vector first_max_end = '0 0 0', prev_max_end = '0 0 0', new_max_end = '0 0 0';
705 float new_max_dist, new_min_dist;
707 vector deviation, angle = '0 0 0';
708 float counter, divisions = 20;
709 for(counter = 0; counter < divisions; ++counter)
711 // perfect circle effect lines
712 makevectors('0 360 0' * (0.75 + (counter - 0.5) / divisions));
713 angle.y = v_forward.x;
714 angle.z = v_forward.y;
716 // first do the spread_to_min effect
717 deviation = angle * spread_to_min;
718 deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
719 new_min_dist = SW_DISTTOMIN;
720 new_min_end = (this.sw_shotorg + (deviation * new_min_dist));
721 //te_lightning2(NULL, new_min_end, this.sw_shotorg);
723 // then calculate spread_to_max effect
724 deviation = angle * spread_to_max;
725 deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
726 new_max_dist = vlen(new_min_end - endpos);
727 new_max_end = (new_min_end + (deviation * new_max_dist));
728 //te_lightning2(NULL, new_end, prev_min_end);
733 first_min_end = new_min_end;
734 first_max_end = new_max_end;
739 // draw from shot origin to min spread radius
740 R_BeginPolygon("", DRAWFLAG_NORMAL, false);
741 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
742 R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
743 R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
746 // draw from min spread radius to max spread radius
747 R_BeginPolygon("", DRAWFLAG_NORMAL, false);
748 R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
749 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
750 R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
751 R_PolygonVertex(new_max_end, '0 0 0', sw_color, a);
755 prev_min_end = new_min_end;
756 prev_max_end = new_max_end;
758 // last division only
759 if((counter + 1) == divisions)
761 // draw from shot origin to min spread radius
762 R_BeginPolygon("", DRAWFLAG_NORMAL, false);
763 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
764 R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
765 R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
768 // draw from min spread radius to max spread radius
769 R_BeginPolygon("", DRAWFLAG_NORMAL, false);
770 R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
771 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
772 R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
773 R_PolygonVertex(first_max_end, '0 0 0', sw_color, a);
779 NET_HANDLE(TE_CSQC_SHOCKWAVEPARTICLE, bool isNew)
781 Net_ReadShockwaveParticle();
785 void Net_ReadShockwaveParticle()
787 entity shockwave = new(shockwave_cone);
788 shockwave.draw = Draw_Shockwave;
789 IL_PUSH(g_drawables, shockwave);
791 shockwave.sw_shotorg = ReadVector();
792 shockwave.sw_shotdir = ReadVector();
794 shockwave.sw_distance = ReadShort();
795 shockwave.sw_spread_max = ReadByte();
796 shockwave.sw_spread_min = ReadByte();
798 shockwave.sv_entnum = ReadByte();
800 shockwave.sw_time = time;
803 METHOD(Shockwave, wr_impacteffect, void(entity thiswep, entity actor))
805 // handled by Net_ReadShockwaveParticle
806 //vector org2 = w_org + w_backoff * 2;
807 //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);