]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/warpzonelib/server.qc
Merge branch 'master' into tzork/ents-onoff
[xonotic/xonotic-data.pk3dir.git] / qcsrc / warpzonelib / server.qc
index ecfddff1ab5b4b1b9e56a5489b446b51a9f5d90a..cfa6ef965ec768949733736a165038d08555fd28 100644 (file)
@@ -137,15 +137,26 @@ void WarpZone_Touch (void)
 
 float WarpZone_Send(entity to, float sendflags)
 {
+       float f;
        WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE);
 
        // we must send this flag for clientside to match properly too
-       WriteByte(MSG_ENTITY, self.warpzone_isboxy);
+       f = 0;
+       if(self.warpzone_isboxy)
+               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);
@@ -170,17 +181,33 @@ float WarpZone_Send(entity to, float sendflags)
        WriteCoord(MSG_ENTITY, self.warpzone_targetangles_y);
        WriteCoord(MSG_ENTITY, self.warpzone_targetangles_z);
 
+       if(f & 2)
+       {
+               WriteShort(MSG_ENTITY, self.warpzone_fadestart);
+               WriteShort(MSG_ENTITY, self.warpzone_fadeend);
+       }
+
        return TRUE;
 }
 
 float WarpZone_Camera_Send(entity to, float sendflags)
 {
+       float f;
        WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
 
+       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);
@@ -199,6 +226,12 @@ float WarpZone_Camera_Send(entity to, float sendflags)
        WriteCoord(MSG_ENTITY, self.enemy.angles_y);
        WriteCoord(MSG_ENTITY, self.enemy.angles_z);
 
+       if(f & 2)
+       {
+               WriteShort(MSG_ENTITY, self.warpzone_fadestart);
+               WriteShort(MSG_ENTITY, self.warpzone_fadeend);
+       }
+
        return TRUE;
 }
 
@@ -222,7 +255,7 @@ float WarpZone_CheckProjectileImpact()
        WarpZone_TraceBox_ThroughZone(self.warpzone_oldorigin, self.mins, self.maxs, self.warpzone_oldorigin + self.warpzone_oldvelocity * frametime, MOVE_NORMAL, self, wz, WarpZone_trace_callback_t_null); // this will get us through the warpzone
        setorigin(self, trace_endpos);
        self.angles = WarpZone_TransformAngles(WarpZone_trace_transform, self.angles);
-       self.velocity = WarpZone_TransformVelocity(WarpZone_trace_transform, self.velocity);
+       self.velocity = WarpZone_TransformVelocity(WarpZone_trace_transform, self.warpzone_oldvelocity);
        
        // in case we are in our warp zone post-teleport, shift the projectile forward a bit
        mpd = max(vlen(self.mins), vlen(self.maxs));