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, cooldown_release, float, NONE) /* delay weapon re-use when releasing button */ \
61 P(class, prefix, overheat_max, float, NONE) /* maximum heat before jamming */ \
62 P(class, prefix, overheat_min, float, NONE) /* minimum heat to wait for cooldown */ \
63 P(class, prefix, switchdelay_drop, float, NONE) \
64 P(class, prefix, switchdelay_raise, float, NONE) \
65 P(class, prefix, weaponreplace, string, NONE) \
66 P(class, prefix, weaponstartoverride, float, NONE) \
67 P(class, prefix, weaponstart, float, NONE) \
68 P(class, prefix, weaponthrowable, float, NONE) \
74 REGISTER_WEAPON(ARC, arc, NEW(Arc));
78 const float ARC_MAX_SEGMENTS = 20;
79 vector arc_shotorigin[4];
85 const int ARC_BT_MISS = 0x00;
86 const int ARC_BT_WALL = 0x01;
87 const int ARC_BT_HEAL = 0x02;
88 const int ARC_BT_HIT = 0x03;
89 const int ARC_BT_BURST_MISS = 0x10;
90 const int ARC_BT_BURST_WALL = 0x11;
91 const int ARC_BT_BURST_HEAL = 0x12;
92 const int ARC_BT_BURST_HIT = 0x13;
93 const int ARC_BT_BURSTMASK = 0x10;
95 const int ARC_SF_SETTINGS = BIT(0);
96 const int ARC_SF_START = BIT(1);
97 const int ARC_SF_WANTDIR = BIT(2);
98 const int ARC_SF_BEAMDIR = BIT(3);
99 const int ARC_SF_BEAMTYPE = BIT(4);
100 const int ARC_SF_LOCALMASK = ARC_SF_START | ARC_SF_WANTDIR | ARC_SF_BEAMDIR;
104 .bool arc_BUTTON_ATCK_prev; // for better animation control
106 .float beam_initialized;
107 .float beam_bursting;
108 .float beam_teleporttime;
109 .float beam_heat; // (beam) amount of heat produced
110 .float arc_overheat; // (dropped arc/player) time during which it's too hot
111 .float arc_cooldown; // (dropped arc/player) cooling speed
112 .float arc_heat_percent = _STAT(ARC_HEAT);
113 .float arc_smoke_sound;
119 .float beam_thickness;
120 .entity beam_traileffect;
121 .entity beam_hiteffect;
122 .float beam_hitlight[4]; // 0: radius, 123: rgb
123 .entity beam_muzzleeffect;
124 .float beam_muzzlelight[4]; // 0: radius, 123: rgb
127 .entity beam_muzzleentity;
129 .float beam_degreespersegment;
130 .float beam_distancepersegment;
131 .float beam_usevieworigin;
132 .float beam_initialized;
133 .float beam_maxangle;
135 .float beam_returnspeed;
136 .float beam_tightness;
137 .vector beam_shotorigin;
139 entity Draw_ArcBeam_callback_entity;
140 float Draw_ArcBeam_callback_last_thickness;
141 vector Draw_ArcBeam_callback_last_top; // NOTE: in same coordinate system as player.
142 vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as player.
145 #ifdef IMPLEMENTATION
147 spawnfunc(weapon_arc) { weapon_defaultspawnfunc(this, WEP_ARC); }
149 bool W_Arc_Beam_Send(entity this, entity to, int sf)
151 WriteHeader(MSG_ENTITY, ENT_CLIENT_ARC_BEAM);
153 // Truncate information when this beam is displayed to the owner client
154 // - The owner client has no use for beam start position or directions,
155 // it always figures this information out for itself with csqc code.
156 // - Spectating the owner also truncates this information.
157 float drawlocal = ((to == this.owner) || ((to.enemy == this.owner) && IS_SPEC(to)));
158 if(drawlocal) { sf &= ~ARC_SF_LOCALMASK; }
160 WriteByte(MSG_ENTITY, sf);
162 if(sf & ARC_SF_SETTINGS) // settings information
164 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_degreespersegment));
165 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_distancepersegment));
166 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_maxangle));
167 WriteCoord(MSG_ENTITY, WEP_CVAR(arc, beam_range));
168 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_returnspeed));
169 WriteByte(MSG_ENTITY, WEP_CVAR(arc, beam_tightness) * 10);
171 WriteByte(MSG_ENTITY, drawlocal);
172 WriteByte(MSG_ENTITY, etof(this.owner));
174 if(sf & ARC_SF_START) // starting location
176 WriteCoord(MSG_ENTITY, this.beam_start.x);
177 WriteCoord(MSG_ENTITY, this.beam_start.y);
178 WriteCoord(MSG_ENTITY, this.beam_start.z);
180 if(sf & ARC_SF_WANTDIR) // want/aim direction
182 WriteCoord(MSG_ENTITY, this.beam_wantdir.x);
183 WriteCoord(MSG_ENTITY, this.beam_wantdir.y);
184 WriteCoord(MSG_ENTITY, this.beam_wantdir.z);
186 if(sf & ARC_SF_BEAMDIR) // beam direction
188 WriteCoord(MSG_ENTITY, this.beam_dir.x);
189 WriteCoord(MSG_ENTITY, this.beam_dir.y);
190 WriteCoord(MSG_ENTITY, this.beam_dir.z);
192 if(sf & ARC_SF_BEAMTYPE) // beam type
194 WriteByte(MSG_ENTITY, this.beam_type);
200 void Reset_ArcBeam(entity player, vector forward)
202 if (!player.arc_beam) {
205 player.arc_beam.beam_dir = forward;
206 player.arc_beam.beam_teleporttime = time;
209 float Arc_GetHeat_Percent(entity player)
211 if ( WEP_CVAR(arc, overheat_max) <= 0 || WEP_CVAR(arc, overheat_max) <= 0 )
213 player.arc_overheat = 0;
217 if ( player.arc_beam )
218 return player.arc_beam.beam_heat/WEP_CVAR(arc, overheat_max);
220 if ( player.arc_overheat > time )
222 return (player.arc_overheat-time) / WEP_CVAR(arc, overheat_max)
223 * player.arc_cooldown;
228 void Arc_Player_SetHeat(entity player)
230 player.arc_heat_percent = Arc_GetHeat_Percent(player);
231 //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
234 void W_Arc_Bolt_Explode(entity this, entity directhitentity)
236 this.event_damage = func_null;
237 RadiusDamage(this, this.realowner, WEP_CVAR(arc, bolt_damage), WEP_CVAR(arc, bolt_edgedamage), WEP_CVAR(arc, bolt_radius), NULL, NULL, WEP_CVAR(arc, bolt_force), this.projectiledeathtype, directhitentity);
242 void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger)
244 W_Arc_Bolt_Explode(this, trigger);
247 void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
252 if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1))
253 return; // g_projectiles_damage says to halt
255 this.health = this.health - damage;
256 this.angles = vectoangles(this.velocity);
259 W_PrepareExplosionByDamage(this, attacker, getthink(this));
262 void W_Arc_Bolt_Touch(entity this, entity toucher)
264 PROJECTILE_TOUCH(this, toucher);
265 this.use(this, NULL, toucher);
268 void W_Arc_Attack_Bolt(Weapon thiswep, entity actor)
272 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(arc, bolt_ammo));
274 W_SetupShot(actor, false, 2, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage));
276 Send_Effect(EFFECT_ARC_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
278 missile = new(missile);
279 missile.owner = missile.realowner = actor;
280 missile.bot_dodge = true;
281 missile.bot_dodgerating = WEP_CVAR(arc, bolt_damage);
283 missile.takedamage = DAMAGE_YES;
284 missile.health = WEP_CVAR(arc, bolt_health);
285 missile.damageforcescale = WEP_CVAR(arc, bolt_damageforcescale);
286 missile.event_damage = W_Arc_Bolt_Damage;
287 missile.damagedbycontents = true;
289 settouch(missile, W_Arc_Bolt_Touch);
290 missile.use = W_Arc_Bolt_Explode_use;
291 setthink(missile, adaptor_think2use_hittype_splash);
292 missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
293 PROJECTILE_MAKETRIGGER(missile);
294 missile.projectiledeathtype = WEP_ARC.m_id | HITTYPE_SECONDARY;
295 setorigin(missile, w_shotorg);
296 setsize(missile, '0 0 0', '0 0 0');
298 set_movetype(missile, MOVETYPE_FLY);
299 W_SetupProjVelocity_PRE(missile, arc, bolt_);
301 missile.angles = vectoangles(missile.velocity);
302 missile.flags = FL_PROJECTILE;
303 missile.missile_flags = MIF_SPLASH;
305 CSQCProjectile(missile, true, PROJECTILE_ARC_BOLT, true);
307 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
310 void W_Arc_Beam_Think(entity this)
312 if(this != this.owner.arc_beam)
320 if( (PHYS_INPUT_BUTTON_ATCK2(this.owner) && !WEP_CVAR(arc, bolt)) || this.beam_bursting)
322 if(!this.beam_bursting)
323 this.beam_bursting = true;
324 burst = ARC_BT_BURSTMASK;
327 Weapon thiswep = WEP_ARC;
330 !IS_PLAYER(this.owner)
332 (this.owner.(thiswep.ammo_field) <= 0 && !(this.owner.items & IT_UNLIMITED_WEAPON_AMMO))
336 forbidWeaponUse(this.owner)
338 (!PHYS_INPUT_BUTTON_ATCK(this.owner) && !burst )
342 (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max))
345 if ( WEP_CVAR(arc, cooldown) > 0 )
347 float cooldown_speed = 0;
348 if ( this.beam_heat > WEP_CVAR(arc, overheat_min) && WEP_CVAR(arc, cooldown) > 0 )
350 cooldown_speed = WEP_CVAR(arc, cooldown);
354 cooldown_speed = this.beam_heat / WEP_CVAR(arc, beam_refire);
357 if ( cooldown_speed )
359 if ( WEP_CVAR(arc, cooldown_release) || (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max)) )
360 this.owner.arc_overheat = time + this.beam_heat / cooldown_speed;
361 this.owner.arc_cooldown = cooldown_speed;
364 if ( WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max) )
366 Send_Effect(EFFECT_ARC_OVERHEAT,
367 this.beam_start, this.beam_wantdir, 1 );
368 sound(this, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
372 if(this == this.owner.arc_beam) { this.owner.arc_beam = NULL; }
373 entity own = this.owner;
375 if(!w.wr_checkammo1(w, own) && !w.wr_checkammo2(w, own))
376 if(!(own.items & IT_UNLIMITED_WEAPON_AMMO))
378 // note: this doesn't force the switch
379 W_SwitchToOtherWeapon(own);
386 float coefficient = frametime;
387 if(!(this.owner.items & IT_UNLIMITED_WEAPON_AMMO))
391 { rootammo = WEP_CVAR(arc, burst_ammo); }
393 { rootammo = WEP_CVAR(arc, beam_ammo); }
397 coefficient = min(coefficient, this.owner.(thiswep.ammo_field) / rootammo);
398 this.owner.(thiswep.ammo_field) = max(0, this.owner.(thiswep.ammo_field) - (rootammo * frametime));
401 float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat);
402 this.beam_heat = min( WEP_CVAR(arc, overheat_max), this.beam_heat + heat_speed*frametime );
404 makevectors(this.owner.v_angle);
412 WEP_CVAR(arc, beam_damage) * coefficient,
413 WEP_CVAR(arc, beam_range)
416 // After teleport, "lock" the beam until the teleport is confirmed.
417 if (time < this.beam_teleporttime + ANTILAG_LATENCY(this.owner)) {
418 w_shotdir = this.beam_dir;
421 // network information: shot origin and want/aim direction
422 if(this.beam_start != w_shotorg)
424 this.SendFlags |= ARC_SF_START;
425 this.beam_start = w_shotorg;
427 if(this.beam_wantdir != w_shotdir)
429 this.SendFlags |= ARC_SF_WANTDIR;
430 this.beam_wantdir = w_shotdir;
433 if(!this.beam_initialized)
435 this.beam_dir = w_shotdir;
436 this.beam_initialized = true;
439 // WEAPONTODO: Detect player velocity so that the beam curves when moving too
440 // idea: blend together this.beam_dir with the inverted direction the player is moving in
441 // might have to make some special accomodation so that it only uses view_right and view_up
443 // note that if we do this, it'll always be corrected to a maximum angle by beam_maxangle handling
446 if(this.beam_dir != w_shotdir)
448 // calculate how much we're going to move the end of the beam to the want position
449 // WEAPONTODO (server and client):
450 // blendfactor never actually becomes 0 in this situation, which is a problem
451 // regarding precision... this means that this.beam_dir and w_shotdir approach
452 // eachother, however they never actually become the same value with this method.
453 // Perhaps we should do some form of rounding/snapping?
454 float angle = vlen(w_shotdir - this.beam_dir) * RAD2DEG;
455 if(angle && (angle > WEP_CVAR(arc, beam_maxangle)))
457 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
458 float blendfactor = bound(
460 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
461 min(WEP_CVAR(arc, beam_maxangle) / angle, 1)
463 this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
467 // the radius is not too far yet, no worries :D
468 float blendfactor = bound(
470 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
473 this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
476 // network information: beam direction
477 this.SendFlags |= ARC_SF_BEAMDIR;
479 // calculate how many segments are needed
480 float max_allowed_segments;
482 if(WEP_CVAR(arc, beam_distancepersegment))
484 max_allowed_segments = min(
486 1 + (vlen(w_shotdir / WEP_CVAR(arc, beam_distancepersegment)))
489 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
491 if(WEP_CVAR(arc, beam_degreespersegment))
498 WEP_CVAR(arc, beam_maxangle)
501 WEP_CVAR(arc, beam_degreespersegment)
506 else { segments = 1; }
508 else { segments = 1; }
510 vector beam_endpos = (w_shotorg + (this.beam_dir * WEP_CVAR(arc, beam_range)));
511 vector beam_controlpoint = w_shotorg + w_shotdir * (WEP_CVAR(arc, beam_range) * (1 - WEP_CVAR(arc, beam_tightness)));
514 float new_beam_type = 0;
515 vector last_origin = w_shotorg;
516 for(i = 1; i <= segments; ++i)
518 // WEAPONTODO (client):
519 // In order to do nice fading and pointing on the starting segment, we must always
520 // have that drawn as a separate triangle... However, that is difficult to do when
521 // keeping in mind the above problems and also optimizing the amount of segments
522 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
524 vector new_origin = bezier_quadratic_getpoint(
529 vector new_dir = normalize(new_origin - last_origin);
531 WarpZone_traceline_antilag(
537 ANTILAG_LATENCY(this.owner)
540 // Do all the transforms for warpzones right now, as we already
541 // "are" in the post-trace system (if we hit a player, that's
542 // always BEHIND the last passed wz).
543 last_origin = trace_endpos;
544 w_shotorg = WarpZone_TransformOrigin(WarpZone_trace_transform, w_shotorg);
545 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
546 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
547 new_dir = WarpZone_TransformVelocity(WarpZone_trace_transform, new_dir);
552 trace_ent.classname == "body"
554 IS_MONSTER(trace_ent)
557 if(trace_ent && trace_ent.takedamage && (is_player || WEP_CVAR(arc, beam_nonplayerdamage)))
559 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
560 // NO. trace_endpos should be just fine. If not,
561 // that's an engine bug that needs proper debugging.
562 vector hitorigin = trace_endpos;
564 float falloff = ExponentialFalloff(
565 WEP_CVAR(arc, beam_falloff_mindist),
566 WEP_CVAR(arc, beam_falloff_maxdist),
567 WEP_CVAR(arc, beam_falloff_halflifedist),
568 vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, hitorigin) - w_shotorg)
571 if(is_player && SAME_TEAM(this.owner, trace_ent))
573 float roothealth, rootarmor;
576 roothealth = WEP_CVAR(arc, burst_healing_hps);
577 rootarmor = WEP_CVAR(arc, burst_healing_aps);
581 roothealth = WEP_CVAR(arc, beam_healing_hps);
582 rootarmor = WEP_CVAR(arc, beam_healing_aps);
585 if(trace_ent.health <= WEP_CVAR(arc, beam_healing_hmax) && roothealth)
587 trace_ent.health = min(
588 trace_ent.health + (roothealth * coefficient),
589 WEP_CVAR(arc, beam_healing_hmax)
592 if(trace_ent.armorvalue <= WEP_CVAR(arc, beam_healing_amax) && rootarmor)
594 trace_ent.armorvalue = min(
595 trace_ent.armorvalue + (rootarmor * coefficient),
596 WEP_CVAR(arc, beam_healing_amax)
600 // stop rot, set visual effect
601 if(roothealth || rootarmor)
603 trace_ent.pauserothealth_finished = max(
604 trace_ent.pauserothealth_finished,
605 time + autocvar_g_balance_pause_health_rot
607 trace_ent.pauserotarmor_finished = max(
608 trace_ent.pauserotarmor_finished,
609 time + autocvar_g_balance_pause_armor_rot
611 new_beam_type = ARC_BT_HEAL;
620 { rootdamage = WEP_CVAR(arc, burst_damage); }
622 { rootdamage = WEP_CVAR(arc, beam_damage); }
625 { rootdamage = WEP_CVAR(arc, beam_nonplayerdamage); }
627 if(accuracy_isgooddamage(this.owner, trace_ent))
633 rootdamage * coefficient * falloff
641 rootdamage * coefficient * falloff,
644 WEP_CVAR(arc, beam_force) * new_dir * coefficient * falloff
647 new_beam_type = ARC_BT_HIT;
651 else if(trace_fraction != 1)
653 // we collided with geometry
654 new_beam_type = ARC_BT_WALL;
659 // te_explosion(trace_endpos);
661 // if we're bursting, use burst visual effects
662 new_beam_type |= burst;
664 // network information: beam type
665 if(new_beam_type != this.beam_type)
667 this.SendFlags |= ARC_SF_BEAMTYPE;
668 this.beam_type = new_beam_type;
671 this.owner.beam_prev = time;
672 this.nextthink = time;
675 void W_Arc_Beam(float burst, entity actor)
678 // only play fire sound if 1 sec has passed since player let go the fire button
679 if(time - actor.beam_prev > 1)
680 sound(actor, CH_WEAPON_A, SND_ARC_FIRE, VOL_BASE, ATTN_NORM);
682 entity beam = actor.arc_beam = new(W_Arc_Beam);
683 beam.solid = SOLID_NOT;
684 setthink(beam, W_Arc_Beam_Think);
686 set_movetype(beam, MOVETYPE_NONE);
687 beam.bot_dodge = true;
688 beam.bot_dodgerating = WEP_CVAR(arc, beam_damage);
689 beam.beam_bursting = burst;
690 Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
692 getthink(beam)(beam);
694 void Arc_Smoke(entity actor)
696 makevectors(actor.v_angle);
697 W_SetupShot_Range(actor,true,0,SND_Null,0,0,0);
699 vector smoke_origin = w_shotorg + actor.velocity*frametime;
700 if ( actor.arc_overheat > time )
702 if ( random() < actor.arc_heat_percent )
703 Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
704 if ( PHYS_INPUT_BUTTON_ATCK(actor) || PHYS_INPUT_BUTTON_ATCK2(actor) )
706 Send_Effect(EFFECT_ARC_OVERHEAT_FIRE, smoke_origin, w_shotdir, 1 );
707 if ( !actor.arc_smoke_sound )
709 actor.arc_smoke_sound = 1;
710 sound(actor, CH_SHOTS_SINGLE, SND_ARC_LOOP_OVERHEAT, VOL_BASE, ATTN_NORM);
714 else if ( actor.arc_beam && WEP_CVAR(arc, overheat_max) > 0 &&
715 actor.arc_beam.beam_heat > WEP_CVAR(arc, overheat_min) )
717 if ( random() < (actor.arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) /
718 ( WEP_CVAR(arc, overheat_max)-WEP_CVAR(arc, overheat_min) ) )
719 Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
722 if ( actor.arc_smoke_sound && ( actor.arc_overheat <= time ||
723 !( PHYS_INPUT_BUTTON_ATCK(actor) || PHYS_INPUT_BUTTON_ATCK2(actor) ) ) || PS(actor).m_switchweapon != WEP_ARC )
725 actor.arc_smoke_sound = 0;
726 sound(actor, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
730 METHOD(Arc, wr_aim, void(entity thiswep, entity actor))
732 if(WEP_CVAR(arc, beam_botaimspeed))
734 PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(
736 WEP_CVAR(arc, beam_botaimspeed),
738 WEP_CVAR(arc, beam_botaimlifetime),
744 PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(
753 METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
755 Arc_Player_SetHeat(actor);
758 bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
760 if (time >= actor.arc_overheat)
761 if ((fire & 1) || beam_fire2 || actor.arc_beam.beam_bursting)
764 if(actor.arc_BUTTON_ATCK_prev)
767 if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
768 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
771 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
774 if((!actor.arc_beam) || wasfreed(actor.arc_beam))
776 if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
778 W_Arc_Beam(boolean(beam_fire2), actor);
780 if(!actor.arc_BUTTON_ATCK_prev)
782 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
783 actor.arc_BUTTON_ATCK_prev = true;
792 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
794 W_Arc_Attack_Bolt(thiswep, actor);
795 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
799 if(actor.arc_BUTTON_ATCK_prev)
801 sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
802 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
803 int slot = weaponslot(weaponentity);
804 ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor(actor);
806 actor.arc_BUTTON_ATCK_prev = false;
810 if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_arc_secondary_refire))
813 actor.arc_count = autocvar_g_balance_arc_secondary_count;
814 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
815 actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor(actor);
819 METHOD(Arc, wr_init, void(entity thiswep))
821 if(!arc_shotorigin[0])
823 arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
824 arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
825 arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
826 arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
829 METHOD(Arc, wr_checkammo1, bool(entity thiswep, entity actor))
831 return ((!WEP_CVAR(arc, beam_ammo)) || (actor.(thiswep.ammo_field) > 0));
833 METHOD(Arc, wr_checkammo2, bool(entity thiswep, entity actor))
835 if(WEP_CVAR(arc, bolt))
837 float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
838 ammo_amount += actor.(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
842 return WEP_CVAR(arc, overheat_max) > 0 &&
843 ((!WEP_CVAR(arc, burst_ammo)) || (actor.(thiswep.ammo_field) > 0));
845 METHOD(Arc, wr_killmessage, Notification(entity thiswep))
847 if(w_deathtype & HITTYPE_SECONDARY)
848 return WEAPON_ARC_MURDER_SPRAY;
850 return WEAPON_ARC_MURDER;
852 METHOD(Arc, wr_drop, void(entity thiswep, entity actor))
854 weapon_dropevent_item.arc_overheat = actor.arc_overheat;
855 weapon_dropevent_item.arc_cooldown = actor.arc_cooldown;
856 actor.arc_overheat = 0;
857 actor.arc_cooldown = 0;
858 actor.arc_BUTTON_ATCK_prev = false;
860 METHOD(Arc, wr_pickup, void(entity thiswep, entity actor))
862 if ( !client_hasweapon(actor, thiswep, false, false) &&
863 weapon_dropevent_item.arc_overheat > time )
865 actor.arc_overheat = weapon_dropevent_item.arc_overheat;
866 actor.arc_cooldown = weapon_dropevent_item.arc_cooldown;
869 METHOD(Arc, wr_resetplayer, void(entity thiswep, entity actor))
871 actor.arc_overheat = 0;
872 actor.arc_cooldown = 0;
873 actor.arc_BUTTON_ATCK_prev = false;
875 METHOD(Arc, wr_playerdeath, void(entity thiswep, entity actor))
877 actor.arc_overheat = 0;
878 actor.arc_cooldown = 0;
879 actor.arc_BUTTON_ATCK_prev = false;
883 bool autocvar_cl_arcbeam_teamcolor = true;
885 METHOD(Arc, wr_impacteffect, void(entity thiswep, entity actor))
887 if(w_deathtype & HITTYPE_SECONDARY)
890 org2 = w_org + w_backoff * 6;
891 pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1);
892 if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
896 void Draw_ArcBeam_callback(vector start, vector hit, vector end)
898 entity beam = Draw_ArcBeam_callback_entity;
899 vector transformed_view_org;
900 transformed_view_org = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
902 // Thickdir shall be perpendicular to the beam and to the view-to-beam direction (WEAPONTODO: WHY)
903 // WEAPONTODO: Wouldn't it be better to be perpendicular to the beam and to the view FORWARD direction?
904 vector thickdir = normalize(cross(normalize(start - hit), transformed_view_org - start));
910 if(trace_fraction != 1)
912 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
913 hitorigin = start + (Draw_ArcBeam_callback_new_dir * Draw_ArcBeam_callback_segmentdist * trace_fraction);
914 hitorigin = WarpZone_TransformOrigin(WarpZone_trace_transform, hitorigin);
924 // decide upon thickness
925 float thickness = beam.beam_thickness;
927 // draw primary beam render
928 vector top = hitorigin + (thickdir * thickness);
929 vector bottom = hitorigin - (thickdir * thickness);
931 vector last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
932 vector last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
934 R_BeginPolygon(beam.beam_image, DRAWFLAG_NORMAL); // DRAWFLAG_ADDITIVE
937 '0 0.5 0' + ('0 0.5 0' * (thickness / beam.beam_thickness)),
943 '0 0.5 0' + ('0 0.5 0' * (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
949 '0 0.5 0' * (1 - (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
955 '0 0.5 0' * (1 - (thickness / beam.beam_thickness)),
961 // draw trailing particles
963 // - Don't use spammy particle counts here, use a FEW small particles around the beam
964 // - We're not using WarpZone_TrailParticles here because we will handle warpzones ourselves.
965 if(beam.beam_traileffect)
967 trailparticles(beam, beam.beam_traileffect, start, hitorigin);
970 // set up for the next
971 Draw_ArcBeam_callback_last_thickness = thickness;
972 Draw_ArcBeam_callback_last_top = WarpZone_UnTransformOrigin(WarpZone_trace_transform, top);
973 Draw_ArcBeam_callback_last_bottom = WarpZone_UnTransformOrigin(WarpZone_trace_transform, bottom);
979 for (e = NULL; (e = findfloat(e, beam_usevieworigin, 1)); ) {
980 e.beam_initialized = false;
982 for (e = NULL; (e = findfloat(e, beam_usevieworigin, 2)); ) {
983 e.beam_initialized = false;
987 void Draw_ArcBeam(entity this)
989 float dt = time - this.move_time;
990 this.move_time = time;
991 if(dt <= 0) { return; }
993 if(!this.beam_usevieworigin)
995 InterpolateOrigin_Do(this);
998 // origin = beam starting origin
999 // v_angle = wanted/aim direction
1000 // angles = current direction of beam
1003 vector wantdir; //= view_forward;
1004 vector beamdir; //= this.beam_dir;
1007 if(this.beam_usevieworigin)
1010 // Currently we have to replicate nearly the same method of figuring
1011 // out the shotdir that the server does... Ideally in the future we
1012 // should be able to acquire this from a generalized function built
1013 // into a weapon system for client code.
1015 // find where we are aiming
1016 makevectors(warpzone_save_view_angles);
1017 vector forward = v_forward;
1018 vector right = v_right;
1021 // decide upon start position
1022 if(this.beam_usevieworigin == 2)
1023 { start_pos = warpzone_save_view_origin; }
1025 { start_pos = this.origin; }
1027 // trace forward with an estimation
1030 start_pos + forward * this.beam_range,
1035 // untransform in case our trace went through a warpzone
1036 vector end_pos = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
1038 // un-adjust trueaim if shotend is too close
1039 if(vdist(end_pos - start_pos, <, g_trueaim_minrange))
1040 end_pos = start_pos + (forward * g_trueaim_minrange);
1042 // move shot origin to the actual gun muzzle origin
1043 vector origin_offset =
1044 right * -this.beam_shotorigin.y
1045 + up * this.beam_shotorigin.z;
1047 start_pos = start_pos + origin_offset;
1049 // Move it also forward, but only as far as possible without hitting anything. Don't poke into walls!
1050 traceline(start_pos, start_pos + forward * this.beam_shotorigin.x, MOVE_NORMAL, this);
1051 start_pos = trace_endpos;
1053 // calculate the aim direction now
1054 wantdir = normalize(end_pos - start_pos);
1056 if(!this.beam_initialized)
1058 this.beam_dir = wantdir;
1059 this.beam_initialized = true;
1062 if(this.beam_dir != wantdir)
1064 // calculate how much we're going to move the end of the beam to the want position
1065 // WEAPONTODO (server and client):
1066 // blendfactor never actually becomes 0 in this situation, which is a problem
1067 // regarding precision... this means that this.beam_dir and w_shotdir approach
1068 // eachother, however they never actually become the same value with this method.
1069 // Perhaps we should do some form of rounding/snapping?
1070 float angle = vlen(wantdir - this.beam_dir) * RAD2DEG;
1071 if(angle && (angle > this.beam_maxangle))
1073 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
1074 float blendfactor = bound(
1076 (1 - (this.beam_returnspeed * frametime)),
1077 min(this.beam_maxangle / angle, 1)
1079 this.beam_dir = normalize((wantdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
1083 // the radius is not too far yet, no worries :D
1084 float blendfactor = bound(
1086 (1 - (this.beam_returnspeed * frametime)),
1089 this.beam_dir = normalize((wantdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
1092 // calculate how many segments are needed
1093 float max_allowed_segments;
1095 if(this.beam_distancepersegment)
1097 max_allowed_segments = min(
1099 1 + (vlen(wantdir / this.beam_distancepersegment))
1102 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
1104 if(this.beam_degreespersegment)
1114 this.beam_degreespersegment
1116 max_allowed_segments
1119 else { segments = 1; }
1121 else { segments = 1; }
1123 // set the beam direction which the rest of the code will refer to
1124 beamdir = this.beam_dir;
1126 // finally, set this.angles to the proper direction so that muzzle attachment points in proper direction
1127 this.angles = fixedvectoangles2(forward, up); // TODO(Samual): is this == warpzone_save_view_angles?
1131 // set the values from the provided info from the networked entity
1132 start_pos = this.origin;
1133 wantdir = this.v_angle;
1134 beamdir = this.angles;
1136 if(beamdir != wantdir)
1138 float angle = vlen(wantdir - beamdir) * RAD2DEG;
1140 // calculate how many segments are needed
1141 float max_allowed_segments;
1143 if(this.beam_distancepersegment)
1145 max_allowed_segments = min(
1147 1 + (vlen(wantdir / this.beam_distancepersegment))
1150 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
1152 if(this.beam_degreespersegment)
1162 this.beam_degreespersegment
1164 max_allowed_segments
1167 else { segments = 1; }
1169 else { segments = 1; }
1172 setorigin(this, start_pos);
1173 this.beam_muzzleentity.angles_z = random() * 360; // WEAPONTODO: use avelocity instead?
1175 vector beam_endpos = (start_pos + (beamdir * this.beam_range));
1176 vector beam_controlpoint = start_pos + wantdir * (this.beam_range * (1 - this.beam_tightness));
1178 Draw_ArcBeam_callback_entity = this;
1179 Draw_ArcBeam_callback_last_thickness = 0;
1180 Draw_ArcBeam_callback_last_top = start_pos;
1181 Draw_ArcBeam_callback_last_bottom = start_pos;
1183 vector last_origin = start_pos;
1184 vector original_start_pos = start_pos;
1187 for(i = 1; i <= segments; ++i)
1189 // WEAPONTODO (client):
1190 // In order to do nice fading and pointing on the starting segment, we must always
1191 // have that drawn as a separate triangle... However, that is difficult to do when
1192 // keeping in mind the above problems and also optimizing the amount of segments
1193 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
1195 vector new_origin = bezier_quadratic_getpoint(
1201 WarpZone_TraceBox_ThroughZone(
1209 Draw_ArcBeam_callback
1212 // Do all the transforms for warpzones right now, as we already "are" in the post-trace
1213 // system (if we hit a player, that's always BEHIND the last passed wz).
1214 last_origin = trace_endpos;
1215 start_pos = WarpZone_TransformOrigin(WarpZone_trace_transform, start_pos);
1216 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
1217 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
1218 beamdir = WarpZone_TransformVelocity(WarpZone_trace_transform, beamdir);
1219 Draw_ArcBeam_callback_last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
1220 Draw_ArcBeam_callback_last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
1222 if(trace_fraction < 1) { break; }
1225 // visual effects for startpoint and endpoint
1226 if(this.beam_hiteffect)
1228 // FIXME we really should do this on the server so it actually
1229 // matches gameplay. What this client side stuff is doing is no
1230 // more than guesswork.
1231 if((trace_ent || trace_fraction < 1) && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
1233 this.beam_hiteffect,
1239 if(this.beam_hitlight[0])
1243 this.beam_hitlight[0],
1245 this.beam_hitlight[1],
1246 this.beam_hitlight[2],
1247 this.beam_hitlight[3]
1251 if(this.beam_muzzleeffect)
1254 this.beam_muzzleeffect,
1255 original_start_pos + wantdir * 20,
1260 if(this.beam_muzzlelight[0])
1263 original_start_pos + wantdir * 20,
1264 this.beam_muzzlelight[0],
1266 this.beam_muzzlelight[1],
1267 this.beam_muzzlelight[2],
1268 this.beam_muzzlelight[3]
1274 Draw_ArcBeam_callback_entity = NULL;
1275 Draw_ArcBeam_callback_last_thickness = 0;
1276 Draw_ArcBeam_callback_last_top = '0 0 0';
1277 Draw_ArcBeam_callback_last_bottom = '0 0 0';
1280 void Remove_ArcBeam(entity this)
1282 remove(this.beam_muzzleentity);
1283 sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
1286 NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
1288 int sf = ReadByte();
1293 int gunalign = W_GetGunAlignment(NULL);
1295 this.beam_shotorigin = arc_shotorigin[gunalign];
1297 // set other main attributes of the beam
1298 this.draw = Draw_ArcBeam;
1299 this.entremove = Remove_ArcBeam;
1300 this.move_time = time;
1301 loopsound(this, CH_SHOTS_SINGLE, SND(ARC_LOOP), VOL_BASE, ATTEN_NORM);
1305 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT;
1306 flash.drawmask = MASK_NORMAL;
1307 flash.solid = SOLID_NOT;
1308 flash.avelocity_z = 5000;
1309 setattachment(flash, this, "");
1310 setorigin(flash, '0 0 0');
1312 this.beam_muzzleentity = flash;
1316 flash = this.beam_muzzleentity;
1319 if(sf & ARC_SF_SETTINGS) // settings information
1321 this.beam_degreespersegment = ReadShort();
1322 this.beam_distancepersegment = ReadShort();
1323 this.beam_maxangle = ReadShort();
1324 this.beam_range = ReadCoord();
1325 this.beam_returnspeed = ReadShort();
1326 this.beam_tightness = (ReadByte() / 10);
1330 if(autocvar_chase_active)
1331 { this.beam_usevieworigin = 1; }
1332 else // use view origin
1333 { this.beam_usevieworigin = 2; }
1337 this.beam_usevieworigin = 0;
1340 this.sv_entnum = ReadByte();
1343 if(!this.beam_usevieworigin)
1345 // this.iflags = IFLAG_ORIGIN | IFLAG_ANGLES | IFLAG_V_ANGLE; // why doesn't this work?
1346 this.iflags = IFLAG_ORIGIN;
1348 InterpolateOrigin_Undo(this);
1351 if(sf & ARC_SF_START) // starting location
1353 this.origin_x = ReadCoord();
1354 this.origin_y = ReadCoord();
1355 this.origin_z = ReadCoord();
1357 else if(this.beam_usevieworigin) // infer the location from player location
1359 if(this.beam_usevieworigin == 2)
1362 this.origin = view_origin;
1366 // use player origin so that third person display still works
1367 this.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * STAT(VIEWHEIGHT));
1371 setorigin(this, this.origin);
1373 if(sf & ARC_SF_WANTDIR) // want/aim direction
1375 this.v_angle_x = ReadCoord();
1376 this.v_angle_y = ReadCoord();
1377 this.v_angle_z = ReadCoord();
1380 if(sf & ARC_SF_BEAMDIR) // beam direction
1382 this.angles_x = ReadCoord();
1383 this.angles_y = ReadCoord();
1384 this.angles_z = ReadCoord();
1387 if(sf & ARC_SF_BEAMTYPE) // beam type
1389 this.beam_type = ReadByte();
1391 vector beamcolor = ((autocvar_cl_arcbeam_teamcolor) ? colormapPaletteColor(stof(getplayerkeyvalue(this.sv_entnum - 1, "colors")) & 0x0F, true) : '1 1 1');
1392 switch(this.beam_type)
1396 this.beam_color = beamcolor;
1397 this.beam_alpha = 0.5;
1398 this.beam_thickness = 8;
1399 this.beam_traileffect = (EFFECT_ARC_BEAM);
1400 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1401 this.beam_hitlight[0] = 0;
1402 this.beam_hitlight[1] = 1;
1403 this.beam_hitlight[2] = 1;
1404 this.beam_hitlight[3] = 1;
1405 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1406 this.beam_muzzlelight[0] = 0;
1407 this.beam_muzzlelight[1] = 1;
1408 this.beam_muzzlelight[2] = 1;
1409 this.beam_muzzlelight[3] = 1;
1410 if(this.beam_muzzleeffect)
1412 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1413 flash.alpha = this.beam_alpha;
1414 flash.colormod = this.beam_color;
1419 case ARC_BT_WALL: // grenadelauncher_muzzleflash healray_muzzleflash
1421 this.beam_color = beamcolor;
1422 this.beam_alpha = 0.5;
1423 this.beam_thickness = 8;
1424 this.beam_traileffect = (EFFECT_ARC_BEAM);
1425 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1426 this.beam_hitlight[0] = 0;
1427 this.beam_hitlight[1] = 1;
1428 this.beam_hitlight[2] = 1;
1429 this.beam_hitlight[3] = 1;
1430 this.beam_muzzleeffect = NULL; // (EFFECT_GRENADE_MUZZLEFLASH);
1431 this.beam_muzzlelight[0] = 0;
1432 this.beam_muzzlelight[1] = 1;
1433 this.beam_muzzlelight[2] = 1;
1434 this.beam_muzzlelight[3] = 1;
1435 this.beam_image = "particles/lgbeam";
1436 if(this.beam_muzzleeffect)
1438 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1439 flash.alpha = this.beam_alpha;
1440 flash.colormod = this.beam_color;
1447 this.beam_color = beamcolor;
1448 this.beam_alpha = 0.5;
1449 this.beam_thickness = 8;
1450 this.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
1451 this.beam_hiteffect = (EFFECT_ARC_BEAM_HEAL_IMPACT);
1452 this.beam_hitlight[0] = 0;
1453 this.beam_hitlight[1] = 1;
1454 this.beam_hitlight[2] = 1;
1455 this.beam_hitlight[3] = 1;
1456 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1457 this.beam_muzzlelight[0] = 0;
1458 this.beam_muzzlelight[1] = 1;
1459 this.beam_muzzlelight[2] = 1;
1460 this.beam_muzzlelight[3] = 1;
1461 this.beam_image = "particles/lgbeam";
1462 if(this.beam_muzzleeffect)
1464 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1465 flash.alpha = this.beam_alpha;
1466 flash.colormod = this.beam_color;
1473 this.beam_color = beamcolor;
1474 this.beam_alpha = 0.5;
1475 this.beam_thickness = 8;
1476 this.beam_traileffect = (EFFECT_ARC_BEAM);
1477 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1478 this.beam_hitlight[0] = 20;
1479 this.beam_hitlight[1] = 1;
1480 this.beam_hitlight[2] = 0;
1481 this.beam_hitlight[3] = 0;
1482 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1483 this.beam_muzzlelight[0] = 50;
1484 this.beam_muzzlelight[1] = 1;
1485 this.beam_muzzlelight[2] = 0;
1486 this.beam_muzzlelight[3] = 0;
1487 this.beam_image = "particles/lgbeam";
1488 if(this.beam_muzzleeffect)
1490 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1491 flash.alpha = this.beam_alpha;
1492 flash.colormod = this.beam_color;
1497 case ARC_BT_BURST_MISS:
1499 this.beam_color = beamcolor;
1500 this.beam_alpha = 0.5;
1501 this.beam_thickness = 14;
1502 this.beam_traileffect = (EFFECT_ARC_BEAM);
1503 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1504 this.beam_hitlight[0] = 0;
1505 this.beam_hitlight[1] = 1;
1506 this.beam_hitlight[2] = 1;
1507 this.beam_hitlight[3] = 1;
1508 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1509 this.beam_muzzlelight[0] = 0;
1510 this.beam_muzzlelight[1] = 1;
1511 this.beam_muzzlelight[2] = 1;
1512 this.beam_muzzlelight[3] = 1;
1513 this.beam_image = "particles/lgbeam";
1514 if(this.beam_muzzleeffect)
1516 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1517 flash.alpha = this.beam_alpha;
1518 flash.colormod = this.beam_color;
1523 case ARC_BT_BURST_WALL:
1525 this.beam_color = beamcolor;
1526 this.beam_alpha = 0.5;
1527 this.beam_thickness = 14;
1528 this.beam_traileffect = (EFFECT_ARC_BEAM);
1529 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1530 this.beam_hitlight[0] = 0;
1531 this.beam_hitlight[1] = 1;
1532 this.beam_hitlight[2] = 1;
1533 this.beam_hitlight[3] = 1;
1534 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1535 this.beam_muzzlelight[0] = 0;
1536 this.beam_muzzlelight[1] = 1;
1537 this.beam_muzzlelight[2] = 1;
1538 this.beam_muzzlelight[3] = 1;
1539 this.beam_image = "particles/lgbeam";
1540 if(this.beam_muzzleeffect)
1542 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1543 flash.alpha = this.beam_alpha;
1544 flash.colormod = this.beam_color;
1549 case ARC_BT_BURST_HEAL:
1551 this.beam_color = beamcolor;
1552 this.beam_alpha = 0.5;
1553 this.beam_thickness = 14;
1554 this.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
1555 this.beam_hiteffect = (EFFECT_ARC_BEAM_HEAL_IMPACT2);
1556 this.beam_hitlight[0] = 0;
1557 this.beam_hitlight[1] = 1;
1558 this.beam_hitlight[2] = 1;
1559 this.beam_hitlight[3] = 1;
1560 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1561 this.beam_muzzlelight[0] = 0;
1562 this.beam_muzzlelight[1] = 1;
1563 this.beam_muzzlelight[2] = 1;
1564 this.beam_muzzlelight[3] = 1;
1565 this.beam_image = "particles/lgbeam";
1566 if(this.beam_muzzleeffect)
1568 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1569 flash.alpha = this.beam_alpha;
1570 flash.colormod = this.beam_color;
1575 case ARC_BT_BURST_HIT:
1577 this.beam_color = beamcolor;
1578 this.beam_alpha = 0.5;
1579 this.beam_thickness = 14;
1580 this.beam_traileffect = (EFFECT_ARC_BEAM);
1581 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1582 this.beam_hitlight[0] = 0;
1583 this.beam_hitlight[1] = 1;
1584 this.beam_hitlight[2] = 1;
1585 this.beam_hitlight[3] = 1;
1586 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1587 this.beam_muzzlelight[0] = 0;
1588 this.beam_muzzlelight[1] = 1;
1589 this.beam_muzzlelight[2] = 1;
1590 this.beam_muzzlelight[3] = 1;
1591 this.beam_image = "particles/lgbeam";
1592 if(this.beam_muzzleeffect)
1594 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1595 flash.alpha = this.beam_alpha;
1596 flash.colormod = this.beam_color;
1602 // shouldn't be possible, but lets make it colorful if it does :D
1605 this.beam_color = randomvec();
1606 this.beam_alpha = 1;
1607 this.beam_thickness = 8;
1608 this.beam_traileffect = NULL;
1609 this.beam_hiteffect = NULL;
1610 this.beam_hitlight[0] = 0;
1611 this.beam_hitlight[1] = 1;
1612 this.beam_hitlight[2] = 1;
1613 this.beam_hitlight[3] = 1;
1614 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1615 this.beam_muzzlelight[0] = 0;
1616 this.beam_muzzlelight[1] = 1;
1617 this.beam_muzzlelight[2] = 1;
1618 this.beam_muzzlelight[3] = 1;
1619 this.beam_image = "particles/lgbeam";
1620 if(this.beam_muzzleeffect)
1622 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1623 flash.alpha = this.beam_alpha;
1624 flash.colormod = this.beam_color;
1632 if(!this.beam_usevieworigin)
1634 InterpolateOrigin_Note(this);