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, beam_ammo, float, NONE) \
21 P(class, prefix, beam_animtime, float, NONE) \
22 P(class, prefix, beam_botaimlifetime, float, NONE) \
23 P(class, prefix, beam_botaimspeed, float, NONE) \
24 P(class, prefix, beam_damage, float, NONE) \
25 P(class, prefix, beam_degreespersegment, float, NONE) \
26 P(class, prefix, beam_distancepersegment, float, NONE) \
27 P(class, prefix, beam_falloff_halflifedist, float, NONE) \
28 P(class, prefix, beam_falloff_maxdist, float, NONE) \
29 P(class, prefix, beam_falloff_mindist, float, NONE) \
30 P(class, prefix, beam_force, float, NONE) \
31 P(class, prefix, beam_healing_amax, float, NONE) \
32 P(class, prefix, beam_healing_aps, float, NONE) \
33 P(class, prefix, beam_healing_hmax, float, NONE) \
34 P(class, prefix, beam_healing_hps, float, NONE) \
35 P(class, prefix, beam_heat, float, NONE) /* heat increase per second (primary) */ \
36 P(class, prefix, beam_maxangle, float, NONE) \
37 P(class, prefix, beam_nonplayerdamage, float, NONE) \
38 P(class, prefix, beam_range, float, NONE) \
39 P(class, prefix, beam_refire, float, NONE) \
40 P(class, prefix, beam_returnspeed, float, NONE) \
41 P(class, prefix, beam_tightness, float, NONE) \
42 P(class, prefix, burst_ammo, float, NONE) \
43 P(class, prefix, burst_damage, float, NONE) \
44 P(class, prefix, burst_healing_aps, float, NONE) \
45 P(class, prefix, burst_healing_hps, float, NONE) \
46 P(class, prefix, burst_heat, float, NONE) /* heat increase per second (secondary) */ \
47 P(class, prefix, cooldown, float, NONE) /* heat decrease per second when resting */ \
48 P(class, prefix, overheat_max, float, NONE) /* maximum heat before jamming */ \
49 P(class, prefix, overheat_min, float, NONE) /* minimum heat to wait for cooldown */ \
50 P(class, prefix, switchdelay_drop, float, NONE) \
51 P(class, prefix, switchdelay_raise, float, NONE) \
52 P(class, prefix, weaponreplace, string, NONE) \
53 P(class, prefix, weaponstartoverride, float, NONE) \
54 P(class, prefix, weaponstart, float, NONE) \
55 P(class, prefix, weaponthrowable, float, NONE) \
61 REGISTER_WEAPON(ARC, arc, NEW(Arc));
65 const float ARC_MAX_SEGMENTS = 20;
66 vector arc_shotorigin[4];
72 const int ARC_BT_MISS = 0x00;
73 const int ARC_BT_WALL = 0x01;
74 const int ARC_BT_HEAL = 0x02;
75 const int ARC_BT_HIT = 0x03;
76 const int ARC_BT_BURST_MISS = 0x10;
77 const int ARC_BT_BURST_WALL = 0x11;
78 const int ARC_BT_BURST_HEAL = 0x12;
79 const int ARC_BT_BURST_HIT = 0x13;
80 const int ARC_BT_BURSTMASK = 0x10;
82 const int ARC_SF_SETTINGS = BIT(0);
83 const int ARC_SF_START = BIT(1);
84 const int ARC_SF_WANTDIR = BIT(2);
85 const int ARC_SF_BEAMDIR = BIT(3);
86 const int ARC_SF_BEAMTYPE = BIT(4);
87 const int ARC_SF_LOCALMASK = ARC_SF_START | ARC_SF_WANTDIR | ARC_SF_BEAMDIR;
91 .bool arc_BUTTON_ATCK_prev; // for better animation control
93 .float beam_initialized;
95 .float beam_teleporttime;
96 .float beam_heat; // (beam) amount of heat produced
97 .float arc_overheat; // (dropped arc/player) time during which it's too hot
98 .float arc_cooldown; // (dropped arc/player) cooling speed
99 .float arc_heat_percent = _STAT(ARC_HEAT);
100 .float arc_smoke_sound;
106 .float beam_thickness;
107 .entity beam_traileffect;
108 .entity beam_hiteffect;
109 .float beam_hitlight[4]; // 0: radius, 123: rgb
110 .entity beam_muzzleeffect;
111 .float beam_muzzlelight[4]; // 0: radius, 123: rgb
114 .entity beam_muzzleentity;
116 .float beam_degreespersegment;
117 .float beam_distancepersegment;
118 .float beam_usevieworigin;
119 .float beam_initialized;
120 .float beam_maxangle;
122 .float beam_returnspeed;
123 .float beam_tightness;
124 .vector beam_shotorigin;
126 entity Draw_ArcBeam_callback_entity;
127 float Draw_ArcBeam_callback_last_thickness;
128 vector Draw_ArcBeam_callback_last_top; // NOTE: in same coordinate system as player.
129 vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as player.
132 #ifdef IMPLEMENTATION
134 spawnfunc(weapon_arc) { weapon_defaultspawnfunc(this, WEP_ARC); }
136 bool W_Arc_Beam_Send(entity this, entity to, int sf)
138 WriteHeader(MSG_ENTITY, ENT_CLIENT_ARC_BEAM);
140 // Truncate information when this beam is displayed to the owner client
141 // - The owner client has no use for beam start position or directions,
142 // it always figures this information out for itself with csqc code.
143 // - Spectating the owner also truncates this information.
144 float drawlocal = ((to == self.owner) || ((to.enemy == self.owner) && IS_SPEC(to)));
145 if(drawlocal) { sf &= ~ARC_SF_LOCALMASK; }
147 WriteByte(MSG_ENTITY, sf);
149 if(sf & ARC_SF_SETTINGS) // settings information
151 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_degreespersegment));
152 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_distancepersegment));
153 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_maxangle));
154 WriteCoord(MSG_ENTITY, WEP_CVAR(arc, beam_range));
155 WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_returnspeed));
156 WriteByte(MSG_ENTITY, WEP_CVAR(arc, beam_tightness) * 10);
158 WriteByte(MSG_ENTITY, drawlocal);
160 if(sf & ARC_SF_START) // starting location
162 WriteCoord(MSG_ENTITY, self.beam_start.x);
163 WriteCoord(MSG_ENTITY, self.beam_start.y);
164 WriteCoord(MSG_ENTITY, self.beam_start.z);
166 if(sf & ARC_SF_WANTDIR) // want/aim direction
168 WriteCoord(MSG_ENTITY, self.beam_wantdir.x);
169 WriteCoord(MSG_ENTITY, self.beam_wantdir.y);
170 WriteCoord(MSG_ENTITY, self.beam_wantdir.z);
172 if(sf & ARC_SF_BEAMDIR) // beam direction
174 WriteCoord(MSG_ENTITY, self.beam_dir.x);
175 WriteCoord(MSG_ENTITY, self.beam_dir.y);
176 WriteCoord(MSG_ENTITY, self.beam_dir.z);
178 if(sf & ARC_SF_BEAMTYPE) // beam type
180 WriteByte(MSG_ENTITY, self.beam_type);
186 void Reset_ArcBeam(entity player, vector forward)
188 if (!player.arc_beam) {
191 player.arc_beam.beam_dir = forward;
192 player.arc_beam.beam_teleporttime = time;
195 float Arc_GetHeat_Percent(entity player)
197 if ( WEP_CVAR(arc, overheat_max) <= 0 || WEP_CVAR(arc, overheat_max) <= 0 )
199 player.arc_overheat = 0;
203 if ( player.arc_beam )
204 return player.arc_beam.beam_heat/WEP_CVAR(arc, overheat_max);
206 if ( player.arc_overheat > time )
208 return (player.arc_overheat-time) / WEP_CVAR(arc, overheat_max)
209 * player.arc_cooldown;
214 void Arc_Player_SetHeat(entity player)
216 player.arc_heat_percent = Arc_GetHeat_Percent(player);
217 //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
220 void W_Arc_Beam_Think()
222 if(self != self.owner.arc_beam)
230 if( self.owner.BUTTON_ATCK2 || self.beam_bursting)
232 if(!self.beam_bursting)
233 self.beam_bursting = true;
234 burst = ARC_BT_BURSTMASK;
238 !IS_PLAYER(self.owner)
240 (self.owner.WEP_AMMO(ARC) <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
242 self.owner.deadflag != DEAD_NO
244 (!self.owner.BUTTON_ATCK && !burst )
250 (WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max))
253 if ( WEP_CVAR(arc, cooldown) > 0 )
255 float cooldown_speed = 0;
256 if ( self.beam_heat > WEP_CVAR(arc, overheat_min) && WEP_CVAR(arc, cooldown) > 0 )
258 cooldown_speed = WEP_CVAR(arc, cooldown);
262 cooldown_speed = self.beam_heat / WEP_CVAR(arc, beam_refire);
265 if ( cooldown_speed )
267 self.owner.arc_overheat = time + self.beam_heat / cooldown_speed;
268 self.owner.arc_cooldown = cooldown_speed;
271 if ( WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max) )
273 Send_Effect(EFFECT_ARC_OVERHEAT,
274 self.beam_start, self.beam_wantdir, 1 );
275 sound(self, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
279 if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
282 if(!w.wr_checkammo1(w) && !w.wr_checkammo2(w))
283 if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
285 // note: this doesn't force the switch
286 W_SwitchToOtherWeapon(self);
294 float coefficient = frametime;
295 if(!(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
299 { rootammo = WEP_CVAR(arc, burst_ammo); }
301 { rootammo = WEP_CVAR(arc, beam_ammo); }
305 coefficient = min(coefficient, self.owner.WEP_AMMO(ARC) / rootammo);
306 self.owner.WEP_AMMO(ARC) = max(0, self.owner.WEP_AMMO(ARC) - (rootammo * frametime));
309 float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat);
310 self.beam_heat = min( WEP_CVAR(arc, overheat_max), self.beam_heat + heat_speed*frametime );
312 makevectors(self.owner.v_angle);
320 WEP_CVAR(arc, beam_damage) * coefficient,
321 WEP_CVAR(arc, beam_range)
324 // After teleport, "lock" the beam until the teleport is confirmed.
325 if (time < self.beam_teleporttime + ANTILAG_LATENCY(self.owner)) {
326 w_shotdir = self.beam_dir;
329 // network information: shot origin and want/aim direction
330 if(self.beam_start != w_shotorg)
332 self.SendFlags |= ARC_SF_START;
333 self.beam_start = w_shotorg;
335 if(self.beam_wantdir != w_shotdir)
337 self.SendFlags |= ARC_SF_WANTDIR;
338 self.beam_wantdir = w_shotdir;
341 if(!self.beam_initialized)
343 self.beam_dir = w_shotdir;
344 self.beam_initialized = true;
347 // WEAPONTODO: Detect player velocity so that the beam curves when moving too
348 // idea: blend together self.beam_dir with the inverted direction the player is moving in
349 // might have to make some special accomodation so that it only uses view_right and view_up
351 // note that if we do this, it'll always be corrected to a maximum angle by beam_maxangle handling
354 if(self.beam_dir != w_shotdir)
356 // calculate how much we're going to move the end of the beam to the want position
357 // WEAPONTODO (server and client):
358 // blendfactor never actually becomes 0 in this situation, which is a problem
359 // regarding precision... this means that self.beam_dir and w_shotdir approach
360 // eachother, however they never actually become the same value with this method.
361 // Perhaps we should do some form of rounding/snapping?
362 float angle = vlen(w_shotdir - self.beam_dir) * RAD2DEG;
363 if(angle && (angle > WEP_CVAR(arc, beam_maxangle)))
365 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
366 float blendfactor = bound(
368 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
369 min(WEP_CVAR(arc, beam_maxangle) / angle, 1)
371 self.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
375 // the radius is not too far yet, no worries :D
376 float blendfactor = bound(
378 (1 - (WEP_CVAR(arc, beam_returnspeed) * frametime)),
381 self.beam_dir = normalize((w_shotdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
384 // network information: beam direction
385 self.SendFlags |= ARC_SF_BEAMDIR;
387 // calculate how many segments are needed
388 float max_allowed_segments;
390 if(WEP_CVAR(arc, beam_distancepersegment))
392 max_allowed_segments = min(
394 1 + (vlen(w_shotdir / WEP_CVAR(arc, beam_distancepersegment)))
397 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
399 if(WEP_CVAR(arc, beam_degreespersegment))
406 WEP_CVAR(arc, beam_maxangle)
409 WEP_CVAR(arc, beam_degreespersegment)
414 else { segments = 1; }
416 else { segments = 1; }
418 vector beam_endpos = (w_shotorg + (self.beam_dir * WEP_CVAR(arc, beam_range)));
419 vector beam_controlpoint = w_shotorg + w_shotdir * (WEP_CVAR(arc, beam_range) * (1 - WEP_CVAR(arc, beam_tightness)));
422 float new_beam_type = 0;
423 vector last_origin = w_shotorg;
424 for(i = 1; i <= segments; ++i)
426 // WEAPONTODO (client):
427 // In order to do nice fading and pointing on the starting segment, we must always
428 // have that drawn as a separate triangle... However, that is difficult to do when
429 // keeping in mind the above problems and also optimizing the amount of segments
430 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
432 vector new_origin = bezier_quadratic_getpoint(
437 vector new_dir = normalize(new_origin - last_origin);
439 WarpZone_traceline_antilag(
445 ANTILAG_LATENCY(self.owner)
448 // Do all the transforms for warpzones right now, as we already
449 // "are" in the post-trace system (if we hit a player, that's
450 // always BEHIND the last passed wz).
451 last_origin = trace_endpos;
452 w_shotorg = WarpZone_TransformOrigin(WarpZone_trace_transform, w_shotorg);
453 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
454 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
455 new_dir = WarpZone_TransformVelocity(WarpZone_trace_transform, new_dir);
460 trace_ent.classname == "body"
462 IS_MONSTER(trace_ent)
465 if(trace_ent && trace_ent.takedamage && (is_player || WEP_CVAR(arc, beam_nonplayerdamage)))
467 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
468 // NO. trace_endpos should be just fine. If not,
469 // that's an engine bug that needs proper debugging.
470 vector hitorigin = trace_endpos;
472 float falloff = ExponentialFalloff(
473 WEP_CVAR(arc, beam_falloff_mindist),
474 WEP_CVAR(arc, beam_falloff_maxdist),
475 WEP_CVAR(arc, beam_falloff_halflifedist),
476 vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, hitorigin) - w_shotorg)
479 if(is_player && SAME_TEAM(self.owner, trace_ent))
481 float roothealth, rootarmor;
484 roothealth = WEP_CVAR(arc, burst_healing_hps);
485 rootarmor = WEP_CVAR(arc, burst_healing_aps);
489 roothealth = WEP_CVAR(arc, beam_healing_hps);
490 rootarmor = WEP_CVAR(arc, beam_healing_aps);
493 if(trace_ent.health <= WEP_CVAR(arc, beam_healing_hmax) && roothealth)
495 trace_ent.health = min(
496 trace_ent.health + (roothealth * coefficient),
497 WEP_CVAR(arc, beam_healing_hmax)
500 if(trace_ent.armorvalue <= WEP_CVAR(arc, beam_healing_amax) && rootarmor)
502 trace_ent.armorvalue = min(
503 trace_ent.armorvalue + (rootarmor * coefficient),
504 WEP_CVAR(arc, beam_healing_amax)
508 // stop rot, set visual effect
509 if(roothealth || rootarmor)
511 trace_ent.pauserothealth_finished = max(
512 trace_ent.pauserothealth_finished,
513 time + autocvar_g_balance_pause_health_rot
515 trace_ent.pauserotarmor_finished = max(
516 trace_ent.pauserotarmor_finished,
517 time + autocvar_g_balance_pause_armor_rot
519 new_beam_type = ARC_BT_HEAL;
528 { rootdamage = WEP_CVAR(arc, burst_damage); }
530 { rootdamage = WEP_CVAR(arc, beam_damage); }
533 { rootdamage = WEP_CVAR(arc, beam_nonplayerdamage); }
535 if(accuracy_isgooddamage(self.owner, trace_ent))
541 rootdamage * coefficient * falloff
549 rootdamage * coefficient * falloff,
552 WEP_CVAR(arc, beam_force) * new_dir * coefficient * falloff
555 new_beam_type = ARC_BT_HIT;
559 else if(trace_fraction != 1)
561 // we collided with geometry
562 new_beam_type = ARC_BT_WALL;
567 // te_explosion(trace_endpos);
569 // if we're bursting, use burst visual effects
570 new_beam_type |= burst;
572 // network information: beam type
573 if(new_beam_type != self.beam_type)
575 self.SendFlags |= ARC_SF_BEAMTYPE;
576 self.beam_type = new_beam_type;
579 self.owner.beam_prev = time;
580 self.nextthink = time;
583 void W_Arc_Beam(float burst)
586 // only play fire sound if 1 sec has passed since player let go the fire button
587 if(time - self.beam_prev > 1)
588 sound(self, CH_WEAPON_A, SND_ARC_FIRE, VOL_BASE, ATTN_NORM);
590 entity beam = self.arc_beam = new(W_Arc_Beam);
591 beam.solid = SOLID_NOT;
592 beam.think = W_Arc_Beam_Think;
594 beam.movetype = MOVETYPE_NONE;
595 beam.bot_dodge = true;
596 beam.bot_dodgerating = WEP_CVAR(arc, beam_damage);
597 beam.beam_bursting = burst;
598 Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
600 WITH(entity, self, beam, beam.think());
605 makevectors(self.v_angle);
606 W_SetupShot_Range(self,true,0,"",0,0,0);
608 vector smoke_origin = w_shotorg + self.velocity*frametime;
609 if ( self.arc_overheat > time )
611 if ( random() < self.arc_heat_percent )
612 Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
613 if ( self.BUTTON_ATCK || self.BUTTON_ATCK2 )
615 Send_Effect(EFFECT_ARC_OVERHEAT_FIRE, smoke_origin, w_shotdir, 1 );
616 if ( !self.arc_smoke_sound )
618 self.arc_smoke_sound = 1;
619 sound(self, CH_SHOTS_SINGLE, SND_ARC_LOOP_OVERHEAT, VOL_BASE, ATTN_NORM);
623 else if ( self.arc_beam && WEP_CVAR(arc, overheat_max) > 0 &&
624 self.arc_beam.beam_heat > WEP_CVAR(arc, overheat_min) )
626 if ( random() < (self.arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) /
627 ( WEP_CVAR(arc, overheat_max)-WEP_CVAR(arc, overheat_min) ) )
628 Send_Effect(EFFECT_ARC_SMOKE, smoke_origin, '0 0 0', 1 );
631 if ( self.arc_smoke_sound && ( self.arc_overheat <= time ||
632 !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || self.switchweapon != WEP_ARC.m_id )
634 self.arc_smoke_sound = 0;
635 sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
639 METHOD(Arc, wr_aim, void(entity thiswep))
642 if(WEP_CVAR(arc, beam_botaimspeed))
644 self.BUTTON_ATCK = bot_aim(
645 WEP_CVAR(arc, beam_botaimspeed),
647 WEP_CVAR(arc, beam_botaimlifetime),
653 self.BUTTON_ATCK = bot_aim(
661 METHOD(Arc, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
663 Arc_Player_SetHeat(actor);
666 if (time >= actor.arc_overheat)
667 if ((fire & 1) || (fire & 2) || actor.arc_beam.beam_bursting)
670 if(actor.arc_BUTTON_ATCK_prev)
673 if(actor.animstate_startframe == actor.anim_shoot.x && actor.animstate_numframes == actor.anim_shoot.y)
674 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
677 weapon_thinkf(actor, weaponentity, WFRAME_DONTCHANGE, WEP_CVAR(arc, beam_animtime), w_ready);
680 if((!actor.arc_beam) || wasfreed(actor.arc_beam))
682 if(weapon_prepareattack(thiswep, actor, weaponentity, boolean(fire & 2), 0))
684 W_Arc_Beam(boolean(fire & 2));
686 if(!actor.arc_BUTTON_ATCK_prev)
688 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
689 actor.arc_BUTTON_ATCK_prev = true;
697 if(actor.arc_BUTTON_ATCK_prev)
699 sound(actor, CH_WEAPON_A, SND_ARC_STOP, VOL_BASE, ATTN_NORM);
700 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
701 int slot = weaponslot(weaponentity);
702 ATTACK_FINISHED(actor, slot) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
704 actor.arc_BUTTON_ATCK_prev = false;
708 if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_arc_secondary_refire))
711 actor.arc_count = autocvar_g_balance_arc_secondary_count;
712 weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_arc_secondary_animtime, w_arc_checkattack);
713 actor.arc_secondarytime = time + autocvar_g_balance_arc_secondary_refire2 * W_WeaponRateFactor();
717 METHOD(Arc, wr_init, void(entity thiswep))
719 if(!arc_shotorigin[0])
721 arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 1);
722 arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 2);
723 arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
724 arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
727 METHOD(Arc, wr_checkammo1, bool(entity thiswep))
730 return ((!WEP_CVAR(arc, beam_ammo)) || (self.WEP_AMMO(ARC) > 0));
732 METHOD(Arc, wr_checkammo2, bool(entity thiswep))
735 return WEP_CVAR(arc, overheat_max) > 0 &&
736 ((!WEP_CVAR(arc, burst_ammo)) || (self.WEP_AMMO(ARC) > 0));
738 METHOD(Arc, wr_killmessage, int(entity thiswep))
740 return WEAPON_ARC_MURDER;
742 METHOD(Arc, wr_drop, void(entity thiswep))
744 weapon_dropevent_item.arc_overheat = self.arc_overheat;
745 weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
746 self.arc_overheat = 0;
747 self.arc_cooldown = 0;
749 METHOD(Arc, wr_pickup, void(entity thiswep))
751 if ( !client_hasweapon(self, thiswep, false, false) &&
752 weapon_dropevent_item.arc_overheat > time )
754 self.arc_overheat = weapon_dropevent_item.arc_overheat;
755 self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
760 void Draw_ArcBeam_callback(vector start, vector hit, vector end)
762 entity beam = Draw_ArcBeam_callback_entity;
763 vector transformed_view_org;
764 transformed_view_org = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
766 // Thickdir shall be perpendicular to the beam and to the view-to-beam direction (WEAPONTODO: WHY)
767 // WEAPONTODO: Wouldn't it be better to be perpendicular to the beam and to the view FORWARD direction?
768 vector thickdir = normalize(cross(normalize(start - hit), transformed_view_org - start));
774 if(trace_fraction != 1)
776 // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
777 hitorigin = start + (Draw_ArcBeam_callback_new_dir * Draw_ArcBeam_callback_segmentdist * trace_fraction);
778 hitorigin = WarpZone_TransformOrigin(WarpZone_trace_transform, hitorigin);
788 // decide upon thickness
789 float thickness = beam.beam_thickness;
791 // draw primary beam render
792 vector top = hitorigin + (thickdir * thickness);
793 vector bottom = hitorigin - (thickdir * thickness);
795 vector last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
796 vector last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
798 R_BeginPolygon(beam.beam_image, DRAWFLAG_NORMAL); // DRAWFLAG_ADDITIVE
801 '0 0.5 0' + ('0 0.5 0' * (thickness / beam.beam_thickness)),
807 '0 0.5 0' + ('0 0.5 0' * (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
813 '0 0.5 0' * (1 - (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
819 '0 0.5 0' * (1 - (thickness / beam.beam_thickness)),
825 // draw trailing particles
827 // - Don't use spammy particle counts here, use a FEW small particles around the beam
828 // - We're not using WarpZone_TrailParticles here because we will handle warpzones ourselves.
829 if(beam.beam_traileffect)
831 trailparticles(beam, beam.beam_traileffect, start, hitorigin);
834 // set up for the next
835 Draw_ArcBeam_callback_last_thickness = thickness;
836 Draw_ArcBeam_callback_last_top = WarpZone_UnTransformOrigin(WarpZone_trace_transform, top);
837 Draw_ArcBeam_callback_last_bottom = WarpZone_UnTransformOrigin(WarpZone_trace_transform, bottom);
843 for (e = world; (e = findfloat(e, beam_usevieworigin, 1)); ) {
844 e.beam_initialized = false;
846 for (e = world; (e = findfloat(e, beam_usevieworigin, 2)); ) {
847 e.beam_initialized = false;
851 void Draw_ArcBeam(entity this)
853 float dt = time - self.move_time;
854 self.move_time = time;
855 if(dt <= 0) { return; }
857 if(!self.beam_usevieworigin)
859 InterpolateOrigin_Do(self);
862 // origin = beam starting origin
863 // v_angle = wanted/aim direction
864 // angles = current direction of beam
867 vector wantdir; //= view_forward;
868 vector beamdir; //= self.beam_dir;
871 if(self.beam_usevieworigin)
874 // Currently we have to replicate nearly the same method of figuring
875 // out the shotdir that the server does... Ideally in the future we
876 // should be able to acquire this from a generalized function built
877 // into a weapon system for client code.
879 // find where we are aiming
880 makevectors(warpzone_save_view_angles);
881 vector forward = v_forward;
882 vector right = v_right;
885 // decide upon start position
886 if(self.beam_usevieworigin == 2)
887 { start_pos = warpzone_save_view_origin; }
889 { start_pos = self.origin; }
891 // trace forward with an estimation
894 start_pos + forward * self.beam_range,
899 // untransform in case our trace went through a warpzone
900 vector end_pos = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
902 // un-adjust trueaim if shotend is too close
903 if(vlen(end_pos - start_pos) < g_trueaim_minrange)
904 end_pos = start_pos + (forward * g_trueaim_minrange);
906 // move shot origin to the actual gun muzzle origin
907 vector origin_offset =
908 right * -self.beam_shotorigin.y
909 + up * self.beam_shotorigin.z;
911 start_pos = start_pos + origin_offset;
913 // Move it also forward, but only as far as possible without hitting anything. Don't poke into walls!
914 traceline(start_pos, start_pos + forward * self.beam_shotorigin.x, MOVE_NORMAL, self);
915 start_pos = trace_endpos;
917 // calculate the aim direction now
918 wantdir = normalize(end_pos - start_pos);
920 if(!self.beam_initialized)
922 self.beam_dir = wantdir;
923 self.beam_initialized = true;
926 if(self.beam_dir != wantdir)
928 // calculate how much we're going to move the end of the beam to the want position
929 // WEAPONTODO (server and client):
930 // blendfactor never actually becomes 0 in this situation, which is a problem
931 // regarding precision... this means that self.beam_dir and w_shotdir approach
932 // eachother, however they never actually become the same value with this method.
933 // Perhaps we should do some form of rounding/snapping?
934 float angle = vlen(wantdir - self.beam_dir) * RAD2DEG;
935 if(angle && (angle > self.beam_maxangle))
937 // if the angle is greater than maxangle, force the blendfactor to make this the maximum factor
938 float blendfactor = bound(
940 (1 - (self.beam_returnspeed * frametime)),
941 min(self.beam_maxangle / angle, 1)
943 self.beam_dir = normalize((wantdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
947 // the radius is not too far yet, no worries :D
948 float blendfactor = bound(
950 (1 - (self.beam_returnspeed * frametime)),
953 self.beam_dir = normalize((wantdir * (1 - blendfactor)) + (self.beam_dir * blendfactor));
956 // calculate how many segments are needed
957 float max_allowed_segments;
959 if(self.beam_distancepersegment)
961 max_allowed_segments = min(
963 1 + (vlen(wantdir / self.beam_distancepersegment))
966 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
968 if(self.beam_degreespersegment)
978 self.beam_degreespersegment
983 else { segments = 1; }
985 else { segments = 1; }
987 // set the beam direction which the rest of the code will refer to
988 beamdir = self.beam_dir;
990 // finally, set self.angles to the proper direction so that muzzle attachment points in proper direction
991 self.angles = fixedvectoangles2(forward, up); // TODO(Samual): is this == warpzone_save_view_angles?
995 // set the values from the provided info from the networked entity
996 start_pos = self.origin;
997 wantdir = self.v_angle;
998 beamdir = self.angles;
1000 if(beamdir != wantdir)
1002 float angle = vlen(wantdir - beamdir) * RAD2DEG;
1004 // calculate how many segments are needed
1005 float max_allowed_segments;
1007 if(self.beam_distancepersegment)
1009 max_allowed_segments = min(
1011 1 + (vlen(wantdir / self.beam_distancepersegment))
1014 else { max_allowed_segments = ARC_MAX_SEGMENTS; }
1016 if(self.beam_degreespersegment)
1026 self.beam_degreespersegment
1028 max_allowed_segments
1031 else { segments = 1; }
1033 else { segments = 1; }
1036 setorigin(self, start_pos);
1037 self.beam_muzzleentity.angles_z = random() * 360; // WEAPONTODO: use avelocity instead?
1039 vector beam_endpos = (start_pos + (beamdir * self.beam_range));
1040 vector beam_controlpoint = start_pos + wantdir * (self.beam_range * (1 - self.beam_tightness));
1042 Draw_ArcBeam_callback_entity = self;
1043 Draw_ArcBeam_callback_last_thickness = 0;
1044 Draw_ArcBeam_callback_last_top = start_pos;
1045 Draw_ArcBeam_callback_last_bottom = start_pos;
1047 vector last_origin = start_pos;
1048 vector original_start_pos = start_pos;
1051 for(i = 1; i <= segments; ++i)
1053 // WEAPONTODO (client):
1054 // In order to do nice fading and pointing on the starting segment, we must always
1055 // have that drawn as a separate triangle... However, that is difficult to do when
1056 // keeping in mind the above problems and also optimizing the amount of segments
1057 // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
1059 vector new_origin = bezier_quadratic_getpoint(
1065 WarpZone_TraceBox_ThroughZone(
1073 Draw_ArcBeam_callback
1076 // Do all the transforms for warpzones right now, as we already "are" in the post-trace
1077 // system (if we hit a player, that's always BEHIND the last passed wz).
1078 last_origin = trace_endpos;
1079 start_pos = WarpZone_TransformOrigin(WarpZone_trace_transform, start_pos);
1080 beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
1081 beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
1082 beamdir = WarpZone_TransformVelocity(WarpZone_trace_transform, beamdir);
1083 Draw_ArcBeam_callback_last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
1084 Draw_ArcBeam_callback_last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
1086 if(trace_fraction < 1) { break; }
1089 // visual effects for startpoint and endpoint
1090 if(self.beam_hiteffect)
1092 // FIXME we really should do this on the server so it actually
1093 // matches gameplay. What this client side stuff is doing is no
1094 // more than guesswork.
1095 if((trace_ent || trace_fraction < 1) && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
1097 self.beam_hiteffect,
1103 if(self.beam_hitlight[0])
1107 self.beam_hitlight[0],
1109 self.beam_hitlight[1],
1110 self.beam_hitlight[2],
1111 self.beam_hitlight[3]
1115 if(self.beam_muzzleeffect)
1118 self.beam_muzzleeffect,
1119 original_start_pos + wantdir * 20,
1124 if(self.beam_muzzlelight[0])
1127 original_start_pos + wantdir * 20,
1128 self.beam_muzzlelight[0],
1130 self.beam_muzzlelight[1],
1131 self.beam_muzzlelight[2],
1132 self.beam_muzzlelight[3]
1138 Draw_ArcBeam_callback_entity = world;
1139 Draw_ArcBeam_callback_last_thickness = 0;
1140 Draw_ArcBeam_callback_last_top = '0 0 0';
1141 Draw_ArcBeam_callback_last_bottom = '0 0 0';
1144 void Remove_ArcBeam()
1146 remove(self.beam_muzzleentity);
1147 sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
1150 NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
1152 int sf = ReadByte();
1157 int gunalign = W_GetGunAlignment(world);
1159 self.beam_shotorigin = arc_shotorigin[gunalign];
1161 // set other main attributes of the beam
1162 self.draw = Draw_ArcBeam;
1163 self.entremove = Remove_ArcBeam;
1164 self.move_time = time;
1165 loopsound(self, CH_SHOTS_SINGLE, SND(ARC_LOOP), VOL_BASE, ATTEN_NORM);
1169 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT;
1170 flash.drawmask = MASK_NORMAL;
1171 flash.solid = SOLID_NOT;
1172 flash.avelocity_z = 5000;
1173 setattachment(flash, self, "");
1174 setorigin(flash, '0 0 0');
1176 self.beam_muzzleentity = flash;
1180 flash = self.beam_muzzleentity;
1183 if(sf & ARC_SF_SETTINGS) // settings information
1185 self.beam_degreespersegment = ReadShort();
1186 self.beam_distancepersegment = ReadShort();
1187 self.beam_maxangle = ReadShort();
1188 self.beam_range = ReadCoord();
1189 self.beam_returnspeed = ReadShort();
1190 self.beam_tightness = (ReadByte() / 10);
1194 if(autocvar_chase_active)
1195 { self.beam_usevieworigin = 1; }
1196 else // use view origin
1197 { self.beam_usevieworigin = 2; }
1201 self.beam_usevieworigin = 0;
1205 if(!self.beam_usevieworigin)
1207 // self.iflags = IFLAG_ORIGIN | IFLAG_ANGLES | IFLAG_V_ANGLE; // why doesn't this work?
1208 self.iflags = IFLAG_ORIGIN;
1210 InterpolateOrigin_Undo(self);
1213 if(sf & ARC_SF_START) // starting location
1215 self.origin_x = ReadCoord();
1216 self.origin_y = ReadCoord();
1217 self.origin_z = ReadCoord();
1219 else if(self.beam_usevieworigin) // infer the location from player location
1221 if(self.beam_usevieworigin == 2)
1224 self.origin = view_origin;
1228 // use player origin so that third person display still works
1229 self.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * STAT(VIEWHEIGHT));
1233 setorigin(self, self.origin);
1235 if(sf & ARC_SF_WANTDIR) // want/aim direction
1237 self.v_angle_x = ReadCoord();
1238 self.v_angle_y = ReadCoord();
1239 self.v_angle_z = ReadCoord();
1242 if(sf & ARC_SF_BEAMDIR) // beam direction
1244 self.angles_x = ReadCoord();
1245 self.angles_y = ReadCoord();
1246 self.angles_z = ReadCoord();
1249 if(sf & ARC_SF_BEAMTYPE) // beam type
1251 self.beam_type = ReadByte();
1252 switch(self.beam_type)
1256 self.beam_color = '1 1 1';
1257 self.beam_alpha = 0.5;
1258 self.beam_thickness = 8;
1259 self.beam_traileffect = (EFFECT_ARC_BEAM);
1260 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1261 self.beam_hitlight[0] = 0;
1262 self.beam_hitlight[1] = 1;
1263 self.beam_hitlight[2] = 1;
1264 self.beam_hitlight[3] = 1;
1265 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1266 self.beam_muzzlelight[0] = 0;
1267 self.beam_muzzlelight[1] = 1;
1268 self.beam_muzzlelight[2] = 1;
1269 self.beam_muzzlelight[3] = 1;
1270 if(self.beam_muzzleeffect)
1272 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1273 flash.alpha = self.beam_alpha;
1274 flash.colormod = self.beam_color;
1279 case ARC_BT_WALL: // grenadelauncher_muzzleflash healray_muzzleflash
1281 self.beam_color = '1 1 1';
1282 self.beam_alpha = 0.5;
1283 self.beam_thickness = 8;
1284 self.beam_traileffect = (EFFECT_ARC_BEAM);
1285 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1286 self.beam_hitlight[0] = 0;
1287 self.beam_hitlight[1] = 1;
1288 self.beam_hitlight[2] = 1;
1289 self.beam_hitlight[3] = 1;
1290 self.beam_muzzleeffect = NULL; // (EFFECT_GRENADE_MUZZLEFLASH);
1291 self.beam_muzzlelight[0] = 0;
1292 self.beam_muzzlelight[1] = 1;
1293 self.beam_muzzlelight[2] = 1;
1294 self.beam_muzzlelight[3] = 1;
1295 self.beam_image = "particles/lgbeam";
1296 if(self.beam_muzzleeffect)
1298 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1299 flash.alpha = self.beam_alpha;
1300 flash.colormod = self.beam_color;
1307 self.beam_color = '1 1 1';
1308 self.beam_alpha = 0.5;
1309 self.beam_thickness = 8;
1310 self.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
1311 self.beam_hiteffect = (EFFECT_ARC_BEAM_HEAL_IMPACT);
1312 self.beam_hitlight[0] = 0;
1313 self.beam_hitlight[1] = 1;
1314 self.beam_hitlight[2] = 1;
1315 self.beam_hitlight[3] = 1;
1316 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1317 self.beam_muzzlelight[0] = 0;
1318 self.beam_muzzlelight[1] = 1;
1319 self.beam_muzzlelight[2] = 1;
1320 self.beam_muzzlelight[3] = 1;
1321 self.beam_image = "particles/lgbeam";
1322 if(self.beam_muzzleeffect)
1324 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1325 flash.alpha = self.beam_alpha;
1326 flash.colormod = self.beam_color;
1333 self.beam_color = '1 1 1';
1334 self.beam_alpha = 0.5;
1335 self.beam_thickness = 8;
1336 self.beam_traileffect = (EFFECT_ARC_BEAM);
1337 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1338 self.beam_hitlight[0] = 20;
1339 self.beam_hitlight[1] = 1;
1340 self.beam_hitlight[2] = 0;
1341 self.beam_hitlight[3] = 0;
1342 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1343 self.beam_muzzlelight[0] = 50;
1344 self.beam_muzzlelight[1] = 1;
1345 self.beam_muzzlelight[2] = 0;
1346 self.beam_muzzlelight[3] = 0;
1347 self.beam_image = "particles/lgbeam";
1348 if(self.beam_muzzleeffect)
1350 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1351 flash.alpha = self.beam_alpha;
1352 flash.colormod = self.beam_color;
1357 case ARC_BT_BURST_MISS:
1359 self.beam_color = '1 1 1';
1360 self.beam_alpha = 0.5;
1361 self.beam_thickness = 14;
1362 self.beam_traileffect = (EFFECT_ARC_BEAM);
1363 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1364 self.beam_hitlight[0] = 0;
1365 self.beam_hitlight[1] = 1;
1366 self.beam_hitlight[2] = 1;
1367 self.beam_hitlight[3] = 1;
1368 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1369 self.beam_muzzlelight[0] = 0;
1370 self.beam_muzzlelight[1] = 1;
1371 self.beam_muzzlelight[2] = 1;
1372 self.beam_muzzlelight[3] = 1;
1373 self.beam_image = "particles/lgbeam";
1374 if(self.beam_muzzleeffect)
1376 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1377 flash.alpha = self.beam_alpha;
1378 flash.colormod = self.beam_color;
1383 case ARC_BT_BURST_WALL:
1385 self.beam_color = '1 1 1';
1386 self.beam_alpha = 0.5;
1387 self.beam_thickness = 14;
1388 self.beam_traileffect = (EFFECT_ARC_BEAM);
1389 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1390 self.beam_hitlight[0] = 0;
1391 self.beam_hitlight[1] = 1;
1392 self.beam_hitlight[2] = 1;
1393 self.beam_hitlight[3] = 1;
1394 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1395 self.beam_muzzlelight[0] = 0;
1396 self.beam_muzzlelight[1] = 1;
1397 self.beam_muzzlelight[2] = 1;
1398 self.beam_muzzlelight[3] = 1;
1399 self.beam_image = "particles/lgbeam";
1400 if(self.beam_muzzleeffect)
1402 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1403 flash.alpha = self.beam_alpha;
1404 flash.colormod = self.beam_color;
1409 case ARC_BT_BURST_HEAL:
1411 self.beam_color = '1 1 1';
1412 self.beam_alpha = 0.5;
1413 self.beam_thickness = 14;
1414 self.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
1415 self.beam_hiteffect = (EFFECT_ARC_BEAM_HEAL_IMPACT2);
1416 self.beam_hitlight[0] = 0;
1417 self.beam_hitlight[1] = 1;
1418 self.beam_hitlight[2] = 1;
1419 self.beam_hitlight[3] = 1;
1420 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1421 self.beam_muzzlelight[0] = 0;
1422 self.beam_muzzlelight[1] = 1;
1423 self.beam_muzzlelight[2] = 1;
1424 self.beam_muzzlelight[3] = 1;
1425 self.beam_image = "particles/lgbeam";
1426 if(self.beam_muzzleeffect)
1428 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1429 flash.alpha = self.beam_alpha;
1430 flash.colormod = self.beam_color;
1435 case ARC_BT_BURST_HIT:
1437 self.beam_color = '1 1 1';
1438 self.beam_alpha = 0.5;
1439 self.beam_thickness = 14;
1440 self.beam_traileffect = (EFFECT_ARC_BEAM);
1441 self.beam_hiteffect = (EFFECT_ARC_LIGHTNING);
1442 self.beam_hitlight[0] = 0;
1443 self.beam_hitlight[1] = 1;
1444 self.beam_hitlight[2] = 1;
1445 self.beam_hitlight[3] = 1;
1446 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1447 self.beam_muzzlelight[0] = 0;
1448 self.beam_muzzlelight[1] = 1;
1449 self.beam_muzzlelight[2] = 1;
1450 self.beam_muzzlelight[3] = 1;
1451 self.beam_image = "particles/lgbeam";
1452 if(self.beam_muzzleeffect)
1454 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1455 flash.alpha = self.beam_alpha;
1456 flash.colormod = self.beam_color;
1462 // shouldn't be possible, but lets make it colorful if it does :D
1465 self.beam_color = randomvec();
1466 self.beam_alpha = 1;
1467 self.beam_thickness = 8;
1468 self.beam_traileffect = NULL;
1469 self.beam_hiteffect = NULL;
1470 self.beam_hitlight[0] = 0;
1471 self.beam_hitlight[1] = 1;
1472 self.beam_hitlight[2] = 1;
1473 self.beam_hitlight[3] = 1;
1474 self.beam_muzzleeffect = NULL; //(EFFECT_VORTEX_MUZZLEFLASH);
1475 self.beam_muzzlelight[0] = 0;
1476 self.beam_muzzlelight[1] = 1;
1477 self.beam_muzzlelight[2] = 1;
1478 self.beam_muzzlelight[3] = 1;
1479 self.beam_image = "particles/lgbeam";
1480 if(self.beam_muzzleeffect)
1482 setmodel(flash, MDL_ARC_MUZZLEFLASH);
1483 flash.alpha = self.beam_alpha;
1484 flash.colormod = self.beam_color;
1492 if(!self.beam_usevieworigin)
1494 InterpolateOrigin_Note(this);