]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/csqcmodellib/cl_player.qc
Fix a crash
[xonotic/xonotic-data.pk3dir.git] / qcsrc / csqcmodellib / cl_player.qc
index 46c312f160ec8e333bd566897cf37aabc559affd..d3c56c813341e275eae06dfdcc08c57dbced4c6b 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 var float autocvar_cl_movement_errorcompensation = 0;
+var float autocvar_cl_movement = 2; // testing purposes
 
 // engine stuff
 #define REFDEFFLAG_TELEPORTED 1
@@ -60,13 +61,13 @@ void CSQCPlayer_SetPredictionError(vector o, vector v, float onground_diff)
        // commented out as this one did not help
        if(onground_diff)
        {
-               print(sprintf("ONGROUND MISMATCH: %d x=%v v=%v\n", onground_diff, o, v));
+               printf("ONGROUND MISMATCH: %d x=%v v=%v\n", onground_diff, o, v);
                return;
        }
        */
        if(vlen(o) > 32 || vlen(v) > 192)
        {
-               //print(sprintf("TOO BIG: x=%v v=%v\n", o, v));
+               //printf("TOO BIG: x=%v v=%v\n", o, v);
                return;
        }
 
@@ -119,6 +120,17 @@ void CSQCPlayer_SavePrediction()
        csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
 }
 
+void CSQC_ClientMovement_PlayerMove_Frame();
+
+void CSQCPlayer_Physics(void)
+{
+       switch(autocvar_cl_movement)
+       {
+               case 1: runstandardplayerphysics(self); break;
+               case 2: CSQC_ClientMovement_PlayerMove_Frame(); break;
+       }
+}
+
 void CSQCPlayer_PredictTo(float endframe, float apply_error)
 {
        CSQCPlayer_Unpredict();
@@ -153,7 +165,7 @@ void CSQCPlayer_PredictTo(float endframe, float apply_error)
                {
                        if (!getinputstate(csqcplayer_moveframe))
                                break;
-                       runstandardplayerphysics(self);
+                       CSQCPlayer_Physics();
                        CSQCPlayer_SetMinsMaxs();
                        csqcplayer_moveframe++;
                }
@@ -182,11 +194,7 @@ void CSQCPlayer_SetCamera()
                oldself = self;
                self = csqcplayer;
 
-#ifdef COMPAT_XON050_ENGINE
-               if(servercommandframe == 0 || clientcommandframe == 0 || !(checkextension("DP_CSQC_V_CALCREFDEF") || checkextension("DP_CSQC_V_CALCREFDEF_WIP1")))
-#else
                if(servercommandframe == 0 || clientcommandframe == 0)
-#endif
                {
                        InterpolateOrigin_Do();
                        self.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT);
@@ -265,11 +273,7 @@ void CSQCPlayer_SetCamera()
        }
 
        entity view;
-#ifdef COMPAT_XON050_ENGINE
-       view = CSQCModel_server2csqc((spectatee_status > 0) ? spectatee_status : player_localentnum);
-#else
        view = CSQCModel_server2csqc(player_localentnum);
-#endif
 
        if(view && view != csqcplayer)
        {
@@ -280,15 +284,6 @@ void CSQCPlayer_SetCamera()
                self = oldself;
        }
 
-#ifdef COMPAT_XON050_ENGINE
-       if(view && !(checkextension("DP_CSQC_V_CALCREFDEF") || checkextension("DP_CSQC_V_CALCREFDEF_WIP1")))
-       {
-               // legacy code, not totally correct, but good enough for not having V_CalcRefdef
-               setproperty(VF_ORIGIN, view.origin + '0 0 1' * getstati(STAT_VIEWHEIGHT));
-               setproperty(VF_ANGLES, view_angles);
-       }
-       else
-#endif
        if(view)
        {
                var float refdefflags = 0;