From 29bbefdbb485a916a2889258c823670f01876015 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 27 Dec 2011 10:51:53 +0100 Subject: [PATCH] fix some issues with spectating --- qcsrc/csqcmodellib/cl_player.qc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/qcsrc/csqcmodellib/cl_player.qc b/qcsrc/csqcmodellib/cl_player.qc index d1cfa4060..8eaa5c3c8 100644 --- a/qcsrc/csqcmodellib/cl_player.qc +++ b/qcsrc/csqcmodellib/cl_player.qc @@ -209,6 +209,15 @@ void CSQCPlayer_SetCamera() view = CSQCModel_server2csqc(player_localentnum); #endif + if(view != csqcplayer) + { + entity oldself = self; + self = view; + InterpolateOrigin_Do(); + self.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT); + self = oldself; + } + #ifdef COMPAT_XON050_ENGINE if(view && !(checkextension("DP_CSQC_V_CALCREFDEF") || checkextension("DP_CSQC_V_CALCREFDEF_WIP1"))) { @@ -241,17 +250,14 @@ void CSQCPlayer_SetCamera() void CSQCPlayer_Remove() { - if(self.entnum != player_localnum + 1) - return; csqcplayer = world; cvar_clientsettemp("cl_movement_replay", "1"); } float CSQCPlayer_PreUpdate() { - if(self.entnum != player_localnum + 1) + if(self != csqcplayer) return 0; - cvar_clientsettemp("cl_movement_replay", "0"); if(csqcplayer_status != CSQCPLAYERSTATUS_FROMSERVER) CSQCPlayer_Unpredict(); return 1; @@ -259,10 +265,11 @@ float CSQCPlayer_PreUpdate() float CSQCPlayer_PostUpdate() { - if(self.entnum != player_localentnum) + if(self.entnum != player_localnum + 1) return 0; - csqcplayer_status = CSQCPLAYERSTATUS_FROMSERVER; csqcplayer = self; + csqcplayer_status = CSQCPLAYERSTATUS_FROMSERVER; + cvar_clientsettemp("cl_movement_replay", "0"); self.entremove = CSQCPlayer_Remove; return 1; } -- 2.39.2