1 #include "shockwave.qh"
3 REGISTER_NET_TEMP(TE_CSQC_SHOCKWAVEPARTICLE)
7 const float MAX_SHOCKWAVE_HITS = 10;
8 //#define DEBUG_SHOCKWAVE
11 .entity swing_alreadyhit;
12 .float shockwave_blasttime;
13 entity shockwave_hit[MAX_SHOCKWAVE_HITS];
14 float shockwave_hit_damage[MAX_SHOCKWAVE_HITS];
15 vector shockwave_hit_force[MAX_SHOCKWAVE_HITS];
18 void W_Shockwave_Melee_Think(entity this)
21 float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
25 // check to see if we can still continue, otherwise give up now
26 if(IS_DEAD(this.realowner) && WEP_CVAR(shockwave, melee_no_doubleslap))
32 // set start time of melee
36 W_PlayStrengthSound(this.realowner);
39 // update values for v_* vectors
40 makevectors(this.realowner.v_angle);
42 // calculate swing percentage based on time
43 meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor(this.realowner);
44 swing = bound(0, (this.cnt + meleetime - time) / meleetime, 10);
45 f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces));
47 // perform the traces needed for this frame
48 for(i=this.swing_prev; i < f; ++i)
50 swing_factor = ((1 - (i / WEP_CVAR(shockwave, melee_traces))) * 2 - 1);
52 targpos = (this.realowner.origin + this.realowner.view_ofs
53 + (v_forward * WEP_CVAR(shockwave, melee_range))
54 + (v_up * swing_factor * WEP_CVAR(shockwave, melee_swing_up))
55 + (v_right * swing_factor * WEP_CVAR(shockwave, melee_swing_side)));
57 WarpZone_traceline_antilag(
59 (this.realowner.origin + this.realowner.view_ofs),
63 ANTILAG_LATENCY(this.realowner)
66 // draw lightning beams for debugging
67 #ifdef DEBUG_SHOCKWAVE
68 te_lightning2(NULL, targpos, this.realowner.origin + this.realowner.view_ofs + v_forward * 5 - v_up * 5);
69 te_customflash(targpos, 40, 2, '1 1 1');
72 is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || IS_MONSTER(trace_ent));
74 if((trace_fraction < 1) // if trace is good, apply the damage and remove this if necessary
75 && (trace_ent.takedamage == DAMAGE_AIM)
76 && (trace_ent != this.swing_alreadyhit)
77 && (is_player || WEP_CVAR(shockwave, melee_nonplayerdamage)))
79 target_victim = trace_ent; // so it persists through other calls
81 if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught
82 swing_damage = (WEP_CVAR(shockwave, melee_damage) * min(1, swing_factor + 1));
84 swing_damage = (WEP_CVAR(shockwave, melee_nonplayerdamage) * min(1, swing_factor + 1));
86 // trigger damage with this calculated info
92 (WEP_SHOCKWAVE.m_id | HITTYPE_SECONDARY),
93 this.weaponentity_fld,
94 (this.realowner.origin + this.realowner.view_ofs),
95 (v_forward * WEP_CVAR(shockwave, melee_force))
99 if(accuracy_isgooddamage(this.realowner, target_victim))
100 { accuracy_add(this.realowner, WEP_SHOCKWAVE, 0, swing_damage); }
102 #ifdef DEBUG_SHOCKWAVE
104 "MELEE: %s hitting %s with %f damage (factor: %f) at %f time.",
105 this.realowner.netname,
106 target_victim.netname,
113 // allow multiple hits with one swing, but not against the same player twice
114 if(WEP_CVAR(shockwave, melee_multihit))
116 this.swing_alreadyhit = target_victim;
117 continue; // move along to next trace
127 if(time >= this.cnt + meleetime)
137 this.nextthink = time;
141 void W_Shockwave_Melee(Weapon thiswep, entity actor, .entity weaponentity, int fire)
143 sound(actor, CH_WEAPON_A, SND_SHOTGUN_MELEE, VOL_BASE, ATTN_NORM);
144 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
146 entity meleetemp = new_pure(meleetemp);
147 meleetemp.owner = meleetemp.realowner = actor;
148 setthink(meleetemp, W_Shockwave_Melee_Think);
149 meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor(actor);
150 meleetemp.weaponentity_fld = weaponentity;
151 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);
154 // SHOCKWAVE ATTACK MODE
155 float W_Shockwave_Attack_CheckSpread(
157 vector nearest_on_line,
159 vector attack_endpos)
162 float distance_of_attack = vlen(sw_shotorg - attack_endpos);
163 float distance_from_line = vlen(targetorg - nearest_on_line);
165 spreadlimit = (distance_of_attack ? min(1, (vlen(sw_shotorg - nearest_on_line) / distance_of_attack)) : 1);
168 (WEP_CVAR(shockwave, blast_spread_min) * (1 - spreadlimit))
170 (WEP_CVAR(shockwave, blast_spread_max) * spreadlimit)
174 (spreadlimit && (distance_from_line <= spreadlimit))
176 ((vlen(normalize(targetorg - sw_shotorg) - normalize(attack_endpos - sw_shotorg)) * RAD2DEG) <= 90)
178 { return bound(0, (distance_from_line / spreadlimit), 1); }
183 float W_Shockwave_Attack_IsVisible(
186 vector nearest_on_line,
188 vector attack_endpos)
190 vector nearest_to_attacker = head.WarpZone_findradius_nearest;
191 vector center = (head.origin + (head.mins + head.maxs) * 0.5);
195 // STEP ONE: Check if the nearest point is clear
196 if(W_Shockwave_Attack_CheckSpread(nearest_to_attacker, nearest_on_line, sw_shotorg, attack_endpos))
198 WarpZone_TraceLine(sw_shotorg, nearest_to_attacker, MOVE_NOMONSTERS, actor);
199 if(trace_fraction == 1) { return true; } // yes, the nearest point is clear and we can allow the damage
202 // STEP TWO: Check if shotorg to center point is clear
203 if(W_Shockwave_Attack_CheckSpread(center, nearest_on_line, sw_shotorg, attack_endpos))
205 WarpZone_TraceLine(sw_shotorg, center, MOVE_NOMONSTERS, actor);
206 if(trace_fraction == 1) { return true; } // yes, the center point is clear and we can allow the damage
209 // STEP THREE: Check each corner to see if they are clear
212 corner = get_corner_position(head, i);
213 if(W_Shockwave_Attack_CheckSpread(corner, nearest_on_line, sw_shotorg, attack_endpos))
215 WarpZone_TraceLine(sw_shotorg, corner, MOVE_NOMONSTERS, actor);
216 if(trace_fraction == 1) { return true; } // yes, this corner is clear and we can allow the damage
223 float W_Shockwave_Attack_CheckHit(
229 if(!head) { return false; }
232 for(i = 0; i <= queue; ++i)
234 if(shockwave_hit[i] == head)
236 if(vlen2(final_force) > vlen2(shockwave_hit_force[i])) { shockwave_hit_force[i] = final_force; }
237 if(final_damage > shockwave_hit_damage[i]) { shockwave_hit_damage[i] = final_damage; }
242 shockwave_hit[queue] = head;
243 shockwave_hit_force[queue] = final_force;
244 shockwave_hit_damage[queue] = final_damage;
248 void W_Shockwave_Send(entity actor)
250 WriteHeader(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE);
251 WriteVector(MSG_BROADCAST, w_shotorg);
252 WriteVector(MSG_BROADCAST, w_shotdir);
253 WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance));
254 WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255));
255 WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255));
256 WriteByte(MSG_BROADCAST, etof(actor));
259 void W_Shockwave_Attack(Weapon thiswep, entity actor, .entity weaponentity)
262 float multiplier, multiplier_from_accuracy, multiplier_from_distance;
264 vector final_force, center, vel;
269 // set up the shot direction
270 W_SetupShot(actor, weaponentity, true, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage), thiswep.m_id);
271 vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
272 WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, actor);
273 vector attack_hitpos = trace_endpos;
274 float distance_to_end = vlen(w_shotorg - attack_endpos);
275 float distance_to_hit = vlen(w_shotorg - attack_hitpos);
276 //entity transform = WarpZone_trace_transform;
278 // do the firing effect now
279 W_Shockwave_Send(actor);
282 WEP_CVAR(shockwave, blast_splash_damage),
283 WEP_CVAR(shockwave, blast_splash_edgedamage),
284 WEP_CVAR(shockwave, blast_splash_radius),
285 w_shotdir * WEP_CVAR(shockwave, blast_splash_force),
291 // splash damage/jumping trace
292 head = WarpZone_FindRadius(
295 WEP_CVAR(shockwave, blast_splash_radius),
296 WEP_CVAR(shockwave, blast_jump_radius)
301 float lag = ((IS_REAL_CLIENT(actor)) ? ANTILAG_LATENCY(actor) : 0);
302 bool noantilag = ((IS_CLIENT(actor)) ? CS_CVAR(actor).cvar_cl_noantilag : false);
305 if(autocvar_g_antilag == 0 || noantilag)
306 lag = 0; // only do hitscan, but no antilag
308 antilag_takeback_all(actor, lag);
314 float distance_to_head = vlen(attack_hitpos - head.WarpZone_findradius_nearest);
316 if((head == actor) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius)))
318 // ========================
319 // BLAST JUMP CALCULATION
320 // ========================
322 // calculate importance of distance and accuracy for this attack
323 multiplier_from_accuracy = (1 -
325 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_jump_radius)))
330 multiplier_from_distance = (1 -
332 min(1, (distance_to_hit / distance_to_end))
339 WEP_CVAR(shockwave, blast_jump_multiplier_min),
341 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_jump_multiplier_accuracy))
343 (multiplier_from_distance * WEP_CVAR(shockwave, blast_jump_multiplier_distance))
347 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
350 (WEP_CVAR(shockwave, blast_jump_damage) * multiplier)
352 (WEP_CVAR(shockwave, blast_jump_edgedamage) * (1 - multiplier))
355 // figure out the direction of force
356 vel = normalize(vec2(head.velocity));
359 bound(0, (vlen(vel) / autocvar_sv_maxspeed), 1)
361 WEP_CVAR(shockwave, blast_jump_force_velocitybias)
364 if (autocvar_g_player_damageplayercenter)
366 vector shot_origin = CENTER_OR_VIEWOFS(actor);
367 shot_origin.z += actor.(weaponentity).movedir.z;
368 //if (head == actor) // was checked for already, is true
369 final_force = normalize((shot_origin - attack_hitpos) + vel);
370 //else // use target's bbox centerpoint
371 //final_force = normalize(((head.origin + ((head.mins + head.maxs) * 0.5)) - attack_hitpos) + vel);
375 // if it's a player, use the view origin as reference
376 final_force = normalize((CENTER_OR_VIEWOFS(head) - attack_hitpos) + vel);
379 // now multiply the direction by force units
380 final_force *= (WEP_CVAR(shockwave, blast_jump_force) * multiplier);
381 final_force.z *= WEP_CVAR(shockwave, blast_jump_force_zscale);
383 // trigger damage with this calculated info
395 #ifdef DEBUG_SHOCKWAVE
397 "SELF HIT: multiplier = %f, damage = %f, force = %f... "
398 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
402 multiplier_from_accuracy,
403 multiplier_from_distance
407 else if(distance_to_head <= WEP_CVAR(shockwave, blast_splash_radius))
409 // ==========================
410 // BLAST SPLASH CALCULATION
411 // ==========================
413 // calculate importance of distance and accuracy for this attack
414 multiplier_from_accuracy = (1 -
416 min(1, (distance_to_head / WEP_CVAR(shockwave, blast_splash_radius)))
421 multiplier_from_distance = (1 -
423 min(1, (distance_to_hit / distance_to_end))
430 WEP_CVAR(shockwave, blast_splash_multiplier_min),
432 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_splash_multiplier_accuracy))
434 (multiplier_from_distance * WEP_CVAR(shockwave, blast_splash_multiplier_distance))
438 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
441 (WEP_CVAR(shockwave, blast_splash_damage) * multiplier)
443 (WEP_CVAR(shockwave, blast_splash_edgedamage) * (1 - multiplier))
446 // figure out the direction of force
447 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_splash_force_forwardbias));
448 if (autocvar_g_player_damageplayercenter)
450 //if (head == actor) // was checked for already, is false
451 //final_force = normalize(CENTER_OR_VIEWOFS(actor) + '0 0 actor.(weaponentity).movedir.z' - (attack_hitpos - final_force));
452 //else // use target's bbox centerpoint
453 final_force = normalize((head.origin + ((head.mins + head.maxs) * 0.5)) - (attack_hitpos - final_force));
457 // if it's a player, use the view origin as reference
458 final_force = normalize(CENTER_OR_VIEWOFS(head) - (attack_hitpos - final_force));
460 //te_lightning2(NULL, attack_hitpos, (attack_hitpos + (final_force * 200)));
462 // now multiply the direction by force units
463 final_force *= (WEP_CVAR(shockwave, blast_splash_force) * multiplier);
464 final_force.z *= WEP_CVAR(shockwave, blast_force_zscale);
466 // queue damage with this calculated info
467 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
469 #ifdef DEBUG_SHOCKWAVE
471 "SPLASH HIT: multiplier = %f, damage = %f, force = %f... "
472 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
476 multiplier_from_accuracy,
477 multiplier_from_distance
486 head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(shockwave, blast_distance), false);
489 if((head != actor) && head.takedamage)
491 // ========================
492 // BLAST CONE CALCULATION
493 // ========================
495 if (autocvar_g_player_damageplayercenter)
497 //if (head == actor) // was checked for already, is false
498 //center = CENTER_OR_VIEWOFS(actor) + '0 0 actor.(weaponentity).movedir.z';
499 //else // use target's bbox centerpoint
500 center = head.origin + ((head.mins + head.maxs) * 0.5);
504 // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in damage.qc)
505 center = CENTER_OR_VIEWOFS(head);
508 // find the closest point on the enemy to the center of the attack
509 float h; // hypotenuse, which is the distance between attacker to head
510 float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
512 h = vlen(center - actor.origin);
513 a = h * (normalize(center - actor.origin) * w_shotdir);
514 // WEAPONTODO: replace with simpler method
516 vector nearest_on_line = (w_shotorg + a * w_shotdir);
517 vector nearest_to_attacker = NearestPointOnBoundingBox(center + head.mins, center + head.maxs, nearest_on_line);
519 if((vdist(head.WarpZone_findradius_dist, <=, WEP_CVAR(shockwave, blast_distance)))
520 && (W_Shockwave_Attack_IsVisible(actor, head, nearest_on_line, w_shotorg, attack_endpos)))
522 // calculate importance of distance and accuracy for this attack
523 multiplier_from_accuracy = (1 -
524 W_Shockwave_Attack_CheckSpread(
531 multiplier_from_distance = (1 -
533 min(1, (vlen(head.WarpZone_findradius_dist) / distance_to_end))
540 WEP_CVAR(shockwave, blast_multiplier_min),
542 (multiplier_from_accuracy * WEP_CVAR(shockwave, blast_multiplier_accuracy))
544 (multiplier_from_distance * WEP_CVAR(shockwave, blast_multiplier_distance))
548 // calculate damage from multiplier: 1 = "highest" damage, 0 = "lowest" edgedamage
551 (WEP_CVAR(shockwave, blast_damage) * multiplier)
553 (WEP_CVAR(shockwave, blast_edgedamage) * (1 - multiplier))
556 // figure out the direction of force
557 final_force = (w_shotdir * WEP_CVAR(shockwave, blast_force_forwardbias));
558 final_force = normalize(center - (nearest_on_line - final_force));
559 //te_lightning2(NULL, nearest_on_line, (attack_hitpos + (final_force * 200)));
561 // now multiply the direction by force units
562 final_force *= (WEP_CVAR(shockwave, blast_force) * multiplier);
563 final_force.z *= WEP_CVAR(shockwave, blast_force_zscale);
565 // queue damage with this calculated info
566 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
568 #ifdef DEBUG_SHOCKWAVE
570 "BLAST HIT: multiplier = %f, damage = %f, force = %f... "
571 "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
575 multiplier_from_accuracy,
576 multiplier_from_distance
584 for(i = 1; i <= queue; ++i)
586 head = shockwave_hit[i-1];
587 final_force = shockwave_hit_force[i-1];
588 final_damage = shockwave_hit_damage[i-1];
601 if(accuracy_isgooddamage(actor, head))
602 accuracy_add(actor, thiswep, 0, final_damage);
604 #ifdef DEBUG_SHOCKWAVE
606 "SHOCKWAVE by %s: damage = %f, force = %f.",
613 shockwave_hit[i-1] = NULL;
614 shockwave_hit_force[i-1] = '0 0 0';
615 shockwave_hit_damage[i-1] = 0;
619 antilag_restore_all(actor);
622 METHOD(Shockwave, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
624 if(vdist(actor.origin - actor.enemy.origin, <=, WEP_CVAR(shockwave, melee_range)))
625 { PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false, false); }
627 { PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, weaponentity, 1000000, 0, 0.001, false, false); }
629 METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
633 if(time >= actor.(weaponentity).shockwave_blasttime) // handle refire separately so the secondary can be fired straight after a primary
635 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(shockwave, blast_animtime)))
637 W_Shockwave_Attack(thiswep, actor, weaponentity);
638 actor.(weaponentity).shockwave_blasttime = time + WEP_CVAR(shockwave, blast_refire) * W_WeaponRateFactor(actor);
639 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(shockwave, blast_animtime), w_ready);
645 //if(actor.clip_load >= 0) // we are not currently reloading
646 if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR(shockwave, melee_refire)))
648 // attempt forcing playback of the anim by switching to another anim (that we never play) here...
649 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shockwave_Melee);
653 METHOD(Shockwave, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
655 return true; // infinite ammo
657 METHOD(Shockwave, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
659 // shockwave has infinite ammo
662 METHOD(Shockwave, wr_suicidemessage, Notification(entity thiswep))
664 return WEAPON_THINKING_WITH_PORTALS;
666 METHOD(Shockwave, wr_killmessage, Notification(entity thiswep))
668 if(w_deathtype & HITTYPE_SECONDARY)
669 return WEAPON_SHOCKWAVE_MURDER_SLAP;
671 return WEAPON_SHOCKWAVE_MURDER;
676 // WEAPONTODO: add client side settings for these
677 const float SW_MAXALPHA = 0.5;
678 const float SW_FADETIME = 0.4;
679 const float SW_DISTTOMIN = 200;
680 void Draw_Shockwave(entity this)
682 // fading/removal control
683 float a = bound(0, (SW_MAXALPHA - ((time - this.sw_time) / SW_FADETIME)), SW_MAXALPHA);
684 if(a < ALPHA_MIN_VISIBLE) { delete(this); }
686 // WEAPONTODO: save this only once when creating the entity
687 vector sw_color = entcs_GetColor(this.sv_entnum - 1); // Team_ColorRGB(entcs_GetTeam(this.sv_entnum));
689 // WEAPONTODO: trace to find what we actually hit
690 vector endpos = (this.sw_shotorg + (this.sw_shotdir * this.sw_distance));
692 vector _forward, right, up;
693 VECTOR_VECTORS(this.sw_shotdir, _forward, right, up);
695 // WEAPONTODO: combine and simplify these calculations
696 vector min_end = ((this.sw_shotorg + (this.sw_shotdir * SW_DISTTOMIN)) + (up * this.sw_spread_min));
697 vector max_end = (endpos + (up * this.sw_spread_max));
698 float spread_to_min = vlen(normalize(min_end - this.sw_shotorg) - this.sw_shotdir);
699 float spread_to_max = vlen(normalize(max_end - min_end) - this.sw_shotdir);
701 vector first_min_end = '0 0 0', prev_min_end = '0 0 0', new_min_end = '0 0 0';
702 vector first_max_end = '0 0 0', prev_max_end = '0 0 0', new_max_end = '0 0 0';
703 float new_max_dist, new_min_dist;
705 vector deviation, angle = '0 0 0';
706 float counter, divisions = 20;
707 for(counter = 0; counter < divisions; ++counter)
709 // perfect circle effect lines
710 makevectors('0 360 0' * (0.75 + (counter - 0.5) / divisions));
711 angle.y = v_forward.x;
712 angle.z = v_forward.y;
714 // first do the spread_to_min effect
715 deviation = angle * spread_to_min;
716 deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
717 new_min_dist = SW_DISTTOMIN;
718 new_min_end = (this.sw_shotorg + (deviation * new_min_dist));
719 //te_lightning2(NULL, new_min_end, this.sw_shotorg);
721 // then calculate spread_to_max effect
722 deviation = angle * spread_to_max;
723 deviation = ((this.sw_shotdir + (right * deviation.y) + (up * deviation.z)));
724 new_max_dist = vlen(new_min_end - endpos);
725 new_max_end = (new_min_end + (deviation * new_max_dist));
726 //te_lightning2(NULL, new_end, prev_min_end);
731 first_min_end = new_min_end;
732 first_max_end = new_max_end;
737 // draw from shot origin to min spread radius
738 R_BeginPolygon("", DRAWFLAG_NORMAL, false);
739 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
740 R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
741 R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
744 // draw from min spread radius to max spread radius
745 R_BeginPolygon("", DRAWFLAG_NORMAL, false);
746 R_PolygonVertex(new_min_end, '0 0 0', sw_color, a);
747 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
748 R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
749 R_PolygonVertex(new_max_end, '0 0 0', sw_color, a);
753 prev_min_end = new_min_end;
754 prev_max_end = new_max_end;
756 // last division only
757 if((counter + 1) == divisions)
759 // draw from shot origin to min spread radius
760 R_BeginPolygon("", DRAWFLAG_NORMAL, false);
761 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
762 R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
763 R_PolygonVertex(this.sw_shotorg, '0 0 0', sw_color, a);
766 // draw from min spread radius to max spread radius
767 R_BeginPolygon("", DRAWFLAG_NORMAL, false);
768 R_PolygonVertex(first_min_end, '0 0 0', sw_color, a);
769 R_PolygonVertex(prev_min_end, '0 0 0', sw_color, a);
770 R_PolygonVertex(prev_max_end, '0 0 0', sw_color, a);
771 R_PolygonVertex(first_max_end, '0 0 0', sw_color, a);
777 NET_HANDLE(TE_CSQC_SHOCKWAVEPARTICLE, bool isNew)
779 Net_ReadShockwaveParticle();
783 void Net_ReadShockwaveParticle()
785 entity shockwave = new(shockwave_cone);
786 shockwave.draw = Draw_Shockwave;
787 IL_PUSH(g_drawables, shockwave);
789 shockwave.sw_shotorg = ReadVector();
790 shockwave.sw_shotdir = ReadVector();
792 shockwave.sw_distance = ReadShort();
793 shockwave.sw_spread_max = ReadByte();
794 shockwave.sw_spread_min = ReadByte();
796 shockwave.sv_entnum = ReadByte();
798 shockwave.sw_time = time;
801 METHOD(Shockwave, wr_impacteffect, void(entity thiswep, entity actor))
803 // handled by Net_ReadShockwaveParticle
804 //vector org2 = w_org + w_backoff * 2;
805 //pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);