Add an option to colour Arc beams by team
authorMario <mario@smbclan.net>
Wed, 3 Feb 2016 05:27:48 +0000 (15:27 +1000)
committerMario <mario@smbclan.net>
Wed, 3 Feb 2016 05:27:48 +0000 (15:27 +1000)
qcsrc/common/weapons/weapon/arc.qc

index 1d6a4a7..6f503d4 100644 (file)
@@ -168,6 +168,7 @@ bool W_Arc_Beam_Send(entity this, entity to, int sf)
                WriteByte(MSG_ENTITY, WEP_CVAR(arc, beam_tightness) * 10);
 
                WriteByte(MSG_ENTITY, drawlocal);
+               WriteByte(MSG_ENTITY, etof(this.owner));
        }
        if(sf & ARC_SF_START) // starting location
        {
@@ -862,6 +863,8 @@ void Arc_Smoke()
                }
 #endif
 #ifdef CSQC
+bool autocvar_cl_arcbeam_teamcolor;
+
                METHOD(Arc, wr_impacteffect, void(entity thiswep))
                {
                        if(w_deathtype & HITTYPE_SECONDARY)
@@ -1316,6 +1319,8 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
                {
                        self.beam_usevieworigin = 0;
                }
+
+               self.sv_entnum = ReadByte();
        }
 
        if(!self.beam_usevieworigin)
@@ -1365,11 +1370,13 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
        if(sf & ARC_SF_BEAMTYPE) // beam type
        {
                self.beam_type = ReadByte();
+
+               vector beamcolor = ((autocvar_cl_arcbeam_teamcolor) ? colormapPaletteColor(stof(getplayerkeyvalue(self.sv_entnum - 1, "colors")) & 0x0F, true) : '1 1 1');
                switch(self.beam_type)
                {
                        case ARC_BT_MISS:
                        {
-                               self.beam_color = '1 1 1';
+                               self.beam_color = beamcolor;
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 8;
                                self.beam_traileffect = (EFFECT_ARC_BEAM);
@@ -1394,7 +1401,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
                        }
                        case ARC_BT_WALL: // grenadelauncher_muzzleflash healray_muzzleflash
                        {
-                               self.beam_color = '1 1 1';
+                               self.beam_color = beamcolor;
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 8;
                                self.beam_traileffect = (EFFECT_ARC_BEAM);
@@ -1420,7 +1427,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
                        }
                        case ARC_BT_HEAL:
                        {
-                               self.beam_color = '1 1 1';
+                               self.beam_color = beamcolor;
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 8;
                                self.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
@@ -1446,7 +1453,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
                        }
                        case ARC_BT_HIT:
                        {
-                               self.beam_color = '1 1 1';
+                               self.beam_color = beamcolor;
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 8;
                                self.beam_traileffect = (EFFECT_ARC_BEAM);
@@ -1472,7 +1479,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
                        }
                        case ARC_BT_BURST_MISS:
                        {
-                               self.beam_color = '1 1 1';
+                               self.beam_color = beamcolor;
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 14;
                                self.beam_traileffect = (EFFECT_ARC_BEAM);
@@ -1498,7 +1505,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
                        }
                        case ARC_BT_BURST_WALL:
                        {
-                               self.beam_color = '1 1 1';
+                               self.beam_color = beamcolor;
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 14;
                                self.beam_traileffect = (EFFECT_ARC_BEAM);
@@ -1524,7 +1531,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
                        }
                        case ARC_BT_BURST_HEAL:
                        {
-                               self.beam_color = '1 1 1';
+                               self.beam_color = beamcolor;
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 14;
                                self.beam_traileffect = (EFFECT_ARC_BEAM_HEAL);
@@ -1550,7 +1557,7 @@ NET_HANDLE(ENT_CLIENT_ARC_BEAM, bool isnew)
                        }
                        case ARC_BT_BURST_HIT:
                        {
-                               self.beam_color = '1 1 1';
+                               self.beam_color = beamcolor;
                                self.beam_alpha = 0.5;
                                self.beam_thickness = 14;
                                self.beam_traileffect = (EFFECT_ARC_BEAM);