]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/warpzonelib/server.qc
Merge remote-tracking branch 'origin/nifrek/skinfixes'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / warpzonelib / server.qc
index dee94fd8565d0655388842bacecfccd81bacd34f..921b2ed58289df9fadff0acb3d409feca06d498f 100644 (file)
@@ -22,17 +22,23 @@ void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector
        player.fixangle = TRUE;
        player.velocity = to_velocity;
 
-       if(player.effects & EF_TELEPORT_BIT)
-               player.effects &~= EF_TELEPORT_BIT;
-       else
-               player.effects |= EF_TELEPORT_BIT;
+       BITXOR_ASSIGN(player.effects, EF_TELEPORT_BIT);
 
        if(player.classname == "player")
-               player.flags &~= FL_ONGROUND;
+               BITCLR_ASSIGN(player.flags, FL_ONGROUND);
 
        WarpZone_PostTeleportPlayer_Callback(player);
 }
 
+float WarpZone_Teleported_Send(entity to, float sf)
+{
+       WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED);
+       WriteCoord(MSG_ENTITY, self.angles_x);
+       WriteCoord(MSG_ENTITY, self.angles_y);
+       WriteCoord(MSG_ENTITY, self.angles_z);
+       return TRUE;
+}
+
 float WarpZone_Teleport(entity player)
 {
        vector o0, a0, v0, o1, a1, v1;
@@ -92,6 +98,23 @@ float WarpZone_Teleport(entity player)
        WarpZone_StoreProjectileData(player);
        player.warpzone_teleport_time = time;
        player.warpzone_teleport_zone = self;
+#ifndef WARPZONE_USE_FIXANGLE
+       // instead of fixangle, send the transform to the client for smoother operation
+       player.fixangle = FALSE;
+
+       entity ts = spawn();
+       setmodel(ts, "null");
+       ts.SendEntity = WarpZone_Teleported_Send;
+       ts.SendFlags = 0xFFFFFF;
+       ts.drawonlytoclient = player;
+       ts.think = SUB_Remove;
+       ts.nextthink = time + 1;
+       ts.owner = player;
+       ts.enemy = self;
+       ts.effects = EF_NODEPTHTEST;
+       ts.classname = "warpzone_teleported";
+       ts.angles = self.warpzone_transform;
+#endif
 
        return 1;
 }
@@ -145,11 +168,11 @@ float WarpZone_Send(entity to, float sendflags)
        // we must send this flag for clientside to match properly too
        f = 0;
        if(self.warpzone_isboxy)
-               f |= 1;
+               BITSET_ASSIGN(f, 1);
        if(self.warpzone_fadestart)
-               f |= 2;
+               BITSET_ASSIGN(f, 2);
        if(self.origin != '0 0 0')
-               f |= 4;
+               BITSET_ASSIGN(f, 4);
        WriteByte(MSG_ENTITY, f);
 
        // we need THESE to render the warpzone (and cull properly)...
@@ -198,9 +221,9 @@ float WarpZone_Camera_Send(entity to, float sendflags)
        WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
 
        if(self.warpzone_fadestart)
-               f |= 2;
+               BITSET_ASSIGN(f, 2);
        if(self.origin != '0 0 0')
-               f |= 4;
+               BITSET_ASSIGN(f, 4);
        WriteByte(MSG_ENTITY, f);
 
        // we need THESE to render the warpzone (and cull properly)...
@@ -385,7 +408,7 @@ void WarpZone_InitStep_UpdateTransform()
                tex = getsurfacetexture(self, i_s);
                if not(tex)
                        break; // this is beyond the last one
-               if(tex == "textures/common/trigger")
+               if(tex == "textures/common/trigger" || tex == "trigger")
                        continue;
                n_t = getsurfacenumtriangles(self, i_s);
                for(i_t = 0; i_t < n_t; ++i_t)
@@ -546,7 +569,7 @@ void spawnfunc_trigger_warpzone(void)
                setsize(self, self.mins, self.maxs);
        self.SendEntity = WarpZone_Send;
        self.SendFlags = 0xFFFFFF;
-       self.effects |= EF_NODEPTHTEST;
+       BITSET_ASSIGN(self.effects, EF_NODEPTHTEST);
        self.warpzone_next = warpzone_first;
        warpzone_first = self;
 }