]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/warpzonelib/client.qc
Merge remote branch 'refs/remotes/origin/fruitiex/racefixes'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / warpzonelib / client.qc
index cb2ac268a22324ad04ea773f3c9a3d1fe700229f..f02fa4a30266d097b9c595d413829300999eeb4d 100644 (file)
@@ -1,9 +1,10 @@
 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 = bound(0, (self.warpzone_fadeend - vlen(view_origin - self.origin - 0.5 * (self.mins + self.maxs))) / (self.warpzone_fadeend - self.warpzone_fadestart), 1);
        else
                self.alpha = 1;
+       //print(sprintf("%v <-> %v\n", view_origin, self.origin + 0.5 * (self.mins + self.maxs)));
        if(self.alpha <= 0)
                self.drawmask = 0;
        else
@@ -14,7 +15,7 @@ void WarpZone_Read(float isnew)
 {
        float f;
 
-       ++warpzone_warpzones_exist;
+       warpzone_warpzones_exist = 1;
        if not(self.enemy)
        {
                self.enemy = spawn();
@@ -24,9 +25,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();
@@ -78,13 +84,18 @@ void WarpZone_Read(float isnew)
 void WarpZone_Camera_Read(float isnew)
 {
        float f;
-       ++warpzone_cameras_exist;
+       warpzone_cameras_exist = 1;
        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();
@@ -159,7 +170,6 @@ void WarpZone_Outside()
 
 vector WarpZone_FixNearClip(vector o, vector c0, vector c1, vector c2, vector c3)
 {
-       float nearclipdistance;
        vector mi, ma;
        entity e;
        float pd;
@@ -199,7 +209,7 @@ var float autocvar_cl_rollkillspeed = 10;
 #endif
 void WarpZone_FixView()
 {
-       float pd, f;
+       float f;
        vector o;
        entity e;
        vector corner0, corner1, corner2, corner3, nearclip;