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 == self.owner) || ((to.enemy == self.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, self.beam_start.x);
177 WriteCoord(MSG_ENTITY, self.beam_start.y);
178 WriteCoord(MSG_ENTITY, self.beam_start.z);
180 if(sf & ARC_SF_WANTDIR) // want/aim direction
182 WriteCoord(MSG_ENTITY, self.beam_wantdir.x);
183 WriteCoord(MSG_ENTITY, self.beam_wantdir.y);
184 WriteCoord(MSG_ENTITY, self.beam_wantdir.z);
186 if(sf & ARC_SF_BEAMDIR) // beam direction
188 WriteCoord(MSG_ENTITY, self.beam_dir.x);
189 WriteCoord(MSG_ENTITY, self.beam_dir.y);
190 WriteCoord(MSG_ENTITY, self.beam_dir.z);
192 if(sf & ARC_SF_BEAMTYPE) // beam type
194 WriteByte(MSG_ENTITY, self.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)
236 self.event_damage = func_null;
237 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);
242 void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger)
244 WITHSELF(this, W_Arc_Bolt_Explode(this));
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)
264 PROJECTILE_TOUCH(this);
265 self.use(this, NULL, NULL);
268 void W_Arc_Attack_Bolt(Weapon thiswep, entity actor)
273 W_DecreaseAmmo(thiswep, self, WEP_CVAR(arc, bolt_ammo));
275 W_SetupShot(self, false, 2, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage));
277 Send_Effect(EFFECT_ARC_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
279 missile = new(missile);
280 missile.owner = missile.realowner = self;
281 missile.bot_dodge = true;
282 missile.bot_dodgerating = WEP_CVAR(arc, bolt_damage);
284 missile.takedamage = DAMAGE_YES;
285 missile.health = WEP_CVAR(arc, bolt_health);
286 missile.damageforcescale = WEP_CVAR(arc, bolt_damageforcescale);
287 missile.event_damage = W_Arc_Bolt_Damage;
288 missile.damagedbycontents = true;
290 settouch(missile, W_Arc_Bolt_Touch);
291 missile.use = W_Arc_Bolt_Explode_use;
292 setthink(missile, adaptor_think2use_hittype_splash);
293 missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
294 PROJECTILE_MAKETRIGGER(missile);
295 missile.projectiledeathtype = WEP_ARC.m_id | HITTYPE_SECONDARY;
296 setorigin(missile, w_shotorg);
297 setsize(missile, '0 0 0', '0 0 0');
299 missile.movetype = MOVETYPE_FLY;
300 W_SetupProjVelocity_PRE(missile, arc, bolt_);
302 missile.angles = vectoangles(missile.velocity);
303 missile.flags = FL_PROJECTILE;
304 missile.missile_flags = MIF_SPLASH;
306 CSQCProjectile(missile, true, PROJECTILE_ARC_BOLT, true);
308 MUTATOR_CALLHOOK(EditProjectile, self, missile);
311 void W_Arc_Beam_Think(entity this)
313 if(self != self.owner.arc_beam)
321 if( (PHYS_INPUT_BUTTON_ATCK2(self.owner) && !WEP_CVAR(arc, bolt)) || self.beam_bursting)
323 if(!self.beam_bursting)
324 self.beam_bursting = true;
325 burst = ARC_BT_BURSTMASK;
328 Weapon thiswep = WEP_ARC;
331 !IS_PLAYER(self.owner)
333 (self.owner.(thiswep.ammo_field) <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
339 (!PHYS_INPUT_BUTTON_ATCK(self.owner) && !burst )
341 STAT(FROZEN, self.owner)
345 (WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max))
348 if ( WEP_CVAR(arc, cooldown) > 0 )
350 float cooldown_speed = 0;
351 if ( self.beam_heat > WEP_CVAR(arc, overheat_min) && WEP_CVAR(arc, cooldown) > 0 )
353 cooldown_speed = WEP_CVAR(arc, cooldown);
357 cooldown_speed = self.beam_heat / WEP_CVAR(arc, beam_refire);
360 if ( cooldown_speed )
362 if ( WEP_CVAR(arc, cooldown_release) || (WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max)) )
363 self.owner.arc_overheat = time + self.beam_heat / cooldown_speed;
364 self.owner.arc_cooldown = cooldown_speed;
367 if ( WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max) )
369 Send_Effect(EFFECT_ARC_OVERHEAT,
370 self.beam_start, self.beam_wantdir, 1 );
371 sound(self, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
375 if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
376 entity own = self.owner;
378 if(!w.wr_checkammo1(w, own) && !w.wr_checkammo2(w, own))
379 if(!(own.items & IT_UNLIMITED_WEAPON_AMMO))
381 // note: this doesn't force the switch
382 W_SwitchToOtherWeapon(own);
389 float coefficient = frametime;
390 if(!(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
394 { rootammo = WEP_CVAR(arc, burst_ammo); }
396 { rootammo = WEP_CVAR(arc, beam_ammo); }
400 coefficient = min(coefficient, self.owner.(thiswep.ammo_field) / rootammo);
401 self.owner.(thiswep.ammo_field) = max(0, self.owner.(thiswep.ammo_field) - (rootammo * frametime));
404 float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat);
405 self.beam_heat = min( WEP_CVAR(arc, overheat_max), self.beam_heat + heat_speed*frametime );
407 makevectors(self.owner.v_angle);
415 WEP_CVAR(arc, beam_damage) * coefficient,
416 WEP_CVAR(arc, beam_range)
419 // After teleport, "lock" the beam until the teleport is confirmed.
420 if (time < self.beam_teleporttime + ANTILAG_LATENCY(self.owner)) {
421 w_shotdir = self.beam_dir;
424 // network information: shot origin and want/aim direction
425 if(self.beam_start != w_shotorg)
427 self.SendFlags |= ARC_SF_START;
428 self.beam_start = w_shotorg;
430 if(self.beam_wantdir != w_shotdir)
432 self.SendFlags |= ARC_SF_WANTDIR;
433 self.beam_wantdir = w_shotdir;
436 if(!self.beam_initialized)
438 self.beam_dir = w_shotdir;
439 self.beam_initialized = true;
442 // WEAPONTODO: Detect player velocity so that the beam curves when moving too
443 // idea: blend together self.beam_dir with the inverted direction the player is moving in
444 // might have to make some special accomodation so that it only uses view_right and view_up
446 // note that if we do this, it'll always be corrected to a maximum angle by beam_maxangle handling
449 if(self.beam_dir != w_shotdir)
451 // calculate how much we're going to move the end of the beam to the want position
452 // WEAPONTODO (server and client):
453 // blendfactor never actually becomes 0 in this situation, which is a problem
454 // regarding precision... this means that self.beam_dir and w_shotdir approach
455 // eachother, however they never actually become the same value with this method.
456 // Perhaps we should do some form of rounding/snapping?
457 float angle = vlen(w_shotdir - self.beam_dir) * RAD2DEG;
458 if(angle && (angle > WEP_CVAR(arc, beam_maxangle)))
460 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
461 float blendfactor = bound(
463 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
464 min(WEP_CVAR(arc, beam_maxangle) / angle, 1)
466 self.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
470 // the radius is not too far yet, no worries :D
471 float blendfactor = bound(
473 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
476 self.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
479 // network information: beam direction
480 self.SendFlags |= ARC_SF_BEAMDIR;
482 // calculate how many segments are needed
483 float max_allowed_segments;
485 if(WEP_CVAR(arc, beam_distancepersegment))
487 max_allowed_segments = min(
489 1 + (vlen(w_shotdir / WEP_CVAR(arc, beam_distancepersegment)))
492 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
494 if(WEP_CVAR(arc, beam_degreespersegment))
501 WEP_CVAR(arc, beam_maxangle)
504 WEP_CVAR(arc, beam_degreespersegment)
509 else { segments = 1; }
511 else { segments = 1; }
513 vector beam_endpos = (w_shotorg + (self.beam_dir * WEP_CVAR(arc, beam_range)));
514 vector beam_controlpoint = w_shotorg + w_shotdir * (WEP_CVAR(arc, beam_range) * (1 - WEP_CVAR(arc, beam_tightness)));
517 float new_beam_type = 0;
518 vector last_origin = w_shotorg;
519 for(i = 1; i <= segments; ++i)
521 // WEAPONTODO (client):
522 // In order to do nice fading and pointing on the starting segment, we must always
523 // have that drawn as a separate triangle... However, that is difficult to do when
524 // keeping in mind the above problems and also optimizing the amount of segments
525 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
527 vector new_origin = bezier_quadratic_getpoint(
532 vector new_dir = normalize(new_origin - last_origin);
534 WarpZone_traceline_antilag(
540 ANTILAG_LATENCY(self.owner)
543 // Do all the transforms for warpzones right now, as we already
544 // "are" in the post-trace system (if we hit a player, that's
545 // always BEHIND the last passed wz).
546 last_origin = trace_endpos;
547 w_shotorg = WarpZone_TransformOrigin(WarpZone_trace_transform, w_shotorg);
548 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
549 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
550 new_dir = WarpZone_TransformVelocity(WarpZone_trace_transform, new_dir);
555 trace_ent.classname == "body"
557 IS_MONSTER(trace_ent)
560 if(trace_ent && trace_ent.takedamage && (is_player || WEP_CVAR(arc, beam_nonplayerdamage)))
562 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
563 // NO. trace_endpos should be just fine. If not,
564 // that's an engine bug that needs proper debugging.
565 vector hitorigin = trace_endpos;
567 float falloff = ExponentialFalloff(
568 WEP_CVAR(arc, beam_falloff_mindist),
569 WEP_CVAR(arc, beam_falloff_maxdist),
570 WEP_CVAR(arc, beam_falloff_halflifedist),
571 vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, hitorigin) - w_shotorg)
574 if(is_player && SAME_TEAM(self.owner, trace_ent))
576 float roothealth, rootarmor;
579 roothealth = WEP_CVAR(arc, burst_healing_hps);
580 rootarmor = WEP_CVAR(arc, burst_healing_aps);
584 roothealth = WEP_CVAR(arc, beam_healing_hps);
585 rootarmor = WEP_CVAR(arc, beam_healing_aps);
588 if(trace_ent.health <= WEP_CVAR(arc, beam_healing_hmax) && roothealth)
590 trace_ent.health = min(
591 trace_ent.health + (roothealth * coefficient),
592 WEP_CVAR(arc, beam_healing_hmax)
595 if(trace_ent.armorvalue <= WEP_CVAR(arc, beam_healing_amax) && rootarmor)
597 trace_ent.armorvalue = min(
598 trace_ent.armorvalue + (rootarmor * coefficient),
599 WEP_CVAR(arc, beam_healing_amax)
603 // stop rot, set visual effect
604 if(roothealth || rootarmor)
606 trace_ent.pauserothealth_finished = max(
607 trace_ent.pauserothealth_finished,
608 time + autocvar_g_balance_pause_health_rot
610 trace_ent.pauserotarmor_finished = max(
611 trace_ent.pauserotarmor_finished,
612 time + autocvar_g_balance_pause_armor_rot
614 new_beam_type = ARC_BT_HEAL;
623 { rootdamage = WEP_CVAR(arc, burst_damage); }
625 { rootdamage = WEP_CVAR(arc, beam_damage); }
628 { rootdamage = WEP_CVAR(arc, beam_nonplayerdamage); }
630 if(accuracy_isgooddamage(self.owner, trace_ent))
636 rootdamage * coefficient * falloff
644 rootdamage * coefficient * falloff,
647 WEP_CVAR(arc, beam_force) * new_dir * coefficient * falloff
650 new_beam_type = ARC_BT_HIT;
654 else if(trace_fraction != 1)
656 // we collided with geometry
657 new_beam_type = ARC_BT_WALL;
662 // te_explosion(trace_endpos);
664 // if we're bursting, use burst visual effects
665 new_beam_type |= burst;
667 // network information: beam type
668 if(new_beam_type != self.beam_type)
670 self.SendFlags |= ARC_SF_BEAMTYPE;
671 self.beam_type = new_beam_type;
674 self.owner.beam_prev = time;
675 self.nextthink = time;
678 void W_Arc_Beam(float burst, entity actor)
679 {entity this = actor;
681 // only play fire sound if 1 sec has passed since player let go the fire button
682 if(time - self.beam_prev > 1)
683 sound(self, CH_WEAPON_A, SND_ARC_FIRE, VOL_BASE, ATTN_NORM);
685 entity beam = self.arc_beam = new(W_Arc_Beam);
686 beam.solid = SOLID_NOT;
687 setthink(beam, W_Arc_Beam_Think);
689 beam.movetype = MOVETYPE_NONE;
690 beam.bot_dodge = true;
691 beam.bot_dodgerating = WEP_CVAR(arc, beam_damage);
692 beam.beam_bursting = burst;
693 Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
695 WITHSELF(beam, getthink(beam)(beam));
697 void Arc_Smoke(entity actor)
698 {entity this = actor;
699 makevectors(self.v_angle);
700 W_SetupShot_Range(self,true,0,SND_Null,0,0,0);
702 vector smoke_origin = w_shotorg + self.velocity*frametime;
703 if ( self.arc_overheat > time )
705 if ( random() < self.arc_heat_percent )
706 Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
707 if ( PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self) )
709 Send_Effect(EFFECT_ARC_OVERHEAT_FIRE, smoke_origin, w_shotdir, 1 );
710 if ( !self.arc_smoke_sound )
712 self.arc_smoke_sound = 1;
713 sound(self, CH_SHOTS_SINGLE, SND_ARC_LOOP_OVERHEAT, VOL_BASE, ATTN_NORM);
717 else if ( self.arc_beam && WEP_CVAR(arc, overheat_max) > 0 &&
718 self.arc_beam.beam_heat > WEP_CVAR(arc, overheat_min) )
720 if ( random() < (self.arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) /
721 ( WEP_CVAR(arc, overheat_max)-WEP_CVAR(arc, overheat_min) ) )
722 Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
725 if ( self.arc_smoke_sound && ( self.arc_overheat <= time ||
726 !( PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self) ) ) || PS(self).m_switchweapon != WEP_ARC )
728 self.arc_smoke_sound = 0;
729 sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
733 METHOD(Arc, wr_aim, void(entity thiswep, entity actor))
736 if(WEP_CVAR(arc, beam_botaimspeed))
738 PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
740 WEP_CVAR(arc, beam_botaimspeed),
742 WEP_CVAR(arc, beam_botaimlifetime),
748 PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(
757 METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
759 Arc_Player_SetHeat(actor);
762 bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
764 if (time >= actor.arc_overheat)
765 if ((fire & 1) || beam_fire2 || actor.arc_beam.beam_bursting)
768 if(actor.arc_BUTTON_ATCK_prev)
771 if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
772 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
775 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
778 if((!actor.arc_beam) || wasfreed(actor.arc_beam))
780 if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
782 W_Arc_Beam(boolean(beam_fire2), actor);
784 if(!actor.arc_BUTTON_ATCK_prev)
786 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
787 actor.arc_BUTTON_ATCK_prev = true;
796 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
798 W_Arc_Attack_Bolt(thiswep, actor);
799 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
803 if(actor.arc_BUTTON_ATCK_prev)
805 sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
806 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
807 int slot = weaponslot(weaponentity);
808 ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
810 actor.arc_BUTTON_ATCK_prev = false;
814 if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_arc_secondary_refire))
817 actor.arc_count = autocvar_g_balance_arc_secondary_count;
818 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
819 actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
823 METHOD(Arc, wr_init, void(entity thiswep))
825 if(!arc_shotorigin[0])
827 arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
828 arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
829 arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
830 arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
833 METHOD(Arc, wr_checkammo1, bool(entity thiswep, entity actor))
835 return ((!WEP_CVAR(arc, beam_ammo)) || (actor.(thiswep.ammo_field) > 0));
837 METHOD(Arc, wr_checkammo2, bool(entity thiswep, entity actor))
839 if(WEP_CVAR(arc, bolt))
841 float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
842 ammo_amount += actor.(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
846 return WEP_CVAR(arc, overheat_max) > 0 &&
847 ((!WEP_CVAR(arc, burst_ammo)) || (actor.(thiswep.ammo_field) > 0));
849 METHOD(Arc, wr_killmessage, Notification(entity thiswep))
851 if(w_deathtype & HITTYPE_SECONDARY)
852 return WEAPON_ARC_MURDER_SPRAY;
854 return WEAPON_ARC_MURDER;
856 METHOD(Arc, wr_drop, void(entity thiswep, entity actor))
859 weapon_dropevent_item.arc_overheat = self.arc_overheat;
860 weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
861 self.arc_overheat = 0;
862 self.arc_cooldown = 0;
864 METHOD(Arc, wr_pickup, void(entity thiswep, entity actor))
867 if ( !client_hasweapon(self, thiswep, false, false) &&
868 weapon_dropevent_item.arc_overheat > time )
870 self.arc_overheat = weapon_dropevent_item.arc_overheat;
871 self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
876 bool autocvar_cl_arcbeam_teamcolor = true;
878 METHOD(Arc, wr_impacteffect, void(entity thiswep, entity actor))
881 if(w_deathtype & HITTYPE_SECONDARY)
884 org2 = w_org + w_backoff * 6;
885 pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1);
886 if(!w_issilent) { sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
890 void Draw_ArcBeam_callback(vector start, vector hit, vector end)
892 entity beam = Draw_ArcBeam_callback_entity;
893 vector transformed_view_org;
894 transformed_view_org = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
896 // Thickdir shall be perpendicular to the beam and to the view-to-beam direction (WEAPONTODO: WHY)
897 // WEAPONTODO: Wouldn't it be better to be perpendicular to the beam and to the view FORWARD direction?
898 vector thickdir = normalize(cross(normalize(start - hit), transformed_view_org - start));
904 if(trace_fraction != 1)
906 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
907 hitorigin = start + (Draw_ArcBeam_callback_new_dir * Draw_ArcBeam_callback_segmentdist * trace_fraction);
908 hitorigin = WarpZone_TransformOrigin(WarpZone_trace_transform, hitorigin);
918 // decide upon thickness
919 float thickness = beam.beam_thickness;
921 // draw primary beam render
922 vector top = hitorigin + (thickdir * thickness);
923 vector bottom = hitorigin - (thickdir * thickness);
925 vector last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
926 vector last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
928 R_BeginPolygon(beam.beam_image, DRAWFLAG_NORMAL); // DRAWFLAG_ADDITIVE
931 '0 0.5 0' + ('0 0.5 0' * (thickness / beam.beam_thickness)),
937 '0 0.5 0' + ('0 0.5 0' * (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
943 '0 0.5 0' * (1 - (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
949 '0 0.5 0' * (1 - (thickness / beam.beam_thickness)),
955 // draw trailing particles
957 // - Don't use spammy particle counts here, use a FEW small particles around the beam
958 // - We're not using WarpZone_TrailParticles here because we will handle warpzones ourselves.
959 if(beam.beam_traileffect)
961 trailparticles(beam, beam.beam_traileffect, start, hitorigin);
964 // set up for the next
965 Draw_ArcBeam_callback_last_thickness = thickness;
966 Draw_ArcBeam_callback_last_top = WarpZone_UnTransformOrigin(WarpZone_trace_transform, top);
967 Draw_ArcBeam_callback_last_bottom = WarpZone_UnTransformOrigin(WarpZone_trace_transform, bottom);
973 for (e = world; (e = findfloat(e, beam_usevieworigin, 1)); ) {
974 e.beam_initialized = false;
976 for (e = world; (e = findfloat(e, beam_usevieworigin, 2)); ) {
977 e.beam_initialized = false;
981 void Draw_ArcBeam(entity this)
983 float dt = time - this.move_time;
984 this.move_time = time;
985 if(dt <= 0) { return; }
987 if(!this.beam_usevieworigin)
989 InterpolateOrigin_Do(this);
992 // origin = beam starting origin
993 // v_angle = wanted/aim direction
994 // angles = current direction of beam
997 vector wantdir; //= view_forward;
998 vector beamdir; //= this.beam_dir;
1001 if(this.beam_usevieworigin)
1004 // Currently we have to replicate nearly the same method of figuring
1005 // out the shotdir that the server does... Ideally in the future we
1006 // should be able to acquire this from a generalized function built
1007 // into a weapon system for client code.
1009 // find where we are aiming
1010 makevectors(warpzone_save_view_angles);
1011 vector forward = v_forward;
1012 vector right = v_right;
1015 // decide upon start position
1016 if(this.beam_usevieworigin == 2)
1017 { start_pos = warpzone_save_view_origin; }
1019 { start_pos = this.origin; }
1021 // trace forward with an estimation
1024 start_pos + forward * this.beam_range,
1029 // untransform in case our trace went through a warpzone
1030 vector end_pos = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
1032 // un-adjust trueaim if shotend is too close
1033 if(vdist(end_pos - start_pos, <, g_trueaim_minrange))
1034 end_pos = start_pos + (forward * g_trueaim_minrange);
1036 // move shot origin to the actual gun muzzle origin
1037 vector origin_offset =
1038 right * -this.beam_shotorigin.y
1039 + up * this.beam_shotorigin.z;
1041 start_pos = start_pos + origin_offset;
1043 // Move it also forward, but only as far as possible without hitting anything. Don't poke into walls!
1044 traceline(start_pos, start_pos + forward * this.beam_shotorigin.x, MOVE_NORMAL, this);
1045 start_pos = trace_endpos;
1047 // calculate the aim direction now
1048 wantdir = normalize(end_pos - start_pos);
1050 if(!this.beam_initialized)
1052 this.beam_dir = wantdir;
1053 this.beam_initialized = true;
1056 if(this.beam_dir != wantdir)
1058 // calculate how much we're going to move the end of the beam to the want position
1059 // WEAPONTODO (server and client):
1060 // blendfactor never actually becomes 0 in this situation, which is a problem
1061 // regarding precision... this means that this.beam_dir and w_shotdir approach
1062 // eachother, however they never actually become the same value with this method.
1063 // Perhaps we should do some form of rounding/snapping?
1064 float angle = vlen(wantdir - this.beam_dir) * RAD2DEG;
1065 if(angle && (angle > this.beam_maxangle))
1067 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
1068 float blendfactor = bound(
1070 (1 - (this.beam_returnspeed * frametime)),
1071 min(this.beam_maxangle / angle, 1)
1073 this.beam_dir = normalize((wantdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
1077 // the radius is not too far yet, no worries :D
1078 float blendfactor = bound(
1080 (1 - (this.beam_returnspeed * frametime)),
1083 this.beam_dir = normalize((wantdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
1086 // calculate how many segments are needed
1087 float max_allowed_segments;
1089 if(this.beam_distancepersegment)
1091 max_allowed_segments = min(
1093 1 + (vlen(wantdir / this.beam_distancepersegment))
1096 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
1098 if(this.beam_degreespersegment)
1108 this.beam_degreespersegment
1110 max_allowed_segments
1113 else { segments = 1; }
1115 else { segments = 1; }
1117 // set the beam direction which the rest of the code will refer to
1118 beamdir = this.beam_dir;
1120 // finally, set this.angles to the proper direction so that muzzle attachment points in proper direction
1121 this.angles = fixedvectoangles2(forward, up); // TODO(Samual): is this == warpzone_save_view_angles?
1125 // set the values from the provided info from the networked entity
1126 start_pos = this.origin;
1127 wantdir = this.v_angle;
1128 beamdir = this.angles;
1130 if(beamdir != wantdir)
1132 float angle = vlen(wantdir - beamdir) * RAD2DEG;
1134 // calculate how many segments are needed
1135 float max_allowed_segments;
1137 if(this.beam_distancepersegment)
1139 max_allowed_segments = min(
1141 1 + (vlen(wantdir / this.beam_distancepersegment))
1144 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
1146 if(this.beam_degreespersegment)
1156 this.beam_degreespersegment
1158 max_allowed_segments
1161 else { segments = 1; }
1163 else { segments = 1; }
1166 setorigin(this, start_pos);
1167 this.beam_muzzleentity.angles_z = random() * 360; // WEAPONTODO: use avelocity instead?
1169 vector beam_endpos = (start_pos + (beamdir * this.beam_range));
1170 vector beam_controlpoint = start_pos + wantdir * (this.beam_range * (1 - this.beam_tightness));
1172 Draw_ArcBeam_callback_entity = this;
1173 Draw_ArcBeam_callback_last_thickness = 0;
1174 Draw_ArcBeam_callback_last_top = start_pos;
1175 Draw_ArcBeam_callback_last_bottom = start_pos;
1177 vector last_origin = start_pos;
1178 vector original_start_pos = start_pos;
1181 for(i = 1; i <= segments; ++i)
1183 // WEAPONTODO (client):
1184 // In order to do nice fading and pointing on the starting segment, we must always
1185 // have that drawn as a separate triangle... However, that is difficult to do when
1186 // keeping in mind the above problems and also optimizing the amount of segments
1187 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
1189 vector new_origin = bezier_quadratic_getpoint(
1195 WarpZone_TraceBox_ThroughZone(
1203 Draw_ArcBeam_callback
1206 // Do all the transforms for warpzones right now, as we already "are" in the post-trace
1207 // system (if we hit a player, that's always BEHIND the last passed wz).
1208 last_origin = trace_endpos;
1209 start_pos = WarpZone_TransformOrigin(WarpZone_trace_transform, start_pos);
1210 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
1211 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
1212 beamdir = WarpZone_TransformVelocity(WarpZone_trace_transform, beamdir);
1213 Draw_ArcBeam_callback_last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
1214 Draw_ArcBeam_callback_last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
1216 if(trace_fraction < 1) { break; }
1219 // visual effects for startpoint and endpoint
1220 if(this.beam_hiteffect)
1222 // FIXME we really should do this on the server so it actually
1223 // matches gameplay. What this client side stuff is doing is no
1224 // more than guesswork.
1225 if((trace_ent || trace_fraction < 1) && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
1227 this.beam_hiteffect,
1233 if(this.beam_hitlight[0])
1237 this.beam_hitlight[0],
1239 this.beam_hitlight[1],
1240 this.beam_hitlight[2],
1241 this.beam_hitlight[3]
1245 if(this.beam_muzzleeffect)
1248 this.beam_muzzleeffect,
1249 original_start_pos + wantdir * 20,
1254 if(this.beam_muzzlelight[0])
1257 original_start_pos + wantdir * 20,
1258 this.beam_muzzlelight[0],
1260 this.beam_muzzlelight[1],
1261 this.beam_muzzlelight[2],
1262 this.beam_muzzlelight[3]
1268 Draw_ArcBeam_callback_entity = world;
1269 Draw_ArcBeam_callback_last_thickness = 0;
1270 Draw_ArcBeam_callback_last_top = '0 0 0';
1271 Draw_ArcBeam_callback_last_bottom = '0 0 0';
1274 void Remove_ArcBeam(entity this)
1276 remove(this.beam_muzzleentity);
1277 sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
1280 NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
1282 int sf = ReadByte();
1287 int gunalign = W_GetGunAlignment(world);
1289 this.beam_shotorigin = arc_shotorigin[gunalign];
1291 // set other main attributes of the beam
1292 this.draw = Draw_ArcBeam;
1293 this.entremove = Remove_ArcBeam;
1294 this.move_time = time;
1295 loopsound(this, CH_SHOTS_SINGLE, SND(ARC_LOOP), VOL_BASE, ATTEN_NORM);
1299 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT;
1300 flash.drawmask = MASK_NORMAL;
1301 flash.solid = SOLID_NOT;
1302 flash.avelocity_z = 5000;
1303 setattachment(flash, this, "");
1304 setorigin(flash, '0 0 0');
1306 this.beam_muzzleentity = flash;
1310 flash = this.beam_muzzleentity;
1313 if(sf & ARC_SF_SETTINGS) // settings information
1315 this.beam_degreespersegment = ReadShort();
1316 this.beam_distancepersegment = ReadShort();
1317 this.beam_maxangle = ReadShort();
1318 this.beam_range = ReadCoord();
1319 this.beam_returnspeed = ReadShort();
1320 this.beam_tightness = (ReadByte() / 10);
1324 if(autocvar_chase_active)
1325 { this.beam_usevieworigin = 1; }
1326 else // use view origin
1327 { this.beam_usevieworigin = 2; }
1331 this.beam_usevieworigin = 0;
1334 this.sv_entnum = ReadByte();
1337 if(!this.beam_usevieworigin)
1339 // this.iflags = IFLAG_ORIGIN | IFLAG_ANGLES | IFLAG_V_ANGLE; // why doesn't this work?
1340 this.iflags = IFLAG_ORIGIN;
1342 InterpolateOrigin_Undo(this);
1345 if(sf & ARC_SF_START) // starting location
1347 this.origin_x = ReadCoord();
1348 this.origin_y = ReadCoord();
1349 this.origin_z = ReadCoord();
1351 else if(this.beam_usevieworigin) // infer the location from player location
1353 if(this.beam_usevieworigin == 2)
1356 this.origin = view_origin;
1360 // use player origin so that third person display still works
1361 this.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * STAT(VIEWHEIGHT));
1365 setorigin(this, this.origin);
1367 if(sf & ARC_SF_WANTDIR) // want/aim direction
1369 this.v_angle_x = ReadCoord();
1370 this.v_angle_y = ReadCoord();
1371 this.v_angle_z = ReadCoord();
1374 if(sf & ARC_SF_BEAMDIR) // beam direction
1376 this.angles_x = ReadCoord();
1377 this.angles_y = ReadCoord();
1378 this.angles_z = ReadCoord();
1381 if(sf & ARC_SF_BEAMTYPE) // beam type
1383 this.beam_type = ReadByte();
1385 vector beamcolor = ((autocvar_cl_arcbeam_teamcolor) ? colormapPaletteColor(stof(getplayerkeyvalue(this.sv_entnum - 1, "colors")) & 0x0F, true) : '1 1 1');
1386 switch(this.beam_type)
1390 this.beam_color = beamcolor;
1391 this.beam_alpha = 0.5;
1392 this.beam_thickness = 8;
1393 this.beam_traileffect = (EFFECT_ARC_BEAM);
1394 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1395 this.beam_hitlight[0] = 0;
1396 this.beam_hitlight[1] = 1;
1397 this.beam_hitlight[2] = 1;
1398 this.beam_hitlight[3] = 1;
1399 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1400 this.beam_muzzlelight[0] = 0;
1401 this.beam_muzzlelight[1] = 1;
1402 this.beam_muzzlelight[2] = 1;
1403 this.beam_muzzlelight[3] = 1;
1404 if(this.beam_muzzleeffect)
1406 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1407 flash.alpha = this.beam_alpha;
1408 flash.colormod = this.beam_color;
1413 case ARC_BT_WALL: // grenadelauncher_muzzleflash healray_muzzleflash
1415 this.beam_color = beamcolor;
1416 this.beam_alpha = 0.5;
1417 this.beam_thickness = 8;
1418 this.beam_traileffect = (EFFECT_ARC_BEAM);
1419 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1420 this.beam_hitlight[0] = 0;
1421 this.beam_hitlight[1] = 1;
1422 this.beam_hitlight[2] = 1;
1423 this.beam_hitlight[3] = 1;
1424 this.beam_muzzleeffect = NULL; // (EFFECT_GRENADE_MUZZLEFLASH);
1425 this.beam_muzzlelight[0] = 0;
1426 this.beam_muzzlelight[1] = 1;
1427 this.beam_muzzlelight[2] = 1;
1428 this.beam_muzzlelight[3] = 1;
1429 this.beam_image = "particles/lgbeam";
1430 if(this.beam_muzzleeffect)
1432 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1433 flash.alpha = this.beam_alpha;
1434 flash.colormod = this.beam_color;
1441 this.beam_color = beamcolor;
1442 this.beam_alpha = 0.5;
1443 this.beam_thickness = 8;
1444 this.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
1445 this.beam_hiteffect = (EFFECT_ARC_BEAM_HEAL_IMPACT);
1446 this.beam_hitlight[0] = 0;
1447 this.beam_hitlight[1] = 1;
1448 this.beam_hitlight[2] = 1;
1449 this.beam_hitlight[3] = 1;
1450 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1451 this.beam_muzzlelight[0] = 0;
1452 this.beam_muzzlelight[1] = 1;
1453 this.beam_muzzlelight[2] = 1;
1454 this.beam_muzzlelight[3] = 1;
1455 this.beam_image = "particles/lgbeam";
1456 if(this.beam_muzzleeffect)
1458 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1459 flash.alpha = this.beam_alpha;
1460 flash.colormod = this.beam_color;
1467 this.beam_color = beamcolor;
1468 this.beam_alpha = 0.5;
1469 this.beam_thickness = 8;
1470 this.beam_traileffect = (EFFECT_ARC_BEAM);
1471 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1472 this.beam_hitlight[0] = 20;
1473 this.beam_hitlight[1] = 1;
1474 this.beam_hitlight[2] = 0;
1475 this.beam_hitlight[3] = 0;
1476 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1477 this.beam_muzzlelight[0] = 50;
1478 this.beam_muzzlelight[1] = 1;
1479 this.beam_muzzlelight[2] = 0;
1480 this.beam_muzzlelight[3] = 0;
1481 this.beam_image = "particles/lgbeam";
1482 if(this.beam_muzzleeffect)
1484 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1485 flash.alpha = this.beam_alpha;
1486 flash.colormod = this.beam_color;
1491 case ARC_BT_BURST_MISS:
1493 this.beam_color = beamcolor;
1494 this.beam_alpha = 0.5;
1495 this.beam_thickness = 14;
1496 this.beam_traileffect = (EFFECT_ARC_BEAM);
1497 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1498 this.beam_hitlight[0] = 0;
1499 this.beam_hitlight[1] = 1;
1500 this.beam_hitlight[2] = 1;
1501 this.beam_hitlight[3] = 1;
1502 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1503 this.beam_muzzlelight[0] = 0;
1504 this.beam_muzzlelight[1] = 1;
1505 this.beam_muzzlelight[2] = 1;
1506 this.beam_muzzlelight[3] = 1;
1507 this.beam_image = "particles/lgbeam";
1508 if(this.beam_muzzleeffect)
1510 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1511 flash.alpha = this.beam_alpha;
1512 flash.colormod = this.beam_color;
1517 case ARC_BT_BURST_WALL:
1519 this.beam_color = beamcolor;
1520 this.beam_alpha = 0.5;
1521 this.beam_thickness = 14;
1522 this.beam_traileffect = (EFFECT_ARC_BEAM);
1523 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1524 this.beam_hitlight[0] = 0;
1525 this.beam_hitlight[1] = 1;
1526 this.beam_hitlight[2] = 1;
1527 this.beam_hitlight[3] = 1;
1528 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1529 this.beam_muzzlelight[0] = 0;
1530 this.beam_muzzlelight[1] = 1;
1531 this.beam_muzzlelight[2] = 1;
1532 this.beam_muzzlelight[3] = 1;
1533 this.beam_image = "particles/lgbeam";
1534 if(this.beam_muzzleeffect)
1536 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1537 flash.alpha = this.beam_alpha;
1538 flash.colormod = this.beam_color;
1543 case ARC_BT_BURST_HEAL:
1545 this.beam_color = beamcolor;
1546 this.beam_alpha = 0.5;
1547 this.beam_thickness = 14;
1548 this.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
1549 this.beam_hiteffect = (EFFECT_ARC_BEAM_HEAL_IMPACT2);
1550 this.beam_hitlight[0] = 0;
1551 this.beam_hitlight[1] = 1;
1552 this.beam_hitlight[2] = 1;
1553 this.beam_hitlight[3] = 1;
1554 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1555 this.beam_muzzlelight[0] = 0;
1556 this.beam_muzzlelight[1] = 1;
1557 this.beam_muzzlelight[2] = 1;
1558 this.beam_muzzlelight[3] = 1;
1559 this.beam_image = "particles/lgbeam";
1560 if(this.beam_muzzleeffect)
1562 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1563 flash.alpha = this.beam_alpha;
1564 flash.colormod = this.beam_color;
1569 case ARC_BT_BURST_HIT:
1571 this.beam_color = beamcolor;
1572 this.beam_alpha = 0.5;
1573 this.beam_thickness = 14;
1574 this.beam_traileffect = (EFFECT_ARC_BEAM);
1575 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1576 this.beam_hitlight[0] = 0;
1577 this.beam_hitlight[1] = 1;
1578 this.beam_hitlight[2] = 1;
1579 this.beam_hitlight[3] = 1;
1580 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1581 this.beam_muzzlelight[0] = 0;
1582 this.beam_muzzlelight[1] = 1;
1583 this.beam_muzzlelight[2] = 1;
1584 this.beam_muzzlelight[3] = 1;
1585 this.beam_image = "particles/lgbeam";
1586 if(this.beam_muzzleeffect)
1588 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1589 flash.alpha = this.beam_alpha;
1590 flash.colormod = this.beam_color;
1596 // shouldn't be possible, but lets make it colorful if it does :D
1599 this.beam_color = randomvec();
1600 this.beam_alpha = 1;
1601 this.beam_thickness = 8;
1602 this.beam_traileffect = NULL;
1603 this.beam_hiteffect = NULL;
1604 this.beam_hitlight[0] = 0;
1605 this.beam_hitlight[1] = 1;
1606 this.beam_hitlight[2] = 1;
1607 this.beam_hitlight[3] = 1;
1608 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1609 this.beam_muzzlelight[0] = 0;
1610 this.beam_muzzlelight[1] = 1;
1611 this.beam_muzzlelight[2] = 1;
1612 this.beam_muzzlelight[3] = 1;
1613 this.beam_image = "particles/lgbeam";
1614 if(this.beam_muzzleeffect)
1616 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1617 flash.alpha = this.beam_alpha;
1618 flash.colormod = this.beam_color;
1626 if(!this.beam_usevieworigin)
1628 InterpolateOrigin_Note(this);