]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/w_arc.qc
Merge branch 'master' into Melanosuchus/minigames
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / w_arc.qc
index 94e4d50b844388c217d54af59ba8e6b01ab67a9a..79d4dc7c7ad99fea7663a8f9cc4d6289d9d74efa 100644 (file)
@@ -7,10 +7,10 @@ REGISTER_WEAPON(
 /* flags     */ WEP_FLAG_NORMAL,
 /* rating    */ BOT_PICKUP_RATING_HIGH,
 /* color     */ '1 1 1',
-/* modelname */ "hlac",
+/* modelname */ "arc",
 /* simplemdl */ "foobar",
 /* crosshair */ "gfx/crosshairhlac 0.7",
-/* wepimg    */ "weaponhlac",
+/* wepimg    */ "weaponarc",
 /* refname   */ "arc",
 /* wepname   */ _("Arc")
 );
@@ -42,6 +42,11 @@ REGISTER_WEAPON(
        w_cvar(id, sn, NONE, burst_damage) \
        w_cvar(id, sn, NONE, burst_healing_aps) \
        w_cvar(id, sn, NONE, burst_healing_hps) \
+       w_cvar(id, sn, NONE, overheat_max)/* maximum heat before jamming */ \
+       w_cvar(id, sn, NONE, overheat_min)/* minimum heat to wait for cooldown */ \
+       w_cvar(id, sn, NONE, beam_heat)   /* heat increase per second (primary) */ \
+       w_cvar(id, sn, NONE, burst_heat)  /* heat increase per second (secondary) */ \
+       w_cvar(id, sn, NONE, cooldown)    /* heat decrease per second when resting */ \
        w_prop(id, sn, float,  switchdelay_raise, switchdelay_raise) \
        w_prop(id, sn, float,  switchdelay_drop, switchdelay_drop) \
        w_prop(id, sn, string, weaponreplace, weaponreplace) \
@@ -50,46 +55,79 @@ REGISTER_WEAPON(
        w_prop(id, sn, float,  weaponthrowable, weaponthrowable)
 
 #ifndef MENUQC
-#define ARC_MAX_SEGMENTS 20
+const float ARC_MAX_SEGMENTS = 20;
 vector arc_shotorigin[4];
 .vector beam_start;
 .vector beam_dir;
 .vector beam_wantdir;
-.float beam_type;
-
-#define ARC_BT_MISS        0
-#define ARC_BT_WALL        1
-#define ARC_BT_HEAL        2
-#define ARC_BT_HIT         3
-#define ARC_BT_BURST_MISS  10
-#define ARC_BT_BURST_WALL  11
-#define ARC_BT_BURST_HEAL  12
-#define ARC_BT_BURST_HIT   13
-#define ARC_BT_BURSTMASK   10
-
-#define ARC_SF_SETTINGS    1
-#define ARC_SF_START       2
-#define ARC_SF_WANTDIR     4
-#define ARC_SF_BEAMDIR     8
-#define ARC_SF_BEAMTYPE    16
-#define ARC_SF_LOCALMASK   14
+.int beam_type;
+
+const int ARC_BT_MISS =        0x00;
+const int ARC_BT_WALL =        0x01;
+const int ARC_BT_HEAL =        0x02;
+const int ARC_BT_HIT =         0x03;
+const int ARC_BT_BURST_MISS =  0x10;
+const int ARC_BT_BURST_WALL =  0x11;
+const int ARC_BT_BURST_HEAL =  0x12;
+const int ARC_BT_BURST_HIT =   0x13;
+const int ARC_BT_BURSTMASK =   0x10;
+
+const int ARC_SF_SETTINGS =    1;
+const int ARC_SF_START =       2;
+const int ARC_SF_WANTDIR =     4;
+const int ARC_SF_BEAMDIR =     8;
+const int ARC_SF_BEAMTYPE =    16;
+const int ARC_SF_LOCALMASK =   14;
 #endif
 #ifdef SVQC
 ARC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
 .entity arc_beam;
-.float BUTTON_ATCK_prev; // for better animation control
+.float arc_BUTTON_ATCK_prev; // for better animation control
 .float beam_prev;
 .float beam_initialized;
 .float beam_bursting;
+.float beam_teleporttime;
+.float beam_heat; // (beam) amount of heat produced
+.float arc_overheat; // (dropped arc/player) time during which it's too hot
+.float arc_cooldown; // (dropped arc/player) cooling speed
+.float arc_heat_percent; // (player) arc heat in [0,1] (stat)
+.float arc_smoke_sound;
 #endif
 #ifdef CSQC
 void Ent_ReadArcBeam(float isnew);
+
+.vector beam_color;
+.float beam_alpha;
+.float beam_thickness;
+.float beam_traileffect;
+.float beam_hiteffect;
+.float beam_hitlight[4]; // 0: radius, 123: rgb
+.float beam_muzzleeffect;
+.float beam_muzzlelight[4]; // 0: radius, 123: rgb
+.string beam_image;
+
+.entity beam_muzzleentity;
+
+.float beam_degreespersegment;
+.float beam_distancepersegment;
+.float beam_usevieworigin;
+.float beam_initialized;
+.float beam_maxangle;
+.float beam_range;
+.float beam_returnspeed;
+.float beam_tightness;
+.vector beam_shotorigin;
+
+entity Draw_ArcBeam_callback_entity;
+float Draw_ArcBeam_callback_last_thickness;
+vector Draw_ArcBeam_callback_last_top; // NOTE: in same coordinate system as player.
+vector Draw_ArcBeam_callback_last_bottom; // NOTE: in same coordinate system as player.
 #endif
 #else
 #ifdef SVQC
 void spawnfunc_weapon_arc(void) { weapon_defaultspawnfunc(WEP_ARC); }
 
-float W_Arc_Beam_Send(entity to, float sf)
+float W_Arc_Beam_Send(entity to, int sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_ARC_BEAM);
 
@@ -98,10 +136,7 @@ float W_Arc_Beam_Send(entity to, float sf)
        //    it always figures this information out for itself with csqc code.
        // - Spectating the owner also truncates this information.
        float drawlocal = ((to == self.owner) || ((to.enemy == self.owner) && IS_SPEC(to)));
-       if(drawlocal)
-       {
-               sf &= ~ARC_SF_LOCALMASK;
-       }
+       if(drawlocal) { sf &= ~ARC_SF_LOCALMASK; }
 
        WriteByte(MSG_ENTITY, sf);
 
@@ -118,28 +153,62 @@ float W_Arc_Beam_Send(entity to, float sf)
        }
        if(sf & ARC_SF_START) // starting location
        {
-               WriteCoord(MSG_ENTITY, self.beam_start_x);
-               WriteCoord(MSG_ENTITY, self.beam_start_y);
-               WriteCoord(MSG_ENTITY, self.beam_start_z);
+               WriteCoord(MSG_ENTITY, self.beam_start.x);
+               WriteCoord(MSG_ENTITY, self.beam_start.y);
+               WriteCoord(MSG_ENTITY, self.beam_start.z);
        }
        if(sf & ARC_SF_WANTDIR) // want/aim direction
        {
-               WriteCoord(MSG_ENTITY, self.beam_wantdir_x);
-               WriteCoord(MSG_ENTITY, self.beam_wantdir_y);
-               WriteCoord(MSG_ENTITY, self.beam_wantdir_z);
+               WriteCoord(MSG_ENTITY, self.beam_wantdir.x);
+               WriteCoord(MSG_ENTITY, self.beam_wantdir.y);
+               WriteCoord(MSG_ENTITY, self.beam_wantdir.z);
        }
        if(sf & ARC_SF_BEAMDIR) // beam direction
        {
-               WriteCoord(MSG_ENTITY, self.beam_dir_x);
-               WriteCoord(MSG_ENTITY, self.beam_dir_y);
-               WriteCoord(MSG_ENTITY, self.beam_dir_z);
+               WriteCoord(MSG_ENTITY, self.beam_dir.x);
+               WriteCoord(MSG_ENTITY, self.beam_dir.y);
+               WriteCoord(MSG_ENTITY, self.beam_dir.z);
        }
        if(sf & ARC_SF_BEAMTYPE) // beam type
        {
                WriteByte(MSG_ENTITY, self.beam_type);
        }
 
-       return TRUE;
+       return true;
+}
+
+void Reset_ArcBeam(entity player, vector forward)
+{
+       if (!player.arc_beam) {
+               return;
+       }
+       player.arc_beam.beam_dir = forward;
+       player.arc_beam.beam_teleporttime = time;
+}
+
+float Arc_GetHeat_Percent(entity player)
+{
+       if ( WEP_CVAR(arc, overheat_max) <= 0 ||  WEP_CVAR(arc, overheat_max) <= 0 )
+       {
+               player.arc_overheat = 0;
+               return 0;
+       }
+
+       if ( player.arc_beam )
+               return player.arc_beam.beam_heat/WEP_CVAR(arc, overheat_max);
+
+       if ( player.arc_overheat > time )
+       {
+               return (player.arc_overheat-time) / WEP_CVAR(arc, overheat_max)
+                       * player.arc_cooldown;
+       }
+
+       return 0;
+}
+void Arc_Player_SetHeat(entity player)
+{
+       player.arc_heat_percent = Arc_GetHeat_Percent(player);
+       //dprint("Heat: ",ftos(player.arc_heat_percent*100),"%\n");
 }
 
 void W_Arc_Beam_Think(void)
