]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
optimize a bit more
authorRudolf Polzer <divverent@alientrap.org>
Sat, 25 Sep 2010 19:24:41 +0000 (21:24 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 25 Sep 2010 19:24:41 +0000 (21:24 +0200)
qcsrc/warpzonelib/client.qc
qcsrc/warpzonelib/server.qc

index cb2ac268a22324ad04ea773f3c9a3d1fe700229f..164294044fadb50d9f4c845c27c3c40838c34c09 100644 (file)
@@ -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();
index 8879d6f425a7a9aa4178d941501a6e0043407792..b677467b374ff037dbe6d9767bd6945a76e9adc1 100644 (file)
@@ -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);