From: Rudolf Polzer Date: Sat, 25 Sep 2010 19:24:41 +0000 (+0200) Subject: optimize a bit more X-Git-Tag: xonotic-v0.1.0preview~310^2~7^2~4 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b9b03343340dc5da5b52aea654f6fd2b83208b2f;p=xonotic%2Fxonotic-data.pk3dir.git optimize a bit more --- diff --git a/qcsrc/warpzonelib/client.qc b/qcsrc/warpzonelib/client.qc index cb2ac268a..164294044 100644 --- a/qcsrc/warpzonelib/client.qc +++ b/qcsrc/warpzonelib/client.qc @@ -1,7 +1,7 @@ void WarpZone_Fade_PreDraw() { if(self.warpzone_fadestart) - self.alpha = (self.warpzone_fadeend - vlen(view_origin - self.origin)) / (self.warpzone_fadeend - self.warpzone_fadestart); + self.alpha = (self.warpzone_fadeend - vlen(view_origin - self.origin - 0.5 * (self.mins + self.maxs))) / (self.warpzone_fadeend - self.warpzone_fadestart); else self.alpha = 1; if(self.alpha <= 0) @@ -24,9 +24,14 @@ void WarpZone_Read(float isnew) f = ReadByte(); self.warpzone_isboxy = (f & 1); - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); + if(f & 4) + { + self.origin_x = ReadCoord(); + self.origin_y = ReadCoord(); + self.origin_z = ReadCoord(); + } + else + self.origin = '0 0 0'; self.modelindex = ReadShort(); self.mins_x = ReadCoord(); self.mins_y = ReadCoord(); @@ -82,9 +87,14 @@ void WarpZone_Camera_Read(float isnew) self.classname = "func_warpzone_camera"; f = ReadByte(); - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); + if(f & 4) + { + self.origin_x = ReadCoord(); + self.origin_y = ReadCoord(); + self.origin_z = ReadCoord(); + } + else + self.origin = '0 0 0'; self.modelindex = ReadShort(); self.mins_x = ReadCoord(); self.mins_y = ReadCoord(); diff --git a/qcsrc/warpzonelib/server.qc b/qcsrc/warpzonelib/server.qc index 8879d6f42..b677467b3 100644 --- a/qcsrc/warpzonelib/server.qc +++ b/qcsrc/warpzonelib/server.qc @@ -146,12 +146,17 @@ float WarpZone_Send(entity to, float sendflags) f |= 1; if(self.warpzone_fadestart) f |= 2; + if(self.origin != '0 0 0') + f |= 4; WriteByte(MSG_ENTITY, f); // we need THESE to render the warpzone (and cull properly)... - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + if(f & 4) + { + WriteCoord(MSG_ENTITY, self.origin_x); + WriteCoord(MSG_ENTITY, self.origin_y); + WriteCoord(MSG_ENTITY, self.origin_z); + } WriteShort(MSG_ENTITY, self.modelindex); WriteCoord(MSG_ENTITY, self.mins_x); @@ -192,12 +197,17 @@ float WarpZone_Camera_Send(entity to, float sendflags) if(self.warpzone_fadestart) f |= 2; + if(self.origin != '0 0 0') + f |= 4; WriteByte(MSG_ENTITY, f); // we need THESE to render the warpzone (and cull properly)... - WriteCoord(MSG_ENTITY, self.origin_x); - WriteCoord(MSG_ENTITY, self.origin_y); - WriteCoord(MSG_ENTITY, self.origin_z); + if(f & 4) + { + WriteCoord(MSG_ENTITY, self.origin_x); + WriteCoord(MSG_ENTITY, self.origin_y); + WriteCoord(MSG_ENTITY, self.origin_z); + } WriteShort(MSG_ENTITY, self.modelindex); WriteCoord(MSG_ENTITY, self.mins_x);