]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
instead of fixangle, use a R_SetView based hack to adjust view angles after a warp...
authorRudolf Polzer <divverent@alientrap.org>
Fri, 29 Apr 2011 19:38:55 +0000 (21:38 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 29 Apr 2011 19:38:55 +0000 (21:38 +0200)
qcsrc/client/Main.qc
qcsrc/common/constants.qh
qcsrc/warpzonelib/client.qc
qcsrc/warpzonelib/client.qh
qcsrc/warpzonelib/server.qc

index 81a713c32456ee7d3b0d5034dacb31f9da1df228..2ec193b8416bc2308da66a25209d8ca2b41a83ae 100644 (file)
@@ -962,6 +962,7 @@ void(float bIsNewEntity) CSQC_Ent_Update =
                case ENT_CLIENT_TUBANOTE: Ent_TubaNote(bIsNewEntity); break;
                case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;
                case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;
+               case ENT_CLIENT_WARPZONE_TELEPORTED: WarpZone_Teleported_Read(bIsNewEntity); break;
                case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;
                case ENT_CLIENT_HOOK: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break;
                case ENT_CLIENT_LGBEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_LGBEAM); break;
index 419ab73e8fa1b8e14d21f44afca79f7775e0936b..64dcaa44e1fb25f1fdb12c3c08767d1286632aad 100644 (file)
@@ -113,6 +113,7 @@ const float ENT_CLIENT_HOOK = 27;
 const float ENT_CLIENT_LGBEAM = 28;
 const float ENT_CLIENT_GAUNTLET = 29;
 const float ENT_CLIENT_ACCURACY = 30;
+const float ENT_CLIENT_WARPZONE_TELEPORTED = 31;
 
 const float ENT_CLIENT_TURRET = 40;
 
index f02fa4a30266d097b9c595d413829300999eeb4d..39df6df90d1c26bf3c6d8a2b78914177548740b8 100644 (file)
@@ -141,6 +141,19 @@ void WarpZone_Camera_Read(float isnew)
                self.drawmask = MASK_NORMAL;
 }
 
+void WarpZone_Teleported_Read(float isnew)
+{
+       vector v;
+       self.classname = "warpzone_teleported";
+       v_x = ReadCoord();
+       v_y = ReadCoord();
+       v_z = ReadCoord();
+       if(!isnew)
+               return;
+       self.warpzone_transform = v;
+       R_SetView3fv(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(self, R_SetView3fv(VF_CL_VIEWANGLES)));
+}
+
 float warpzone_fixingview;
 float warpzone_fixingview_drawexteriormodel;
 //float warpzone_fixingview_sidespeed;
index e8f44be136d4effa8c4cf5102554fdab48c77eec..d5b3ac2fc097887b0a6181b059033fc214b3e2b8 100644 (file)
@@ -1,5 +1,6 @@
 void WarpZone_Read(float bIsNewEntity);
 void WarpZone_Camera_Read(float bIsNewEntity);
+void WarpZone_Teleported_Read(float bIsNewEntity);
 
 vector warpzone_fixview_origin;
 vector warpzone_fixview_angles;
index dee94fd8565d0655388842bacecfccd81bacd34f..29f5dc8db11aaf218354895ed5bba94f53e76397 100644 (file)
@@ -33,6 +33,15 @@ void WarpZone_TeleportPlayer(entity teleporter, entity player, vector to, vector
        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 +101,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;
 }