From 57a11ca5913eeb314860a991e70d63359d686ce7 Mon Sep 17 00:00:00 2001 From: div0 Date: Thu, 2 Oct 2008 06:33:24 +0000 Subject: [PATCH] optimize entcs data git-svn-id: svn://svn.icculus.org/nexuiz/trunk@4574 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/client/Main.qc | 7 ++++--- data/qcsrc/common/constants.qh | 3 ++- data/qcsrc/server/ent_cs.qc | 7 ++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/data/qcsrc/client/Main.qc b/data/qcsrc/client/Main.qc index 69d908ce4..c565da3a9 100644 --- a/data/qcsrc/client/Main.qc +++ b/data/qcsrc/client/Main.qc @@ -332,9 +332,10 @@ void Ent_ReadEntCS() InterpolateOrigin_Undo(); - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.angles_y = ReadCoord(); + self.origin_x = ReadShort(); + self.origin_y = ReadShort(); + self.origin_z = ReadShort(); + self.angles_y = ReadByte() * 360.0 / 256; self.origin_z = self.angles_x = self.angles_z = 0; InterpolateOrigin_Note(); diff --git a/data/qcsrc/common/constants.qh b/data/qcsrc/common/constants.qh index 872d0b1b9..97340b53e 100644 --- a/data/qcsrc/common/constants.qh +++ b/data/qcsrc/common/constants.qh @@ -19,7 +19,8 @@ // Revision 18: warmup // Revision 19: fog // Revision 20: naggers -#define CSQC_REVISION 20 +// Revision 21: entcs for players optimized (position data down from 12 to 7 bytes) +#define CSQC_REVISION 21 // probably put these in common/ // so server/ and client/ can be synced better diff --git a/data/qcsrc/server/ent_cs.qc b/data/qcsrc/server/ent_cs.qc index c562cfee2..5fd09b783 100644 --- a/data/qcsrc/server/ent_cs.qc +++ b/data/qcsrc/server/ent_cs.qc @@ -41,9 +41,10 @@ void entcs_ons(entity to) return; } WriteByte(MSG_ENTITY, ENTCS_MSG_ONS_GPS); - WriteCoord(MSG_ENTITY, self.owner.origin_x); - WriteCoord(MSG_ENTITY, self.owner.origin_y); - WriteCoord(MSG_ENTITY, self.owner.angles_y); + WriteShort(MSG_ENTITY, self.owner.origin_x); + WriteShort(MSG_ENTITY, self.owner.origin_y); + WriteShort(MSG_ENTITY, self.owner.origin_z); + WriteByte(MSG_ENTITY, self.owner.angles_y * 256.0 / 360); } void entcs_common_self() -- 2.39.2