@@ -150,23 +219,62 @@ void W_Arc_Beam_Think(void)
                return;
        }
 
+
+       float burst = 0;
+       if( self.owner.BUTTON_ATCK2 || self.beam_bursting)
+       {
+               if(!self.beam_bursting)
+                       self.beam_bursting = true;
+               burst = ARC_BT_BURSTMASK;
+       }
+
        if(
+               !IS_PLAYER(self.owner)
+               ||
                (self.owner.WEP_AMMO(ARC) <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
                ||
                self.owner.deadflag != DEAD_NO
                ||
-               (!self.owner.BUTTON_ATCK && !self.beam_bursting)
+               (!self.owner.BUTTON_ATCK && !burst )
+               ||
+               self.owner.frozen
+               ||
+               self.owner.vehicle
                ||
-               self.owner.freezetag_frozen
+               (WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max))
        )
        {
-               #if 0
-               // is this needed? I thought this is changed to world when removed ANYWAY
+               if ( WEP_CVAR(arc, cooldown) > 0 )
+               {
+                       float cooldown_speed = 0;
+                       if ( self.beam_heat > WEP_CVAR(arc, overheat_min) && WEP_CVAR(arc, cooldown) > 0 )
+                       {
+                               cooldown_speed = WEP_CVAR(arc, cooldown);
+                       }
+                       else if ( !burst )
+                       {
+                               cooldown_speed = self.beam_heat / WEP_CVAR(arc, beam_refire);
+                       }
+
+                       if ( cooldown_speed )
+                       {
+                               self.owner.arc_overheat = time + self.beam_heat / cooldown_speed;
+                               self.owner.arc_cooldown = cooldown_speed;
+                       }
+
+                       if ( WEP_CVAR(arc, overheat_max) > 0 && self.beam_heat >= WEP_CVAR(arc, overheat_max) )
+                       {
+                               pointparticles( particleeffectnum("arc_overheat"),
+                                       self.beam_start, self.beam_wantdir, 1 );
+                               sound(self, CH_WEAPON_A, "weapons/arc_stop.wav", VOL_BASE, ATTN_NORM);
+                       }
+               }
+
                if(self == self.owner.arc_beam) { self.owner.arc_beam = world; }
-               #endif
                entity oldself = self;
                self = self.owner;
                if(!WEP_ACTION(WEP_ARC, WR_CHECKAMMO1) && !WEP_ACTION(WEP_ARC, WR_CHECKAMMO2))
+               if(!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                {
                        // note: this doesn't force the switch
                        W_SwitchToOtherWeapon(self);
@@ -176,14 +284,6 @@ void W_Arc_Beam_Think(void)
                return;
        }
 
-       float burst = 0;
-       if(self.owner.BUTTON_ATCK2 || self.beam_bursting)
-       {
-               if(!self.beam_bursting)
-                       self.beam_bursting = TRUE;
-               burst = ARC_BT_BURSTMASK;
-       }
-
        // decrease ammo
        float coefficient = frametime;
        if(!(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
@@ -200,12 +300,14 @@ void W_Arc_Beam_Think(void)
                        self.owner.WEP_AMMO(ARC) = max(0, self.owner.WEP_AMMO(ARC) - (rootammo * frametime));
                }
        }
+       float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat);
+       self.beam_heat = min( WEP_CVAR(arc, overheat_max), self.beam_heat + heat_speed*frametime );
 
        makevectors(self.owner.v_angle);
 
        W_SetupShot_Range(
                self.owner,
-               TRUE,
+               true,
                0,
                "",
                0,
@@ -213,6 +315,11 @@ void W_Arc_Beam_Think(void)
                WEP_CVAR(arc, beam_range)
        );
 
+       // After teleport, "lock" the beam until the teleport is confirmed.
+       if (time < self.beam_teleporttime + ANTILAG_LATENCY(self.owner)) {
+               w_shotdir = self.beam_dir;
+       }
+
        // network information: shot origin and want/aim direction
        if(self.beam_start != w_shotorg)
        {
@@ -228,7 +335,7 @@ void W_Arc_Beam_Think(void)
        if(!self.beam_initialized)
        {
                self.beam_dir = w_shotdir;
-               self.beam_initialized = TRUE;
+               self.beam_initialized = true;
        }
 
        // WEAPONTODO: Detect player velocity so that the beam curves when moving too
@@ -237,7 +344,7 @@ void W_Arc_Beam_Think(void)
 
        // note that if we do this, it'll always be corrected to a maximum angle by beam_maxangle handling
 
-       float segments; 
+       float segments;
        if(self.beam_dir != w_shotdir)
        {
                // calculate how much we're going to move the end of the beam to the want position
@@ -286,7 +393,7 @@ void W_Arc_Beam_Think(void)
                if(WEP_CVAR(arc, beam_degreespersegment))
                {
                        segments = bound(
-                               1, 
+                               1,
                                (
                                        min(
                                                angle,
@@ -302,49 +409,26 @@ void W_Arc_Beam_Think(void)
        }
        else { segments = 1; }
 
-       vector beam_endpos_estimate = (w_shotorg + (self.beam_dir * WEP_CVAR(arc, beam_range)));
+       vector beam_endpos = (w_shotorg + (self.beam_dir * WEP_CVAR(arc, beam_range)));
+       vector beam_controlpoint = w_shotorg + w_shotdir * (WEP_CVAR(arc, beam_range) * (1 - WEP_CVAR(arc, beam_tightness)));
 
        float i;
        float new_beam_type = 0;
        vector last_origin = w_shotorg;
        for(i = 1; i <= segments; ++i)
        {
-               // WEAPONTODO (server and client):
-               // Segment blend and distance should probably really be calculated in a better way,
-               // however I am not sure how to do it properly. There are a few things I have tried,
-               // but most of them do not work properly due to my lack of understanding regarding
-               // the mathematics behind them.
-
-               // Ideally, we should calculate the positions along a perfect curve
-               // between wantdir and self.beam_dir with an option for depth of arc
-
-               // Another issue is that (on the client code) we must separate the
-               // curve into multiple rendered curves when handling warpzones.
-
-               // I can handle this by detecting it for each segment, however that
-               // is a fairly inefficient method in comparison to having a curved line
-               // drawing function similar to Draw_CylindricLine that accepts
-               // top and bottom origins as input, this way there would be no
-               // overlapping edges when connecting the curved pieces.
-
                // WEAPONTODO (client):
                // In order to do nice fading and pointing on the starting segment, we must always
                // have that drawn as a separate triangle... However, that is difficult to do when
                // keeping in mind the above problems and also optimizing the amount of segments
                // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
 
-               // calculate this on every segment to ensure that we always reach the full length of the attack
-               float segmentblend = bound(0, (i/segments) + WEP_CVAR(arc, beam_tightness), 1);
-               float segmentdist = vlen(beam_endpos_estimate - last_origin) * (i/segments);
-
-               // WEAPONTODO: Apparently, normalize is not the correct function to use here...
-               // Figure out how this actually should work.
-               vector new_dir = normalize(
-                       (w_shotdir * (1 - segmentblend))
-                       +
-                       (normalize(beam_endpos_estimate - last_origin) * segmentblend)
-               );
-               vector new_origin = last_origin + (new_dir * segmentdist);
+               vector new_origin = bezier_quadratic_getpoint(
+                       w_shotorg,
+                       beam_controlpoint,
+                       beam_endpos,
+                       i / segments);
+               vector new_dir = normalize(new_origin - last_origin);
 
                WarpZone_traceline_antilag(
                        self.owner,
@@ -355,6 +439,15 @@ void W_Arc_Beam_Think(void)
                        ANTILAG_LATENCY(self.owner)
                );
 
+               // Do all the transforms for warpzones right now, as we already
+               // "are" in the post-trace system (if we hit a player, that's
+               // always BEHIND the last passed wz).
+               last_origin = trace_endpos;
+               w_shotorg = WarpZone_TransformOrigin(WarpZone_trace_transform, w_shotorg);
+               beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
+               beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
+               new_dir = WarpZone_TransformVelocity(WarpZone_trace_transform, new_dir);
+
                float is_player = (
                        trace_ent.classname == "player"
                        ||
@@ -366,7 +459,9 @@ void W_Arc_Beam_Think(void)
                if(trace_ent && trace_ent.takedamage && (is_player || WEP_CVAR(arc, beam_nonplayerdamage)))
                {
                        // calculate our own hit origin as trace_endpos tends to jump around annoyingly (to player origin?)
-                       vector hitorigin = last_origin + (new_dir * segmentdist * trace_fraction);
+                       // NO. trace_endpos should be just fine. If not,
+                       // that's an engine bug that needs proper debugging.
+                       vector hitorigin = trace_endpos;
 
                        float falloff = ExponentialFalloff(
                                WEP_CVAR(arc, beam_falloff_mindist),
@@ -453,7 +548,7 @@ void W_Arc_Beam_Think(void)
 
                                new_beam_type = ARC_BT_HIT;
                        }
-                       break; 
+                       break;
                }
                else if(trace_fraction != 1)
                {
@@ -461,14 +556,12 @@ void W_Arc_Beam_Think(void)
                        new_beam_type = ARC_BT_WALL;
                        break;
                }
-               else
-               {
-                       last_origin = new_origin;
-               }
        }
 
+       // te_explosion(trace_endpos);
+
        // if we're bursting, use burst visual effects
-       new_beam_type += burst;
+       new_beam_type |= burst;
 
        // network information: beam type
        if(new_beam_type != self.beam_type)
@@ -483,10 +576,11 @@ void W_Arc_Beam_Think(void)
 
 void W_Arc_Beam(float burst)
 {
+
        // only play fire sound if 1 sec has passed since player let go the fire button
        if(time - self.beam_prev > 1)
        {
-               sound(self, CH_WEAPON_A, "weapons/lgbeam_fire.wav", VOL_BASE, ATTN_NORM);
+               sound(self, CH_WEAPON_A, "weapons/arc_fire.wav", VOL_BASE, ATTN_NORM);
        }
 
        entity beam = self.arc_beam = spawn();
@@ -495,10 +589,10 @@ void W_Arc_Beam(float burst)
        beam.think = W_Arc_Beam_Think;
        beam.owner = self;
        beam.movetype = MOVETYPE_NONE;
-       beam.bot_dodge = TRUE;
+       beam.bot_dodge = true;
        beam.bot_dodgerating = WEP_CVAR(arc, beam_damage);
        beam.beam_bursting = burst;
-       Net_LinkEntity(beam, FALSE, 0, W_Arc_Beam_Send);
+       Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
 
        entity oldself = self;
        self = beam;
@@ -506,7 +600,43 @@ void W_Arc_Beam(float burst)
        self = oldself;
 }
 
-float W_Arc(float req)
+void Arc_Smoke()
+{
+       makevectors(self.v_angle);
+       W_SetupShot_Range(self,true,0,"",0,0,0);
+
+       vector smoke_origin = w_shotorg + self.velocity*frametime;
+       if ( self.arc_overheat > time )
+       {
+               if ( random() < self.arc_heat_percent )
+                       pointparticles( particleeffectnum("arc_smoke"), smoke_origin, '0 0 0', 1 );
+               if ( self.BUTTON_ATCK || self.BUTTON_ATCK2 )
+               {
+                       pointparticles( particleeffectnum("arc_overheat_fire"), smoke_origin, w_shotdir, 1 );
+                       if ( !self.arc_smoke_sound )
+                       {
+                               self.arc_smoke_sound = 1;
+                               sound(self, CH_SHOTS_SINGLE, "weapons/arc_loop_overheat.wav", VOL_BASE, ATTN_NORM);
+                       }
+               }
+       }
+       else if ( self.arc_beam && WEP_CVAR(arc, overheat_max) > 0 &&
+                       self.arc_beam.beam_heat > WEP_CVAR(arc, overheat_min) )
+       {
+               if ( random() < (self.arc_beam.beam_heat-WEP_CVAR(arc, overheat_min)) /
+                               ( WEP_CVAR(arc, overheat_max)-WEP_CVAR(arc, overheat_min) ) )
+                       pointparticles( particleeffectnum("arc_smoke"), smoke_origin, '0 0 0', 1 );
+       }
+
+       if (  self.arc_smoke_sound && ( self.arc_overheat <= time ||
+               !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || self.switchweapon != WEP_ARC )
+       {
+               self.arc_smoke_sound = 0;
+               sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM);
+       }
+}
+
+bool W_Arc(int req)
 {
        switch(req)
        {
@@ -518,7 +648,7 @@ float W_Arc(float req)
                                        WEP_CVAR(arc, beam_botaimspeed),
                                        0,
                                        WEP_CVAR(arc, beam_botaimlifetime),
-                                       FALSE
+                                       false
                                );
                        }
                        else
@@ -527,27 +657,24 @@ float W_Arc(float req)
                                        1000000,
                                        0,
                                        0.001,
-                                       FALSE
+                                       false
                                );
                        }
-                       return TRUE;
+                       return true;
                }
                case WR_THINK:
                {
-                       #if 0
-                       if(self.arc_beam.beam_heat > threshold)
-                       {
-                               stop the beam somehow
-                               play overheat animation
-                       }
-                       #endif
+                       Arc_Player_SetHeat(self);
+                       Arc_Smoke();
 
-                       if(self.BUTTON_ATCK || self.BUTTON_ATCK2 || self.arc_beam.beam_bursting)
+                       if ( self.arc_overheat <= time )
+                       if(self.BUTTON_ATCK || self.BUTTON_ATCK2 || self.arc_beam.beam_bursting )
                        {
-                               if(self.BUTTON_ATCK_prev)
+
+                               if(self.arc_BUTTON_ATCK_prev)
                                {
                                        #if 0
-                                       if(self.animstate_startframe == self.anim_shoot_x && self.animstate_numframes == self.anim_shoot_y)
+                                       if(self.animstate_startframe == self.anim_shoot.x && self.animstate_numframes == self.anim_shoot.y)
                                                weapon_thinkf(WFRAME_DONTCHANGE, autocvar_g_balance_arc_primary_animtime, w_ready);
                                        else
                                        #endif
@@ -559,24 +686,25 @@ float W_Arc(float req)
                                        if(weapon_prepareattack(!!self.BUTTON_ATCK2, 0))
                                        {
                                                W_Arc_Beam(!!self.BUTTON_ATCK2);
-                                               
-                                               if(!self.BUTTON_ATCK_prev)
+
+                                               if(!self.arc_BUTTON_ATCK_prev)
                                                {
                                                        weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
-                                                       self.BUTTON_ATCK_prev = 1;
+                                                       self.arc_BUTTON_ATCK_prev = 1;
                                                }
                                        }
                                }
-                       } 
-                       else // todo
+
+                               return true;
+                       }
+
+                       if(self.arc_BUTTON_ATCK_prev != 0)
                        {
-                               if(self.BUTTON_ATCK_prev != 0)
-                               {
-                                       weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
-                                       ATTACK_FINISHED(self) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
-                               }
-                               self.BUTTON_ATCK_prev = 0;
+                               sound(self, CH_WEAPON_A, "weapons/arc_stop.wav", VOL_BASE, ATTN_NORM);
+                               weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(arc, beam_animtime), w_ready);
+                               ATTACK_FINISHED(self) = time + WEP_CVAR(arc, beam_refire) * W_WeaponRateFactor();
                        }
+                       self.arc_BUTTON_ATCK_prev = 0;
 
                        #if 0
                        if(self.BUTTON_ATCK2)
@@ -589,25 +717,26 @@ float W_Arc(float req)
                        }
                        #endif
 
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
                        precache_model("models/weapons/g_arc.md3");
                        precache_model("models/weapons/v_arc.md3");
                        precache_model("models/weapons/h_arc.iqm");
-                       //precache_sound("weapons/arc_fire.wav");
-                       //precache_sound("weapons/arc_fire2.wav");
-                       //precache_sound("weapons/arc_impact.wav");
+                       precache_sound("weapons/arc_fire.wav");
+                       precache_sound("weapons/arc_loop.wav");
+                       precache_sound("weapons/arc_stop.wav");
+                       precache_sound("weapons/arc_loop_overheat.wav");
                        if(!arc_shotorigin[0])
                        {
-                               arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), FALSE, FALSE, 1);
-                               arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), FALSE, FALSE, 2);
-                               arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), FALSE, FALSE, 3);
-                               arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), FALSE, FALSE, 4);
+                               arc_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 1);
+                               arc_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 2);
+                               arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 3);
+                               arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC), false, false, 4);
                        }
