4 /* ammotype */ ATTRIB(Arc, ammo_field, .int, ammo_cells);
5 /* impulse */ ATTRIB(Arc, impulse, int, 3);
6 /* flags */ ATTRIB(Arc, spawnflags, int, WEP_FLAG_NORMAL);
7 /* rating */ ATTRIB(Arc, bot_pickupbasevalue, float, BOT_PICKUP_RATING_HIGH);
8 /* color */ ATTRIB(Arc, wpcolor, vector, '1 1 1');
9 /* modelname */ ATTRIB(Arc, mdl, string, "arc");
11 /* model */ ATTRIB(Arc, m_model, Model, MDL_ARC_ITEM);
13 /* crosshair */ ATTRIB(Arc, w_crosshair, string, "gfx/crosshairhlac");
14 /* crosshair */ ATTRIB(Arc, w_crosshair_size, float, 0.7);
15 /* wepimg */ ATTRIB(Arc, model2, string, "weaponarc");
16 /* refname */ ATTRIB(Arc, netname, string, "arc");
17 /* wepname */ ATTRIB(Arc, m_name, string, _("Arc"));
19 #define X(BEGIN, P, END, class, prefix) \
21 P(class, prefix, bolt, float, NONE) \
22 P(class, prefix, bolt_ammo, float, NONE) \
23 P(class, prefix, bolt_damageforcescale, float, NONE) \
24 P(class, prefix, bolt_damage, float, NONE) \
25 P(class, prefix, bolt_edgedamage, float, NONE) \
26 P(class, prefix, bolt_force, float, NONE) \
27 P(class, prefix, bolt_health, float, NONE) \
28 P(class, prefix, bolt_lifetime, float, NONE) \
29 P(class, prefix, bolt_radius, float, NONE) \
30 P(class, prefix, bolt_refire, float, NONE) \
31 P(class, prefix, bolt_speed, float, NONE) \
32 P(class, prefix, bolt_spread, float, NONE) \
33 P(class, prefix, beam_ammo, float, NONE) \
34 P(class, prefix, beam_animtime, float, NONE) \
35 P(class, prefix, beam_botaimlifetime, float, NONE) \
36 P(class, prefix, beam_botaimspeed, float, NONE) \
37 P(class, prefix, beam_damage, float, NONE) \
38 P(class, prefix, beam_degreespersegment, float, NONE) \
39 P(class, prefix, beam_distancepersegment, float, NONE) \
40 P(class, prefix, beam_falloff_halflifedist, float, NONE) \
41 P(class, prefix, beam_falloff_maxdist, float, NONE) \
42 P(class, prefix, beam_falloff_mindist, float, NONE) \
43 P(class, prefix, beam_force, float, NONE) \
44 P(class, prefix, beam_healing_amax, float, NONE) \
45 P(class, prefix, beam_healing_aps, float, NONE) \
46 P(class, prefix, beam_healing_hmax, float, NONE) \
47 P(class, prefix, beam_healing_hps, float, NONE) \
48 P(class, prefix, beam_heat, float, NONE) /* heat increase per second (primary) */ \
49 P(class, prefix, beam_maxangle, float, NONE) \
50 P(class, prefix, beam_nonplayerdamage, float, NONE) \
51 P(class, prefix, beam_range, float, NONE) \
52 P(class, prefix, beam_refire, float, NONE) \
53 P(class, prefix, beam_returnspeed, float, NONE) \
54 P(class, prefix, beam_tightness, float, NONE) \
55 P(class, prefix, burst_ammo, float, NONE) \
56 P(class, prefix, burst_damage, float, NONE) \
57 P(class, prefix, burst_healing_aps, float, NONE) \
58 P(class, prefix, burst_healing_hps, float, NONE) \
59 P(class, prefix, burst_heat, float, NONE) /* heat increase per second (secondary) */ \
60 P(class, prefix, cooldown, float, NONE) /* heat decrease per second when resting */ \
61 P(class, prefix, cooldown_release, float, NONE) /* delay weapon re-use when releasing button */ \
62 P(class, prefix, overheat_max, float, NONE) /* maximum heat before jamming */ \
63 P(class, prefix, overheat_min, float, NONE) /* minimum heat to wait for cooldown */ \
64 P(class, prefix, switchdelay_drop, float, NONE) \
65 P(class, prefix, switchdelay_raise, float, NONE) \
66 P(class, prefix, weaponreplace, string, NONE) \
67 P(class, prefix, weaponstartoverride, float, NONE) \
68 P(class, prefix, weaponstart, float, NONE) \
69 P(class, prefix, weaponthrowable, float, NONE) \
75 REGISTER_WEAPON(ARC, arc, NEW(Arc));
79 const float ARC_MAX_SEGMENTS = 20;
80 vector arc_shotorigin[4];
86 const int ARC_BT_MISS = 0x00;
87 const int ARC_BT_WALL = 0x01;
88 const int ARC_BT_HEAL = 0x02;
89 const int ARC_BT_HIT = 0x03;
90 const int ARC_BT_BURST_MISS = 0x10;
91 const int ARC_BT_BURST_WALL = 0x11;
92 const int ARC_BT_BURST_HEAL = 0x12;
93 const int ARC_BT_BURST_HIT = 0x13;
94 const int ARC_BT_BURSTMASK = 0x10;
96 const int ARC_SF_SETTINGS = BIT(0);
97 const int ARC_SF_START = BIT(1);
98 const int ARC_SF_WANTDIR = BIT(2);
99 const int ARC_SF_BEAMDIR = BIT(3);
100 const int ARC_SF_BEAMTYPE = BIT(4);
101 const int ARC_SF_LOCALMASK = ARC_SF_START | ARC_SF_WANTDIR | ARC_SF_BEAMDIR;
105 .bool arc_BUTTON_ATCK_prev; // for better animation control
107 .float beam_initialized;
108 .float beam_bursting;
109 .float beam_teleporttime;
110 .float beam_heat; // (beam) amount of heat produced
111 .float arc_overheat; // (dropped arc/player) time during which it's too hot
112 .float arc_cooldown; // (dropped arc/player) cooling speed
113 .float arc_heat_percent = _STAT(ARC_HEAT);
114 .float arc_smoke_sound;
120 .float beam_thickness;
121 .entity beam_traileffect;
122 .entity beam_hiteffect;
123 .float beam_hitlight[4]; // 0: radius, 123: rgb
124 .entity beam_muzzleeffect;
125 .float beam_muzzlelight[4]; // 0: radius, 123: rgb
128 .entity beam_muzzleentity;
130 .float beam_degreespersegment;
131 .float beam_distancepersegment;
132 .float beam_usevieworigin;
133 .float beam_initialized;
134 .float beam_maxangle;
136 .float beam_returnspeed;
137 .float beam_tightness;
138 .vector beam_shotorigin;
140 entity Draw_ArcBeam_callback_entity;
141 float Draw_ArcBeam_callback_last_thickness;
142 vector Draw_ArcBeam_callback_last_top; // NOTE: in same coordinate system as player.
143 vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as player.
146 #ifdef IMPLEMENTATION
148 spawnfunc(weapon_arc) { weapon_defaultspawnfunc(this, WEP_ARC); }
150 bool W_Arc_Beam_Send(entity this, entity to, int sf)
152 WriteHeader(MSG_ENTITY, ENT_CLIENT_ARC_BEAM);
154 // Truncate information when this beam is displayed to the owner client
155 // - The owner client has no use for beam start position or directions,
156 // it always figures this information out for itself with csqc code.
157 // - Spectating the owner also truncates this information.
158 float drawlocal = ((to == this.owner) || ((to.enemy == this.owner) && IS_SPEC(to)));
159 if(drawlocal) { sf &= ~ARC_SF_LOCALMASK; }
161 WriteByte(MSG_ENTITY, sf);
162 WriteByte(MSG_ENTITY, weaponslot(this.weaponentity_fld));
164 if(sf & ARC_SF_SETTINGS) // settings information
166 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_degreespersegment));
167 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_distancepersegment));
168 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_maxangle));
169 WriteCoord(MSG_ENTITY, WEP_CVAR(arc, beam_range));
170 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_returnspeed));
171 WriteByte(MSG_ENTITY, WEP_CVAR(arc, beam_tightness) * 10);
173 WriteByte(MSG_ENTITY, drawlocal);
174 WriteByte(MSG_ENTITY, etof(this.owner));
176 if(sf & ARC_SF_START) // starting location
178 WriteCoord(MSG_ENTITY, this.beam_start.x);
179 WriteCoord(MSG_ENTITY, this.beam_start.y);
180 WriteCoord(MSG_ENTITY, this.beam_start.z);
182 if(sf & ARC_SF_WANTDIR) // want/aim direction
184 WriteCoord(MSG_ENTITY, this.beam_wantdir.x);
185 WriteCoord(MSG_ENTITY, this.beam_wantdir.y);
186 WriteCoord(MSG_ENTITY, this.beam_wantdir.z);
188 if(sf & ARC_SF_BEAMDIR) // beam direction
190 WriteCoord(MSG_ENTITY, this.beam_dir.x);
191 WriteCoord(MSG_ENTITY, this.beam_dir.y);
192 WriteCoord(MSG_ENTITY, this.beam_dir.z);
194 if(sf & ARC_SF_BEAMTYPE) // beam type
196 WriteByte(MSG_ENTITY, this.beam_type);
202 void Reset_ArcBeam(entity player, vector forward)
204 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
206 .entity weaponentity = weaponentities[slot];
207 if(!player.(weaponentity).arc_beam)
209 player.(weaponentity).arc_beam.beam_dir = forward;
210 player.(weaponentity).arc_beam.beam_teleporttime = time;
214 float Arc_GetHeat_Percent(entity player, .entity weaponentity)
216 if ( WEP_CVAR(arc, overheat_max) <= 0 || WEP_CVAR(arc, overheat_max) <= 0 )
218 player.arc_overheat = 0;
222 if ( player.(weaponentity).arc_beam )
223 return player.(weaponentity).arc_beam.beam_heat/WEP_CVAR(arc, overheat_max);
225 if ( player.arc_overheat > time )
227 return (player.arc_overheat-time) / WEP_CVAR(arc, overheat_max)
228 * player.arc_cooldown;
233 void Arc_Player_SetHeat(entity player, .entity weaponentity)
235 player.arc_heat_percent = Arc_GetHeat_Percent(player, weaponentity);
236 //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
239 void W_Arc_Bolt_Explode(entity this, entity directhitentity)
241 this.event_damage = func_null;
242 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);
247 void W_Arc_Bolt_Explode_use(entity this, entity actor, entity trigger)
249 W_Arc_Bolt_Explode(this, trigger);
252 void W_Arc_Bolt_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
257 if(!W_CheckProjectileDamage(inflictor.realowner, this.realowner, deathtype, -1))
258 return; // g_projectiles_damage says to halt
260 this.health = this.health - damage;
261 this.angles = vectoangles(this.velocity);
264 W_PrepareExplosionByDamage(this, attacker, getthink(this));
267 void W_Arc_Bolt_Touch(entity this, entity toucher)
269 PROJECTILE_TOUCH(this, toucher);
270 this.use(this, NULL, toucher);
273 void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity)
277 W_DecreaseAmmo(thiswep, actor, WEP_CVAR(arc, bolt_ammo), weaponentity);
279 W_SetupShot(actor, weaponentity, false, 2, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage));
281 Send_Effect(EFFECT_ARC_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
283 missile = new(missile);
284 missile.owner = missile.realowner = actor;
285 missile.bot_dodge = true;
286 IL_PUSH(g_bot_dodge, missile);
287 missile.bot_dodgerating = WEP_CVAR(arc, bolt_damage);
289 missile.takedamage = DAMAGE_YES;
290 missile.health = WEP_CVAR(arc, bolt_health);
291 missile.damageforcescale = WEP_CVAR(arc, bolt_damageforcescale);
292 missile.event_damage = W_Arc_Bolt_Damage;
293 missile.damagedbycontents = true;
294 IL_PUSH(g_damagedbycontents, missile);
296 settouch(missile, W_Arc_Bolt_Touch);
297 missile.use = W_Arc_Bolt_Explode_use;
298 setthink(missile, adaptor_think2use_hittype_splash);
299 missile.nextthink = time + WEP_CVAR(arc, bolt_lifetime);
300 PROJECTILE_MAKETRIGGER(missile);
301 missile.projectiledeathtype = WEP_ARC.m_id | HITTYPE_SECONDARY;
302 setorigin(missile, w_shotorg);
303 setsize(missile, '0 0 0', '0 0 0');
305 set_movetype(missile, MOVETYPE_FLY);
306 W_SetupProjVelocity_PRE(missile, arc, bolt_);
308 missile.angles = vectoangles(missile.velocity);
309 missile.flags = FL_PROJECTILE;
310 missile.missile_flags = MIF_SPLASH;
312 CSQCProjectile(missile, true, PROJECTILE_ARC_BOLT, true);
314 MUTATOR_CALLHOOK(EditProjectile, actor, missile);
317 void W_Arc_Beam_Think(entity this)
319 .entity weaponentity = this.weaponentity_fld;
320 if(this != this.owner.(weaponentity).arc_beam)
327 if( (PHYS_INPUT_BUTTON_ATCK2(this.owner) && !WEP_CVAR(arc, bolt)) || this.beam_bursting)
329 if(!this.beam_bursting)
330 this.beam_bursting = true;
331 burst = ARC_BT_BURSTMASK;
334 Weapon thiswep = WEP_ARC;
337 !IS_PLAYER(this.owner)
339 (this.owner.(thiswep.ammo_field) <= 0 && !(this.owner.items & IT_UNLIMITED_WEAPON_AMMO))
343 forbidWeaponUse(this.owner)
345 this.owner.(weaponentity).m_switchweapon != WEP_ARC
347 (!PHYS_INPUT_BUTTON_ATCK(this.owner) && !burst )
351 (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max))
354 if ( WEP_CVAR(arc, cooldown) > 0 )
356 float cooldown_speed = 0;
357 if ( this.beam_heat > WEP_CVAR(arc, overheat_min) && WEP_CVAR(arc, cooldown) > 0 )
359 cooldown_speed = WEP_CVAR(arc, cooldown);
363 cooldown_speed = this.beam_heat / WEP_CVAR(arc, beam_refire);
366 if ( cooldown_speed )
368 if ( WEP_CVAR(arc, cooldown_release) || (WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max)) )
369 this.owner.arc_overheat = time + this.beam_heat / cooldown_speed;
370 this.owner.arc_cooldown = cooldown_speed;
373 if ( WEP_CVAR(arc, overheat_max) > 0 && this.beam_heat >= WEP_CVAR(arc, overheat_max) )
375 Send_Effect(EFFECT_ARC_OVERHEAT,
376 this.beam_start, this.beam_wantdir, 1 );
377 sound(this, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
381 if(this == this.owner.(weaponentity).arc_beam) { this.owner.(weaponentity).arc_beam = NULL; }
382 entity own = this.owner;
384 if(!w.wr_checkammo1(w, own, weaponentity) && !w.wr_checkammo2(w, own, weaponentity))
385 if(!(own.items & IT_UNLIMITED_WEAPON_AMMO))
387 // note: this doesn't force the switch
388 W_SwitchToOtherWeapon(own, weaponentity);
395 float coefficient = frametime;
396 if(!(this.owner.items & IT_UNLIMITED_WEAPON_AMMO))
400 { rootammo = WEP_CVAR(arc, burst_ammo); }
402 { rootammo = WEP_CVAR(arc, beam_ammo); }
406 coefficient = min(coefficient, this.owner.(thiswep.ammo_field) / rootammo);
407 this.owner.(thiswep.ammo_field) = max(0, this.owner.(thiswep.ammo_field) - (rootammo * frametime));
410 float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat);
411 this.beam_heat = min( WEP_CVAR(arc, overheat_max), this.beam_heat + heat_speed*frametime );
413 makevectors(this.owner.v_angle);
417 weaponentity, // TODO
422 WEP_CVAR(arc, beam_damage) * coefficient,
423 WEP_CVAR(arc, beam_range)
426 // After teleport, "lock" the beam until the teleport is confirmed.
427 if (time < this.beam_teleporttime + ANTILAG_LATENCY(this.owner)) {
428 w_shotdir = this.beam_dir;
431 // network information: shot origin and want/aim direction
432 if(this.beam_start != w_shotorg)
434 this.SendFlags |= ARC_SF_START;
435 this.beam_start = w_shotorg;
437 if(this.beam_wantdir != w_shotdir)
439 this.SendFlags |= ARC_SF_WANTDIR;
440 this.beam_wantdir = w_shotdir;
443 if(!this.beam_initialized)
445 this.beam_dir = w_shotdir;
446 this.beam_initialized = true;
449 // WEAPONTODO: Detect player velocity so that the beam curves when moving too
450 // idea: blend together this.beam_dir with the inverted direction the player is moving in
451 // might have to make some special accomodation so that it only uses view_right and view_up
453 // note that if we do this, it'll always be corrected to a maximum angle by beam_maxangle handling
456 if(this.beam_dir != w_shotdir)
458 // calculate how much we're going to move the end of the beam to the want position
459 // WEAPONTODO (server and client):
460 // blendfactor never actually becomes 0 in this situation, which is a problem
461 // regarding precision... this means that this.beam_dir and w_shotdir approach
462 // eachother, however they never actually become the same value with this method.
463 // Perhaps we should do some form of rounding/snapping?
464 float angle = vlen(w_shotdir - this.beam_dir) * RAD2DEG;
465 if(angle && (angle > WEP_CVAR(arc, beam_maxangle)))
467 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
468 float blendfactor = bound(
470 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
471 min(WEP_CVAR(arc, beam_maxangle) / angle, 1)
473 this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
477 // the radius is not too far yet, no worries :D
478 float blendfactor = bound(
480 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
483 this.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
486 // network information: beam direction
487 this.SendFlags |= ARC_SF_BEAMDIR;
489 // calculate how many segments are needed
490 float max_allowed_segments;
492 if(WEP_CVAR(arc, beam_distancepersegment))
494 max_allowed_segments = min(
496 1 + (vlen(w_shotdir / WEP_CVAR(arc, beam_distancepersegment)))
499 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
501 if(WEP_CVAR(arc, beam_degreespersegment))
508 WEP_CVAR(arc, beam_maxangle)
511 WEP_CVAR(arc, beam_degreespersegment)
516 else { segments = 1; }
518 else { segments = 1; }
520 vector beam_endpos = (w_shotorg + (this.beam_dir * WEP_CVAR(arc, beam_range)));
521 vector beam_controlpoint = w_shotorg + w_shotdir * (WEP_CVAR(arc, beam_range) * (1 - WEP_CVAR(arc, beam_tightness)));
524 float new_beam_type = 0;
525 vector last_origin = w_shotorg;
526 for(i = 1; i <= segments; ++i)
528 // WEAPONTODO (client):
529 // In order to do nice fading and pointing on the starting segment, we must always
530 // have that drawn as a separate triangle... However, that is difficult to do when
531 // keeping in mind the above problems and also optimizing the amount of segments
532 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
534 vector new_origin = bezier_quadratic_getpoint(
539 vector new_dir = normalize(new_origin - last_origin);
541 WarpZone_traceline_antilag(
547 ANTILAG_LATENCY(this.owner)
550 // Do all the transforms for warpzones right now, as we already
551 // "are" in the post-trace system (if we hit a player, that's
552 // always BEHIND the last passed wz).
553 last_origin = trace_endpos;
554 w_shotorg = WarpZone_TransformOrigin(WarpZone_trace_transform, w_shotorg);
555 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
556 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
557 new_dir = WarpZone_TransformVelocity(WarpZone_trace_transform, new_dir);
562 trace_ent.classname == "body"
564 IS_MONSTER(trace_ent)
567 if(trace_ent && trace_ent.takedamage && (is_player || WEP_CVAR(arc, beam_nonplayerdamage)))
569 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
570 // NO. trace_endpos should be just fine. If not,
571 // that's an engine bug that needs proper debugging.
572 vector hitorigin = trace_endpos;
574 float falloff = ExponentialFalloff(
575 WEP_CVAR(arc, beam_falloff_mindist),
576 WEP_CVAR(arc, beam_falloff_maxdist),
577 WEP_CVAR(arc, beam_falloff_halflifedist),
578 vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, hitorigin) - w_shotorg)
581 if(is_player && SAME_TEAM(this.owner, trace_ent))
583 float roothealth, rootarmor;
586 roothealth = WEP_CVAR(arc, burst_healing_hps);
587 rootarmor = WEP_CVAR(arc, burst_healing_aps);
591 roothealth = WEP_CVAR(arc, beam_healing_hps);
592 rootarmor = WEP_CVAR(arc, beam_healing_aps);
595 if(trace_ent.health <= WEP_CVAR(arc, beam_healing_hmax) && roothealth)
597 trace_ent.health = min(
598 trace_ent.health + (roothealth * coefficient),
599 WEP_CVAR(arc, beam_healing_hmax)
602 if(trace_ent.armorvalue <= WEP_CVAR(arc, beam_healing_amax) && rootarmor)
604 trace_ent.armorvalue = min(
605 trace_ent.armorvalue + (rootarmor * coefficient),
606 WEP_CVAR(arc, beam_healing_amax)
610 // stop rot, set visual effect
611 if(roothealth || rootarmor)
613 trace_ent.pauserothealth_finished = max(
614 trace_ent.pauserothealth_finished,
615 time + autocvar_g_balance_pause_health_rot
617 trace_ent.pauserotarmor_finished = max(
618 trace_ent.pauserotarmor_finished,
619 time + autocvar_g_balance_pause_armor_rot
621 new_beam_type = ARC_BT_HEAL;
630 { rootdamage = WEP_CVAR(arc, burst_damage); }
632 { rootdamage = WEP_CVAR(arc, beam_damage); }
635 { rootdamage = WEP_CVAR(arc, beam_nonplayerdamage); }
637 if(accuracy_isgooddamage(this.owner, trace_ent))
643 rootdamage * coefficient * falloff
651 rootdamage * coefficient * falloff,
654 WEP_CVAR(arc, beam_force) * new_dir * coefficient * falloff
657 new_beam_type = ARC_BT_HIT;
661 else if(trace_fraction != 1)
663 // we collided with geometry
664 new_beam_type = ARC_BT_WALL;
669 // te_explosion(trace_endpos);
671 // if we're bursting, use burst visual effects
672 new_beam_type |= burst;
674 // network information: beam type
675 if(new_beam_type != this.beam_type)
677 this.SendFlags |= ARC_SF_BEAMTYPE;
678 this.beam_type = new_beam_type;
681 this.owner.(weaponentity).beam_prev = time;
682 this.nextthink = time;
685 void W_Arc_Beam(float burst, entity actor, .entity weaponentity)
688 // only play fire sound if 1 sec has passed since player let go the fire button
689 if(time - actor.(weaponentity).beam_prev > 1)
690 sound(actor, CH_WEAPON_A, SND_ARC_FIRE, VOL_BASE, ATTN_NORM);
692 entity beam = actor.(weaponentity).arc_beam = new(W_Arc_Beam);
693 beam.weaponentity_fld = weaponentity;
694 beam.solid = SOLID_NOT;
695 setthink(beam, W_Arc_Beam_Think);
697 set_movetype(beam, MOVETYPE_NONE);
698 beam.bot_dodge = true;
699 IL_PUSH(g_bot_dodge, beam);
700 beam.bot_dodgerating = WEP_CVAR(arc, beam_damage);
701 beam.beam_bursting = burst;
702 Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
704 getthink(beam)(beam);
706 void Arc_Smoke(entity actor, .entity weaponentity)
708 makevectors(actor.v_angle);
709 W_SetupShot_Range(actor,weaponentity,true,0,SND_Null,0,0,0);
711 vector smoke_origin = w_shotorg + actor.velocity*frametime;
712 if ( actor.arc_overheat > time )
714 if ( random() < actor.arc_heat_percent )
715 Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
716 if ( PHYS_INPUT_BUTTON_ATCK(actor) || PHYS_INPUT_BUTTON_ATCK2(actor) )
718 Send_Effect(EFFECT_ARC_OVERHEAT_FIRE, smoke_origin, w_shotdir, 1 );
719 if ( !actor.arc_smoke_sound )
721 actor.arc_smoke_sound = 1;
722 sound(actor, CH_SHOTS_SINGLE, SND_ARC_LOOP_OVERHEAT, VOL_BASE, ATTN_NORM);
726 else if ( actor.(weaponentity).arc_beam && WEP_CVAR(arc, overheat_max) > 0 &&
727 actor.(weaponentity).arc_beam.beam_heat > WEP_CVAR(arc, overheat_min) )
729 if ( random() < (actor.(weaponentity).arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) /
730 ( WEP_CVAR(arc, overheat_max)-WEP_CVAR(arc, overheat_min) ) )
731 Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
734 if ( actor.arc_smoke_sound && ( actor.arc_overheat <= time ||
735 !( PHYS_INPUT_BUTTON_ATCK(actor) || PHYS_INPUT_BUTTON_ATCK2(actor) ) ) || actor.(weaponentity).m_switchweapon != WEP_ARC )
737 actor.arc_smoke_sound = 0;
738 sound(actor, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
742 METHOD(Arc, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
744 if(WEP_CVAR(arc, beam_botaimspeed))
746 PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(
749 WEP_CVAR(arc, beam_botaimspeed),
751 WEP_CVAR(arc, beam_botaimlifetime),
757 PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(
767 METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
769 Arc_Player_SetHeat(actor, weaponentity);
770 Arc_Smoke(actor, weaponentity);
772 bool beam_fire2 = ((fire & 2) && !WEP_CVAR(arc, bolt));
774 if (time >= actor.arc_overheat)
775 if ((fire & 1) || beam_fire2 || actor.(weaponentity).arc_beam.beam_bursting)
778 if(actor.(weaponentity).arc_BUTTON_ATCK_prev)
781 if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
782 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
785 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
788 if((!actor.(weaponentity).arc_beam) || wasfreed(actor.(weaponentity).arc_beam))
790 if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(beam_fire2), 0))
792 W_Arc_Beam(boolean(beam_fire2), actor, weaponentity);
794 if(!actor.(weaponentity).arc_BUTTON_ATCK_prev)
796 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
797 actor.(weaponentity).arc_BUTTON_ATCK_prev = true;
806 if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(arc, bolt_refire)))
808 W_Arc_Attack_Bolt(thiswep, actor, weaponentity);
809 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, bolt_refire), w_ready);
813 if(actor.(weaponentity).arc_BUTTON_ATCK_prev)
815 int slot = weaponslot(weaponentity);
816 sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
817 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
818 ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor(actor);
820 actor.(weaponentity).arc_BUTTON_ATCK_prev = false;
824 if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_arc_secondary_refire))
827 actor.arc_count = autocvar_g_balance_arc_secondary_count;
828 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
829 actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor(actor);
833 METHOD(Arc, wr_init, void(entity thiswep))
835 if(!arc_shotorigin[0])
837 arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
838 arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
839 arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
840 arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
843 METHOD(Arc, wr_checkammo1, bool(entity thiswep, entity actor, .entity weaponentity))
845 return ((!WEP_CVAR(arc, beam_ammo)) || (actor.(thiswep.ammo_field) > 0));
847 METHOD(Arc, wr_checkammo2, bool(entity thiswep, entity actor, .entity weaponentity))
849 if(WEP_CVAR(arc, bolt))
851 float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(arc, bolt_ammo);
852 ammo_amount += actor.(weaponentity).(weapon_load[WEP_ARC.m_id]) >= WEP_CVAR(arc, bolt_ammo);
856 return WEP_CVAR(arc, overheat_max) > 0 &&
857 ((!WEP_CVAR(arc, burst_ammo)) || (actor.(thiswep.ammo_field) > 0));
859 METHOD(Arc, wr_killmessage, Notification(entity thiswep))
861 if(w_deathtype & HITTYPE_SECONDARY)
862 return WEAPON_ARC_MURDER_SPRAY;
864 return WEAPON_ARC_MURDER;
866 METHOD(Arc, wr_drop, void(entity thiswep, entity actor, .entity weaponentity))
868 weapon_dropevent_item.arc_overheat = actor.arc_overheat;
869 weapon_dropevent_item.arc_cooldown = actor.arc_cooldown;
870 actor.arc_overheat = 0;
871 actor.arc_cooldown = 0;
872 actor.(weaponentity).arc_BUTTON_ATCK_prev = false;
874 METHOD(Arc, wr_pickup, void(entity thiswep, entity actor, .entity weaponentity))
876 if ( !client_hasweapon(actor, thiswep, weaponentity, false, false) &&
877 weapon_dropevent_item.arc_overheat > time )
879 actor.arc_overheat = weapon_dropevent_item.arc_overheat;
880 actor.arc_cooldown = weapon_dropevent_item.arc_cooldown;
883 METHOD(Arc, wr_resetplayer, void(entity thiswep, entity actor))
885 actor.arc_overheat = 0;
886 actor.arc_cooldown = 0;
887 for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
889 .entity weaponentity = weaponentities[slot];
890 actor.(weaponentity).arc_BUTTON_ATCK_prev = false;
893 METHOD(Arc, wr_playerdeath, void(entity thiswep, entity actor, .entity weaponentity))
895 actor.arc_overheat = 0;
896 actor.arc_cooldown = 0;
897 actor.(weaponentity).arc_BUTTON_ATCK_prev = false;
901 bool autocvar_cl_arcbeam_teamcolor = true;
903 METHOD(Arc, wr_impacteffect, void(entity thiswep, entity actor))
905 if(w_deathtype & HITTYPE_SECONDARY)
908 org2 = w_org + w_backoff * 6;
909 pointparticles(EFFECT_ARC_BOLT_EXPLODE, org2, w_backoff * 1000, 1);
910 if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
914 void Draw_ArcBeam_callback(vector start, vector hit, vector end)
916 entity beam = Draw_ArcBeam_callback_entity;
917 vector transformed_view_org;
918 transformed_view_org = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
920 // Thickdir shall be perpendicular to the beam and to the view-to-beam direction (WEAPONTODO: WHY)
921 // WEAPONTODO: Wouldn't it be better to be perpendicular to the beam and to the view FORWARD direction?
922 vector thickdir = normalize(cross(normalize(start - hit), transformed_view_org - start));
928 if(trace_fraction != 1)
930 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
931 hitorigin = start + (Draw_ArcBeam_callback_new_dir * Draw_ArcBeam_callback_segmentdist * trace_fraction);
932 hitorigin = WarpZone_TransformOrigin(WarpZone_trace_transform, hitorigin);
942 // decide upon thickness
943 float thickness = beam.beam_thickness;
945 // draw primary beam render
946 vector top = hitorigin + (thickdir * thickness);
947 vector bottom = hitorigin - (thickdir * thickness);
949 vector last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
950 vector last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
952 R_BeginPolygon(beam.beam_image, DRAWFLAG_NORMAL); // DRAWFLAG_ADDITIVE
955 '0 0.5 0' + ('0 0.5 0' * (thickness / beam.beam_thickness)),
961 '0 0.5 0' + ('0 0.5 0' * (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
967 '0 0.5 0' * (1 - (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
973 '0 0.5 0' * (1 - (thickness / beam.beam_thickness)),
979 // draw trailing particles
981 // - Don't use spammy particle counts here, use a FEW small particles around the beam
982 // - We're not using WarpZone_TrailParticles here because we will handle warpzones ourselves.
983 if(beam.beam_traileffect)
985 trailparticles(beam, beam.beam_traileffect, start, hitorigin);
988 // set up for the next
989 Draw_ArcBeam_callback_last_thickness = thickness;
990 Draw_ArcBeam_callback_last_top = WarpZone_UnTransformOrigin(WarpZone_trace_transform, top);
991 Draw_ArcBeam_callback_last_bottom = WarpZone_UnTransformOrigin(WarpZone_trace_transform, bottom);
997 for (e = NULL; (e = findfloat(e, beam_usevieworigin, 1)); ) {
998 e.beam_initialized = false;
1000 for (e = NULL; (e = findfloat(e, beam_usevieworigin, 2)); ) {
1001 e.beam_initialized = false;
1005 void Draw_ArcBeam(entity this)
1007 float dt = time - this.move_time;
1008 this.move_time = time;
1009 if(dt <= 0) { return; }
1011 if(!this.beam_usevieworigin)
1013 InterpolateOrigin_Do(this);
1016 // origin = beam starting origin
1017 // v_angle = wanted/aim direction
1018 // angles = current direction of beam
1021 vector wantdir; //= view_forward;
1022 vector beamdir; //= this.beam_dir;
1025 if(this.beam_usevieworigin)
1028 // Currently we have to replicate nearly the same method of figuring
1029 // out the shotdir that the server does... Ideally in the future we
1030 // should be able to acquire this from a generalized function built
1031 // into a weapon system for client code.
1033 // find where we are aiming
1034 makevectors(warpzone_save_view_angles);
1035 vector forward = v_forward;
1036 vector right = v_right;
1039 // decide upon start position
1040 if(this.beam_usevieworigin == 2)
1041 { start_pos = warpzone_save_view_origin; }
1043 { start_pos = this.origin; }
1045 // trace forward with an estimation
1048 start_pos + forward * this.beam_range,
1053 // untransform in case our trace went through a warpzone
1054 vector end_pos = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
1056 // un-adjust trueaim if shotend is too close
1057 if(vdist(end_pos - start_pos, <, g_trueaim_minrange))
1058 end_pos = start_pos + (forward * g_trueaim_minrange);
1060 // move shot origin to the actual gun muzzle origin
1061 vector origin_offset =
1062 right * -this.beam_shotorigin.y
1063 + up * this.beam_shotorigin.z;
1065 start_pos = start_pos + origin_offset;
1067 // Move it also forward, but only as far as possible without hitting anything. Don't poke into walls!
1068 traceline(start_pos, start_pos + forward * this.beam_shotorigin.x, MOVE_NORMAL, this);
1069 start_pos = trace_endpos;
1071 // calculate the aim direction now
1072 wantdir = normalize(end_pos - start_pos);
1074 if(!this.beam_initialized)
1076 this.beam_dir = wantdir;
1077 this.beam_initialized = true;
1080 if(this.beam_dir != wantdir)
1082 // calculate how much we're going to move the end of the beam to the want position
1083 // WEAPONTODO (server and client):
1084 // blendfactor never actually becomes 0 in this situation, which is a problem
1085 // regarding precision... this means that this.beam_dir and w_shotdir approach
1086 // eachother, however they never actually become the same value with this method.
1087 // Perhaps we should do some form of rounding/snapping?
1088 float angle = vlen(wantdir - this.beam_dir) * RAD2DEG;
1089 if(angle && (angle > this.beam_maxangle))
1091 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
1092 float blendfactor = bound(
1094 (1 - (this.beam_returnspeed * frametime)),
1095 min(this.beam_maxangle / angle, 1)
1097 this.beam_dir = normalize((wantdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
1101 // the radius is not too far yet, no worries :D
1102 float blendfactor = bound(
1104 (1 - (this.beam_returnspeed * frametime)),
1107 this.beam_dir = normalize((wantdir * (1 - blendfactor)) + (this.beam_dir * blendfactor));
1110 // calculate how many segments are needed
1111 float max_allowed_segments;
1113 if(this.beam_distancepersegment)
1115 max_allowed_segments = min(
1117 1 + (vlen(wantdir / this.beam_distancepersegment))
1120 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
1122 if(this.beam_degreespersegment)
1132 this.beam_degreespersegment
1134 max_allowed_segments
1137 else { segments = 1; }
1139 else { segments = 1; }
1141 // set the beam direction which the rest of the code will refer to
1142 beamdir = this.beam_dir;
1144 // finally, set this.angles to the proper direction so that muzzle attachment points in proper direction
1145 this.angles = fixedvectoangles2(forward, up); // TODO(Samual): is this == warpzone_save_view_angles?
1149 // set the values from the provided info from the networked entity
1150 start_pos = this.origin;
1151 wantdir = this.v_angle;
1152 beamdir = this.angles;
1154 if(beamdir != wantdir)
1156 float angle = vlen(wantdir - beamdir) * RAD2DEG;
1158 // calculate how many segments are needed
1159 float max_allowed_segments;
1161 if(this.beam_distancepersegment)
1163 max_allowed_segments = min(
1165 1 + (vlen(wantdir / this.beam_distancepersegment))
1168 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
1170 if(this.beam_degreespersegment)
1180 this.beam_degreespersegment
1182 max_allowed_segments
1185 else { segments = 1; }
1187 else { segments = 1; }
1190 setorigin(this, start_pos);
1191 this.beam_muzzleentity.angles_z = random() * 360; // WEAPONTODO: use avelocity instead?
1193 vector beam_endpos = (start_pos + (beamdir * this.beam_range));
1194 vector beam_controlpoint = start_pos + wantdir * (this.beam_range * (1 - this.beam_tightness));
1196 Draw_ArcBeam_callback_entity = this;
1197 Draw_ArcBeam_callback_last_thickness = 0;
1198 Draw_ArcBeam_callback_last_top = start_pos;
1199 Draw_ArcBeam_callback_last_bottom = start_pos;
1201 vector last_origin = start_pos;
1202 vector original_start_pos = start_pos;
1205 for(i = 1; i <= segments; ++i)
1207 // WEAPONTODO (client):
1208 // In order to do nice fading and pointing on the starting segment, we must always
1209 // have that drawn as a separate triangle... However, that is difficult to do when
1210 // keeping in mind the above problems and also optimizing the amount of segments
1211 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
1213 vector new_origin = bezier_quadratic_getpoint(
1219 WarpZone_TraceBox_ThroughZone(
1227 Draw_ArcBeam_callback
1230 // Do all the transforms for warpzones right now, as we already "are" in the post-trace
1231 // system (if we hit a player, that's always BEHIND the last passed wz).
1232 last_origin = trace_endpos;
1233 start_pos = WarpZone_TransformOrigin(WarpZone_trace_transform, start_pos);
1234 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
1235 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
1236 beamdir = WarpZone_TransformVelocity(WarpZone_trace_transform, beamdir);
1237 Draw_ArcBeam_callback_last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
1238 Draw_ArcBeam_callback_last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
1240 if(trace_fraction < 1) { break; }
1243 // visual effects for startpoint and endpoint
1244 if(this.beam_hiteffect)
1246 // FIXME we really should do this on the server so it actually
1247 // matches gameplay. What this client side stuff is doing is no
1248 // more than guesswork.
1249 if((trace_ent || trace_fraction < 1) && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
1251 this.beam_hiteffect,
1257 if(this.beam_hitlight[0])
1261 this.beam_hitlight[0],
1263 this.beam_hitlight[1],
1264 this.beam_hitlight[2],
1265 this.beam_hitlight[3]
1269 if(this.beam_muzzleeffect)
1272 this.beam_muzzleeffect,
1273 original_start_pos + wantdir * 20,
1278 if(this.beam_muzzlelight[0])
1281 original_start_pos + wantdir * 20,
1282 this.beam_muzzlelight[0],
1284 this.beam_muzzlelight[1],
1285 this.beam_muzzlelight[2],
1286 this.beam_muzzlelight[3]
1292 Draw_ArcBeam_callback_entity = NULL;
1293 Draw_ArcBeam_callback_last_thickness = 0;
1294 Draw_ArcBeam_callback_last_top = '0 0 0';
1295 Draw_ArcBeam_callback_last_bottom = '0 0 0';
1298 void Remove_ArcBeam(entity this)
1300 delete(this.beam_muzzleentity);
1301 sound(this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
1304 NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
1306 int sf = ReadByte();
1307 int slot = ReadByte();
1312 int gunalign = W_GunAlign(viewmodels[slot], STAT(GUNALIGN)) - 1;
1314 this.beam_shotorigin = arc_shotorigin[gunalign];
1316 // set other main attributes of the beam
1317 this.draw = Draw_ArcBeam;
1318 IL_PUSH(g_drawables, this);
1319 this.entremove = Remove_ArcBeam;
1320 this.move_time = time;
1321 loopsound(this, CH_SHOTS_SINGLE, SND(ARC_LOOP), VOL_BASE, ATTEN_NORM);
1325 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT;
1326 flash.drawmask = MASK_NORMAL;
1327 flash.solid = SOLID_NOT;
1328 flash.avelocity_z = 5000;
1329 setattachment(flash, this, "");
1330 setorigin(flash, '0 0 0');
1332 this.beam_muzzleentity = flash;
1336 flash = this.beam_muzzleentity;
1339 if(sf & ARC_SF_SETTINGS) // settings information
1341 this.beam_degreespersegment = ReadShort();
1342 this.beam_distancepersegment = ReadShort();
1343 this.beam_maxangle = ReadShort();
1344 this.beam_range = ReadCoord();
1345 this.beam_returnspeed = ReadShort();
1346 this.beam_tightness = (ReadByte() / 10);
1350 if(autocvar_chase_active)
1351 { this.beam_usevieworigin = 1; }
1352 else // use view origin
1353 { this.beam_usevieworigin = 2; }
1357 this.beam_usevieworigin = 0;
1360 this.sv_entnum = ReadByte();
1363 if(!this.beam_usevieworigin)
1365 // this.iflags = IFLAG_ORIGIN | IFLAG_ANGLES | IFLAG_V_ANGLE; // why doesn't this work?
1366 this.iflags = IFLAG_ORIGIN;
1368 InterpolateOrigin_Undo(this);
1371 if(sf & ARC_SF_START) // starting location
1373 this.origin_x = ReadCoord();
1374 this.origin_y = ReadCoord();
1375 this.origin_z = ReadCoord();
1377 else if(this.beam_usevieworigin) // infer the location from player location
1379 if(this.beam_usevieworigin == 2)
1382 this.origin = view_origin;
1386 // use player origin so that third person display still works
1387 this.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * STAT(VIEWHEIGHT));
1391 setorigin(this, this.origin);
1393 if(sf & ARC_SF_WANTDIR) // want/aim direction
1395 this.v_angle_x = ReadCoord();
1396 this.v_angle_y = ReadCoord();
1397 this.v_angle_z = ReadCoord();
1400 if(sf & ARC_SF_BEAMDIR) // beam direction
1402 this.angles_x = ReadCoord();
1403 this.angles_y = ReadCoord();
1404 this.angles_z = ReadCoord();
1407 if(sf & ARC_SF_BEAMTYPE) // beam type
1409 this.beam_type = ReadByte();
1411 vector beamcolor = ((autocvar_cl_arcbeam_teamcolor) ? colormapPaletteColor(entcs_GetClientColors(this.sv_entnum - 1) & 0x0F, true) : '1 1 1');
1412 switch(this.beam_type)
1416 this.beam_color = beamcolor;
1417 this.beam_alpha = 0.5;
1418 this.beam_thickness = 8;
1419 this.beam_traileffect = (EFFECT_ARC_BEAM);
1420 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1421 this.beam_hitlight[0] = 0;
1422 this.beam_hitlight[1] = 1;
1423 this.beam_hitlight[2] = 1;
1424 this.beam_hitlight[3] = 1;
1425 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1426 this.beam_muzzlelight[0] = 0;
1427 this.beam_muzzlelight[1] = 1;
1428 this.beam_muzzlelight[2] = 1;
1429 this.beam_muzzlelight[3] = 1;
1430 if(this.beam_muzzleeffect)
1432 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1433 flash.alpha = this.beam_alpha;
1434 flash.colormod = this.beam_color;
1439 case ARC_BT_WALL: // grenadelauncher_muzzleflash healray_muzzleflash
1441 this.beam_color = beamcolor;
1442 this.beam_alpha = 0.5;
1443 this.beam_thickness = 8;
1444 this.beam_traileffect = (EFFECT_ARC_BEAM);
1445 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
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_GRENADE_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_HEAL);
1471 this.beam_hiteffect = (EFFECT_ARC_BEAM_HEAL_IMPACT);
1472 this.beam_hitlight[0] = 0;
1473 this.beam_hitlight[1] = 1;
1474 this.beam_hitlight[2] = 1;
1475 this.beam_hitlight[3] = 1;
1476 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1477 this.beam_muzzlelight[0] = 0;
1478 this.beam_muzzlelight[1] = 1;
1479 this.beam_muzzlelight[2] = 1;
1480 this.beam_muzzlelight[3] = 1;
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;
1493 this.beam_color = beamcolor;
1494 this.beam_alpha = 0.5;
1495 this.beam_thickness = 8;
1496 this.beam_traileffect = (EFFECT_ARC_BEAM);
1497 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1498 this.beam_hitlight[0] = 20;
1499 this.beam_hitlight[1] = 1;
1500 this.beam_hitlight[2] = 0;
1501 this.beam_hitlight[3] = 0;
1502 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1503 this.beam_muzzlelight[0] = 50;
1504 this.beam_muzzlelight[1] = 1;
1505 this.beam_muzzlelight[2] = 0;
1506 this.beam_muzzlelight[3] = 0;
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_MISS:
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_WALL:
1545 this.beam_color = beamcolor;
1546 this.beam_alpha = 0.5;
1547 this.beam_thickness = 14;
1548 this.beam_traileffect = (EFFECT_ARC_BEAM);
1549 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
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_HEAL:
1571 this.beam_color = beamcolor;
1572 this.beam_alpha = 0.5;
1573 this.beam_thickness = 14;
1574 this.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
1575 this.beam_hiteffect = (EFFECT_ARC_BEAM_HEAL_IMPACT2);
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;
1595 case ARC_BT_BURST_HIT:
1597 this.beam_color = beamcolor;
1598 this.beam_alpha = 0.5;
1599 this.beam_thickness = 14;
1600 this.beam_traileffect = (EFFECT_ARC_BEAM);
1601 this.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1602 this.beam_hitlight[0] = 0;
1603 this.beam_hitlight[1] = 1;
1604 this.beam_hitlight[2] = 1;
1605 this.beam_hitlight[3] = 1;
1606 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1607 this.beam_muzzlelight[0] = 0;
1608 this.beam_muzzlelight[1] = 1;
1609 this.beam_muzzlelight[2] = 1;
1610 this.beam_muzzlelight[3] = 1;
1611 this.beam_image = "particles/lgbeam";
1612 if(this.beam_muzzleeffect)
1614 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1615 flash.alpha = this.beam_alpha;
1616 flash.colormod = this.beam_color;
1622 // shouldn't be possible, but lets make it colorful if it does :D
1625 this.beam_color = randomvec();
1626 this.beam_alpha = 1;
1627 this.beam_thickness = 8;
1628 this.beam_traileffect = NULL;
1629 this.beam_hiteffect = NULL;
1630 this.beam_hitlight[0] = 0;
1631 this.beam_hitlight[1] = 1;
1632 this.beam_hitlight[2] = 1;
1633 this.beam_hitlight[3] = 1;
1634 this.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1635 this.beam_muzzlelight[0] = 0;
1636 this.beam_muzzlelight[1] = 1;
1637 this.beam_muzzlelight[2] = 1;
1638 this.beam_muzzlelight[3] = 1;
1639 this.beam_image = "particles/lgbeam";
1640 if(this.beam_muzzleeffect)
1642 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1643 flash.alpha = this.beam_alpha;
1644 flash.colormod = this.beam_color;
1652 if(!this.beam_usevieworigin)
1654 InterpolateOrigin_Note(this);