]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Cleanup, fix an issue with knowing origin
authorSamual Lenks <samual@xonotic.org>
Wed, 19 Feb 2014 05:12:41 +0000 (00:12 -0500)
committerSamual Lenks <samual@xonotic.org>
Wed, 19 Feb 2014 05:12:41 +0000 (00:12 -0500)
qcsrc/client/particles.qc
qcsrc/common/weapons/w_arc.qc

index f4e04a9c86a79771868da96903a0a8d984560ec7..077a76acb27667c5d7f35ea4335a4977ff390de5 100644 (file)
@@ -468,8 +468,7 @@ void Draw_ArcBeam()
        }
 
        setorigin(self, start_pos);
-       //self.beam_muzzleentity.angles = self.angles;
-       self.beam_muzzleentity.angles_z = random() * 360;
+       self.beam_muzzleentity.angles_z = random() * 360; // randomly spin the muzzleflash
 
        vector beam_endpos_estimate = (start_pos + (beamdir * self.beam_range));
 
@@ -487,19 +486,6 @@ void Draw_ArcBeam()
 
        vector hitorigin = start_pos;
 
-       /*
-       _len = vlen(self.origin - self.move_origin);
-       _dir = normalize(self.move_origin - self.origin);
-
-       if(self.total_damages < time)
-       {
-               boxparticles(self.traileffect, self, self.origin, self.origin + _dir * -64, _dir * -_len , _dir * -_len, 1, PARTICLES_USEALPHA);
-               boxparticles(self.lip, self, self.move_origin, self.move_origin + _dir * -64, _dir * -200 , _dir * -200, 1, PARTICLES_USEALPHA);
-               self.total_damages = time + 0.1;
-       }
-       */
-
-
        float i;
        for(i = 1; i <= segments; ++i)
        {
@@ -627,6 +613,18 @@ void Ent_ReadArcBeam(float isnew)
                self.beam_range = ReadCoord();
                self.beam_returnspeed = ReadShort();
                self.beam_tightness = (ReadByte() / 10);
+
+               if(ReadByte())
+               {
+                       if(autocvar_chase_active)
+                               { self.beam_usevieworigin = 1; }
+                       else // use view origin
+                               { self.beam_usevieworigin = 2; }
+               }
+               else
+               {
+                       self.beam_usevieworigin = 0;
+               }
        }
 
        if(sf & 2) // starting location
@@ -634,24 +632,23 @@ void Ent_ReadArcBeam(float isnew)
                self.origin_x = ReadCoord();
                self.origin_y = ReadCoord();
                self.origin_z = ReadCoord();
-               setorigin(self, self.origin);
-               self.beam_usevieworigin = 0;
        }
-       else // infer the location from player location
+       else if(self.beam_usevieworigin) // infer the location from player location
        {
-               if(autocvar_chase_active) // use player origin so that third person display still works
+               if(self.beam_usevieworigin == 2)
                {
-                       self.beam_usevieworigin = 1;
-                       self.origin = getplayerorigin(player_localnum) + ('0 0 1' * getstati(STAT_VIEWHEIGHT));
+                       // use view origin
+                       self.origin = view_origin;
                }
-               else // use view origin
+               else
                {
-                       self.beam_usevieworigin = 2;
-                       self.origin = view_origin; // note that this is only necessary for the sound to be properly located
+                       // use player origin so that third person display still works
+                       self.origin = getplayerorigin(player_localnum) + ('0 0 1' * getstati(STAT_VIEWHEIGHT));
                }
-               setorigin(self, self.origin);
        }
 
+       setorigin(self, self.origin);
+
        if(sf & 4) // want/aim direction
        {
                self.v_angle_x = ReadCoord();
index f7f9adc9c72429aa69e2eaa6cd04dbc58ebc2a38..44655f71bf9b0cc9866cf7c6947e28509ccf0d63 100644 (file)
@@ -78,7 +78,8 @@ float W_Arc_Beam_Send(entity to, float sf)
        // - The owner client has no use for beam start position or directions,
        //    it always figures this information out for itself with csqc code.
        // - Spectating the owner also truncates this information.
-       if((to == self.owner) || ((to.enemy == self.owner) && IS_SPEC(to)))
+       float drawlocal = ((to == self.owner) || ((to.enemy == self.owner) && IS_SPEC(to)));
+       if(drawlocal)
        {
                #if 0
                sf &= ~2;
@@ -97,6 +98,8 @@ float W_Arc_Beam_Send(entity to, float sf)
                WriteCoord(MSG_ENTITY, WEP_CVAR(arc, beam_range));
                WriteShort(MSG_ENTITY, WEP_CVAR(arc, beam_returnspeed));
                WriteByte(MSG_ENTITY, WEP_CVAR(arc, beam_tightness) * 10);
+
+               WriteByte(MSG_ENTITY, drawlocal);
        }
        if(sf & 2) // starting location
        {