5 /* ammotype */ ammo_cells,
7 /* flags */ WEP_FLAG_NORMAL,
8 /* rating */ BOT_PICKUP_RATING_HIGH,
10 /* modelname */ "arc",
11 /* simplemdl */ "foobar",
12 /* crosshair */ "gfx/crosshairhlac 0.7",
13 /* wepimg */ "weaponarc",
15 /* wepname */ _("Arc")
18 #define ARC_SETTINGS(w_cvar,w_prop) ARC_SETTINGS_LIST(w_cvar, w_prop, ARC, arc)
19 #define ARC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
20 w_cvar(id, sn, NONE, beam_ammo) \
21 w_cvar(id, sn, NONE, beam_animtime) \
22 w_cvar(id, sn, NONE, beam_botaimspeed) \
23 w_cvar(id, sn, NONE, beam_botaimlifetime) \
24 w_cvar(id, sn, NONE, beam_damage) \
25 w_cvar(id, sn, NONE, beam_degreespersegment) \
26 w_cvar(id, sn, NONE, beam_distancepersegment) \
27 w_cvar(id, sn, NONE, beam_falloff_halflifedist) \
28 w_cvar(id, sn, NONE, beam_falloff_maxdist) \
29 w_cvar(id, sn, NONE, beam_falloff_mindist) \
30 w_cvar(id, sn, NONE, beam_force) \
31 w_cvar(id, sn, NONE, beam_healing_amax) \
32 w_cvar(id, sn, NONE, beam_healing_aps) \
33 w_cvar(id, sn, NONE, beam_healing_hmax) \
34 w_cvar(id, sn, NONE, beam_healing_hps) \
35 w_cvar(id, sn, NONE, beam_maxangle) \
36 w_cvar(id, sn, NONE, beam_nonplayerdamage) \
37 w_cvar(id, sn, NONE, beam_range) \
38 w_cvar(id, sn, NONE, beam_refire) \
39 w_cvar(id, sn, NONE, beam_returnspeed) \
40 w_cvar(id, sn, NONE, beam_tightness) \
41 w_cvar(id, sn, NONE, burst_ammo) \
42 w_cvar(id, sn, NONE, burst_damage) \
43 w_cvar(id, sn, NONE, burst_healing_aps) \
44 w_cvar(id, sn, NONE, burst_healing_hps) \
45 w_cvar(id, sn, NONE, overheat_max)/* maximum heat before jamming */ \
46 w_cvar(id, sn, NONE, overheat_min)/* minimum heat to wait for cooldown */ \
47 w_cvar(id, sn, NONE, beam_heat) /* heat increase per second (primary) */ \
48 w_cvar(id, sn, NONE, burst_heat) /* heat increase per second (secondary) */ \
49 w_cvar(id, sn, NONE, cooldown) /* heat decrease per second when resting */ \
50 w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
51 w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
52 w_prop(id, sn, string, weaponreplace, weaponreplace) \
53 w_prop(id, sn, float, weaponstart, weaponstart) \
54 w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
55 w_prop(id, sn, float, weaponthrowable, weaponthrowable)
58 const float ARC_MAX_SEGMENTS = 20;
59 vector arc_shotorigin[4];
65 const int ARC_BT_MISS = 0x00;
66 const int ARC_BT_WALL = 0x01;
67 const int ARC_BT_HEAL = 0x02;
68 const int ARC_BT_HIT = 0x03;
69 const int ARC_BT_BURST_MISS = 0x10;
70 const int ARC_BT_BURST_WALL = 0x11;
71 const int ARC_BT_BURST_HEAL = 0x12;
72 const int ARC_BT_BURST_HIT = 0x13;
73 const int ARC_BT_BURSTMASK = 0x10;
75 const int ARC_SF_SETTINGS = 1;
76 const int ARC_SF_START = 2;
77 const int ARC_SF_WANTDIR = 4;
78 const int ARC_SF_BEAMDIR = 8;
79 const int ARC_SF_BEAMTYPE = 16;
80 const int ARC_SF_LOCALMASK = 14;
83 ARC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
85 .float arc_BUTTON_ATCK_prev; // for better animation control
87 .float beam_initialized;
89 .float beam_teleporttime;
90 .float beam_heat; // (beam) amount of heat produced
91 .float arc_overheat; // (dropped arc/player) time during which it's too hot
92 .float arc_cooldown; // (dropped arc/player) cooling speed
93 .float arc_heat_percent; // (player) arc heat in [0,1] (stat)
94 .float arc_smoke_sound;
97 void Ent_ReadArcBeam(float isnew);
101 .float beam_thickness;
102 .float beam_traileffect;
103 .float beam_hiteffect;
104 .float beam_hitlight[4]; // 0: radius, 123: rgb
105 .float beam_muzzleeffect;
106 .float beam_muzzlelight[4]; // 0: radius, 123: rgb
109 .entity beam_muzzleentity;
111 .float beam_degreespersegment;
112 .float beam_distancepersegment;
113 .float beam_usevieworigin;
114 .float beam_initialized;
115 .float beam_maxangle;
117 .float beam_returnspeed;
118 .float beam_tightness;
119 .vector beam_shotorigin;
121 entity Draw_ArcBeam_callback_entity;
122 float Draw_ArcBeam_callback_last_thickness;
123 vector Draw_ArcBeam_callback_last_top; // NOTE: in same coordinate system as player.
124 vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as player.
128 void spawnfunc_weapon_arc(void) { weapon_defaultspawnfunc(WEP_ARC); }
130 float W_Arc_Beam_Send(entity to, int sf)
132 WriteByte(MSG_ENTITY, ENT_CLIENT_ARC_BEAM);
134 // Truncate information when this beam is displayed to the owner client
135 // - The owner client has no use for beam start position or directions,
136 // it always figures this information out for itself with csqc code.
137 // - Spectating the owner also truncates this information.
138 float drawlocal = ((to == self.owner) || ((to.enemy == self.owner) && IS_SPEC(to)));
139 if(drawlocal) { sf &= ~ARC_SF_LOCALMASK; }
141 WriteByte(MSG_ENTITY, sf);
143 if(sf & ARC_SF_SETTINGS) // settings information
145 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_degreespersegment));
146 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_distancepersegment));
147 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_maxangle));
148 WriteCoord(MSG_ENTITY, WEP_CVAR(arc, beam_range));
149 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_returnspeed));
150 WriteByte(MSG_ENTITY, WEP_CVAR(arc, beam_tightness) * 10);
152 WriteByte(MSG_ENTITY, drawlocal);
154 if(sf & ARC_SF_START) // starting location
156 WriteCoord(MSG_ENTITY, self.beam_start.x);
157 WriteCoord(MSG_ENTITY, self.beam_start.y);
158 WriteCoord(MSG_ENTITY, self.beam_start.z);
160 if(sf & ARC_SF_WANTDIR) // want/aim direction
162 WriteCoord(MSG_ENTITY, self.beam_wantdir.x);
163 WriteCoord(MSG_ENTITY, self.beam_wantdir.y);
164 WriteCoord(MSG_ENTITY, self.beam_wantdir.z);
166 if(sf & ARC_SF_BEAMDIR) // beam direction
168 WriteCoord(MSG_ENTITY, self.beam_dir.x);
169 WriteCoord(MSG_ENTITY, self.beam_dir.y);
170 WriteCoord(MSG_ENTITY, self.beam_dir.z);
172 if(sf & ARC_SF_BEAMTYPE) // beam type
174 WriteByte(MSG_ENTITY, self.beam_type);
180 void Reset_ArcBeam(entity player, vector forward)
182 if (!player.arc_beam) {
185 player.arc_beam.beam_dir = forward;
186 player.arc_beam.beam_teleporttime = time;
189 float Arc_GetHeat_Percent(entity player)
191 if ( WEP_CVAR(arc, overheat_max) <= 0 || WEP_CVAR(arc, overheat_max) <= 0 )
193 player.arc_overheat = 0;
197 if ( player.arc_beam )
198 return player.arc_beam.beam_heat/WEP_CVAR(arc, overheat_max);
200 if ( player.arc_overheat > time )
202 return (player.arc_overheat-time) / WEP_CVAR(arc, overheat_max)
203 * player.arc_cooldown;
208 void Arc_Player_SetHeat(entity player)
210 player.arc_heat_percent = Arc_GetHeat_Percent(player);
211 //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
214 void W_Arc_Beam_Think(void)
216 if(self != self.owner.arc_beam)
224 if( self.owner.BUTTON_ATCK2 || self.beam_bursting)
226 if(!self.beam_bursting)
227 self.beam_bursting = true;
228 burst = ARC_BT_BURSTMASK;
232 !IS_PLAYER(self.owner)
234 (self.owner.WEP_AMMO(ARC) <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
236 self.owner.deadflag != DEAD_NO
238 (!self.owner.BUTTON_ATCK && !burst )
244 (WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max))
247 if ( WEP_CVAR(arc, cooldown) > 0 )
249 float cooldown_speed = 0;
250 if ( self.beam_heat > WEP_CVAR(arc, overheat_min) && WEP_CVAR(arc, cooldown) > 0 )
252 cooldown_speed = WEP_CVAR(arc, cooldown);
256 cooldown_speed = self.beam_heat / WEP_CVAR(arc, beam_refire);
259 if ( cooldown_speed )
261 self.owner.arc_overheat = time + self.beam_heat / cooldown_speed;
262 self.owner.arc_cooldown = cooldown_speed;
265 if ( WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max) )
267 pointparticles( particleeffectnum("arc_overheat"),
268 self.beam_start, self.beam_wantdir, 1 );
269 sound(self, CH_WEAPON_A, "weapons/arc_stop.wav", VOL_BASE, ATTN_NORM);
273 if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
274 entity oldself = self;
276 if(!WEP_ACTION(WEP_ARC, WR_CHECKAMMO1) && !WEP_ACTION(WEP_ARC, WR_CHECKAMMO2))
277 if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
279 // note: this doesn't force the switch
280 W_SwitchToOtherWeapon(self);
288 float coefficient = frametime;
289 if(!(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
293 { rootammo = WEP_CVAR(arc, burst_ammo); }
295 { rootammo = WEP_CVAR(arc, beam_ammo); }
299 coefficient = min(coefficient, self.owner.WEP_AMMO(ARC) / rootammo);
300 self.owner.WEP_AMMO(ARC) = max(0, self.owner.WEP_AMMO(ARC) - (rootammo * frametime));
303 float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat);
304 self.beam_heat = min( WEP_CVAR(arc, overheat_max), self.beam_heat + heat_speed*frametime );
306 makevectors(self.owner.v_angle);
314 WEP_CVAR(arc, beam_damage) * coefficient,
315 WEP_CVAR(arc, beam_range)
318 // After teleport, "lock" the beam until the teleport is confirmed.
319 if (time < self.beam_teleporttime + ANTILAG_LATENCY(self.owner)) {
320 w_shotdir = self.beam_dir;
323 // network information: shot origin and want/aim direction
324 if(self.beam_start != w_shotorg)
326 self.SendFlags |= ARC_SF_START;
327 self.beam_start = w_shotorg;
329 if(self.beam_wantdir != w_shotdir)
331 self.SendFlags |= ARC_SF_WANTDIR;
332 self.beam_wantdir = w_shotdir;
335 if(!self.beam_initialized)
337 self.beam_dir = w_shotdir;
338 self.beam_initialized = true;
341 // WEAPONTODO: Detect player velocity so that the beam curves when moving too
342 // idea: blend together self.beam_dir with the inverted direction the player is moving in
343 // might have to make some special accomodation so that it only uses view_right and view_up
345 // note that if we do this, it'll always be corrected to a maximum angle by beam_maxangle handling
348 if(self.beam_dir != w_shotdir)
350 // calculate how much we're going to move the end of the beam to the want position
351 // WEAPONTODO (server and client):
352 // blendfactor never actually becomes 0 in this situation, which is a problem
353 // regarding precision... this means that self.beam_dir and w_shotdir approach
354 // eachother, however they never actually become the same value with this method.
355 // Perhaps we should do some form of rounding/snapping?
356 float angle = vlen(w_shotdir - self.beam_dir) * RAD2DEG;
357 if(angle && (angle > WEP_CVAR(arc, beam_maxangle)))
359 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
360 float blendfactor = bound(
362 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
363 min(WEP_CVAR(arc, beam_maxangle) / angle, 1)
365 self.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
369 // the radius is not too far yet, no worries :D
370 float blendfactor = bound(
372 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
375 self.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
378 // network information: beam direction
379 self.SendFlags |= ARC_SF_BEAMDIR;
381 // calculate how many segments are needed
382 float max_allowed_segments;
384 if(WEP_CVAR(arc, beam_distancepersegment))
386 max_allowed_segments = min(
388 1 + (vlen(w_shotdir / WEP_CVAR(arc, beam_distancepersegment)))
391 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
393 if(WEP_CVAR(arc, beam_degreespersegment))
400 WEP_CVAR(arc, beam_maxangle)
403 WEP_CVAR(arc, beam_degreespersegment)
408 else { segments = 1; }
410 else { segments = 1; }
412 vector beam_endpos = (w_shotorg + (self.beam_dir * WEP_CVAR(arc, beam_range)));
413 vector beam_controlpoint = w_shotorg + w_shotdir * (WEP_CVAR(arc, beam_range) * (1 - WEP_CVAR(arc, beam_tightness)));
416 float new_beam_type = 0;
417 vector last_origin = w_shotorg;
418 for(i = 1; i <= segments; ++i)
420 // WEAPONTODO (client):
421 // In order to do nice fading and pointing on the starting segment, we must always
422 // have that drawn as a separate triangle... However, that is difficult to do when
423 // keeping in mind the above problems and also optimizing the amount of segments
424 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
426 vector new_origin = bezier_quadratic_getpoint(
431 vector new_dir = normalize(new_origin - last_origin);
433 WarpZone_traceline_antilag(
439 ANTILAG_LATENCY(self.owner)
442 // Do all the transforms for warpzones right now, as we already
443 // "are" in the post-trace system (if we hit a player, that's
444 // always BEHIND the last passed wz).
445 last_origin = trace_endpos;
446 w_shotorg = WarpZone_TransformOrigin(WarpZone_trace_transform, w_shotorg);
447 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
448 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
449 new_dir = WarpZone_TransformVelocity(WarpZone_trace_transform, new_dir);
452 trace_ent.classname == "player"
454 trace_ent.classname == "body"
456 (trace_ent.flags & FL_MONSTER)
459 if(trace_ent && trace_ent.takedamage && (is_player || WEP_CVAR(arc, beam_nonplayerdamage)))
461 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
462 // NO. trace_endpos should be just fine. If not,
463 // that's an engine bug that needs proper debugging.
464 vector hitorigin = trace_endpos;
466 float falloff = ExponentialFalloff(
467 WEP_CVAR(arc, beam_falloff_mindist),
468 WEP_CVAR(arc, beam_falloff_maxdist),
469 WEP_CVAR(arc, beam_falloff_halflifedist),
470 vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, hitorigin) - w_shotorg)
473 if(is_player && SAME_TEAM(self.owner, trace_ent))
475 float roothealth, rootarmor;
478 roothealth = WEP_CVAR(arc, burst_healing_hps);
479 rootarmor = WEP_CVAR(arc, burst_healing_aps);
483 roothealth = WEP_CVAR(arc, beam_healing_hps);
484 rootarmor = WEP_CVAR(arc, beam_healing_aps);
487 if(trace_ent.health <= WEP_CVAR(arc, beam_healing_hmax) && roothealth)
489 trace_ent.health = min(
490 trace_ent.health + (roothealth * coefficient),
491 WEP_CVAR(arc, beam_healing_hmax)
494 if(trace_ent.armorvalue <= WEP_CVAR(arc, beam_healing_amax) && rootarmor)
496 trace_ent.armorvalue = min(
497 trace_ent.armorvalue + (rootarmor * coefficient),
498 WEP_CVAR(arc, beam_healing_amax)
502 // stop rot, set visual effect
503 if(roothealth || rootarmor)
505 trace_ent.pauserothealth_finished = max(
506 trace_ent.pauserothealth_finished,
507 time + autocvar_g_balance_pause_health_rot
509 trace_ent.pauserotarmor_finished = max(
510 trace_ent.pauserotarmor_finished,
511 time + autocvar_g_balance_pause_armor_rot
513 new_beam_type = ARC_BT_HEAL;
522 { rootdamage = WEP_CVAR(arc, burst_damage); }
524 { rootdamage = WEP_CVAR(arc, beam_damage); }
527 { rootdamage = WEP_CVAR(arc, beam_nonplayerdamage); }
529 if(accuracy_isgooddamage(self.owner, trace_ent))
535 rootdamage * coefficient * falloff
543 rootdamage * coefficient * falloff,
546 WEP_CVAR(arc, beam_force) * new_dir * coefficient * falloff
549 new_beam_type = ARC_BT_HIT;
553 else if(trace_fraction != 1)
555 // we collided with geometry
556 new_beam_type = ARC_BT_WALL;
561 // te_explosion(trace_endpos);
563 // if we're bursting, use burst visual effects
564 new_beam_type |= burst;
566 // network information: beam type
567 if(new_beam_type != self.beam_type)
569 self.SendFlags |= ARC_SF_BEAMTYPE;
570 self.beam_type = new_beam_type;
573 self.owner.beam_prev = time;
574 self.nextthink = time;
577 void W_Arc_Beam(float burst)
580 // only play fire sound if 1 sec has passed since player let go the fire button
581 if(time - self.beam_prev > 1)
583 sound(self, CH_WEAPON_A, "weapons/arc_fire.wav", VOL_BASE, ATTN_NORM);
586 entity beam = self.arc_beam = spawn();
587 beam.classname = "W_Arc_Beam";
588 beam.solid = SOLID_NOT;
589 beam.think = W_Arc_Beam_Think;
591 beam.movetype = MOVETYPE_NONE;
592 beam.bot_dodge = true;
593 beam.bot_dodgerating = WEP_CVAR(arc, beam_damage);
594 beam.beam_bursting = burst;
595 Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
597 entity oldself = self;
605 makevectors(self.v_angle);
606 W_SetupShot_Range(self,true,0,"",0,0,0);
608 vector smoke_origin = w_shotorg + self.velocity*frametime;
609 if ( self.arc_overheat > time )
611 if ( random() < self.arc_heat_percent )
612 pointparticles( particleeffectnum("arc_smoke"), smoke_origin, '0 0 0', 1 );
613 if ( self.BUTTON_ATCK || self.BUTTON_ATCK2 )
615 pointparticles( particleeffectnum("arc_overheat_fire"), smoke_origin, w_shotdir, 1 );
616 if ( !self.arc_smoke_sound )
618 self.arc_smoke_sound = 1;
619 sound(self, CH_SHOTS_SINGLE, "weapons/arc_loop_overheat.wav", VOL_BASE, ATTN_NORM);
623 else if ( self.arc_beam && WEP_CVAR(arc, overheat_max) > 0 &&
624 self.arc_beam.beam_heat > WEP_CVAR(arc, overheat_min) )
626 if ( random() < (self.arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) /
627 ( WEP_CVAR(arc, overheat_max)-WEP_CVAR(arc, overheat_min) ) )
628 pointparticles( particleeffectnum("arc_smoke"), smoke_origin, '0 0 0', 1 );
631 if ( self.arc_smoke_sound && ( self.arc_overheat <= time ||
632 !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || self.switchweapon != WEP_ARC )
634 self.arc_smoke_sound = 0;
635 sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM);
645 if(WEP_CVAR(arc, beam_botaimspeed))
647 self.BUTTON_ATCK = bot_aim(
648 WEP_CVAR(arc, beam_botaimspeed),
650 WEP_CVAR(arc, beam_botaimlifetime),
656 self.BUTTON_ATCK = bot_aim(
667 Arc_Player_SetHeat(self);
670 if ( self.arc_overheat <= time )
671 if(self.BUTTON_ATCK || self.BUTTON_ATCK2 || self.arc_beam.beam_bursting )
674 if(self.arc_BUTTON_ATCK_prev)
677 if(self.animstate_startframe == self.anim_shoot.x && self.animstate_numframes == self.anim_shoot.y)
678 weapon_thinkf(WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
681 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
684 if((!self.arc_beam) || wasfreed(self.arc_beam))
686 if(weapon_prepareattack(!!self.BUTTON_ATCK2, 0))
688 W_Arc_Beam(!!self.BUTTON_ATCK2);
690 if(!self.arc_BUTTON_ATCK_prev)
692 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
693 self.arc_BUTTON_ATCK_prev = 1;
701 if(self.arc_BUTTON_ATCK_prev != 0)
703 sound(self, CH_WEAPON_A, "weapons/arc_stop.wav", VOL_BASE, ATTN_NORM);
704 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
705 ATTACK_FINISHED(self) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
707 self.arc_BUTTON_ATCK_prev = 0;
710 if(self.BUTTON_ATCK2)
711 if(weapon_prepareattack(1, autocvar_g_balance_arc_secondary_refire))
714 self.arc_count = autocvar_g_balance_arc_secondary_count;
715 weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
716 self.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
724 precache_model("models/weapons/g_arc.md3");
725 precache_model("models/weapons/v_arc.md3");
726 precache_model("models/weapons/h_arc.iqm");
727 precache_sound("weapons/arc_fire.wav");
728 precache_sound("weapons/arc_loop.wav");
729 precache_sound("weapons/arc_stop.wav");
730 precache_sound("weapons/arc_loop_overheat.wav");
731 if(!arc_shotorigin[0])
733 arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 1);
734 arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 2);
735 arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 3);
736 arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 4);
738 ARC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
743 return ((!WEP_CVAR(arc, beam_ammo)) || (self.WEP_AMMO(ARC) > 0));
747 return WEP_CVAR(arc, overheat_max) > 0 &&
748 ((!WEP_CVAR(arc, burst_ammo)) || (self.WEP_AMMO(ARC) > 0));
752 ARC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
757 return WEAPON_ARC_MURDER;
761 weapon_dropevent_item.arc_overheat = self.arc_overheat;
762 weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
763 self.arc_overheat = 0;
764 self.arc_cooldown = 0;
769 if ( !client_hasweapon(self, WEP_ARC, false, false) &&
770 weapon_dropevent_item.arc_overheat > time )
772 self.arc_overheat = weapon_dropevent_item.arc_overheat;
773 self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
782 void Draw_ArcBeam_callback(vector start, vector hit, vector end)
784 entity beam = Draw_ArcBeam_callback_entity;
785 vector transformed_view_org;
786 transformed_view_org = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
788 // Thickdir shall be perpendicular to the beam and to the view-to-beam direction (WEAPONTODO: WHY)
789 // WEAPONTODO: Wouldn't it be better to be perpendicular to the beam and to the view FORWARD direction?
790 vector thickdir = normalize(cross(normalize(start - hit), transformed_view_org - start));
796 if(trace_fraction != 1)
798 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
799 hitorigin = start + (Draw_ArcBeam_callback_new_dir * Draw_ArcBeam_callback_segmentdist * trace_fraction);
800 hitorigin = WarpZone_TransformOrigin(WarpZone_trace_transform, hitorigin);
810 // decide upon thickness
811 float thickness = beam.beam_thickness;
813 // draw primary beam render
814 vector top = hitorigin + (thickdir * thickness);
815 vector bottom = hitorigin - (thickdir * thickness);
817 vector last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
818 vector last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
820 R_BeginPolygon(beam.beam_image, DRAWFLAG_NORMAL); // DRAWFLAG_ADDITIVE
823 '0 0.5 0' + ('0 0.5 0' * (thickness / beam.beam_thickness)),
829 '0 0.5 0' + ('0 0.5 0' * (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
835 '0 0.5 0' * (1 - (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
841 '0 0.5 0' * (1 - (thickness / beam.beam_thickness)),
847 // draw trailing particles
849 // - Don't use spammy particle counts here, use a FEW small particles around the beam
850 // - We're not using WarpZone_TrailParticles here because we will handle warpzones ourselves.
851 if(beam.beam_traileffect)
853 trailparticles(beam, beam.beam_traileffect, start, hitorigin);
856 // set up for the next
857 Draw_ArcBeam_callback_last_thickness = thickness;
858 Draw_ArcBeam_callback_last_top = WarpZone_UnTransformOrigin(WarpZone_trace_transform, top);
859 Draw_ArcBeam_callback_last_bottom = WarpZone_UnTransformOrigin(WarpZone_trace_transform, bottom);
862 void Reset_ArcBeam(void)
865 for (e = world; (e = findfloat(e, beam_usevieworigin, 1)); ) {
866 e.beam_initialized = false;
868 for (e = world; (e = findfloat(e, beam_usevieworigin, 2)); ) {
869 e.beam_initialized = false;
873 void Draw_ArcBeam(void)
875 float dt = time - self.move_time;
876 self.move_time = time;
877 if(dt <= 0) { return; }
879 if(!self.beam_usevieworigin)
881 InterpolateOrigin_Do();
884 // origin = beam starting origin
885 // v_angle = wanted/aim direction
886 // angles = current direction of beam
889 vector wantdir; //= view_forward;
890 vector beamdir; //= self.beam_dir;
893 if(self.beam_usevieworigin)
896 // Currently we have to replicate nearly the same method of figuring
897 // out the shotdir that the server does... Ideally in the future we
898 // should be able to acquire this from a generalized function built
899 // into a weapon system for client code.
901 // find where we are aiming
902 makevectors(warpzone_save_view_angles);
903 vector forward = v_forward;
904 vector right = v_right;
907 // decide upon start position
908 if(self.beam_usevieworigin == 2)
909 { start_pos = warpzone_save_view_origin; }
911 { start_pos = self.origin; }
913 // trace forward with an estimation
916 start_pos + forward * self.beam_range,
921 // untransform in case our trace went through a warpzone
922 vector end_pos = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
924 // un-adjust trueaim if shotend is too close
925 if(vlen(end_pos - start_pos) < g_trueaim_minrange)
926 end_pos = start_pos + (forward * g_trueaim_minrange);
928 // move shot origin to the actual gun muzzle origin
929 vector origin_offset =
930 right * -self.beam_shotorigin.y
931 + up * self.beam_shotorigin.z;
933 start_pos = start_pos + origin_offset;
935 // Move it also forward, but only as far as possible without hitting anything. Don't poke into walls!
936 traceline(start_pos, start_pos + forward * self.beam_shotorigin.x, MOVE_NORMAL, self);
937 start_pos = trace_endpos;
939 // calculate the aim direction now
940 wantdir = normalize(end_pos - start_pos);
942 if(!self.beam_initialized)
944 self.beam_dir = wantdir;
945 self.beam_initialized = true;
948 if(self.beam_dir != wantdir)
950 // calculate how much we're going to move the end of the beam to the want position
951 // WEAPONTODO (server and client):
952 // blendfactor never actually becomes 0 in this situation, which is a problem
953 // regarding precision... this means that self.beam_dir and w_shotdir approach
954 // eachother, however they never actually become the same value with this method.
955 // Perhaps we should do some form of rounding/snapping?
956 float angle = vlen(wantdir - self.beam_dir) * RAD2DEG;
957 if(angle && (angle > self.beam_maxangle))
959 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
960 float blendfactor = bound(
962 (1 - (self.beam_returnspeed * frametime)),
963 min(self.beam_maxangle / angle, 1)
965 self.beam_dir = normalize((wantdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
969 // the radius is not too far yet, no worries :D
970 float blendfactor = bound(
972 (1 - (self.beam_returnspeed * frametime)),
975 self.beam_dir = normalize((wantdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
978 // calculate how many segments are needed
979 float max_allowed_segments;
981 if(self.beam_distancepersegment)
983 max_allowed_segments = min(
985 1 + (vlen(wantdir / self.beam_distancepersegment))
988 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
990 if(self.beam_degreespersegment)
1000 self.beam_degreespersegment
1002 max_allowed_segments
1005 else { segments = 1; }
1007 else { segments = 1; }
1009 // set the beam direction which the rest of the code will refer to
1010 beamdir = self.beam_dir;
1012 // finally, set self.angles to the proper direction so that muzzle attachment points in proper direction
1013 self.angles = fixedvectoangles2(forward, up); // TODO(Samual): is this == warpzone_save_view_angles?
1017 // set the values from the provided info from the networked entity
1018 start_pos = self.origin;
1019 wantdir = self.v_angle;
1020 beamdir = self.angles;
1022 if(beamdir != wantdir)
1024 float angle = vlen(wantdir - beamdir) * RAD2DEG;
1026 // calculate how many segments are needed
1027 float max_allowed_segments;
1029 if(self.beam_distancepersegment)
1031 max_allowed_segments = min(
1033 1 + (vlen(wantdir / self.beam_distancepersegment))
1036 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
1038 if(self.beam_degreespersegment)
1048 self.beam_degreespersegment
1050 max_allowed_segments
1053 else { segments = 1; }
1055 else { segments = 1; }
1058 setorigin(self, start_pos);
1059 self.beam_muzzleentity.angles_z = random() * 360; // WEAPONTODO: use avelocity instead?
1061 vector beam_endpos = (start_pos + (beamdir * self.beam_range));
1062 vector beam_controlpoint = start_pos + wantdir * (self.beam_range * (1 - self.beam_tightness));
1064 Draw_ArcBeam_callback_entity = self;
1065 Draw_ArcBeam_callback_last_thickness = 0;
1066 Draw_ArcBeam_callback_last_top = start_pos;
1067 Draw_ArcBeam_callback_last_bottom = start_pos;
1069 vector last_origin = start_pos;
1070 vector original_start_pos = start_pos;
1073 for(i = 1; i <= segments; ++i)
1075 // WEAPONTODO (client):
1076 // In order to do nice fading and pointing on the starting segment, we must always
1077 // have that drawn as a separate triangle... However, that is difficult to do when
1078 // keeping in mind the above problems and also optimizing the amount of segments
1079 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
1081 vector new_origin = bezier_quadratic_getpoint(
1087 WarpZone_TraceBox_ThroughZone(
1095 Draw_ArcBeam_callback
1098 // Do all the transforms for warpzones right now, as we already "are" in the post-trace
1099 // system (if we hit a player, that's always BEHIND the last passed wz).
1100 last_origin = trace_endpos;
1101 start_pos = WarpZone_TransformOrigin(WarpZone_trace_transform, start_pos);
1102 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
1103 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
1104 beamdir = WarpZone_TransformVelocity(WarpZone_trace_transform, beamdir);
1105 Draw_ArcBeam_callback_last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
1106 Draw_ArcBeam_callback_last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
1108 if(trace_fraction < 1) { break; }
1111 // visual effects for startpoint and endpoint
1112 if(self.beam_hiteffect)
1114 // FIXME we really should do this on the server so it actually
1115 // matches gameplay. What this client side stuff is doing is no
1116 // more than guesswork.
1117 if((trace_ent || trace_fraction < 1) && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
1119 self.beam_hiteffect,
1125 if(self.beam_hitlight[0])
1129 self.beam_hitlight[0],
1131 self.beam_hitlight[1],
1132 self.beam_hitlight[2],
1133 self.beam_hitlight[3]
1137 if(self.beam_muzzleeffect)
1140 self.beam_muzzleeffect,
1141 original_start_pos + wantdir * 20,
1146 if(self.beam_muzzlelight[0])
1149 original_start_pos + wantdir * 20,
1150 self.beam_muzzlelight[0],
1152 self.beam_muzzlelight[1],
1153 self.beam_muzzlelight[2],
1154 self.beam_muzzlelight[3]
1160 Draw_ArcBeam_callback_entity = world;
1161 Draw_ArcBeam_callback_last_thickness = 0;
1162 Draw_ArcBeam_callback_last_top = '0 0 0';
1163 Draw_ArcBeam_callback_last_bottom = '0 0 0';
1166 void Remove_ArcBeam(void)
1168 remove(self.beam_muzzleentity);
1169 sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM);
1172 void Ent_ReadArcBeam(float isnew)
1174 int sf = ReadByte();
1179 // calculate shot origin offset from gun alignment
1180 int gunalign = autocvar_cl_gunalign;
1181 if(gunalign != 1 && gunalign != 2 && gunalign != 4)
1182 gunalign = 3; // default value
1185 self.beam_shotorigin = arc_shotorigin[gunalign];
1187 // set other main attributes of the beam
1188 self.draw = Draw_ArcBeam;
1189 self.entremove = Remove_ArcBeam;
1190 self.move_time = time;
1191 loopsound(self, CH_SHOTS_SINGLE, "weapons/arc_loop.wav", VOL_BASE, ATTEN_NORM);
1195 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT;
1196 flash.drawmask = MASK_NORMAL;
1197 flash.solid = SOLID_NOT;
1198 flash.avelocity_z = 5000;
1199 setattachment(flash, self, "");
1200 setorigin(flash, '0 0 0');
1202 self.beam_muzzleentity = flash;
1206 flash = self.beam_muzzleentity;
1209 if(sf & ARC_SF_SETTINGS) // settings information
1211 self.beam_degreespersegment = ReadShort();
1212 self.beam_distancepersegment = ReadShort();
1213 self.beam_maxangle = ReadShort();
1214 self.beam_range = ReadCoord();
1215 self.beam_returnspeed = ReadShort();
1216 self.beam_tightness = (ReadByte() / 10);
1220 if(autocvar_chase_active)
1221 { self.beam_usevieworigin = 1; }
1222 else // use view origin
1223 { self.beam_usevieworigin = 2; }
1227 self.beam_usevieworigin = 0;
1231 if(!self.beam_usevieworigin)
1233 // self.iflags = IFLAG_ORIGIN | IFLAG_ANGLES | IFLAG_V_ANGLE; // why doesn't this work?
1234 self.iflags = IFLAG_ORIGIN;
1236 InterpolateOrigin_Undo();
1239 if(sf & ARC_SF_START) // starting location
1241 self.origin_x = ReadCoord();
1242 self.origin_y = ReadCoord();
1243 self.origin_z = ReadCoord();
1245 else if(self.beam_usevieworigin) // infer the location from player location
1247 if(self.beam_usevieworigin == 2)
1250 self.origin = view_origin;
1254 // use player origin so that third person display still works
1255 self.origin = getplayerorigin(player_localnum) + ('0 0 1' * getstati(STAT_VIEWHEIGHT));
1259 setorigin(self, self.origin);
1261 if(sf & ARC_SF_WANTDIR) // want/aim direction
1263 self.v_angle_x = ReadCoord();
1264 self.v_angle_y = ReadCoord();
1265 self.v_angle_z = ReadCoord();
1268 if(sf & ARC_SF_BEAMDIR) // beam direction
1270 self.angles_x = ReadCoord();
1271 self.angles_y = ReadCoord();
1272 self.angles_z = ReadCoord();
1275 if(sf & ARC_SF_BEAMTYPE) // beam type
1277 self.beam_type = ReadByte();
1278 switch(self.beam_type)
1282 self.beam_color = '1 1 1';
1283 self.beam_alpha = 0.5;
1284 self.beam_thickness = 8;
1285 self.beam_traileffect = particleeffectnum("arc_beam");
1286 self.beam_hiteffect = particleeffectnum("arc_lightning");
1287 self.beam_hitlight[0] = 0;
1288 self.beam_hitlight[1] = 1;
1289 self.beam_hitlight[2] = 1;
1290 self.beam_hitlight[3] = 1;
1291 self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
1292 self.beam_muzzlelight[0] = 0;
1293 self.beam_muzzlelight[1] = 1;
1294 self.beam_muzzlelight[2] = 1;
1295 self.beam_muzzlelight[3] = 1;
1296 if(self.beam_muzzleeffect >= 0)
1298 setmodel(flash, "models/flash.md3");
1299 flash.alpha = self.beam_alpha;
1300 flash.colormod = self.beam_color;
1305 case ARC_BT_WALL: // grenadelauncher_muzzleflash healray_muzzleflash
1307 self.beam_color = '1 1 1';
1308 self.beam_alpha = 0.5;
1309 self.beam_thickness = 8;
1310 self.beam_traileffect = particleeffectnum("arc_beam");
1311 self.beam_hiteffect = particleeffectnum("arc_lightning");
1312 self.beam_hitlight[0] = 0;
1313 self.beam_hitlight[1] = 1;
1314 self.beam_hitlight[2] = 1;
1315 self.beam_hitlight[3] = 1;
1316 self.beam_muzzleeffect = -1; // particleeffectnum("grenadelauncher_muzzleflash");
1317 self.beam_muzzlelight[0] = 0;
1318 self.beam_muzzlelight[1] = 1;
1319 self.beam_muzzlelight[2] = 1;
1320 self.beam_muzzlelight[3] = 1;
1321 self.beam_image = "particles/lgbeam";
1322 if(self.beam_muzzleeffect >= 0)
1324 setmodel(flash, "models/flash.md3");
1325 flash.alpha = self.beam_alpha;
1326 flash.colormod = self.beam_color;
1333 self.beam_color = '1 1 1';
1334 self.beam_alpha = 0.5;
1335 self.beam_thickness = 8;
1336 self.beam_traileffect = particleeffectnum("arc_beam_heal");
1337 self.beam_hiteffect = particleeffectnum("arc_beam_healimpact");
1338 self.beam_hitlight[0] = 0;
1339 self.beam_hitlight[1] = 1;
1340 self.beam_hitlight[2] = 1;
1341 self.beam_hitlight[3] = 1;
1342 self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
1343 self.beam_muzzlelight[0] = 0;
1344 self.beam_muzzlelight[1] = 1;
1345 self.beam_muzzlelight[2] = 1;
1346 self.beam_muzzlelight[3] = 1;
1347 self.beam_image = "particles/lgbeam";
1348 if(self.beam_muzzleeffect >= 0)
1350 setmodel(flash, "models/flash.md3");
1351 flash.alpha = self.beam_alpha;
1352 flash.colormod = self.beam_color;
1359 self.beam_color = '1 1 1';
1360 self.beam_alpha = 0.5;
1361 self.beam_thickness = 8;
1362 self.beam_traileffect = particleeffectnum("arc_beam");
1363 self.beam_hiteffect = particleeffectnum("arc_lightning");
1364 self.beam_hitlight[0] = 20;
1365 self.beam_hitlight[1] = 1;
1366 self.beam_hitlight[2] = 0;
1367 self.beam_hitlight[3] = 0;
1368 self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
1369 self.beam_muzzlelight[0] = 50;
1370 self.beam_muzzlelight[1] = 1;
1371 self.beam_muzzlelight[2] = 0;
1372 self.beam_muzzlelight[3] = 0;
1373 self.beam_image = "particles/lgbeam";
1374 if(self.beam_muzzleeffect >= 0)
1376 setmodel(flash, "models/flash.md3");
1377 flash.alpha = self.beam_alpha;
1378 flash.colormod = self.beam_color;
1383 case ARC_BT_BURST_MISS:
1385 self.beam_color = '1 1 1';
1386 self.beam_alpha = 0.5;
1387 self.beam_thickness = 14;
1388 self.beam_traileffect = particleeffectnum("arc_beam");
1389 self.beam_hiteffect = particleeffectnum("arc_lightning");
1390 self.beam_hitlight[0] = 0;
1391 self.beam_hitlight[1] = 1;
1392 self.beam_hitlight[2] = 1;
1393 self.beam_hitlight[3] = 1;
1394 self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
1395 self.beam_muzzlelight[0] = 0;
1396 self.beam_muzzlelight[1] = 1;
1397 self.beam_muzzlelight[2] = 1;
1398 self.beam_muzzlelight[3] = 1;
1399 self.beam_image = "particles/lgbeam";
1400 if(self.beam_muzzleeffect >= 0)
1402 setmodel(flash, "models/flash.md3");
1403 flash.alpha = self.beam_alpha;
1404 flash.colormod = self.beam_color;
1409 case ARC_BT_BURST_WALL:
1411 self.beam_color = '1 1 1';
1412 self.beam_alpha = 0.5;
1413 self.beam_thickness = 14;
1414 self.beam_traileffect = particleeffectnum("arc_beam");
1415 self.beam_hiteffect = particleeffectnum("arc_lightning");
1416 self.beam_hitlight[0] = 0;
1417 self.beam_hitlight[1] = 1;
1418 self.beam_hitlight[2] = 1;
1419 self.beam_hitlight[3] = 1;
1420 self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
1421 self.beam_muzzlelight[0] = 0;
1422 self.beam_muzzlelight[1] = 1;
1423 self.beam_muzzlelight[2] = 1;
1424 self.beam_muzzlelight[3] = 1;
1425 self.beam_image = "particles/lgbeam";
1426 if(self.beam_muzzleeffect >= 0)
1428 setmodel(flash, "models/flash.md3");
1429 flash.alpha = self.beam_alpha;
1430 flash.colormod = self.beam_color;
1435 case ARC_BT_BURST_HEAL:
1437 self.beam_color = '1 1 1';
1438 self.beam_alpha = 0.5;
1439 self.beam_thickness = 14;
1440 self.beam_traileffect = particleeffectnum("arc_beam_heal");
1441 self.beam_hiteffect = particleeffectnum("healray_impact");
1442 self.beam_hitlight[0] = 0;
1443 self.beam_hitlight[1] = 1;
1444 self.beam_hitlight[2] = 1;
1445 self.beam_hitlight[3] = 1;
1446 self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
1447 self.beam_muzzlelight[0] = 0;
1448 self.beam_muzzlelight[1] = 1;
1449 self.beam_muzzlelight[2] = 1;
1450 self.beam_muzzlelight[3] = 1;
1451 self.beam_image = "particles/lgbeam";
1452 if(self.beam_muzzleeffect >= 0)
1454 setmodel(flash, "models/flash.md3");
1455 flash.alpha = self.beam_alpha;
1456 flash.colormod = self.beam_color;
1461 case ARC_BT_BURST_HIT:
1463 self.beam_color = '1 1 1';
1464 self.beam_alpha = 0.5;
1465 self.beam_thickness = 14;
1466 self.beam_traileffect = particleeffectnum("arc_beam");
1467 self.beam_hiteffect = particleeffectnum("arc_lightning");
1468 self.beam_hitlight[0] = 0;
1469 self.beam_hitlight[1] = 1;
1470 self.beam_hitlight[2] = 1;
1471 self.beam_hitlight[3] = 1;
1472 self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
1473 self.beam_muzzlelight[0] = 0;
1474 self.beam_muzzlelight[1] = 1;
1475 self.beam_muzzlelight[2] = 1;
1476 self.beam_muzzlelight[3] = 1;
1477 self.beam_image = "particles/lgbeam";
1478 if(self.beam_muzzleeffect >= 0)
1480 setmodel(flash, "models/flash.md3");
1481 flash.alpha = self.beam_alpha;
1482 flash.colormod = self.beam_color;
1488 // shouldn't be possible, but lets make it colorful if it does :D
1491 self.beam_color = randomvec();
1492 self.beam_alpha = 1;
1493 self.beam_thickness = 8;
1494 self.beam_traileffect = false;
1495 self.beam_hiteffect = false;
1496 self.beam_hitlight[0] = 0;
1497 self.beam_hitlight[1] = 1;
1498 self.beam_hitlight[2] = 1;
1499 self.beam_hitlight[3] = 1;
1500 self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
1501 self.beam_muzzlelight[0] = 0;
1502 self.beam_muzzlelight[1] = 1;
1503 self.beam_muzzlelight[2] = 1;
1504 self.beam_muzzlelight[3] = 1;
1505 self.beam_image = "particles/lgbeam";
1506 if(self.beam_muzzleeffect >= 0)
1508 setmodel(flash, "models/flash.md3");
1509 flash.alpha = self.beam_alpha;
1510 flash.colormod = self.beam_color;
1518 if(!self.beam_usevieworigin)
1520 InterpolateOrigin_Note();
1528 case WR_IMPACTEFFECT:
1535 precache_sound("weapons/arc_loop.wav");
1538 case WR_ZOOMRETICLE:
1540 // no weapon specific image for this weapon