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);
172 if(sf & ARC_SF_START) // starting location
174 WriteCoord(MSG_ENTITY, self.beam_start.x);
175 WriteCoord(MSG_ENTITY, self.beam_start.y);
176 WriteCoord(MSG_ENTITY, self.beam_start.z);
178 if(sf & ARC_SF_WANTDIR) // want/aim direction
180 WriteCoord(MSG_ENTITY, self.beam_wantdir.x);
181 WriteCoord(MSG_ENTITY, self.beam_wantdir.y);
182 WriteCoord(MSG_ENTITY, self.beam_wantdir.z);
184 if(sf & ARC_SF_BEAMDIR) // beam direction
186 WriteCoord(MSG_ENTITY, self.beam_dir.x);
187 WriteCoord(MSG_ENTITY, self.beam_dir.y);
188 WriteCoord(MSG_ENTITY, self.beam_dir.z);
190 if(sf & ARC_SF_BEAMTYPE) // beam type
192 WriteByte(MSG_ENTITY, self.beam_type);
198 void Reset_ArcBeam(entity player, vector forward)
200 if (!player.arc_beam) {
203 player.arc_beam.beam_dir = forward;
204 player.arc_beam.beam_teleporttime = time;
207 float Arc_GetHeat_Percent(entity player)
209 if ( WEP_CVAR(arc, overheat_max) <= 0 || WEP_CVAR(arc, overheat_max) <= 0 )
211 player.arc_overheat = 0;
215 if ( player.arc_beam )
216 return player.arc_beam.beam_heat/WEP_CVAR(arc, overheat_max);
218 if ( player.arc_overheat > time )
220 return (player.arc_overheat-time) / WEP_CVAR(arc, overheat_max)
221 * player.arc_cooldown;
226 void Arc_Player_SetHeat(entity player)
228 player.arc_heat_percent = Arc_GetHeat_Percent(player);
229 //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
232 void W_Arc_Bolt_Explode()
234 self.event_damage = func_null;
235 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);
240 void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
245 if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1))
246 return; // g_projectiles_damage says to halt
248 this.health = this.health - damage;
249 this.angles = vectoangles(this.velocity);
252 WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
255 void W_Arc_Bolt_Touch()
261 void W_Arc_Attack_Bolt(Weapon thiswep)
265 W_DecreaseAmmo(thiswep, self, WEP_CVAR(arc, bolt_ammo));
267 W_SetupShot(self, false, 2, SND(LASERGUN_FIRE), CH_WEAPON_A, WEP_CVAR(arc, bolt_damage));
269 Send_Effect(EFFECT_ARC_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
271 missile = new(missile);
272 missile.owner = missile.realowner = self;
273 missile.bot_dodge = true;
274 missile.bot_dodgerating = WEP_CVAR(arc, bolt_damage);
276 missile.takedamage = DAMAGE_YES;
277 missile.health = WEP_CVAR(arc, bolt_health);
278 missile.damageforcescale = WEP_CVAR(arc, bolt_damageforcescale);
279 missile.event_damage = W_Arc_Bolt_Damage;
280 missile.damagedbycontents = true;
282 missile.touch = W_Arc_Bolt_Touch;
283 missile.use = W_Arc_Bolt_Explode;
284 missile.think = adaptor_think2use_hittype_splash;
285 missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
286 PROJECTILE_MAKETRIGGER(missile);
287 missile.projectiledeathtype = WEP_ARC.m_id | HITTYPE_SECONDARY;
288 setorigin(missile, w_shotorg);
289 setsize(missile, '0 0 0', '0 0 0');
291 missile.movetype = MOVETYPE_FLY;
292 W_SetupProjVelocity_PRE(missile, arc, bolt_);
294 missile.angles = vectoangles(missile.velocity);
295 missile.flags = FL_PROJECTILE;
296 missile.missile_flags = MIF_SPLASH;
298 CSQCProjectile(missile, true, PROJECTILE_ARC_BOLT, true);
300 MUTATOR_CALLHOOK(EditProjectile, self, missile);
303 void W_Arc_Beam_Think()
305 if(self != self.owner.arc_beam)
313 if( (self.owner.BUTTON_ATCK2 && !WEP_CVAR(arc, bolt)) || self.beam_bursting)
315 if(!self.beam_bursting)
316 self.beam_bursting = true;
317 burst = ARC_BT_BURSTMASK;
320 Weapon thiswep = WEP_ARC;
323 !IS_PLAYER(self.owner)
325 (self.owner.(thiswep.ammo_field) <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
329 (!self.owner.BUTTON_ATCK && !burst )
331 STAT(FROZEN, self.owner)
335 (WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max))
338 if ( WEP_CVAR(arc, cooldown) > 0 )
340 float cooldown_speed = 0;
341 if ( self.beam_heat > WEP_CVAR(arc, overheat_min) && WEP_CVAR(arc, cooldown) > 0 )
343 cooldown_speed = WEP_CVAR(arc, cooldown);
347 cooldown_speed = self.beam_heat / WEP_CVAR(arc, beam_refire);
350 if ( cooldown_speed )
352 self.owner.arc_overheat = time + self.beam_heat / cooldown_speed;
353 self.owner.arc_cooldown = cooldown_speed;
356 if ( WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max) )
358 Send_Effect(EFFECT_ARC_OVERHEAT,
359 self.beam_start, self.beam_wantdir, 1 );
360 sound(self, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
364 if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
367 if(!w.wr_checkammo1(w) && !w.wr_checkammo2(w))
368 if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
370 // note: this doesn't force the switch
371 W_SwitchToOtherWeapon(self);
379 float coefficient = frametime;
380 if(!(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
384 { rootammo = WEP_CVAR(arc, burst_ammo); }
386 { rootammo = WEP_CVAR(arc, beam_ammo); }
390 coefficient = min(coefficient, self.owner.(thiswep.ammo_field) / rootammo);
391 self.owner.(thiswep.ammo_field) = max(0, self.owner.(thiswep.ammo_field) - (rootammo * frametime));
394 float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat);
395 self.beam_heat = min( WEP_CVAR(arc, overheat_max), self.beam_heat + heat_speed*frametime );
397 makevectors(self.owner.v_angle);
405 WEP_CVAR(arc, beam_damage) * coefficient,
406 WEP_CVAR(arc, beam_range)
409 // After teleport, "lock" the beam until the teleport is confirmed.
410 if (time < self.beam_teleporttime + ANTILAG_LATENCY(self.owner)) {
411 w_shotdir = self.beam_dir;
414 // network information: shot origin and want/aim direction
415 if(self.beam_start != w_shotorg)
417 self.SendFlags |= ARC_SF_START;
418 self.beam_start = w_shotorg;
420 if(self.beam_wantdir != w_shotdir)
422 self.SendFlags |= ARC_SF_WANTDIR;
423 self.beam_wantdir = w_shotdir;
426 if(!self.beam_initialized)
428 self.beam_dir = w_shotdir;
429 self.beam_initialized = true;
432 // WEAPONTODO: Detect player velocity so that the beam curves when moving too
433 // idea: blend together self.beam_dir with the inverted direction the player is moving in
434 // might have to make some special accomodation so that it only uses view_right and view_up
436 // note that if we do this, it'll always be corrected to a maximum angle by beam_maxangle handling
439 if(self.beam_dir != w_shotdir)
441 // calculate how much we're going to move the end of the beam to the want position
442 // WEAPONTODO (server and client):
443 // blendfactor never actually becomes 0 in this situation, which is a problem
444 // regarding precision... this means that self.beam_dir and w_shotdir approach
445 // eachother, however they never actually become the same value with this method.
446 // Perhaps we should do some form of rounding/snapping?
447 float angle = vlen(w_shotdir - self.beam_dir) * RAD2DEG;
448 if(angle && (angle > WEP_CVAR(arc, beam_maxangle)))
450 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
451 float blendfactor = bound(
453 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
454 min(WEP_CVAR(arc, beam_maxangle) / angle, 1)
456 self.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
460 // the radius is not too far yet, no worries :D
461 float blendfactor = bound(
463 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
466 self.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
469 // network information: beam direction
470 self.SendFlags |= ARC_SF_BEAMDIR;
472 // calculate how many segments are needed
473 float max_allowed_segments;
475 if(WEP_CVAR(arc, beam_distancepersegment))
477 max_allowed_segments = min(
479 1 + (vlen(w_shotdir / WEP_CVAR(arc, beam_distancepersegment)))
482 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
484 if(WEP_CVAR(arc, beam_degreespersegment))
491 WEP_CVAR(arc, beam_maxangle)
494 WEP_CVAR(arc, beam_degreespersegment)
499 else { segments = 1; }
501 else { segments = 1; }
503 vector beam_endpos = (w_shotorg + (self.beam_dir * WEP_CVAR(arc, beam_range)));
504 vector beam_controlpoint = w_shotorg + w_shotdir * (WEP_CVAR(arc, beam_range) * (1 - WEP_CVAR(arc, beam_tightness)));
507 float new_beam_type = 0;
508 vector last_origin = w_shotorg;
509 for(i = 1; i <= segments; ++i)
511 // WEAPONTODO (client):
512 // In order to do nice fading and pointing on the starting segment, we must always
513 // have that drawn as a separate triangle... However, that is difficult to do when
514 // keeping in mind the above problems and also optimizing the amount of segments
515 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
517 vector new_origin = bezier_quadratic_getpoint(
522 vector new_dir = normalize(new_origin - last_origin);
524 WarpZone_traceline_antilag(
530 ANTILAG_LATENCY(self.owner)
533 // Do all the transforms for warpzones right now, as we already
534 // "are" in the post-trace system (if we hit a player, that's
535 // always BEHIND the last passed wz).
536 last_origin = trace_endpos;
537 w_shotorg = WarpZone_TransformOrigin(WarpZone_trace_transform, w_shotorg);
538 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
539 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
540 new_dir = WarpZone_TransformVelocity(WarpZone_trace_transform, new_dir);
545 trace_ent.classname == "body"
547 IS_MONSTER(trace_ent)
550 if(trace_ent && trace_ent.takedamage && (is_player || WEP_CVAR(arc, beam_nonplayerdamage)))
552 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
553 // NO. trace_endpos should be just fine. If not,
554 // that's an engine bug that needs proper debugging.
555 vector hitorigin = trace_endpos;
557 float falloff = ExponentialFalloff(
558 WEP_CVAR(arc, beam_falloff_mindist),
559 WEP_CVAR(arc, beam_falloff_maxdist),
560 WEP_CVAR(arc, beam_falloff_halflifedist),
561 vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, hitorigin) - w_shotorg)
564 if(is_player && SAME_TEAM(self.owner, trace_ent))
566 float roothealth, rootarmor;
569 roothealth = WEP_CVAR(arc, burst_healing_hps);
570 rootarmor = WEP_CVAR(arc, burst_healing_aps);
574 roothealth = WEP_CVAR(arc, beam_healing_hps);
575 rootarmor = WEP_CVAR(arc, beam_healing_aps);
578 if(trace_ent.health <= WEP_CVAR(arc, beam_healing_hmax) && roothealth)
580 trace_ent.health = min(
581 trace_ent.health + (roothealth * coefficient),
582 WEP_CVAR(arc, beam_healing_hmax)
585 if(trace_ent.armorvalue <= WEP_CVAR(arc, beam_healing_amax) && rootarmor)
587 trace_ent.armorvalue = min(
588 trace_ent.armorvalue + (rootarmor * coefficient),
589 WEP_CVAR(arc, beam_healing_amax)
593 // stop rot, set visual effect
594 if(roothealth || rootarmor)
596 trace_ent.pauserothealth_finished = max(
597 trace_ent.pauserothealth_finished,
598 time + autocvar_g_balance_pause_health_rot
600 trace_ent.pauserotarmor_finished = max(
601 trace_ent.pauserotarmor_finished,
602 time + autocvar_g_balance_pause_armor_rot
604 new_beam_type = ARC_BT_HEAL;
613 { rootdamage = WEP_CVAR(arc, burst_damage); }
615 { rootdamage = WEP_CVAR(arc, beam_damage); }
618 { rootdamage = WEP_CVAR(arc, beam_nonplayerdamage); }
620 if(accuracy_isgooddamage(self.owner, trace_ent))
626 rootdamage * coefficient * falloff
634 rootdamage * coefficient * falloff,
637 WEP_CVAR(arc, beam_force) * new_dir * coefficient * falloff
640 new_beam_type = ARC_BT_HIT;
644 else if(trace_fraction != 1)
646 // we collided with geometry
647 new_beam_type = ARC_BT_WALL;
652 // te_explosion(trace_endpos);
654 // if we're bursting, use burst visual effects
655 new_beam_type |= burst;
657 // network information: beam type
658 if(new_beam_type != self.beam_type)
660 self.SendFlags |= ARC_SF_BEAMTYPE;
661 self.beam_type = new_beam_type;
664 self.owner.beam_prev = time;
665 self.nextthink = time;
668 void W_Arc_Beam(float burst)
671 // only play fire sound if 1 sec has passed since player let go the fire button
672 if(time - self.beam_prev > 1)
673 sound(self, CH_WEAPON_A, SND_ARC_FIRE, VOL_BASE, ATTN_NORM);
675 entity beam = self.arc_beam = new(W_Arc_Beam);
676 beam.solid = SOLID_NOT;
677 beam.think = W_Arc_Beam_Think;
679 beam.movetype = MOVETYPE_NONE;
680 beam.bot_dodge = true;
681 beam.bot_dodgerating = WEP_CVAR(arc, beam_damage);
682 beam.beam_bursting = burst;
683 Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
685 WITH(entity, self, beam, beam.think());
690 makevectors(self.v_angle);
691 W_SetupShot_Range(self,true,0,"",0,0,0);
693 vector smoke_origin = w_shotorg + self.velocity*frametime;
694 if ( self.arc_overheat > time )
696 if ( random() < self.arc_heat_percent )
697 Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
698 if ( self.BUTTON_ATCK || self.BUTTON_ATCK2 )
700 Send_Effect(EFFECT_ARC_OVERHEAT_FIRE, smoke_origin, w_shotdir, 1 );
701 if ( !self.arc_smoke_sound )
703 self.arc_smoke_sound = 1;
704 sound(self, CH_SHOTS_SINGLE, SND_ARC_LOOP_OVERHEAT, VOL_BASE, ATTN_NORM);
708 else if ( self.arc_beam && WEP_CVAR(arc, overheat_max) > 0 &&
709 self.arc_beam.beam_heat > WEP_CVAR(arc, overheat_min) )
711 if ( random() < (self.arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) /
712 ( WEP_CVAR(arc, overheat_max)-WEP_CVAR(arc, overheat_min) ) )
713 Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
716 if ( self.arc_smoke_sound && ( self.arc_overheat <= time ||
717 !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || PS(self).m_switchweapon != WEP_ARC )
719 self.arc_smoke_sound = 0;
720 sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
724 METHOD(Arc, wr_aim, void(entity thiswep))
727 if(WEP_CVAR(arc, beam_botaimspeed))
729 self.BUTTON_ATCK = bot_aim(
730 WEP_CVAR(arc, beam_botaimspeed),
732 WEP_CVAR(arc, beam_botaimlifetime),
738 self.BUTTON_ATCK = bot_aim(
746 METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
748 Arc_Player_SetHeat(actor);
751 bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
753 if (time >= actor.arc_overheat)
754 if ((fire & 1) || beam_fire2 || actor.arc_beam.beam_bursting)
757 if(actor.arc_BUTTON_ATCK_prev)
760 if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
761 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
764 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
767 if((!actor.arc_beam) || wasfreed(actor.arc_beam))
769 if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
771 W_Arc_Beam(boolean(beam_fire2));
773 if(!actor.arc_BUTTON_ATCK_prev)
775 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
776 actor.arc_BUTTON_ATCK_prev = true;
785 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
787 W_Arc_Attack_Bolt(thiswep);
788 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
792 if(actor.arc_BUTTON_ATCK_prev)
794 sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
795 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
796 int slot = weaponslot(weaponentity);
797 ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
799 actor.arc_BUTTON_ATCK_prev = false;
803 if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_arc_secondary_refire))
806 actor.arc_count = autocvar_g_balance_arc_secondary_count;
807 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
808 actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
812 METHOD(Arc, wr_init, void(entity thiswep))
814 if(!arc_shotorigin[0])
816 arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
817 arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
818 arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
819 arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
822 METHOD(Arc, wr_checkammo1, bool(entity thiswep))
825 return ((!WEP_CVAR(arc, beam_ammo)) || (self.(thiswep.ammo_field) > 0));
827 METHOD(Arc, wr_checkammo2, bool(entity thiswep))
830 if(WEP_CVAR(arc, bolt))
832 float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
833 ammo_amount += self.(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
837 return WEP_CVAR(arc, overheat_max) > 0 &&
838 ((!WEP_CVAR(arc, burst_ammo)) || (self.(thiswep.ammo_field) > 0));
840 METHOD(Arc, wr_killmessage, int(entity thiswep))
842 if(w_deathtype & HITTYPE_SECONDARY)
843 return WEAPON_ARC_MURDER_SPRAY;
845 return WEAPON_ARC_MURDER;
847 METHOD(Arc, wr_drop, void(entity thiswep))
849 weapon_dropevent_item.arc_overheat = self.arc_overheat;
850 weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
851 self.arc_overheat = 0;
852 self.arc_cooldown = 0;
854 METHOD(Arc, wr_pickup, void(entity thiswep))
856 if ( !client_hasweapon(self, thiswep, false, false) &&
857 weapon_dropevent_item.arc_overheat > time )
859 self.arc_overheat = weapon_dropevent_item.arc_overheat;
860 self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
865 METHOD(Arc, wr_impacteffect, void(entity thiswep))
867 if(w_deathtype & HITTYPE_SECONDARY)
870 org2 = w_org + w_backoff * 6;
871 pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1);
872 if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
876 void Draw_ArcBeam_callback(vector start, vector hit, vector end)
878 entity beam = Draw_ArcBeam_callback_entity;
879 vector transformed_view_org;
880 transformed_view_org = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
882 // Thickdir shall be perpendicular to the beam and to the view-to-beam direction (WEAPONTODO: WHY)
883 // WEAPONTODO: Wouldn't it be better to be perpendicular to the beam and to the view FORWARD direction?
884 vector thickdir = normalize(cross(normalize(start - hit), transformed_view_org - start));
890 if(trace_fraction != 1)
892 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
893 hitorigin = start + (Draw_ArcBeam_callback_new_dir * Draw_ArcBeam_callback_segmentdist * trace_fraction);
894 hitorigin = WarpZone_TransformOrigin(WarpZone_trace_transform, hitorigin);
904 // decide upon thickness
905 float thickness = beam.beam_thickness;
907 // draw primary beam render
908 vector top = hitorigin + (thickdir * thickness);
909 vector bottom = hitorigin - (thickdir * thickness);
911 vector last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
912 vector last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
914 R_BeginPolygon(beam.beam_image, DRAWFLAG_NORMAL); // DRAWFLAG_ADDITIVE
917 '0 0.5 0' + ('0 0.5 0' * (thickness / beam.beam_thickness)),
923 '0 0.5 0' + ('0 0.5 0' * (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
929 '0 0.5 0' * (1 - (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
935 '0 0.5 0' * (1 - (thickness / beam.beam_thickness)),
941 // draw trailing particles
943 // - Don't use spammy particle counts here, use a FEW small particles around the beam
944 // - We're not using WarpZone_TrailParticles here because we will handle warpzones ourselves.
945 if(beam.beam_traileffect)
947 trailparticles(beam, beam.beam_traileffect, start, hitorigin);
950 // set up for the next
951 Draw_ArcBeam_callback_last_thickness = thickness;
952 Draw_ArcBeam_callback_last_top = WarpZone_UnTransformOrigin(WarpZone_trace_transform, top);
953 Draw_ArcBeam_callback_last_bottom = WarpZone_UnTransformOrigin(WarpZone_trace_transform, bottom);
959 for (e = world; (e = findfloat(e, beam_usevieworigin, 1)); ) {
960 e.beam_initialized = false;
962 for (e = world; (e = findfloat(e, beam_usevieworigin, 2)); ) {
963 e.beam_initialized = false;
967 void Draw_ArcBeam(entity this)
969 float dt = time - this.move_time;
970 this.move_time = time;
971 if(dt <= 0) { return; }
973 if(!this.beam_usevieworigin)
975 InterpolateOrigin_Do(this);
978 // origin = beam starting origin
979 // v_angle = wanted/aim direction
980 // angles = current direction of beam
983 vector wantdir; //= view_forward;
984 vector beamdir; //= this.beam_dir;
987 if(this.beam_usevieworigin)
990 // Currently we have to replicate nearly the same method of figuring
991 // out the shotdir that the server does... Ideally in the future we
992 // should be able to acquire this from a generalized function built
993 // into a weapon system for client code.
995 // find where we are aiming
996 makevectors(warpzone_save_view_angles);
997 vector forward = v_forward;
998 vector right = v_right;
1001 // decide upon start position
1002 if(this.beam_usevieworigin == 2)
1003 { start_pos = warpzone_save_view_origin; }
1005 { start_pos = this.origin; }
1007 // trace forward with an estimation
1010 start_pos + forward * this.beam_range,
1015 // untransform in case our trace went through a warpzone
1016 vector end_pos = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
1018 // un-adjust trueaim if shotend is too close
1019 if(vdist(end_pos - start_pos, <, g_trueaim_minrange))
1020 end_pos = start_pos + (forward * g_trueaim_minrange);
1022 // move shot origin to the actual gun muzzle origin
1023 vector origin_offset =
1024 right * -this.beam_shotorigin.y
1025 + up * this.beam_shotorigin.z;
1027 start_pos = start_pos + origin_offset;
1029 // Move it also forward, but only as far as possible without hitting anything. Don't poke into walls!
1030 traceline(start_pos, start_pos + forward * this.beam_shotorigin.x, MOVE_NORMAL, this);
1031 start_pos = trace_endpos;
1033 // calculate the aim direction now
1034 wantdir = normalize(end_pos - start_pos);
1036 if(!this.beam_initialized)
1038 this.beam_dir = wantdir;
1039 this.beam_initialized = true;
1042 if(this.beam_dir != wantdir)
1044 // calculate how much we're going to move the end of the beam to the want position
1045 // WEAPONTODO (server and client):
1046 // blendfactor never actually becomes 0 in this situation, which is a problem
1047 // regarding precision... this means that this.beam_dir and w_shotdir approach
1048 // eachother, however they never actually become the same value with this method.
1049 // Perhaps we should do some form of rounding/snapping?
1050 float angle = vlen(wantdir - this.beam_dir) * RAD2DEG;
1051 if(angle && (angle > this.beam_maxangle))
1053 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
1054 float blendfactor = bound(
1056 (1 - (this.beam_returnspeed * frametime)),
1057 min(this.beam_maxangle / angle, 1)
1059 this.beam_dir = normalize((wantdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
1063 // the radius is not too far yet, no worries :D
1064 float blendfactor = bound(
1066 (1 - (this.beam_returnspeed * frametime)),
1069 this.beam_dir = normalize((wantdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
1072 // calculate how many segments are needed
1073 float max_allowed_segments;
1075 if(this.beam_distancepersegment)
1077 max_allowed_segments = min(
1079 1 + (vlen(wantdir / this.beam_distancepersegment))
1082 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
1084 if(this.beam_degreespersegment)
1094 this.beam_degreespersegment
1096 max_allowed_segments
1099 else { segments = 1; }
1101 else { segments = 1; }
1103 // set the beam direction which the rest of the code will refer to
1104 beamdir = this.beam_dir;
1106 // finally, set this.angles to the proper direction so that muzzle attachment points in proper direction
1107 this.angles = fixedvectoangles2(forward, up); // TODO(Samual): is this == warpzone_save_view_angles?
1111 // set the values from the provided info from the networked entity
1112 start_pos = this.origin;
1113 wantdir = this.v_angle;
1114 beamdir = this.angles;
1116 if(beamdir != wantdir)
1118 float angle = vlen(wantdir - beamdir) * RAD2DEG;
1120 // calculate how many segments are needed
1121 float max_allowed_segments;
1123 if(this.beam_distancepersegment)
1125 max_allowed_segments = min(
1127 1 + (vlen(wantdir / this.beam_distancepersegment))
1130 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
1132 if(this.beam_degreespersegment)
1142 this.beam_degreespersegment
1144 max_allowed_segments
1147 else { segments = 1; }
1149 else { segments = 1; }
1152 setorigin(this, start_pos);
1153 this.beam_muzzleentity.angles_z = random() * 360; // WEAPONTODO: use avelocity instead?
1155 vector beam_endpos = (start_pos + (beamdir * this.beam_range));
1156 vector beam_controlpoint = start_pos + wantdir * (this.beam_range * (1 - this.beam_tightness));
1158 Draw_ArcBeam_callback_entity = this;
1159 Draw_ArcBeam_callback_last_thickness = 0;
1160 Draw_ArcBeam_callback_last_top = start_pos;
1161 Draw_ArcBeam_callback_last_bottom = start_pos;
1163 vector last_origin = start_pos;
1164 vector original_start_pos = start_pos;
1167 for(i = 1; i <= segments; ++i)
1169 // WEAPONTODO (client):
1170 // In order to do nice fading and pointing on the starting segment, we must always
1171 // have that drawn as a separate triangle... However, that is difficult to do when
1172 // keeping in mind the above problems and also optimizing the amount of segments
1173 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
1175 vector new_origin = bezier_quadratic_getpoint(
1181 WarpZone_TraceBox_ThroughZone(
1189 Draw_ArcBeam_callback
1192 // Do all the transforms for warpzones right now, as we already "are" in the post-trace
1193 // system (if we hit a player, that's always BEHIND the last passed wz).
1194 last_origin = trace_endpos;
1195 start_pos = WarpZone_TransformOrigin(WarpZone_trace_transform, start_pos);
1196 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
1197 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
1198 beamdir = WarpZone_TransformVelocity(WarpZone_trace_transform, beamdir);
1199 Draw_ArcBeam_callback_last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
1200 Draw_ArcBeam_callback_last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
1202 if(trace_fraction < 1) { break; }
1205 // visual effects for startpoint and endpoint
1206 if(this.beam_hiteffect)
1208 // FIXME we really should do this on the server so it actually
1209 // matches gameplay. What this client side stuff is doing is no
1210 // more than guesswork.
1211 if((trace_ent || trace_fraction < 1) && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
1213 this.beam_hiteffect,
1219 if(this.beam_hitlight[0])
1223 this.beam_hitlight[0],
1225 this.beam_hitlight[1],
1226 this.beam_hitlight[2],
1227 this.beam_hitlight[3]
1231 if(this.beam_muzzleeffect)
1234 this.beam_muzzleeffect,
1235 original_start_pos + wantdir * 20,
1240 if(this.beam_muzzlelight[0])
1243 original_start_pos + wantdir * 20,
1244 this.beam_muzzlelight[0],
1246 this.beam_muzzlelight[1],
1247 this.beam_muzzlelight[2],
1248 this.beam_muzzlelight[3]
1254 Draw_ArcBeam_callback_entity = world;
1255 Draw_ArcBeam_callback_last_thickness = 0;
1256 Draw_ArcBeam_callback_last_top = '0 0 0';
1257 Draw_ArcBeam_callback_last_bottom = '0 0 0';
1260 void Remove_ArcBeam(entity this)
1262 remove(this.beam_muzzleentity);
1263 sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
1266 NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
1268 int sf = ReadByte();
1273 int gunalign = W_GetGunAlignment(world);
1275 self.beam_shotorigin = arc_shotorigin[gunalign];
1277 // set other main attributes of the beam
1278 self.draw = Draw_ArcBeam;
1279 self.entremove = Remove_ArcBeam;
1280 self.move_time = time;
1281 loopsound(self, CH_SHOTS_SINGLE, SND(ARC_LOOP), VOL_BASE, ATTEN_NORM);
1285 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT;
1286 flash.drawmask = MASK_NORMAL;
1287 flash.solid = SOLID_NOT;
1288 flash.avelocity_z = 5000;
1289 setattachment(flash, self, "");
1290 setorigin(flash, '0 0 0');
1292 self.beam_muzzleentity = flash;
1296 flash = self.beam_muzzleentity;
1299 if(sf & ARC_SF_SETTINGS) // settings information
1301 self.beam_degreespersegment = ReadShort();
1302 self.beam_distancepersegment = ReadShort();
1303 self.beam_maxangle = ReadShort();
1304 self.beam_range = ReadCoord();
1305 self.beam_returnspeed = ReadShort();
1306 self.beam_tightness = (ReadByte() / 10);
1310 if(autocvar_chase_active)
1311 { self.beam_usevieworigin = 1; }
1312 else // use view origin
1313 { self.beam_usevieworigin = 2; }
1317 self.beam_usevieworigin = 0;
1321 if(!self.beam_usevieworigin)
1323 // self.iflags = IFLAG_ORIGIN | IFLAG_ANGLES | IFLAG_V_ANGLE; // why doesn't this work?
1324 self.iflags = IFLAG_ORIGIN;
1326 InterpolateOrigin_Undo(self);
1329 if(sf & ARC_SF_START) // starting location
1331 self.origin_x = ReadCoord();
1332 self.origin_y = ReadCoord();
1333 self.origin_z = ReadCoord();
1335 else if(self.beam_usevieworigin) // infer the location from player location
1337 if(self.beam_usevieworigin == 2)
1340 self.origin = view_origin;
1344 // use player origin so that third person display still works
1345 self.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * STAT(VIEWHEIGHT));
1349 setorigin(self, self.origin);
1351 if(sf & ARC_SF_WANTDIR) // want/aim direction
1353 self.v_angle_x = ReadCoord();
1354 self.v_angle_y = ReadCoord();
1355 self.v_angle_z = ReadCoord();
1358 if(sf & ARC_SF_BEAMDIR) // beam direction
1360 self.angles_x = ReadCoord();
1361 self.angles_y = ReadCoord();
1362 self.angles_z = ReadCoord();
1365 if(sf & ARC_SF_BEAMTYPE) // beam type
1367 self.beam_type = ReadByte();
1368 switch(self.beam_type)
1372 self.beam_color = '1 1 1';
1373 self.beam_alpha = 0.5;
1374 self.beam_thickness = 8;
1375 self.beam_traileffect = (EFFECT_ARC_BEAM);
1376 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1377 self.beam_hitlight[0] = 0;
1378 self.beam_hitlight[1] = 1;
1379 self.beam_hitlight[2] = 1;
1380 self.beam_hitlight[3] = 1;
1381 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1382 self.beam_muzzlelight[0] = 0;
1383 self.beam_muzzlelight[1] = 1;
1384 self.beam_muzzlelight[2] = 1;
1385 self.beam_muzzlelight[3] = 1;
1386 if(self.beam_muzzleeffect)
1388 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1389 flash.alpha = self.beam_alpha;
1390 flash.colormod = self.beam_color;
1395 case ARC_BT_WALL: // grenadelauncher_muzzleflash healray_muzzleflash
1397 self.beam_color = '1 1 1';
1398 self.beam_alpha = 0.5;
1399 self.beam_thickness = 8;
1400 self.beam_traileffect = (EFFECT_ARC_BEAM);
1401 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1402 self.beam_hitlight[0] = 0;
1403 self.beam_hitlight[1] = 1;
1404 self.beam_hitlight[2] = 1;
1405 self.beam_hitlight[3] = 1;
1406 self.beam_muzzleeffect = NULL; // (EFFECT_GRENADE_MUZZLEFLASH);
1407 self.beam_muzzlelight[0] = 0;
1408 self.beam_muzzlelight[1] = 1;
1409 self.beam_muzzlelight[2] = 1;
1410 self.beam_muzzlelight[3] = 1;
1411 self.beam_image = "particles/lgbeam";
1412 if(self.beam_muzzleeffect)
1414 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1415 flash.alpha = self.beam_alpha;
1416 flash.colormod = self.beam_color;
1423 self.beam_color = '1 1 1';
1424 self.beam_alpha = 0.5;
1425 self.beam_thickness = 8;
1426 self.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
1427 self.beam_hiteffect = (EFFECT_ARC_BEAM_HEAL_IMPACT);
1428 self.beam_hitlight[0] = 0;
1429 self.beam_hitlight[1] = 1;
1430 self.beam_hitlight[2] = 1;
1431 self.beam_hitlight[3] = 1;
1432 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1433 self.beam_muzzlelight[0] = 0;
1434 self.beam_muzzlelight[1] = 1;
1435 self.beam_muzzlelight[2] = 1;
1436 self.beam_muzzlelight[3] = 1;
1437 self.beam_image = "particles/lgbeam";
1438 if(self.beam_muzzleeffect)
1440 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1441 flash.alpha = self.beam_alpha;
1442 flash.colormod = self.beam_color;
1449 self.beam_color = '1 1 1';
1450 self.beam_alpha = 0.5;
1451 self.beam_thickness = 8;
1452 self.beam_traileffect = (EFFECT_ARC_BEAM);
1453 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1454 self.beam_hitlight[0] = 20;
1455 self.beam_hitlight[1] = 1;
1456 self.beam_hitlight[2] = 0;
1457 self.beam_hitlight[3] = 0;
1458 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1459 self.beam_muzzlelight[0] = 50;
1460 self.beam_muzzlelight[1] = 1;
1461 self.beam_muzzlelight[2] = 0;
1462 self.beam_muzzlelight[3] = 0;
1463 self.beam_image = "particles/lgbeam";
1464 if(self.beam_muzzleeffect)
1466 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1467 flash.alpha = self.beam_alpha;
1468 flash.colormod = self.beam_color;
1473 case ARC_BT_BURST_MISS:
1475 self.beam_color = '1 1 1';
1476 self.beam_alpha = 0.5;
1477 self.beam_thickness = 14;
1478 self.beam_traileffect = (EFFECT_ARC_BEAM);
1479 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1480 self.beam_hitlight[0] = 0;
1481 self.beam_hitlight[1] = 1;
1482 self.beam_hitlight[2] = 1;
1483 self.beam_hitlight[3] = 1;
1484 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1485 self.beam_muzzlelight[0] = 0;
1486 self.beam_muzzlelight[1] = 1;
1487 self.beam_muzzlelight[2] = 1;
1488 self.beam_muzzlelight[3] = 1;
1489 self.beam_image = "particles/lgbeam";
1490 if(self.beam_muzzleeffect)
1492 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1493 flash.alpha = self.beam_alpha;
1494 flash.colormod = self.beam_color;
1499 case ARC_BT_BURST_WALL:
1501 self.beam_color = '1 1 1';
1502 self.beam_alpha = 0.5;
1503 self.beam_thickness = 14;
1504 self.beam_traileffect = (EFFECT_ARC_BEAM);
1505 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1506 self.beam_hitlight[0] = 0;
1507 self.beam_hitlight[1] = 1;
1508 self.beam_hitlight[2] = 1;
1509 self.beam_hitlight[3] = 1;
1510 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1511 self.beam_muzzlelight[0] = 0;
1512 self.beam_muzzlelight[1] = 1;
1513 self.beam_muzzlelight[2] = 1;
1514 self.beam_muzzlelight[3] = 1;
1515 self.beam_image = "particles/lgbeam";
1516 if(self.beam_muzzleeffect)
1518 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1519 flash.alpha = self.beam_alpha;
1520 flash.colormod = self.beam_color;
1525 case ARC_BT_BURST_HEAL:
1527 self.beam_color = '1 1 1';
1528 self.beam_alpha = 0.5;
1529 self.beam_thickness = 14;
1530 self.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
1531 self.beam_hiteffect = (EFFECT_ARC_BEAM_HEAL_IMPACT2);
1532 self.beam_hitlight[0] = 0;
1533 self.beam_hitlight[1] = 1;
1534 self.beam_hitlight[2] = 1;
1535 self.beam_hitlight[3] = 1;
1536 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1537 self.beam_muzzlelight[0] = 0;
1538 self.beam_muzzlelight[1] = 1;
1539 self.beam_muzzlelight[2] = 1;
1540 self.beam_muzzlelight[3] = 1;
1541 self.beam_image = "particles/lgbeam";
1542 if(self.beam_muzzleeffect)
1544 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1545 flash.alpha = self.beam_alpha;
1546 flash.colormod = self.beam_color;
1551 case ARC_BT_BURST_HIT:
1553 self.beam_color = '1 1 1';
1554 self.beam_alpha = 0.5;
1555 self.beam_thickness = 14;
1556 self.beam_traileffect = (EFFECT_ARC_BEAM);
1557 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1558 self.beam_hitlight[0] = 0;
1559 self.beam_hitlight[1] = 1;
1560 self.beam_hitlight[2] = 1;
1561 self.beam_hitlight[3] = 1;
1562 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1563 self.beam_muzzlelight[0] = 0;
1564 self.beam_muzzlelight[1] = 1;
1565 self.beam_muzzlelight[2] = 1;
1566 self.beam_muzzlelight[3] = 1;
1567 self.beam_image = "particles/lgbeam";
1568 if(self.beam_muzzleeffect)
1570 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1571 flash.alpha = self.beam_alpha;
1572 flash.colormod = self.beam_color;
1578 // shouldn't be possible, but lets make it colorful if it does :D
1581 self.beam_color = randomvec();
1582 self.beam_alpha = 1;
1583 self.beam_thickness = 8;
1584 self.beam_traileffect = NULL;
1585 self.beam_hiteffect = NULL;
1586 self.beam_hitlight[0] = 0;
1587 self.beam_hitlight[1] = 1;
1588 self.beam_hitlight[2] = 1;
1589 self.beam_hitlight[3] = 1;
1590 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1591 self.beam_muzzlelight[0] = 0;
1592 self.beam_muzzlelight[1] = 1;
1593 self.beam_muzzlelight[2] = 1;
1594 self.beam_muzzlelight[3] = 1;
1595 self.beam_image = "particles/lgbeam";
1596 if(self.beam_muzzleeffect)
1598 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1599 flash.alpha = self.beam_alpha;
1600 flash.colormod = self.beam_color;
1608 if(!self.beam_usevieworigin)
1610 InterpolateOrigin_Note(this);