-                       ARC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP)
-                       return TRUE;
+                       ARC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
+                       return true;
                }
                case WR_CHECKAMMO1:
                {
@@ -615,69 +744,49 @@ float W_Arc(float req)
                }
                case WR_CHECKAMMO2:
                {
-                       return ((!WEP_CVAR(arc, burst_ammo)) || (self.WEP_AMMO(ARC) > 0));
+                       return WEP_CVAR(arc, overheat_max) > 0 &&
+                               ((!WEP_CVAR(arc, burst_ammo)) || (self.WEP_AMMO(ARC) > 0));
                }
                case WR_CONFIG:
                {
-                       ARC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
-                       return TRUE;
+                       ARC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+                       return true;
                }
                case WR_KILLMESSAGE:
                {
-                       if(w_deathtype & HITTYPE_SECONDARY)
-                       {
-                               return WEAPON_ELECTRO_MURDER_ORBS;
-                       }
-                       else
+                       return WEAPON_ARC_MURDER;
+               }
+               case WR_DROP:
+               {
+                       weapon_dropevent_item.arc_overheat = self.arc_overheat;
+                       weapon_dropevent_item.arc_cooldown = self.arc_cooldown;
+                       self.arc_overheat = 0;
+                       self.arc_cooldown = 0;
+                       return true;
+               }
+               case WR_PICKUP:
+               {
+                       if ( !client_hasweapon(self, WEP_ARC, false, false) &&
+                               weapon_dropevent_item.arc_overheat > time )
                        {
-                               if(w_deathtype & HITTYPE_BOUNCE)
-                                       return WEAPON_ELECTRO_MURDER_COMBO;
-                               else
-                                       return WEAPON_ELECTRO_MURDER_BOLT;
+                               self.arc_overheat = weapon_dropevent_item.arc_overheat;
+                               self.arc_cooldown = weapon_dropevent_item.arc_cooldown;
                        }
+                       return true;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #ifdef CSQC
-
-.vector beam_color;
-.float beam_alpha;
-.float beam_thickness;
-.float beam_traileffect;
-.float beam_hiteffect;
-.float beam_hitlight[4]; // 0: radius, 123: rgb
-.float beam_muzzleeffect;
-.float beam_muzzlelight[4]; // 0: radius, 123: rgb
-.string beam_image;
-
-.entity beam_muzzleentity;
-
-.float beam_degreespersegment;
-.float beam_distancepersegment;
-.float beam_usevieworigin;
-.float beam_initialized;
-.float beam_maxangle;
-.float beam_range;
-.float beam_returnspeed;
-.float beam_tightness;
-.vector beam_shotorigin;
-.vector beam_dir;
-
-entity Draw_ArcBeam_callback_entity;
-vector Draw_ArcBeam_callback_new_dir;
-float Draw_ArcBeam_callback_segmentdist;
-float Draw_ArcBeam_callback_last_thickness;
-vector Draw_ArcBeam_callback_last_top;
-vector Draw_ArcBeam_callback_last_bottom;
-
 void Draw_ArcBeam_callback(vector start, vector hit, vector end)
 {
        entity beam = Draw_ArcBeam_callback_entity;
        vector transformed_view_org;
        transformed_view_org = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
 
+       // Thickdir shall be perpendicular to the beam and to the view-to-beam direction (WEAPONTODO: WHY)
+       // WEAPONTODO: Wouldn't it be better to be perpendicular to the beam and to the view FORWARD direction?
        vector thickdir = normalize(cross(normalize(start - hit), transformed_view_org - start));
 
        vector hitorigin;
@@ -704,8 +813,9 @@ void Draw_ArcBeam_callback(vector start, vector hit, vector end)
        // draw primary beam render
        vector top    = hitorigin + (thickdir * thickness);
        vector bottom = hitorigin - (thickdir * thickness);
-       //vector last_top    = start + (thickdir * Draw_ArcBeam_callback_last_thickness);
-       //vector last_bottom = start - (thickdir * Draw_ArcBeam_callback_last_thickness);
+
+       vector last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
+       vector last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
 
        R_BeginPolygon(beam.beam_image, DRAWFLAG_NORMAL); // DRAWFLAG_ADDITIVE
        R_PolygonVertex(
@@ -715,13 +825,13 @@ void Draw_ArcBeam_callback(vector start, vector hit, vector end)
                beam.beam_alpha
        );
        R_PolygonVertex(
-               Draw_ArcBeam_callback_last_top,
+               last_top,
                '0 0.5 0' + ('0 0.5 0' * (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
                beam.beam_color,
                beam.beam_alpha
        );
        R_PolygonVertex(
-               Draw_ArcBeam_callback_last_bottom,
+               last_bottom,
                '0 0.5 0' * (1 - (Draw_ArcBeam_callback_last_thickness / beam.beam_thickness)),
                beam.beam_color,
                beam.beam_alpha
@@ -743,14 +853,29 @@ void Draw_ArcBeam_callback(vector start, vector hit, vector end)
                trailparticles(beam, beam.beam_traileffect, start, hitorigin);
        }
 
-       // set up for the next 
+       // set up for the next
        Draw_ArcBeam_callback_last_thickness = thickness;
-       Draw_ArcBeam_callback_last_top = top;
-       Draw_ArcBeam_callback_last_bottom = bottom;
+       Draw_ArcBeam_callback_last_top = WarpZone_UnTransformOrigin(WarpZone_trace_transform, top);
+       Draw_ArcBeam_callback_last_bottom = WarpZone_UnTransformOrigin(WarpZone_trace_transform, bottom);
+}
+
+void Reset_ArcBeam(void)
+{
+       entity e;
+       for (e = world; (e = findfloat(e, beam_usevieworigin, 1)); ) {
+               e.beam_initialized = false;
+       }
+       for (e = world; (e = findfloat(e, beam_usevieworigin, 2)); ) {
+               e.beam_initialized = false;
+       }
 }
 
 void Draw_ArcBeam(void)
 {
+       float dt = time - self.move_time;
+       self.move_time = time;
+       if(dt <= 0) { return; }
+
        if(!self.beam_usevieworigin)
        {
                InterpolateOrigin_Do();
@@ -771,54 +896,53 @@ void Draw_ArcBeam(void)
                // Currently we have to replicate nearly the same method of figuring
                // out the shotdir that the server does... Ideally in the future we
                // should be able to acquire this from a generalized function built
-               // into a weapon system for client code. 
+               // into a weapon system for client code.
 
                // find where we are aiming
-               makevectors(view_angles);
+               makevectors(warpzone_save_view_angles);
+               vector forward = v_forward;
+               vector right = v_right;
+               vector up = v_up;
 
                // decide upon start position
                if(self.beam_usevieworigin == 2)
-                       { start_pos = view_origin; }
+                       { start_pos = warpzone_save_view_origin; }
                else
                        { start_pos = self.origin; }
 
                // trace forward with an estimation
                WarpZone_TraceLine(
                        start_pos,
-                       start_pos + view_forward * self.beam_range,
+                       start_pos + forward * self.beam_range,
                        MOVE_NOMONSTERS,
                        self
                );
 
                // untransform in case our trace went through a warpzone
-               vector vf, vr, vu;
-               vf = view_forward;
-               vr = view_right;
-               vu = view_up;
-               vector shothitpos = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos); // warpzone support
-               view_forward = vf;
-               view_right = vr;
-               view_up = vu;
+               vector end_pos = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
 
                // un-adjust trueaim if shotend is too close
-               if(vlen(shothitpos - view_origin) < g_trueaim_minrange)
-                       shothitpos = view_origin + (view_forward * g_trueaim_minrange);
+               if(vlen(end_pos - start_pos) < g_trueaim_minrange)
+                       end_pos = start_pos + (forward * g_trueaim_minrange);
 
                // move shot origin to the actual gun muzzle origin
                vector origin_offset =
-                       view_forward * self.beam_shotorigin_x
-                       + view_right * -self.beam_shotorigin_y 
-                       + view_up * self.beam_shotorigin_z;
+                         right * -self.beam_shotorigin.y
+                       + up * self.beam_shotorigin.z;
 
                start_pos = start_pos + origin_offset;
 
+               // Move it also forward, but only as far as possible without hitting anything. Don't poke into walls!
+               traceline(start_pos, start_pos + forward * self.beam_shotorigin.x, MOVE_NORMAL, self);
+               start_pos = trace_endpos;
+
                // calculate the aim direction now
-               wantdir = normalize(shothitpos - start_pos);
+               wantdir = normalize(end_pos - start_pos);
 
                if(!self.beam_initialized)
                {
                        self.beam_dir = wantdir;
-                       self.beam_initialized = TRUE;
+                       self.beam_initialized = true;
                }
 
                if(self.beam_dir != wantdir)
@@ -866,7 +990,7 @@ void Draw_ArcBeam(void)
                        if(self.beam_degreespersegment)
                        {
                                segments = bound(
-                                       1, 
+                                       1,
                                        (
                                                min(
                                                        angle,
@@ -886,7 +1010,7 @@ void Draw_ArcBeam(void)
                beamdir = self.beam_dir;
 
                // finally, set self.angles to the proper direction so that muzzle attachment points in proper direction
-               self.angles = fixedvectoangles2(view_forward, view_up);
+               self.angles = fixedvectoangles2(forward, up); // TODO(Samual): is this == warpzone_save_view_angles?
        }
        else
        {
@@ -914,7 +1038,7 @@ void Draw_ArcBeam(void)
                        if(self.beam_degreespersegment)
                        {
                                segments = bound(
-                                       1, 
+                                       1,
                                        (
                                                min(
                                                        angle,
@@ -934,7 +1058,8 @@ void Draw_ArcBeam(void)
        setorigin(self, start_pos);
        self.beam_muzzleentity.angles_z = random() * 360; // WEAPONTODO: use avelocity instead?
 
-       vector beam_endpos_estimate = (start_pos + (beamdir * self.beam_range));
+       vector beam_endpos = (start_pos + (beamdir * self.beam_range));
+       vector beam_controlpoint = start_pos + wantdir * (self.beam_range * (1 - self.beam_tightness));
 
        Draw_ArcBeam_callback_entity = self;
        Draw_ArcBeam_callback_last_thickness = 0;
@@ -942,49 +1067,22 @@ void Draw_ArcBeam(void)
        Draw_ArcBeam_callback_last_bottom = start_pos;
 
        vector last_origin = start_pos;
+       vector original_start_pos = start_pos;
 
        float i;
        for(i = 1; i <= segments; ++i)
        {
-               // WEAPONTODO (server and client):
-               // Segment blend and distance should probably really be calculated in a better way,
-               // however I am not sure how to do it properly. There are a few things I have tried,
-               // but most of them do not work properly due to my lack of understanding regarding
-               // the mathematics behind them.
-
-               // Ideally, we should calculate the positions along a perfect curve
-               // between wantdir and self.beam_dir with an option for depth of arc
-
-               // Another issue is that (on the client code) we must separate the
-               // curve into multiple rendered curves when handling warpzones.
-
-               // I can handle this by detecting it for each segment, however that
-               // is a fairly inefficient method in comparison to having a curved line
-               // drawing function similar to Draw_CylindricLine that accepts
-               // top and bottom origins as input, this way there would be no
-               // overlapping edges when connecting the curved pieces.
-
                // WEAPONTODO (client):
                // In order to do nice fading and pointing on the starting segment, we must always
                // have that drawn as a separate triangle... However, that is difficult to do when
                // keeping in mind the above problems and also optimizing the amount of segments
                // drawn on screen at any given time. (Automatic beam quality scaling, essentially)
 
-               // calculate this on every segment to ensure that we always reach the full length of the attack
-               float segmentblend = bound(0, (i/segments) + self.beam_tightness, 1);
-               float segmentdist = vlen(beam_endpos_estimate - last_origin) * (i/segments);
-
-               // WEAPONTODO: Apparently, normalize is not the correct function to use here...
-               // Figure out how this actually should work.
-               vector new_dir = normalize(
-                       (wantdir * (1 - segmentblend))
-                       +
-                       (normalize(beam_endpos_estimate - last_origin) * segmentblend)
-               );
-               vector new_origin = last_origin + (new_dir * segmentdist);
-
-               Draw_ArcBeam_callback_segmentdist = segmentdist;
-               Draw_ArcBeam_callback_new_dir = new_dir;
+               vector new_origin = bezier_quadratic_getpoint(
+                       start_pos,
+                       beam_controlpoint,
+                       beam_endpos,
+                       i / segments);
 
                WarpZone_TraceBox_ThroughZone(
                        last_origin,
@@ -997,20 +1095,26 @@ void Draw_ArcBeam(void)
                        Draw_ArcBeam_callback
                );
 
-               //printf("segment: %d, warpzone transform: %d\n", i, (WarpZone_trace_transform != world));
-
-               // WEAPONTODO:
-               // Figure out some way to detect a collision with geometry with callback...
-               // That way we can know when we are done drawing the beam and skip
-               // the rest of the segments without breaking warpzone support.
-
-               last_origin = WarpZone_TransformOrigin(WarpZone_trace_transform, new_origin);
-               beam_endpos_estimate = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos_estimate);
+               // Do all the transforms for warpzones right now, as we already "are" in the post-trace
+               // system (if we hit a player, that's always BEHIND the last passed wz).
+               last_origin = trace_endpos;
+               start_pos = WarpZone_TransformOrigin(WarpZone_trace_transform, start_pos);
+               beam_controlpoint = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_controlpoint);
+               beam_endpos = WarpZone_TransformOrigin(WarpZone_trace_transform, beam_endpos);
+               beamdir = WarpZone_TransformVelocity(WarpZone_trace_transform, beamdir);
+               Draw_ArcBeam_callback_last_top = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_top);
+               Draw_ArcBeam_callback_last_bottom = WarpZone_TransformOrigin(WarpZone_trace_transform, Draw_ArcBeam_callback_last_bottom);
+
+               if(trace_fraction < 1) { break; }
        }
 
-       // startpoint and endpoint drawn visual effects
+       // visual effects for startpoint and endpoint
        if(self.beam_hiteffect)
        {
+               // FIXME we really should do this on the server so it actually
+               // matches gameplay. What this client side stuff is doing is no
+               // more than guesswork.
+               if((trace_ent || trace_fraction < 1) && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
                pointparticles(
                        self.beam_hiteffect,
                        last_origin,
@@ -1034,7 +1138,7 @@ void Draw_ArcBeam(void)
        {
                pointparticles(
                        self.beam_muzzleeffect,
-                       start_pos + wantdir * 20,
+                       original_start_pos + wantdir * 20,
                        wantdir * 1000,
                        frametime * 0.1
                );
@@ -1042,7 +1146,7 @@ void Draw_ArcBeam(void)
        if(self.beam_muzzlelight[0])
        {
                adddynamiclight(
-                       start_pos + wantdir * 20,
+                       original_start_pos + wantdir * 20,
                        self.beam_muzzlelight[0],
                        vec3(
                                self.beam_muzzlelight[1],
@@ -1054,8 +1158,6 @@ void Draw_ArcBeam(void)
 
        // cleanup
        Draw_ArcBeam_callback_entity = world;
-       Draw_ArcBeam_callback_new_dir = '0 0 0';
-       Draw_ArcBeam_callback_segmentdist = 0;
        Draw_ArcBeam_callback_last_thickness = 0;
        Draw_ArcBeam_callback_last_top = '0 0 0';
        Draw_ArcBeam_callback_last_bottom = '0 0 0';
@@ -1069,13 +1171,13 @@ void Remove_ArcBeam(void)
 
 void Ent_ReadArcBeam(float isnew)
 {
-       float sf = ReadByte();
+       int sf = ReadByte();
        entity flash;
 
        if(isnew)
        {
                // calculate shot origin offset from gun alignment
-               float gunalign = autocvar_cl_gunalign;
+               int gunalign = autocvar_cl_gunalign;
                if(gunalign != 1 && gunalign != 2 && gunalign != 4)
                        gunalign = 3; // default value
                --gunalign;
@@ -1085,13 +1187,15 @@ void Ent_ReadArcBeam(float isnew)
                // set other main attributes of the beam
                self.draw = Draw_ArcBeam;
                self.entremove = Remove_ArcBeam;
-               sound(self, CH_SHOTS_SINGLE, "weapons/lgbeam_fly.wav", VOL_BASE, ATTEN_NORM);
+               self.move_time = time;
+               loopsound(self, CH_SHOTS_SINGLE, "weapons/arc_loop.wav", VOL_BASE, ATTEN_NORM);
 
                flash = spawn();
                flash.owner = self;
                flash.effects = EF_ADDITIVE | EF_FULLBRIGHT;
                flash.drawmask = MASK_NORMAL;
                flash.solid = SOLID_NOT;
+               flash.avelocity_z = 5000;
                setattachment(flash, self, "");
                setorigin(flash, '0 0 0');
 
@@ -1175,186 +1279,209 @@ void Ent_ReadArcBeam(float isnew)
                {
                        case ARC_BT_MISS:
                        {
-                               self.beam_color = '-1 -1 1';
+                               self.beam_color = '1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 8;
-                               self.beam_traileffect = FALSE;
-                               self.beam_hiteffect = particleeffectnum("electro_lightning");
+                               self.beam_traileffect = particleeffectnum("arc_beam");
+                               self.beam_hiteffect = particleeffectnum("arc_lightning");
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
                                self.beam_hitlight[3] = 1;
-                               self.beam_muzzleeffect = FALSE; //particleeffectnum("nex_muzzleflash");
+                               self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
                                self.beam_muzzlelight[0] = 0;
                                self.beam_muzzlelight[1] = 1;
                                self.beam_muzzlelight[2] = 1;
                                self.beam_muzzlelight[3] = 1;
-                               self.beam_image = "particles/lgbeam";
-                               setmodel(flash, "models/flash.md3");
-                               flash.alpha = self.beam_alpha;
-                               flash.colormod = self.beam_color;
-                               flash.scale = 0.5;
+                               if(self.beam_muzzleeffect >= 0)
+                               {
+                                       setmodel(flash, "models/flash.md3");
+                                       flash.alpha = self.beam_alpha;
+                                       flash.colormod = self.beam_color;
+                                       flash.scale = 0.5;
+                               }
                                break;
                        }
                        case ARC_BT_WALL: // grenadelauncher_muzzleflash healray_muzzleflash
                        {
-                               self.beam_color = '0.5 0.5 1';
+                               self.beam_color = '1 1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 8;
-                               self.beam_traileffect = FALSE;
-                               self.beam_hiteffect = particleeffectnum("electro_lightning");
+                               self.beam_traileffect = particleeffectnum("arc_beam");
+                               self.beam_hiteffect = particleeffectnum("arc_lightning");
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
                                self.beam_hitlight[3] = 1;
-                               self.beam_muzzleeffect = FALSE; // particleeffectnum("grenadelauncher_muzzleflash");
+                               self.beam_muzzleeffect = -1; // particleeffectnum("grenadelauncher_muzzleflash");
                                self.beam_muzzlelight[0] = 0;
                                self.beam_muzzlelight[1] = 1;
                                self.beam_muzzlelight[2] = 1;
                                self.beam_muzzlelight[3] = 1;
                                self.beam_image = "particles/lgbeam";
-                               setmodel(flash, "models/flash.md3");
-                               flash.alpha = self.beam_alpha;
-                               flash.colormod = self.beam_color;
-                               flash.scale = 0.5;
+                               if(self.beam_muzzleeffect >= 0)
+                               {
+                                       setmodel(flash, "models/flash.md3");
+                                       flash.alpha = self.beam_alpha;
+                                       flash.colormod = self.beam_color;
+                                       flash.scale = 0.5;
+                               }
                                break;
                        }
                        case ARC_BT_HEAL:
                        {
-                               self.beam_color = '0 1 0';
+                               self.beam_color = '1 1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 8;
-                               self.beam_traileffect = FALSE;
-                               self.beam_hiteffect = particleeffectnum("healray_impact"); 
+                               self.beam_traileffect = particleeffectnum("arc_beam_heal");
+                               self.beam_hiteffect = particleeffectnum("arc_beam_healimpact");
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
                                self.beam_hitlight[3] = 1;
-                               self.beam_muzzleeffect = FALSE; //particleeffectnum("nex_muzzleflash");
+                               self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
                                self.beam_muzzlelight[0] = 0;
                                self.beam_muzzlelight[1] = 1;
                                self.beam_muzzlelight[2] = 1;
                                self.beam_muzzlelight[3] = 1;
                                self.beam_image = "particles/lgbeam";
-                               setmodel(flash, "models/flash.md3");
-                               flash.alpha = self.beam_alpha;
-                               flash.colormod = self.beam_color;
-                               flash.scale = 0.5;
+                               if(self.beam_muzzleeffect >= 0)
+                               {
+                                       setmodel(flash, "models/flash.md3");
+                                       flash.alpha = self.beam_alpha;
+                                       flash.colormod = self.beam_color;
+                                       flash.scale = 0.5;
+                               }
                                break;
                        }
                        case ARC_BT_HIT:
                        {
-                               self.beam_color = '1 0 1';
+                               self.beam_color = '1 1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 8;
-                               self.beam_traileffect = particleeffectnum("nex_beam");
-                               self.beam_hiteffect = particleeffectnum("electro_lightning"); 
+                               self.beam_traileffect = particleeffectnum("arc_beam");
+                               self.beam_hiteffect = particleeffectnum("arc_lightning");
                                self.beam_hitlight[0] = 20;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 0;
                                self.beam_hitlight[3] = 0;
-                               self.beam_muzzleeffect = FALSE; //particleeffectnum("nex_muzzleflash");
+                               self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
                                self.beam_muzzlelight[0] = 50;
                                self.beam_muzzlelight[1] = 1;
                                self.beam_muzzlelight[2] = 0;
                                self.beam_muzzlelight[3] = 0;
                                self.beam_image = "particles/lgbeam";
-                               setmodel(flash, "models/flash.md3");
-                               flash.alpha = self.beam_alpha;
-                               flash.colormod = self.beam_color;
-                               flash.scale = 0.5;
+                               if(self.beam_muzzleeffect >= 0)
+                               {
+                                       setmodel(flash, "models/flash.md3");
+                                       flash.alpha = self.beam_alpha;
+                                       flash.colormod = self.beam_color;
+                                       flash.scale = 0.5;
+                               }
                                break;
                        }
                        case ARC_BT_BURST_MISS:
                        {
-                               self.beam_color = '-1 -1 1';
+                               self.beam_color = '1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 14;
-                               self.beam_traileffect = FALSE;
-                               self.beam_hiteffect = particleeffectnum("electro_lightning"); 
+                               self.beam_traileffect = particleeffectnum("arc_beam");
+                               self.beam_hiteffect = particleeffectnum("arc_lightning");
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
                                self.beam_hitlight[3] = 1;
-                               self.beam_muzzleeffect = FALSE; //particleeffectnum("nex_muzzleflash");
+                               self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
                                self.beam_muzzlelight[0] = 0;
                                self.beam_muzzlelight[1] = 1;
                                self.beam_muzzlelight[2] = 1;
                                self.beam_muzzlelight[3] = 1;
                                self.beam_image = "particles/lgbeam";
-                               setmodel(flash, "models/flash.md3");
-                               flash.alpha = self.beam_alpha;
-                               flash.colormod = self.beam_color;
-                               flash.scale = 0.5;
+                               if(self.beam_muzzleeffect >= 0)
+                               {
+                                       setmodel(flash, "models/flash.md3");
+                                       flash.alpha = self.beam_alpha;
+                                       flash.colormod = self.beam_color;
+                                       flash.scale = 0.5;
+                               }
                                break;
                        }
                        case ARC_BT_BURST_WALL:
                        {
-                               self.beam_color = '0.5 0.5 1';
+                               self.beam_color = '1 1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 14;
-                               self.beam_traileffect = FALSE;
-                               self.beam_hiteffect = particleeffectnum("electro_lightning"); 
+                               self.beam_traileffect = particleeffectnum("arc_beam");
+                               self.beam_hiteffect = particleeffectnum("arc_lightning");
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
                                self.beam_hitlight[3] = 1;
-                               self.beam_muzzleeffect = FALSE; //particleeffectnum("nex_muzzleflash");
+                               self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
                                self.beam_muzzlelight[0] = 0;
                                self.beam_muzzlelight[1] = 1;
                                self.beam_muzzlelight[2] = 1;
                                self.beam_muzzlelight[3] = 1;
                                self.beam_image = "particles/lgbeam";
-                               setmodel(flash, "models/flash.md3");
-                               flash.alpha = self.beam_alpha;
-                               flash.colormod = self.beam_color;
-                               flash.scale = 0.5;
+                               if(self.beam_muzzleeffect >= 0)
+                               {
+                                       setmodel(flash, "models/flash.md3");
+                                       flash.alpha = self.beam_alpha;
+                                       flash.colormod = self.beam_color;
+                                       flash.scale = 0.5;
+                               }
                                break;
                        }
                        case ARC_BT_BURST_HEAL:
                        {
-                               self.beam_color = '0 1 0';
+                               self.beam_color = '1 1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 14;
-                               self.beam_traileffect = FALSE;
-                               self.beam_hiteffect = particleeffectnum("electro_lightning"); 
+                               self.beam_traileffect = particleeffectnum("arc_beam_heal");
+                               self.beam_hiteffect = particleeffectnum("healray_impact");
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
                                self.beam_hitlight[3] = 1;
-                               self.beam_muzzleeffect = FALSE; //particleeffectnum("nex_muzzleflash");
+                               self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
                                self.beam_muzzlelight[0] = 0;
                                self.beam_muzzlelight[1] = 1;
                                self.beam_muzzlelight[2] = 1;
                                self.beam_muzzlelight[3] = 1;
                                self.beam_image = "particles/lgbeam";
-                               setmodel(flash, "models/flash.md3");
-                               flash.alpha = self.beam_alpha;
-                               flash.colormod = self.beam_color;
-                               flash.scale = 0.5;
+                               if(self.beam_muzzleeffect >= 0)
+                               {
+                                       setmodel(flash, "models/flash.md3");
+                                       flash.alpha = self.beam_alpha;
+                                       flash.colormod = self.beam_color;
+                                       flash.scale = 0.5;
+                               }
                                break;
                        }
                        case ARC_BT_BURST_HIT:
                        {
-                               self.beam_color = '1 0 1';
+                               self.beam_color = '1 1 1';
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 14;
-                               self.beam_traileffect = FALSE;
-                               self.beam_hiteffect = particleeffectnum("electro_lightning"); 
+                               self.beam_traileffect = particleeffectnum("arc_beam");
+                               self.beam_hiteffect = particleeffectnum("arc_lightning");
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
                                self.beam_hitlight[3] = 1;
-                               self.beam_muzzleeffect = FALSE; //particleeffectnum("nex_muzzleflash");
+                               self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
                                self.beam_muzzlelight[0] = 0;
                                self.beam_muzzlelight[1] = 1;
                                self.beam_muzzlelight[2] = 1;
                                self.beam_muzzlelight[3] = 1;
                                self.beam_image = "particles/lgbeam";
-                               setmodel(flash, "models/flash.md3");
-                               flash.alpha = self.beam_alpha;
-                               flash.colormod = self.beam_color;
-                               flash.scale = 0.5;
+                               if(self.beam_muzzleeffect >= 0)
+                               {
+                                       setmodel(flash, "models/flash.md3");
+                                       flash.alpha = self.beam_alpha;
+                                       flash.colormod = self.beam_color;
+                                       flash.scale = 0.5;
+                               }
                                break;
                        }
 
@@ -1364,22 +1491,25 @@ void Ent_ReadArcBeam(float isnew)
                                self.beam_color = randomvec();
                                self.beam_alpha = 1;
                                self.beam_thickness = 8;
-                               self.beam_traileffect = FALSE;
-                               self.beam_hiteffect = FALSE; 
+                               self.beam_traileffect = false;
+                               self.beam_hiteffect = false;
                                self.beam_hitlight[0] = 0;
                                self.beam_hitlight[1] = 1;
                                self.beam_hitlight[2] = 1;
                                self.beam_hitlight[3] = 1;
-                               self.beam_muzzleeffect = FALSE; //particleeffectnum("nex_muzzleflash");
+                               self.beam_muzzleeffect = -1; //particleeffectnum("nex_muzzleflash");
                                self.beam_muzzlelight[0] = 0;
                                self.beam_muzzlelight[1] = 1;
                                self.beam_muzzlelight[2] = 1;
                                self.beam_muzzlelight[3] = 1;
                                self.beam_image = "particles/lgbeam";
-                               setmodel(flash, "models/flash.md3");
-                               flash.alpha = self.beam_alpha;
-                               flash.colormod = self.beam_color;
-                               flash.scale = 0.5;
+                               if(self.beam_muzzleeffect >= 0)
+                               {
+                                       setmodel(flash, "models/flash.md3");
+                                       flash.alpha = self.beam_alpha;
+                                       flash.colormod = self.beam_color;
+                                       flash.scale = 0.5;
+                               }
                                break;
                        }
                }
@@ -1391,28 +1521,27 @@ void Ent_ReadArcBeam(float isnew)
        }
 }
 
-float W_Arc(float req)
+bool W_Arc(int req)
 {
        switch(req)
        {
                case WR_IMPACTEFFECT:
                {
                        // todo
-                       return TRUE;
+                       return true;
                }
                case WR_INIT:
                {
-                       //precache_sound("weapons/arc_impact.wav");
-                       //precache_sound("weapons/arc_impact_combo.wav");
-                       return TRUE;
+                       precache_sound("weapons/arc_loop.wav");
+                       return true;
                }
                case WR_ZOOMRETICLE:
                {
                        // no weapon specific image for this weapon
-                       return FALSE;
+                       return false;
                }
        }
-       return FALSE;
+       return false;
 }
 #endif
 #endif