]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/csqcmodellib/cl_player.qc
Merge branch 'master' of /var/cache/git/xonotic/xonotic-data.pk3dir
[xonotic/xonotic-data.pk3dir.git] / qcsrc / csqcmodellib / cl_player.qc
index 9c62bbc5fabcc2e0072b7385d463f2d253eab11c..66b32befab0ea247f6f219511c7768f86da841d2 100644 (file)
@@ -112,27 +112,8 @@ void CSQCPlayer_PredictTo(float endframe)
                {
                        break;
                }
-               if(input_timelength <= 0.0005) // too short move
-               {
-                       dprint("CSQC physics hack: too short frame skipped\n");
-                       // even if not running physics, handle releasing the jump key
-                       if(!(input_buttons & 4))
-                               self.pmove_flags &~= PMF_JUMP_HELD;
-               }
-               else if(input_timelength > 0.05) // too long move
-               {
-                       dprint("CSQC physics hack: too long frame split in two\n");
-                       input_timelength *= 0.5;
-                       runstandardplayerphysics(self);
-                       CSQCPlayer_SetMinsMaxs();
-                       runstandardplayerphysics(self);
-                       CSQCPlayer_SetMinsMaxs();
-               }
-               else
-               {
-                       runstandardplayerphysics(self);
-                       CSQCPlayer_SetMinsMaxs();
-               }
+               runstandardplayerphysics(self);
+               CSQCPlayer_SetMinsMaxs();
                csqcplayer_moveframe++;
        }
 
@@ -156,9 +137,9 @@ void CSQCPlayer_SetCamera()
                self = csqcplayer;
 
 #ifdef COMPAT_XON050_ENGINE
-               if(servercommandframe == 0 || !(checkextension("DP_CSQC_V_CALCREFDEF") || checkextension("DP_CSQC_V_CALCREFDEF_WIP1")))
+               if(servercommandframe == 0 || clientcommandframe == 0 || !(checkextension("DP_CSQC_V_CALCREFDEF") || checkextension("DP_CSQC_V_CALCREFDEF_WIP1")))
 #else
-               if(servercommandframe == 0)
+               if(servercommandframe == 0 || clientcommandframe == 0)
 #endif
                {
                        InterpolateOrigin_Do();
@@ -228,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")))
        {
@@ -251,8 +241,12 @@ void CSQCPlayer_SetCamera()
        }
        else
        {
+               // FIXME by CSQC spec we have to do this:
+               // but it breaks chase cam
+               /*
                setproperty(VF_ORIGIN, pmove_org + '0 0 1' * getstati(STAT_VIEWHEIGHT));
                setproperty(VF_ANGLES, view_angles);
+               */
        }
 
        { CSQCPLAYER_HOOK_POSTCAMERASETUP }
@@ -260,17 +254,14 @@ void CSQCPlayer_SetCamera()
 
 void CSQCPlayer_Remove()
 {
-       if(self.entnum != player_localnum + 1)
-               return;
        csqcplayer = world;
-       cvar_clientsettemp("cl_movement_replay", "1");
+       cvar_settemp("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;
@@ -278,10 +269,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_settemp("cl_movement_replay", "0");
        self.entremove = CSQCPlayer_Remove;
        return 1;
 }