]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Network settings information instead of using local cvar checking
authorSamual Lenks <samual@xonotic.org>
Tue, 18 Feb 2014 23:31:16 +0000 (18:31 -0500)
committerSamual Lenks <samual@xonotic.org>
Tue, 18 Feb 2014 23:31:16 +0000 (18:31 -0500)
qcsrc/client/particles.qc
qcsrc/common/weapons/w_arc.qc

index 6c7face62ec78816a31679cb4e6b1a00c9a0ecd7..394491261a3b5dd59f55cf6f6cb194cd968d1b14 100644 (file)
@@ -364,6 +364,7 @@ void Net_ReadShockwaveParticle()
 
 .float beam_usevieworigin;
 .float beam_initialized;
+.float beam_range;
 .vector beam_shotorigin;
 .vector beam_dir;
 void Draw_ArcBeam()
@@ -397,7 +398,7 @@ void Draw_ArcBeam()
                        { start_pos = self.origin; }
 
                // trace forward with an estimation
-               WarpZone_TraceLine(start_pos, start_pos + view_forward * cvar("g_balance_arc_beam_range"), MOVE_NOMONSTERS, self);
+               WarpZone_TraceLine(start_pos, start_pos + view_forward * self.beam_range, MOVE_NOMONSTERS, self);
 
                // untransform in case our trace went through a warpzone
                vector vf, vr, vu;
@@ -459,7 +460,7 @@ void Draw_ArcBeam()
 
        setorigin(self, start_pos);
 
-       vector beam_endpos_estimate = (start_pos + (beamdir * cvar("g_balance_arc_beam_range")));
+       vector beam_endpos_estimate = (start_pos + (beamdir * self.beam_range));
 
        float i;
        float segments = 20; // todo: calculate this in a similar way to server does
@@ -601,7 +602,12 @@ void Ent_ReadArcBeam(float isnew)
 
        InterpolateOrigin_Undo();
 
-       if(sf & 1) // starting location // not sent if beam is for owner
+       if(sf & 1) // settings information
+       {
+               self.beam_range = ReadCoord();
+       }
+
+       if(sf & 2) // starting location
        {
                self.origin_x = ReadCoord();
                self.origin_y = ReadCoord();
@@ -624,20 +630,22 @@ void Ent_ReadArcBeam(float isnew)
                }
                setorigin(self, self.origin);
        }
-       
-       if(sf & 2) // want/aim direction
+
+       if(sf & 4) // want/aim direction
        {
                self.v_angle_x = ReadCoord();
                self.v_angle_y = ReadCoord();
                self.v_angle_z = ReadCoord();
        }
-       if(sf & 4) // beam direction
+
+       if(sf & 8) // beam direction
        {
                self.angles_x = ReadCoord();
                self.angles_y = ReadCoord();
                self.angles_z = ReadCoord();
        }
-       if(sf & 8) // beam type
+
+       if(sf & 16) // beam type
        {
                self.beam_type = ReadByte();
        }
index dcb2747b60fdac0b2ec78aacefc25b29a9ad8330..a47f1c57bbbb1ebe6b23bd4760c148b13f5bb231 100644 (file)
@@ -73,31 +73,46 @@ float W_Arc_Beam_Send(entity to, float sf)
 {
        WriteByte(MSG_ENTITY, ENT_CLIENT_ARC_BEAM);
 
-       // don't send group 1, 2, or 3 if this beam is for the local player
-       if((to == self.owner) || ((to.enemy == self.owner) && IS_SPEC(to))) { sf &= ~7; }
-       WriteByte(MSG_ENTITY, sf);
+       // Truncate information when this beam is displayed to the owner client
+       // - 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)))
+       {
+               #if 0
+               sf &= ~2;
+               sf &= ~4;
+               sf &= ~8;
+               #else
+               sf &= ~14;
+               #endif
+       }
 
-       //WriteCoord(MSG_ENTITY, WEP_CVAR(arc, beam_range));
+       WriteByte(MSG_ENTITY, sf);
 
-       if(sf & 1) // starting location
+       if(sf & 1) // settings information
+       {
+               WriteCoord(MSG_ENTITY, WEP_CVAR(arc, beam_range));
+       }
+       if(sf & 2) // starting location
        {
                WriteCoord(MSG_ENTITY, self.beam_start_x);
                WriteCoord(MSG_ENTITY, self.beam_start_y);
                WriteCoord(MSG_ENTITY, self.beam_start_z);
        }
-       if(sf & 2) // want/aim direction
+       if(sf & 4) // want/aim direction
        {
                WriteCoord(MSG_ENTITY, self.beam_wantdir_x);
                WriteCoord(MSG_ENTITY, self.beam_wantdir_y);
                WriteCoord(MSG_ENTITY, self.beam_wantdir_z);
        }
-       if(sf & 4) // beam direction
+       if(sf & 8) // beam direction
        {
                WriteCoord(MSG_ENTITY, self.beam_dir_x);
                WriteCoord(MSG_ENTITY, self.beam_dir_y);
                WriteCoord(MSG_ENTITY, self.beam_dir_z);
        }
-       if(sf & 8) // beam type
+       if(sf & 16) // beam type
        {
                WriteByte(MSG_ENTITY, self.beam_type);
        }
@@ -143,12 +158,12 @@ void W_Arc_Beam_Think(void)
        // network information: shot origin and want/aim direction
        if(self.beam_start != w_shotorg)
        {
-               self.SendFlags |= 1;
+               self.SendFlags |= 2;
                self.beam_start = w_shotorg;
        }
        if(self.beam_wantdir != w_shotdir)
        {
-               self.SendFlags |= 2;
+               self.SendFlags |= 4;
                self.beam_wantdir = w_shotdir;
        }
 
@@ -188,7 +203,7 @@ void W_Arc_Beam_Think(void)
                // printf("blendfactor = %f\n", blendfactor);
 
                // network information: beam direction
-               self.SendFlags |= 4;
+               self.SendFlags |= 8;
 
                // calculate how many segments are needed
                float max_allowed_segments;
@@ -299,7 +314,7 @@ void W_Arc_Beam_Think(void)
        // network information: beam type
        if(new_beam_type != self.beam_type)
        {
-               self.SendFlags |= 8;
+               self.SendFlags |= 16;
                self.beam_type = new_beam_type;
        }