From: Rudolf Polzer Date: Fri, 29 Apr 2011 19:38:55 +0000 (+0200) Subject: instead of fixangle, use a R_SetView based hack to adjust view angles after a warp... X-Git-Tag: xonotic-v0.5.0~264^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e67f2a53bd5dced70f4b3b546b3571aa63863dc2;p=xonotic%2Fxonotic-data.pk3dir.git instead of fixangle, use a R_SetView based hack to adjust view angles after a warp. No longer "resets" the view. Turn of by -DWARPZONE_USE_FIXANGLE. --- diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 81a713c32..2ec193b84 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -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; diff --git a/qcsrc/common/constants.qh b/qcsrc/common/constants.qh index 419ab73e8..64dcaa44e 100644 --- a/qcsrc/common/constants.qh +++ b/qcsrc/common/constants.qh @@ -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; diff --git a/qcsrc/warpzonelib/client.qc b/qcsrc/warpzonelib/client.qc index f02fa4a30..39df6df90 100644 --- a/qcsrc/warpzonelib/client.qc +++ b/qcsrc/warpzonelib/client.qc @@ -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; diff --git a/qcsrc/warpzonelib/client.qh b/qcsrc/warpzonelib/client.qh index e8f44be13..d5b3ac2fc 100644 --- a/qcsrc/warpzonelib/client.qh +++ b/qcsrc/warpzonelib/client.qh @@ -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; diff --git a/qcsrc/warpzonelib/server.qc b/qcsrc/warpzonelib/server.qc index dee94fd85..29f5dc8db 100644 --- a/qcsrc/warpzonelib/server.qc +++ b/qcsrc/warpzonelib/server.qc @@ -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; }