]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/lib/warpzone/client.qc
Merge branch 'master' into Mario/arc_bolt_bounce
[xonotic/xonotic-data.pk3dir.git] / qcsrc / lib / warpzone / client.qc
index fd0925db93f65720648b644818e06deb4bb82750..95c78e3898a8fa7f86ed416a2a3bb14ea004464d 100644 (file)
@@ -2,7 +2,6 @@
 #include "common.qh"
 
 #if defined(CSQC)
-       #include <client/autocvars.qh>
        #include <lib/csqcmodel/cl_model.qh>
 #elif defined(MENUQC)
 #elif defined(SVQC)
@@ -28,6 +27,11 @@ void WarpZone_Fade_PreDraw(entity this)
 void WarpZone_Touch(entity this, entity toucher);
 NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew)
 {
+       if(!warpzone_warpzones_exist)
+       {
+               cvar_settemp("r_water", "1"); // HACK for DarkPlaces: always enable reflections when a map has warpzones
+               cvar_settemp("r_water_resolutionmultiplier", "1"); // HACK for DarkPlaces: enforce full quality so entities can be seen clearly through warpzones
+       }
        warpzone_warpzones_exist = 1;
        if (!this.enemy)
        {
@@ -35,36 +39,25 @@ NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew)
        }
        this.classname = "trigger_warpzone";
 
+       if(isnew)
+               IL_PUSH(g_warpzones, this);
+
        int f = ReadByte();
        this.warpzone_isboxy = (f & 1);
        if(f & 4)
        {
-               this.origin_x = ReadCoord();
-               this.origin_y = ReadCoord();
-               this.origin_z = ReadCoord();
+               this.origin = ReadVector();
        }
        else
                this.origin = '0 0 0';
        this.modelindex = ReadShort();
-       this.mins_x = ReadCoord();
-       this.mins_y = ReadCoord();
-       this.mins_z = ReadCoord();
-       this.maxs_x = ReadCoord();
-       this.maxs_y = ReadCoord();
-       this.maxs_z = ReadCoord();
+       this.mins = ReadVector();
+       this.maxs = ReadVector();
        this.scale = ReadByte() / 16;
-       this.enemy.oldorigin_x = ReadCoord();
-       this.enemy.oldorigin_y = ReadCoord();
-       this.enemy.oldorigin_z = ReadCoord();
-       this.enemy.avelocity_x = ReadCoord();
-       this.enemy.avelocity_y = ReadCoord();
-       this.enemy.avelocity_z = ReadCoord();
-       this.oldorigin_x = ReadCoord();
-       this.oldorigin_y = ReadCoord();
-       this.oldorigin_z = ReadCoord();
-       this.avelocity_x = ReadCoord();
-       this.avelocity_y = ReadCoord();
-       this.avelocity_z = ReadCoord();
+       this.enemy.oldorigin = ReadVector();
+       this.enemy.avelocity = ReadVector();
+       this.oldorigin = ReadVector();
+       this.avelocity = ReadVector();
 
        if(f & 2)
        {
@@ -89,38 +82,33 @@ NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew)
        // engine currently wants this
        setpredraw(this, WarpZone_Fade_PreDraw);
 
-       //this.move_touch = WarpZone_Touch;
+       //settouch(this, WarpZone_Touch);
        return true;
 }
 
 NET_HANDLE(ENT_CLIENT_WARPZONE_CAMERA, bool isnew)
 {
+       if(!warpzone_cameras_exist)
+       {
+               cvar_settemp("r_water", "1"); // HACK for DarkPlaces: always enable reflections when a map has cameras
+               cvar_settemp("r_water_resolutionmultiplier", "1"); // HACK for DarkPlaces: enforce full quality so entities can be seen clearly through warpzones
+       }
        warpzone_cameras_exist = 1;
        this.classname = "func_warpzone_camera";
 
        int f = ReadByte();
        if(f & 4)
        {
-               this.origin_x = ReadCoord();
-               this.origin_y = ReadCoord();
-               this.origin_z = ReadCoord();
+               this.origin = ReadVector();
        }
        else
                this.origin = '0 0 0';
        this.modelindex = ReadShort();
-       this.mins_x = ReadCoord();
-       this.mins_y = ReadCoord();
-       this.mins_z = ReadCoord();
-       this.maxs_x = ReadCoord();
-       this.maxs_y = ReadCoord();
-       this.maxs_z = ReadCoord();
+       this.mins = ReadVector();
+       this.maxs = ReadVector();
        this.scale = ReadByte() / 16;
-       this.oldorigin_x = ReadCoord();
-       this.oldorigin_y = ReadCoord();
-       this.oldorigin_z = ReadCoord();
-       this.avelocity_x = ReadCoord();
-       this.avelocity_y = ReadCoord();
-       this.avelocity_z = ReadCoord();
+       this.oldorigin = ReadVector();
+       this.avelocity = ReadVector();
 
        if(f & 2)
        {
@@ -154,10 +142,7 @@ void CL_RotateMoves(vector ang) = #638;
 NET_HANDLE(ENT_CLIENT_WARPZONE_TELEPORTED, bool isnew)
 {
        this.classname = "warpzone_teleported";
-       vector v;
-       v.x = ReadCoord();
-       v.y = ReadCoord();
-       v.z = ReadCoord();
+       vector v = ReadVector();
        return = true;
        if (!isnew) return;
        this.warpzone_transform = v;
@@ -290,11 +275,13 @@ void WarpZone_FixView()
        setproperty(VF_ORIGIN, org);
        setproperty(VF_ANGLES, ang);
 
+       vector width = '1 0 0' * cvar("vid_conwidth");
+       vector height = '0 1 0' * cvar("vid_conheight");
        nearclip = '0 0 1' * (cvar("r_nearclip") * 1.125);
        corner0 = cs_unproject('0 0 0' + nearclip);
-       corner1 = cs_unproject('1 0 0' * cvar("vid_conwidth") + nearclip);
-       corner2 = cs_unproject('0 1 0' * cvar("vid_conheight") + nearclip);
-       corner3 = cs_unproject('1 0 0' * cvar("vid_conwidth") + '0 1 0' * cvar("vid_conheight") + nearclip);
+       corner1 = cs_unproject(width + nearclip);
+       corner2 = cs_unproject(height + nearclip);
+       corner3 = cs_unproject(width + height + nearclip);
        o = WarpZone_FixNearClip(org, corner0, corner1, corner2, corner3);
        if(o != '0 0 0')
                setproperty(VF_ORIGIN, org + o);