]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/warpzone/client.qc
Add a hack to fix the use of self in .predraw functions
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / warpzone / client.qc
index 49216057c447f115009ddc82c2f13da67cb3ee40..89f6b84afcef4d306989867fe4c2bb6160247922 100644 (file)
@@ -2,31 +2,32 @@
 #include "common.qh"
 
 #if defined(CSQC)
-       #include "../../client/autocvars.qh"
-       #include "../csqcmodel/cl_model.qh"
+       #include <client/autocvars.qh>
+       #include <lib/csqcmodel/cl_model.qh>
 #elif defined(MENUQC)
 #elif defined(SVQC)
 #endif
 
-void WarpZone_Fade_PreDraw()
-{SELFPARAM();
+void WarpZone_Fade_PreDraw(entity this)
+{
        vector org;
        org = getpropertyvec(VF_ORIGIN);
-       if(!checkpvs(org, self)) // this makes sense as long as we don't support recursive warpzones
-               self.alpha = 0;
-       else if(self.warpzone_fadestart)
-               self.alpha = bound(0, (self.warpzone_fadeend - vlen(org - self.origin - 0.5 * (self.mins + self.maxs))) / (self.warpzone_fadeend - self.warpzone_fadestart), 1);
+       if(!checkpvs(org, this)) // this makes sense as long as we don't support recursive warpzones
+               this.alpha = 0;
+       else if(this.warpzone_fadestart)
+               this.alpha = bound(0, (this.warpzone_fadeend - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.warpzone_fadeend - this.warpzone_fadestart), 1);
        else
-               self.alpha = 1;
-       //printf("%v <-> %v\n", view_origin, self.origin + 0.5 * (self.mins + self.maxs));
-       if(self.alpha <= 0)
-               self.drawmask = 0;
+               this.alpha = 1;
+       //printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs));
+       if(this.alpha <= 0)
+               this.drawmask = 0;
        else
-               self.drawmask = MASK_NORMAL;
+               this.drawmask = MASK_NORMAL;
 }
 
-void WarpZone_Read(float isnew)
-{SELFPARAM();
+void WarpZone_Touch ();
+NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew)
+{
        warpzone_warpzones_exist = 1;
        if (!self.enemy)
        {
@@ -86,11 +87,14 @@ void WarpZone_Read(float isnew)
 
        // how to draw
        // engine currently wants this
-       self.predraw = WarpZone_Fade_PreDraw;
+       setpredraw(self, WarpZone_Fade_PreDraw);
+
+       //self.move_touch = WarpZone_Touch;
+       return true;
 }
 
-void WarpZone_Camera_Read(float isnew)
-{SELFPARAM();
+NET_HANDLE(ENT_CLIENT_WARPZONE_CAMERA, bool isnew)
+{
        warpzone_cameras_exist = 1;
        self.classname = "func_warpzone_camera";
 
@@ -142,19 +146,20 @@ void WarpZone_Camera_Read(float isnew)
 
        // how to draw
        // engine currently wants this
-       self.predraw = WarpZone_Fade_PreDraw;
+       setpredraw(self, WarpZone_Fade_PreDraw);
+       return true;
 }
 
 void CL_RotateMoves(vector ang) = #638;
-void WarpZone_Teleported_Read(float isnew)
-{SELFPARAM();
+NET_HANDLE(ENT_CLIENT_WARPZONE_TELEPORTED, bool isnew)
+{
        self.classname = "warpzone_teleported";
        vector v;
        v.x = ReadCoord();
        v.y = ReadCoord();
        v.z = ReadCoord();
-       if(!isnew)
-               return;
+       return = true;
+       if (!isnew) return;
        self.warpzone_transform = v;
        setproperty(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(self, getpropertyvec(VF_CL_VIEWANGLES)));
        if(checkextension("DP_CSQC_ROTATEMOVES"))
@@ -278,10 +283,6 @@ void WarpZone_FixView()
                setproperty(VF_ORIGIN, org + o);
 }
 
-void WarpZone_Init()
-{
-}
-
 void WarpZone_Shutdown()
 {
        WarpZone_View_Outside();