3 /* ammotype */ ATTRIB(Arc, ammo_field, .int, ammo_cells)
4 /* impulse */ ATTRIB(Arc, impulse, int, 3)
5 /* flags */ ATTRIB(Arc, spawnflags, int, WEP_FLAG_NORMAL);
6 /* rating */ ATTRIB(Arc, bot_pickupbasevalue, float, BOT_PICKUP_RATING_HIGH);
7 /* color */ ATTRIB(Arc, wpcolor, vector, '1 1 1');
8 /* modelname */ ATTRIB(Arc, mdl, string, "arc");
10 /* model */ ATTRIB(Arc, m_model, Model, MDL_ARC_ITEM);
12 /* crosshair */ ATTRIB(Arc, w_crosshair, string, "gfx/crosshairhlac");
13 /* crosshair */ ATTRIB(Arc, w_crosshair_size, float, 0.7);
14 /* wepimg */ ATTRIB(Arc, model2, string, "weaponarc");
15 /* refname */ ATTRIB(Arc, netname, string, "arc");
16 /* wepname */ ATTRIB(Arc, m_name, string, _("Arc"));
18 #define X(BEGIN, P, END, class, prefix) \
20 P(class, prefix, bolt, float, NONE) \
21 P(class, prefix, bolt_ammo, float, NONE) \
22 P(class, prefix, bolt_damageforcescale, float, NONE) \
23 P(class, prefix, bolt_damage, float, NONE) \
24 P(class, prefix, bolt_edgedamage, float, NONE) \
25 P(class, prefix, bolt_force, float, NONE) \
26 P(class, prefix, bolt_health, float, NONE) \
27 P(class, prefix, bolt_lifetime, float, NONE) \
28 P(class, prefix, bolt_radius, float, NONE) \
29 P(class, prefix, bolt_refire, float, NONE) \
30 P(class, prefix, bolt_speed, float, NONE) \
31 P(class, prefix, bolt_spread, float, NONE) \
32 P(class, prefix, beam_ammo, float, NONE) \
33 P(class, prefix, beam_animtime, float, NONE) \
34 P(class, prefix, beam_botaimlifetime, float, NONE) \
35 P(class, prefix, beam_botaimspeed, float, NONE) \
36 P(class, prefix, beam_damage, float, NONE) \
37 P(class, prefix, beam_degreespersegment, float, NONE) \
38 P(class, prefix, beam_distancepersegment, float, NONE) \
39 P(class, prefix, beam_falloff_halflifedist, float, NONE) \
40 P(class, prefix, beam_falloff_maxdist, float, NONE) \
41 P(class, prefix, beam_falloff_mindist, float, NONE) \
42 P(class, prefix, beam_force, float, NONE) \
43 P(class, prefix, beam_healing_amax, float, NONE) \
44 P(class, prefix, beam_healing_aps, float, NONE) \
45 P(class, prefix, beam_healing_hmax, float, NONE) \
46 P(class, prefix, beam_healing_hps, float, NONE) \
47 P(class, prefix, beam_heat, float, NONE) /* heat increase per second (primary) */ \
48 P(class, prefix, beam_maxangle, float, NONE) \
49 P(class, prefix, beam_nonplayerdamage, float, NONE) \
50 P(class, prefix, beam_range, float, NONE) \
51 P(class, prefix, beam_refire, float, NONE) \
52 P(class, prefix, beam_returnspeed, float, NONE) \
53 P(class, prefix, beam_tightness, float, NONE) \
54 P(class, prefix, burst_ammo, float, NONE) \
55 P(class, prefix, burst_damage, float, NONE) \
56 P(class, prefix, burst_healing_aps, float, NONE) \
57 P(class, prefix, burst_healing_hps, float, NONE) \
58 P(class, prefix, burst_heat, float, NONE) /* heat increase per second (secondary) */ \
59 P(class, prefix, cooldown, float, NONE) /* heat decrease per second when resting */ \
60 P(class, prefix, overheat_max, float, NONE) /* maximum heat before jamming */ \
61 P(class, prefix, overheat_min, float, NONE) /* minimum heat to wait for cooldown */ \
62 P(class, prefix, switchdelay_drop, float, NONE) \
63 P(class, prefix, switchdelay_raise, float, NONE) \
64 P(class, prefix, weaponreplace, string, NONE) \
65 P(class, prefix, weaponstartoverride, float, NONE) \
66 P(class, prefix, weaponstart, float, NONE) \
67 P(class, prefix, weaponthrowable, float, NONE) \
73 REGISTER_WEAPON(ARC, arc, NEW(Arc));
77 const float ARC_MAX_SEGMENTS = 20;
78 vector arc_shotorigin[4];
84 const int ARC_BT_MISS = 0x00;
85 const int ARC_BT_WALL = 0x01;
86 const int ARC_BT_HEAL = 0x02;
87 const int ARC_BT_HIT = 0x03;
88 const int ARC_BT_BURST_MISS = 0x10;
89 const int ARC_BT_BURST_WALL = 0x11;
90 const int ARC_BT_BURST_HEAL = 0x12;
91 const int ARC_BT_BURST_HIT = 0x13;
92 const int ARC_BT_BURSTMASK = 0x10;
94 const int ARC_SF_SETTINGS = BIT(0);
95 const int ARC_SF_START = BIT(1);
96 const int ARC_SF_WANTDIR = BIT(2);
97 const int ARC_SF_BEAMDIR = BIT(3);
98 const int ARC_SF_BEAMTYPE = BIT(4);
99 const int ARC_SF_LOCALMASK = ARC_SF_START | ARC_SF_WANTDIR | ARC_SF_BEAMDIR;
103 .bool arc_BUTTON_ATCK_prev; // for better animation control
105 .float beam_initialized;
106 .float beam_bursting;
107 .float beam_teleporttime;
108 .float beam_heat; // (beam) amount of heat produced
109 .float arc_overheat; // (dropped arc/player) time during which it's too hot
110 .float arc_cooldown; // (dropped arc/player) cooling speed
111 .float arc_heat_percent = _STAT(ARC_HEAT);
112 .float arc_smoke_sound;
118 .float beam_thickness;
119 .entity beam_traileffect;
120 .entity beam_hiteffect;
121 .float beam_hitlight[4]; // 0: radius, 123: rgb
122 .entity beam_muzzleeffect;
123 .float beam_muzzlelight[4]; // 0: radius, 123: rgb
126 .entity beam_muzzleentity;
128 .float beam_degreespersegment;
129 .float beam_distancepersegment;
130 .float beam_usevieworigin;
131 .float beam_initialized;
132 .float beam_maxangle;
134 .float beam_returnspeed;
135 .float beam_tightness;
136 .vector beam_shotorigin;
138 entity Draw_ArcBeam_callback_entity;
139 float Draw_ArcBeam_callback_last_thickness;
140 vector Draw_ArcBeam_callback_last_top; // NOTE: in same coordinate system as player.
141 vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as player.
144 #ifdef IMPLEMENTATION
146 spawnfunc(weapon_arc) { weapon_defaultspawnfunc(this, WEP_ARC); }
148 bool W_Arc_Beam_Send(entity this, entity to, int sf)
150 WriteHeader(MSG_ENTITY, ENT_CLIENT_ARC_BEAM);
152 // Truncate information when this beam is displayed to the owner client
153 // - The owner client has no use for beam start position or directions,
154 // it always figures this information out for itself with csqc code.
155 // - Spectating the owner also truncates this information.
156 float drawlocal = ((to == self.owner) || ((to.enemy == self.owner) && IS_SPEC(to)));
157 if(drawlocal) { sf &= ~ARC_SF_LOCALMASK; }
159 WriteByte(MSG_ENTITY, sf);
161 if(sf & ARC_SF_SETTINGS) // settings information
163 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_degreespersegment));
164 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_distancepersegment));
165 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_maxangle));
166 WriteCoord(MSG_ENTITY, WEP_CVAR(arc, beam_range));
167 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_returnspeed));
168 WriteByte(MSG_ENTITY, WEP_CVAR(arc, beam_tightness) * 10);
170 WriteByte(MSG_ENTITY, drawlocal);
171 WriteByte(MSG_ENTITY, etof(this.owner));
173 if(sf & ARC_SF_START) // starting location
175 WriteCoord(MSG_ENTITY, self.beam_start.x);
176 WriteCoord(MSG_ENTITY, self.beam_start.y);
177 WriteCoord(MSG_ENTITY, self.beam_start.z);
179 if(sf & ARC_SF_WANTDIR) // want/aim direction
181 WriteCoord(MSG_ENTITY, self.beam_wantdir.x);
182 WriteCoord(MSG_ENTITY, self.beam_wantdir.y);
183 WriteCoord(MSG_ENTITY, self.beam_wantdir.z);
185 if(sf & ARC_SF_BEAMDIR) // beam direction
187 WriteCoord(MSG_ENTITY, self.beam_dir.x);
188 WriteCoord(MSG_ENTITY, self.beam_dir.y);
189 WriteCoord(MSG_ENTITY, self.beam_dir.z);
191 if(sf & ARC_SF_BEAMTYPE) // beam type
193 WriteByte(MSG_ENTITY, self.beam_type);
199 void Reset_ArcBeam(entity player, vector forward)
201 if (!player.arc_beam) {
204 player.arc_beam.beam_dir = forward;
205 player.arc_beam.beam_teleporttime = time;
208 float Arc_GetHeat_Percent(entity player)
210 if ( WEP_CVAR(arc, overheat_max) <= 0 || WEP_CVAR(arc, overheat_max) <= 0 )
212 player.arc_overheat = 0;
216 if ( player.arc_beam )
217 return player.arc_beam.beam_heat/WEP_CVAR(arc, overheat_max);
219 if ( player.arc_overheat > time )
221 return (player.arc_overheat-time) / WEP_CVAR(arc, overheat_max)
222 * player.arc_cooldown;
227 void Arc_Player_SetHeat(entity player)
229 player.arc_heat_percent = Arc_GetHeat_Percent(player);
230 //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
233 void W_Arc_Bolt_Explode()
235 self.event_damage = func_null;
236 RadiusDamage(self, self.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), world, world, WEP_CVAR(arc, bolt_force), self.projectiledeathtype, other);
241 void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
246 if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1))
247 return; // g_projectiles_damage says to halt
249 this.health = this.health - damage;
250 this.angles = vectoangles(this.velocity);
253 WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
256 void W_Arc_Bolt_Touch()
262 void W_Arc_Attack_Bolt(Weapon thiswep)
266 W_DecreaseAmmo(thiswep, self, WEP_CVAR(arc, bolt_ammo));
268 W_SetupShot(self, false, 2, SND(LASERGUN_FIRE), CH_WEAPON_A, WEP_CVAR(arc, bolt_damage));
270 Send_Effect(EFFECT_ARC_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
272 missile = new(missile);
273 missile.owner = missile.realowner = self;
274 missile.bot_dodge = true;
275 missile.bot_dodgerating = WEP_CVAR(arc, bolt_damage);
277 missile.takedamage = DAMAGE_YES;
278 missile.health = WEP_CVAR(arc, bolt_health);
279 missile.damageforcescale = WEP_CVAR(arc, bolt_damageforcescale);
280 missile.event_damage = W_Arc_Bolt_Damage;
281 missile.damagedbycontents = true;
283 missile.touch = W_Arc_Bolt_Touch;
284 missile.use = W_Arc_Bolt_Explode;
285 missile.think = adaptor_think2use_hittype_splash;
286 missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
287 PROJECTILE_MAKETRIGGER(missile);
288 missile.projectiledeathtype = WEP_ARC.m_id | HITTYPE_SECONDARY;
289 setorigin(missile, w_shotorg);
290 setsize(missile, '0 0 0', '0 0 0');
292 missile.movetype = MOVETYPE_FLY;
293 W_SetupProjVelocity_PRE(missile, arc, bolt_);
295 missile.angles = vectoangles(missile.velocity);
296 missile.flags = FL_PROJECTILE;
297 missile.missile_flags = MIF_SPLASH;
299 CSQCProjectile(missile, true, PROJECTILE_ARC_BOLT, true);
301 MUTATOR_CALLHOOK(EditProjectile, self, missile);
304 void W_Arc_Beam_Think()
306 if(self != self.owner.arc_beam)
314 if( (self.owner.BUTTON_ATCK2 && !WEP_CVAR(arc, bolt)) || self.beam_bursting)
316 if(!self.beam_bursting)
317 self.beam_bursting = true;
318 burst = ARC_BT_BURSTMASK;
321 Weapon thiswep = WEP_ARC;
324 !IS_PLAYER(self.owner)
326 (self.owner.(thiswep.ammo_field) <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
330 (!self.owner.BUTTON_ATCK && !burst )
332 STAT(FROZEN, self.owner)
336 (WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max))
339 if ( WEP_CVAR(arc, cooldown) > 0 )
341 float cooldown_speed = 0;
342 if ( self.beam_heat > WEP_CVAR(arc, overheat_min) && WEP_CVAR(arc, cooldown) > 0 )
344 cooldown_speed = WEP_CVAR(arc, cooldown);
348 cooldown_speed = self.beam_heat / WEP_CVAR(arc, beam_refire);
351 if ( cooldown_speed )
353 self.owner.arc_overheat = time + self.beam_heat / cooldown_speed;
354 self.owner.arc_cooldown = cooldown_speed;
357 if ( WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max) )
359 Send_Effect(EFFECT_ARC_OVERHEAT,
360 self.beam_start, self.beam_wantdir, 1 );
361 sound(self, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
365 if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
368 if(!w.wr_checkammo1(w) && !w.wr_checkammo2(w))
369 if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
371 // note: this doesn't force the switch
372 W_SwitchToOtherWeapon(self);
380 float coefficient = frametime;
381 if(!(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
385 { rootammo = WEP_CVAR(arc, burst_ammo); }
387 { rootammo = WEP_CVAR(arc, beam_ammo); }
391 coefficient = min(coefficient, self.owner.(thiswep.ammo_field) / rootammo);
392 self.owner.(thiswep.ammo_field) = max(0, self.owner.(thiswep.ammo_field) - (rootammo * frametime));
395 float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat);
396 self.beam_heat = min( WEP_CVAR(arc, overheat_max), self.beam_heat + heat_speed*frametime );
398 makevectors(self.owner.v_angle);
406 WEP_CVAR(arc, beam_damage) * coefficient,
407 WEP_CVAR(arc, beam_range)
410 // After teleport, "lock" the beam until the teleport is confirmed.
411 if (time < self.beam_teleporttime + ANTILAG_LATENCY(self.owner)) {
412 w_shotdir = self.beam_dir;
415 // network information: shot origin and want/aim direction
416 if(self.beam_start != w_shotorg)
418 self.SendFlags |= ARC_SF_START;
419 self.beam_start = w_shotorg;
421 if(self.beam_wantdir != w_shotdir)
423 self.SendFlags |= ARC_SF_WANTDIR;
424 self.beam_wantdir = w_shotdir;
427 if(!self.beam_initialized)
429 self.beam_dir = w_shotdir;
430 self.beam_initialized = true;
433 // WEAPONTODO: Detect player velocity so that the beam curves when moving too
434 // idea: blend together self.beam_dir with the inverted direction the player is moving in
435 // might have to make some special accomodation so that it only uses view_right and view_up
437 // note that if we do this, it'll always be corrected to a maximum angle by beam_maxangle handling
440 if(self.beam_dir != w_shotdir)
442 // calculate how much we're going to move the end of the beam to the want position
443 // WEAPONTODO (server and client):
444 // blendfactor never actually becomes 0 in this situation, which is a problem
445 // regarding precision... this means that self.beam_dir and w_shotdir approach
446 // eachother, however they never actually become the same value with this method.
447 // Perhaps we should do some form of rounding/snapping?
448 float angle = vlen(w_shotdir - self.beam_dir) * RAD2DEG;
449 if(angle && (angle > WEP_CVAR(arc, beam_maxangle)))
451 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
452 float blendfactor = bound(
454 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
455 min(WEP_CVAR(arc, beam_maxangle) / angle, 1)
457 self.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
461 // the radius is not too far yet, no worries :D
462 float blendfactor = bound(
464 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
467 self.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
470 // network information: beam direction
471 self.SendFlags |= ARC_SF_BEAMDIR;
473 // calculate how many segments are needed
474 float max_allowed_segments;
476 if(WEP_CVAR(arc, beam_distancepersegment))
478 max_allowed_segments = min(
480 1 + (vlen(w_shotdir / WEP_CVAR(arc, beam_distancepersegment)))
483 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
485 if(WEP_CVAR(arc, beam_degreespersegment))
492 WEP_CVAR(arc, beam_maxangle)
495 WEP_CVAR(arc, beam_degreespersegment)
500 else { segments = 1; }
502 else { segments = 1; }
504 vector beam_endpos = (w_shotorg + (self.beam_dir * WEP_CVAR(arc, beam_range)));
505 vector beam_controlpoint = w_shotorg + w_shotdir * (WEP_CVAR(arc, beam_range) * (1 - WEP_CVAR(arc, beam_tightness)));
508 float new_beam_type = 0;
509 vector last_origin = w_shotorg;
510 for(i = 1; i <= segments; ++i)
512 // WEAPONTODO (client):
513 // In order to do nice fading and pointing on the starting segment, we must always
514 // have that drawn as a separate triangle... However, that is difficult to do when
515 // keeping in mind the above problems and also optimizing the amount of segments
516 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
518 vector new_origin = bezier_quadratic_getpoint(
523 vector new_dir = normalize(new_origin - last_origin);
525 WarpZone_traceline_antilag(
531 ANTILAG_LATENCY(self.owner)
534 // Do all the transforms for warpzones right now, as we already
535 // "are" in the post-trace system (if we hit a player, that's
536 // always BEHIND the last passed wz).
537 last_origin = trace_endpos;
538 w_shotorg = WarpZone_TransformOrigin(WarpZone_trace_transform, w_shotorg);
539 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
540 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
541 new_dir = WarpZone_TransformVelocity(WarpZone_trace_transform, new_dir);
546 trace_ent.classname == "body"
548 IS_MONSTER(trace_ent)
551 if(trace_ent && trace_ent.takedamage && (is_player || WEP_CVAR(arc, beam_nonplayerdamage)))
553 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
554 // NO. trace_endpos should be just fine. If not,
555 // that's an engine bug that needs proper debugging.
556 vector hitorigin = trace_endpos;
558 float falloff = ExponentialFalloff(
559 WEP_CVAR(arc, beam_falloff_mindist),
560 WEP_CVAR(arc, beam_falloff_maxdist),
561 WEP_CVAR(arc, beam_falloff_halflifedist),
562 vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, hitorigin) - w_shotorg)
565 if(is_player && SAME_TEAM(self.owner, trace_ent))
567 float roothealth, rootarmor;
570 roothealth = WEP_CVAR(arc, burst_healing_hps);
571 rootarmor = WEP_CVAR(arc, burst_healing_aps);
575 roothealth = WEP_CVAR(arc, beam_healing_hps);
576 rootarmor = WEP_CVAR(arc, beam_healing_aps);
579 if(trace_ent.health <= WEP_CVAR(arc, beam_healing_hmax) && roothealth)
581 trace_ent.health = min(
582 trace_ent.health + (roothealth * coefficient),
583 WEP_CVAR(arc, beam_healing_hmax)
586 if(trace_ent.armorvalue <= WEP_CVAR(arc, beam_healing_amax) && rootarmor)
588 trace_ent.armorvalue = min(
589 trace_ent.armorvalue + (rootarmor * coefficient),
590 WEP_CVAR(arc, beam_healing_amax)
594 // stop rot, set visual effect
595 if(roothealth || rootarmor)
597 trace_ent.pauserothealth_finished = max(
598 trace_ent.pauserothealth_finished,
599 time + autocvar_g_balance_pause_health_rot
601 trace_ent.pauserotarmor_finished = max(
602 trace_ent.pauserotarmor_finished,
603 time + autocvar_g_balance_pause_armor_rot
605 new_beam_type = ARC_BT_HEAL;
614 { rootdamage = WEP_CVAR(arc, burst_damage); }
616 { rootdamage = WEP_CVAR(arc, beam_damage); }
619 { rootdamage = WEP_CVAR(arc, beam_nonplayerdamage); }
621 if(accuracy_isgooddamage(self.owner, trace_ent))
627 rootdamage * coefficient * falloff
635 rootdamage * coefficient * falloff,
638 WEP_CVAR(arc, beam_force) * new_dir * coefficient * falloff
641 new_beam_type = ARC_BT_HIT;
645 else if(trace_fraction != 1)
647 // we collided with geometry
648 new_beam_type = ARC_BT_WALL;
653 // te_explosion(trace_endpos);
655 // if we're bursting, use burst visual effects
656 new_beam_type |= burst;
658 // network information: beam type
659 if(new_beam_type != self.beam_type)
661 self.SendFlags |= ARC_SF_BEAMTYPE;
662 self.beam_type = new_beam_type;
665 self.owner.beam_prev = time;
666 self.nextthink = time;
669 void W_Arc_Beam(float burst)
672 // only play fire sound if 1 sec has passed since player let go the fire button
673 if(time - self.beam_prev > 1)
674 sound(self, CH_WEAPON_A, SND_ARC_FIRE, VOL_BASE, ATTN_NORM);
676 entity beam = self.arc_beam = new(W_Arc_Beam);
677 beam.solid = SOLID_NOT;
678 beam.think = W_Arc_Beam_Think;
680 beam.movetype = MOVETYPE_NONE;
681 beam.bot_dodge = true;
682 beam.bot_dodgerating = WEP_CVAR(arc, beam_damage);
683 beam.beam_bursting = burst;
684 Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
686 WITH(entity, self, beam, beam.think());
691 makevectors(self.v_angle);
692 W_SetupShot_Range(self,true,0,"",0,0,0);
694 vector smoke_origin = w_shotorg + self.velocity*frametime;
695 if ( self.arc_overheat > time )
697 if ( random() < self.arc_heat_percent )
698 Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
699 if ( self.BUTTON_ATCK || self.BUTTON_ATCK2 )
701 Send_Effect(EFFECT_ARC_OVERHEAT_FIRE, smoke_origin, w_shotdir, 1 );
702 if ( !self.arc_smoke_sound )
704 self.arc_smoke_sound = 1;
705 sound(self, CH_SHOTS_SINGLE, SND_ARC_LOOP_OVERHEAT, VOL_BASE, ATTN_NORM);
709 else if ( self.arc_beam && WEP_CVAR(arc, overheat_max) > 0 &&
710 self.arc_beam.beam_heat > WEP_CVAR(arc, overheat_min) )
712 if ( random() < (self.arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) /
713 ( WEP_CVAR(arc, overheat_max)-WEP_CVAR(arc, overheat_min) ) )
714 Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
717 if ( self.arc_smoke_sound && ( self.arc_overheat <= time ||
718 !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || PS(self).m_switchweapon != WEP_ARC )
720 self.arc_smoke_sound = 0;
721 sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
725 METHOD(Arc, wr_aim, void(entity thiswep))
728 if(WEP_CVAR(arc, beam_botaimspeed))
730 self.BUTTON_ATCK = bot_aim(
731 WEP_CVAR(arc, beam_botaimspeed),
733 WEP_CVAR(arc, beam_botaimlifetime),
739 self.BUTTON_ATCK = bot_aim(
747 METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
749 Arc_Player_SetHeat(actor);
752 bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
754 if (time >= actor.arc_overheat)
755 if ((fire & 1) || beam_fire2 || actor.arc_beam.beam_bursting)
758 if(actor.arc_BUTTON_ATCK_prev)
761 if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
762 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
765 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
768 if((!actor.arc_beam) || wasfreed(actor.arc_beam))
770 if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
772 W_Arc_Beam(boolean(beam_fire2));
774 if(!actor.arc_BUTTON_ATCK_prev)
776 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
777 actor.arc_BUTTON_ATCK_prev = true;
786 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
788 W_Arc_Attack_Bolt(thiswep);
789 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
793 if(actor.arc_BUTTON_ATCK_prev)
795 sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
796 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
797 int slot = weaponslot(weaponentity);
798 ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
800 actor.arc_BUTTON_ATCK_prev = false;
804 if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_arc_secondary_refire))
807 actor.arc_count = autocvar_g_balance_arc_secondary_count;
808 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
809 actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
813 METHOD(Arc, wr_init, void(entity thiswep))
815 if(!arc_shotorigin[0])
817 arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
818 arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
819 arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
820 arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
823 METHOD(Arc, wr_checkammo1, bool(entity thiswep))
826 return ((!WEP_CVAR(arc, beam_ammo)) || (self.(thiswep.ammo_field) > 0));
828 METHOD(Arc, wr_checkammo2, bool(entity thiswep))
831 if(WEP_CVAR(arc, bolt))
833 float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
834 ammo_amount += self.(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
838 return WEP_CVAR(arc, overheat_max) > 0 &&
839 ((!WEP_CVAR(arc, burst_ammo)) || (self.(thiswep.ammo_field) > 0));
841 METHOD(Arc, wr_killmessage, int(entity thiswep))
843 if(w_deathtype & HITTYPE_SECONDARY)
844 return WEAPON_ARC_MURDER_SPRAY;
846 return WEAPON_ARC_MURDER;
848 METHOD(Arc, wr_drop, void(entity thiswep))
850 weapon_dropevent_item.arc_overheat = self.arc_overheat;
851 weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
852 self.arc_overheat = 0;
853 self.arc_cooldown = 0;
855 METHOD(Arc, wr_pickup, void(entity thiswep))
857 if ( !client_hasweapon(self, thiswep, false, false) &&
858 weapon_dropevent_item.arc_overheat > time )
860 self.arc_overheat = weapon_dropevent_item.arc_overheat;
861 self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
866 bool autocvar_cl_arcbeam_teamcolor;
868 METHOD(Arc, wr_impacteffect, void(entity thiswep))
870 if(w_deathtype & HITTYPE_SECONDARY)
873 org2 = w_org + w_backoff * 6;
874 pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1);
875 if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
879 void Draw_ArcBeam_callback(vector start, vector hit, vector end)
881 entity beam = Draw_ArcBeam_callback_entity;
882 vector transformed_view_org;
883 transformed_view_org = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
885 // Thickdir shall be perpendicular to the beam and to the view-to-beam direction (WEAPONTODO: WHY)
886 // WEAPONTODO: Wouldn't it be better to be perpendicular to the beam and to the view FORWARD direction?
887 vector thickdir = normalize(cross(normalize(start - hit), transformed_view_org - start));
893 if(trace_fraction != 1)
895 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
896 hitorigin = start + (Draw_ArcBeam_callback_new_dir * Draw_ArcBeam_callback_segmentdist * trace_fraction);
897 hitorigin = WarpZone_TransformOrigin(WarpZone_trace_transform, hitorigin);
907 // decide upon thickness
908 float thickness = beam.beam_thickness;
910 // draw primary beam render
911 vector top = hitorigin + (thickdir * thickness);
912 vector bottom = hitorigin - (thickdir * thickness);
914 vector last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
915 vector last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
917 R_BeginPolygon(beam.beam_image, DRAWFLAG_NORMAL); // DRAWFLAG_ADDITIVE
920 '0 0.5 0' + ('0 0.5 0' * (thickness / beam.beam_thickness)),
926 '0 0.5 0' + ('0 0.5 0' * (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
932 '0 0.5 0' * (1 - (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
938 '0 0.5 0' * (1 - (thickness / beam.beam_thickness)),
944 // draw trailing particles
946 // - Don't use spammy particle counts here, use a FEW small particles around the beam
947 // - We're not using WarpZone_TrailParticles here because we will handle warpzones ourselves.
948 if(beam.beam_traileffect)
950 trailparticles(beam, beam.beam_traileffect, start, hitorigin);
953 // set up for the next
954 Draw_ArcBeam_callback_last_thickness = thickness;
955 Draw_ArcBeam_callback_last_top = WarpZone_UnTransformOrigin(WarpZone_trace_transform, top);
956 Draw_ArcBeam_callback_last_bottom = WarpZone_UnTransformOrigin(WarpZone_trace_transform, bottom);
962 for (e = world; (e = findfloat(e, beam_usevieworigin, 1)); ) {
963 e.beam_initialized = false;
965 for (e = world; (e = findfloat(e, beam_usevieworigin, 2)); ) {
966 e.beam_initialized = false;
970 void Draw_ArcBeam(entity this)
972 float dt = time - this.move_time;
973 this.move_time = time;
974 if(dt <= 0) { return; }
976 if(!this.beam_usevieworigin)
978 InterpolateOrigin_Do(this);
981 // origin = beam starting origin
982 // v_angle = wanted/aim direction
983 // angles = current direction of beam
986 vector wantdir; //= view_forward;
987 vector beamdir; //= this.beam_dir;
990 if(this.beam_usevieworigin)
993 // Currently we have to replicate nearly the same method of figuring
994 // out the shotdir that the server does... Ideally in the future we
995 // should be able to acquire this from a generalized function built
996 // into a weapon system for client code.
998 // find where we are aiming
999 makevectors(warpzone_save_view_angles);
1000 vector forward = v_forward;
1001 vector right = v_right;
1004 // decide upon start position
1005 if(this.beam_usevieworigin == 2)
1006 { start_pos = warpzone_save_view_origin; }
1008 { start_pos = this.origin; }
1010 // trace forward with an estimation
1013 start_pos + forward * this.beam_range,
1018 // untransform in case our trace went through a warpzone
1019 vector end_pos = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
1021 // un-adjust trueaim if shotend is too close
1022 if(vdist(end_pos - start_pos, <, g_trueaim_minrange))
1023 end_pos = start_pos + (forward * g_trueaim_minrange);
1025 // move shot origin to the actual gun muzzle origin
1026 vector origin_offset =
1027 right * -this.beam_shotorigin.y
1028 + up * this.beam_shotorigin.z;
1030 start_pos = start_pos + origin_offset;
1032 // Move it also forward, but only as far as possible without hitting anything. Don't poke into walls!
1033 traceline(start_pos, start_pos + forward * this.beam_shotorigin.x, MOVE_NORMAL, this);
1034 start_pos = trace_endpos;
1036 // calculate the aim direction now
1037 wantdir = normalize(end_pos - start_pos);
1039 if(!this.beam_initialized)
1041 this.beam_dir = wantdir;
1042 this.beam_initialized = true;
1045 if(this.beam_dir != wantdir)
1047 // calculate how much we're going to move the end of the beam to the want position
1048 // WEAPONTODO (server and client):
1049 // blendfactor never actually becomes 0 in this situation, which is a problem
1050 // regarding precision... this means that this.beam_dir and w_shotdir approach
1051 // eachother, however they never actually become the same value with this method.
1052 // Perhaps we should do some form of rounding/snapping?
1053 float angle = vlen(wantdir - this.beam_dir) * RAD2DEG;
1054 if(angle && (angle > this.beam_maxangle))
1056 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
1057 float blendfactor = bound(
1059 (1 - (this.beam_returnspeed * frametime)),
1060 min(this.beam_maxangle / angle, 1)
1062 this.beam_dir = normalize((wantdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
1066 // the radius is not too far yet, no worries :D
1067 float blendfactor = bound(
1069 (1 - (this.beam_returnspeed * frametime)),
1072 this.beam_dir = normalize((wantdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
1075 // calculate how many segments are needed
1076 float max_allowed_segments;
1078 if(this.beam_distancepersegment)
1080 max_allowed_segments = min(
1082 1 + (vlen(wantdir / this.beam_distancepersegment))
1085 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
1087 if(this.beam_degreespersegment)
1097 this.beam_degreespersegment
1099 max_allowed_segments
1102 else { segments = 1; }
1104 else { segments = 1; }
1106 // set the beam direction which the rest of the code will refer to
1107 beamdir = this.beam_dir;
1109 // finally, set this.angles to the proper direction so that muzzle attachment points in proper direction
1110 this.angles = fixedvectoangles2(forward, up); // TODO(Samual): is this == warpzone_save_view_angles?
1114 // set the values from the provided info from the networked entity
1115 start_pos = this.origin;
1116 wantdir = this.v_angle;
1117 beamdir = this.angles;
1119 if(beamdir != wantdir)
1121 float angle = vlen(wantdir - beamdir) * RAD2DEG;
1123 // calculate how many segments are needed
1124 float max_allowed_segments;
1126 if(this.beam_distancepersegment)
1128 max_allowed_segments = min(
1130 1 + (vlen(wantdir / this.beam_distancepersegment))
1133 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
1135 if(this.beam_degreespersegment)
1145 this.beam_degreespersegment
1147 max_allowed_segments
1150 else { segments = 1; }
1152 else { segments = 1; }
1155 setorigin(this, start_pos);
1156 this.beam_muzzleentity.angles_z = random() * 360; // WEAPONTODO: use avelocity instead?
1158 vector beam_endpos = (start_pos + (beamdir * this.beam_range));
1159 vector beam_controlpoint = start_pos + wantdir * (this.beam_range * (1 - this.beam_tightness));
1161 Draw_ArcBeam_callback_entity = this;
1162 Draw_ArcBeam_callback_last_thickness = 0;
1163 Draw_ArcBeam_callback_last_top = start_pos;
1164 Draw_ArcBeam_callback_last_bottom = start_pos;
1166 vector last_origin = start_pos;
1167 vector original_start_pos = start_pos;
1170 for(i = 1; i <= segments; ++i)
1172 // WEAPONTODO (client):
1173 // In order to do nice fading and pointing on the starting segment, we must always
1174 // have that drawn as a separate triangle... However, that is difficult to do when
1175 // keeping in mind the above problems and also optimizing the amount of segments
1176 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
1178 vector new_origin = bezier_quadratic_getpoint(
1184 WarpZone_TraceBox_ThroughZone(
1192 Draw_ArcBeam_callback
1195 // Do all the transforms for warpzones right now, as we already "are" in the post-trace
1196 // system (if we hit a player, that's always BEHIND the last passed wz).
1197 last_origin = trace_endpos;
1198 start_pos = WarpZone_TransformOrigin(WarpZone_trace_transform, start_pos);
1199 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
1200 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
1201 beamdir = WarpZone_TransformVelocity(WarpZone_trace_transform, beamdir);
1202 Draw_ArcBeam_callback_last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
1203 Draw_ArcBeam_callback_last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
1205 if(trace_fraction < 1) { break; }
1208 // visual effects for startpoint and endpoint
1209 if(this.beam_hiteffect)
1211 // FIXME we really should do this on the server so it actually
1212 // matches gameplay. What this client side stuff is doing is no
1213 // more than guesswork.
1214 if((trace_ent || trace_fraction < 1) && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
1216 this.beam_hiteffect,
1222 if(this.beam_hitlight[0])
1226 this.beam_hitlight[0],
1228 this.beam_hitlight[1],
1229 this.beam_hitlight[2],
1230 this.beam_hitlight[3]
1234 if(this.beam_muzzleeffect)
1237 this.beam_muzzleeffect,
1238 original_start_pos + wantdir * 20,
1243 if(this.beam_muzzlelight[0])
1246 original_start_pos + wantdir * 20,
1247 this.beam_muzzlelight[0],
1249 this.beam_muzzlelight[1],
1250 this.beam_muzzlelight[2],
1251 this.beam_muzzlelight[3]
1257 Draw_ArcBeam_callback_entity = world;
1258 Draw_ArcBeam_callback_last_thickness = 0;
1259 Draw_ArcBeam_callback_last_top = '0 0 0';
1260 Draw_ArcBeam_callback_last_bottom = '0 0 0';
1263 void Remove_ArcBeam(entity this)
1265 remove(this.beam_muzzleentity);
1266 sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
1269 NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
1271 int sf = ReadByte();
1276 int gunalign = W_GetGunAlignment(world);
1278 self.beam_shotorigin = arc_shotorigin[gunalign];
1280 // set other main attributes of the beam
1281 self.draw = Draw_ArcBeam;
1282 self.entremove = Remove_ArcBeam;
1283 self.move_time = time;
1284 loopsound(self, CH_SHOTS_SINGLE, SND(ARC_LOOP), VOL_BASE, ATTEN_NORM);
1288 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT;
1289 flash.drawmask = MASK_NORMAL;
1290 flash.solid = SOLID_NOT;
1291 flash.avelocity_z = 5000;
1292 setattachment(flash, self, "");
1293 setorigin(flash, '0 0 0');
1295 self.beam_muzzleentity = flash;
1299 flash = self.beam_muzzleentity;
1302 if(sf & ARC_SF_SETTINGS) // settings information
1304 self.beam_degreespersegment = ReadShort();
1305 self.beam_distancepersegment = ReadShort();
1306 self.beam_maxangle = ReadShort();
1307 self.beam_range = ReadCoord();
1308 self.beam_returnspeed = ReadShort();
1309 self.beam_tightness = (ReadByte() / 10);
1313 if(autocvar_chase_active)
1314 { self.beam_usevieworigin = 1; }
1315 else // use view origin
1316 { self.beam_usevieworigin = 2; }
1320 self.beam_usevieworigin = 0;
1323 self.sv_entnum = ReadByte();
1326 if(!self.beam_usevieworigin)
1328 // self.iflags = IFLAG_ORIGIN | IFLAG_ANGLES | IFLAG_V_ANGLE; // why doesn't this work?
1329 self.iflags = IFLAG_ORIGIN;
1331 InterpolateOrigin_Undo(self);
1334 if(sf & ARC_SF_START) // starting location
1336 self.origin_x = ReadCoord();
1337 self.origin_y = ReadCoord();
1338 self.origin_z = ReadCoord();
1340 else if(self.beam_usevieworigin) // infer the location from player location
1342 if(self.beam_usevieworigin == 2)
1345 self.origin = view_origin;
1349 // use player origin so that third person display still works
1350 self.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * STAT(VIEWHEIGHT));
1354 setorigin(self, self.origin);
1356 if(sf & ARC_SF_WANTDIR) // want/aim direction
1358 self.v_angle_x = ReadCoord();
1359 self.v_angle_y = ReadCoord();
1360 self.v_angle_z = ReadCoord();
1363 if(sf & ARC_SF_BEAMDIR) // beam direction
1365 self.angles_x = ReadCoord();
1366 self.angles_y = ReadCoord();
1367 self.angles_z = ReadCoord();
1370 if(sf & ARC_SF_BEAMTYPE) // beam type
1372 self.beam_type = ReadByte();
1374 vector beamcolor = ((autocvar_cl_arcbeam_teamcolor) ? colormapPaletteColor(stof(getplayerkeyvalue(self.sv_entnum - 1, "colors")) & 0x0F, true) : '1 1 1');
1375 switch(self.beam_type)
1379 self.beam_color = beamcolor;
1380 self.beam_alpha = 0.5;
1381 self.beam_thickness = 8;
1382 self.beam_traileffect = (EFFECT_ARC_BEAM);
1383 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1384 self.beam_hitlight[0] = 0;
1385 self.beam_hitlight[1] = 1;
1386 self.beam_hitlight[2] = 1;
1387 self.beam_hitlight[3] = 1;
1388 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1389 self.beam_muzzlelight[0] = 0;
1390 self.beam_muzzlelight[1] = 1;
1391 self.beam_muzzlelight[2] = 1;
1392 self.beam_muzzlelight[3] = 1;
1393 if(self.beam_muzzleeffect)
1395 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1396 flash.alpha = self.beam_alpha;
1397 flash.colormod = self.beam_color;
1402 case ARC_BT_WALL: // grenadelauncher_muzzleflash healray_muzzleflash
1404 self.beam_color = beamcolor;
1405 self.beam_alpha = 0.5;
1406 self.beam_thickness = 8;
1407 self.beam_traileffect = (EFFECT_ARC_BEAM);
1408 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1409 self.beam_hitlight[0] = 0;
1410 self.beam_hitlight[1] = 1;
1411 self.beam_hitlight[2] = 1;
1412 self.beam_hitlight[3] = 1;
1413 self.beam_muzzleeffect = NULL; // (EFFECT_GRENADE_MUZZLEFLASH);
1414 self.beam_muzzlelight[0] = 0;
1415 self.beam_muzzlelight[1] = 1;
1416 self.beam_muzzlelight[2] = 1;
1417 self.beam_muzzlelight[3] = 1;
1418 self.beam_image = "particles/lgbeam";
1419 if(self.beam_muzzleeffect)
1421 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1422 flash.alpha = self.beam_alpha;
1423 flash.colormod = self.beam_color;
1430 self.beam_color = beamcolor;
1431 self.beam_alpha = 0.5;
1432 self.beam_thickness = 8;
1433 self.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
1434 self.beam_hiteffect = (EFFECT_ARC_BEAM_HEAL_IMPACT);
1435 self.beam_hitlight[0] = 0;
1436 self.beam_hitlight[1] = 1;
1437 self.beam_hitlight[2] = 1;
1438 self.beam_hitlight[3] = 1;
1439 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1440 self.beam_muzzlelight[0] = 0;
1441 self.beam_muzzlelight[1] = 1;
1442 self.beam_muzzlelight[2] = 1;
1443 self.beam_muzzlelight[3] = 1;
1444 self.beam_image = "particles/lgbeam";
1445 if(self.beam_muzzleeffect)
1447 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1448 flash.alpha = self.beam_alpha;
1449 flash.colormod = self.beam_color;
1456 self.beam_color = beamcolor;
1457 self.beam_alpha = 0.5;
1458 self.beam_thickness = 8;
1459 self.beam_traileffect = (EFFECT_ARC_BEAM);
1460 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1461 self.beam_hitlight[0] = 20;
1462 self.beam_hitlight[1] = 1;
1463 self.beam_hitlight[2] = 0;
1464 self.beam_hitlight[3] = 0;
1465 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1466 self.beam_muzzlelight[0] = 50;
1467 self.beam_muzzlelight[1] = 1;
1468 self.beam_muzzlelight[2] = 0;
1469 self.beam_muzzlelight[3] = 0;
1470 self.beam_image = "particles/lgbeam";
1471 if(self.beam_muzzleeffect)
1473 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1474 flash.alpha = self.beam_alpha;
1475 flash.colormod = self.beam_color;
1480 case ARC_BT_BURST_MISS:
1482 self.beam_color = beamcolor;
1483 self.beam_alpha = 0.5;
1484 self.beam_thickness = 14;
1485 self.beam_traileffect = (EFFECT_ARC_BEAM);
1486 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1487 self.beam_hitlight[0] = 0;
1488 self.beam_hitlight[1] = 1;
1489 self.beam_hitlight[2] = 1;
1490 self.beam_hitlight[3] = 1;
1491 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1492 self.beam_muzzlelight[0] = 0;
1493 self.beam_muzzlelight[1] = 1;
1494 self.beam_muzzlelight[2] = 1;
1495 self.beam_muzzlelight[3] = 1;
1496 self.beam_image = "particles/lgbeam";
1497 if(self.beam_muzzleeffect)
1499 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1500 flash.alpha = self.beam_alpha;
1501 flash.colormod = self.beam_color;
1506 case ARC_BT_BURST_WALL:
1508 self.beam_color = beamcolor;
1509 self.beam_alpha = 0.5;
1510 self.beam_thickness = 14;
1511 self.beam_traileffect = (EFFECT_ARC_BEAM);
1512 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1513 self.beam_hitlight[0] = 0;
1514 self.beam_hitlight[1] = 1;
1515 self.beam_hitlight[2] = 1;
1516 self.beam_hitlight[3] = 1;
1517 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1518 self.beam_muzzlelight[0] = 0;
1519 self.beam_muzzlelight[1] = 1;
1520 self.beam_muzzlelight[2] = 1;
1521 self.beam_muzzlelight[3] = 1;
1522 self.beam_image = "particles/lgbeam";
1523 if(self.beam_muzzleeffect)
1525 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1526 flash.alpha = self.beam_alpha;
1527 flash.colormod = self.beam_color;
1532 case ARC_BT_BURST_HEAL:
1534 self.beam_color = beamcolor;
1535 self.beam_alpha = 0.5;
1536 self.beam_thickness = 14;
1537 self.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
1538 self.beam_hiteffect = (EFFECT_ARC_BEAM_HEAL_IMPACT2);
1539 self.beam_hitlight[0] = 0;
1540 self.beam_hitlight[1] = 1;
1541 self.beam_hitlight[2] = 1;
1542 self.beam_hitlight[3] = 1;
1543 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1544 self.beam_muzzlelight[0] = 0;
1545 self.beam_muzzlelight[1] = 1;
1546 self.beam_muzzlelight[2] = 1;
1547 self.beam_muzzlelight[3] = 1;
1548 self.beam_image = "particles/lgbeam";
1549 if(self.beam_muzzleeffect)
1551 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1552 flash.alpha = self.beam_alpha;
1553 flash.colormod = self.beam_color;
1558 case ARC_BT_BURST_HIT:
1560 self.beam_color = beamcolor;
1561 self.beam_alpha = 0.5;
1562 self.beam_thickness = 14;
1563 self.beam_traileffect = (EFFECT_ARC_BEAM);
1564 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1565 self.beam_hitlight[0] = 0;
1566 self.beam_hitlight[1] = 1;
1567 self.beam_hitlight[2] = 1;
1568 self.beam_hitlight[3] = 1;
1569 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1570 self.beam_muzzlelight[0] = 0;
1571 self.beam_muzzlelight[1] = 1;
1572 self.beam_muzzlelight[2] = 1;
1573 self.beam_muzzlelight[3] = 1;
1574 self.beam_image = "particles/lgbeam";
1575 if(self.beam_muzzleeffect)
1577 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1578 flash.alpha = self.beam_alpha;
1579 flash.colormod = self.beam_color;
1585 // shouldn't be possible, but lets make it colorful if it does :D
1588 self.beam_color = randomvec();
1589 self.beam_alpha = 1;
1590 self.beam_thickness = 8;
1591 self.beam_traileffect = NULL;
1592 self.beam_hiteffect = NULL;
1593 self.beam_hitlight[0] = 0;
1594 self.beam_hitlight[1] = 1;
1595 self.beam_hitlight[2] = 1;
1596 self.beam_hitlight[3] = 1;
1597 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1598 self.beam_muzzlelight[0] = 0;
1599 self.beam_muzzlelight[1] = 1;
1600 self.beam_muzzlelight[2] = 1;
1601 self.beam_muzzlelight[3] = 1;
1602 self.beam_image = "particles/lgbeam";
1603 if(self.beam_muzzleeffect)
1605 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1606 flash.alpha = self.beam_alpha;
1607 flash.colormod = self.beam_color;
1615 if(!self.beam_usevieworigin)
1617 InterpolateOrigin_Note(this);