From 758ae0a71a334316a8246bf8e1b2854525910b25 Mon Sep 17 00:00:00 2001 From: Samual Lenks Date: Tue, 18 Feb 2014 18:31:16 -0500 Subject: [PATCH] Network settings information instead of using local cvar checking --- qcsrc/client/particles.qc | 22 +++++++++++++------- qcsrc/common/weapons/w_arc.qc | 39 ++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/qcsrc/client/particles.qc b/qcsrc/client/particles.qc index 6c7face62..394491261 100644 --- a/qcsrc/client/particles.qc +++ b/qcsrc/client/particles.qc @@ -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(); } diff --git a/qcsrc/common/weapons/w_arc.qc b/qcsrc/common/weapons/w_arc.qc index dcb2747b6..a47f1c57b 100644 --- a/qcsrc/common/weapons/w_arc.qc +++ b/qcsrc/common/weapons/w_arc.qc @@ -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; } -- 2.39.2