From 6d9bb7ebbc3e3930db1004e1051957d99ab8abc8 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sat, 8 May 2010 15:35:27 +0200 Subject: [PATCH 1/1] csqcprojectiles: do not network gravity if at default value (instead use a sendflags bit) --- qcsrc/client/projectile.qc | 7 +++++-- qcsrc/server/csqcprojectile.qc | 18 ++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/qcsrc/client/projectile.qc b/qcsrc/client/projectile.qc index 1cbab300f9..9a2907c5c8 100644 --- a/qcsrc/client/projectile.qc +++ b/qcsrc/client/projectile.qc @@ -213,12 +213,15 @@ void Ent_Projectile() self.velocity_x = ReadCoord(); self.velocity_y = ReadCoord(); self.velocity_z = ReadCoord(); - self.gravity = ReadCoord(); + if(f & 0x10) + self.gravity = ReadCoord(); + else + self.gravity = 0; // default self.move_origin = self.origin; self.move_velocity = self.velocity; } - if(time == self.spawntime || (self.count & 0x80) || (f & 0x10)) + if(time == self.spawntime || (self.count & 0x80) || (f & 0x08)) { self.trail_oldorigin = self.origin; if(!(self.count & 0x80)) diff --git a/qcsrc/server/csqcprojectile.qc b/qcsrc/server/csqcprojectile.qc index e585b1e379..49076bb813 100644 --- a/qcsrc/server/csqcprojectile.qc +++ b/qcsrc/server/csqcprojectile.qc @@ -4,8 +4,8 @@ float CSQCProjectile_SendEntity(entity to, float sf) { float ft, fr; - // note: flag 0x10 = no trail please - sf = sf & 0x1F; + // note: flag 0x08 = no trail please (teleport bit) + sf = sf & 0x0F; if(self.csqcprojectile_clientanimate) sf |= 0x80; // client animated, not interpolated @@ -21,6 +21,9 @@ float CSQCProjectile_SendEntity(entity to, float sf) sf |= 0x20; } + if(self.gravity != 0 && self.gravity != 1) + sf |= 0x10; + WriteByte(MSG_ENTITY, ENT_CLIENT_PROJECTILE); WriteByte(MSG_ENTITY, sf); @@ -35,7 +38,8 @@ float CSQCProjectile_SendEntity(entity to, float sf) WriteCoord(MSG_ENTITY, self.velocity_x); WriteCoord(MSG_ENTITY, self.velocity_y); WriteCoord(MSG_ENTITY, self.velocity_z); - WriteCoord(MSG_ENTITY, self.gravity); + if(sf & 0x10) + WriteCoord(MSG_ENTITY, self.gravity); } if(sf & 0x20) @@ -85,7 +89,7 @@ void UpdateCSQCProjectile(entity e) if(e.SendEntity == CSQCProjectile_SendEntity) { // send new origin data - e.SendFlags |= 1; + e.SendFlags |= 0x01; } } @@ -93,8 +97,10 @@ void UpdateCSQCProjectileAfterTeleport(entity e) { if(e.SendEntity == CSQCProjectile_SendEntity) { - // send new origin data and mark as teleported - e.SendFlags |= 0x11; + // send new origin data + e.SendFlags |= 0x01; + // mark as teleported + e.SendFlags |= 0x08; } } -- 2.39.2