]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/csqcmodellib/cl_player.qc
Merge branch 'master' into terencehill/music_player
[xonotic/xonotic-data.pk3dir.git] / qcsrc / csqcmodellib / cl_player.qc
index 2ececc6e1781cc26d2b98b92cdc4cdb39a60cdb4..4f7381a4af83fa73047368e1b9bccd5492e1cc09 100644 (file)
 var float autocvar_cl_movement_errorcompensation = 0;
 
 // engine stuff
-.float pmove_flags;
-float pmove_onground; // weird engine flag we shouldn't really use but have to for now
-#define PMF_JUMP_HELD 1
-#define PMF_DUCKED 4
-#define PMF_ONGROUND 8
 #define REFDEFFLAG_TELEPORTED 1
 #define REFDEFFLAG_JUMPING 2
+float pmove_onground; // weird engine flag we shouldn't really use but have to for now
 
 vector csqcplayer_origin, csqcplayer_velocity;
 float csqcplayer_sequence, player_pmflags;
@@ -64,13 +60,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;
        }
 
@@ -135,8 +131,9 @@ void CSQCPlayer_PredictTo(float endframe, float apply_error)
 
        csqcplayer_status = CSQCPLAYERSTATUS_PREDICTED;
 
-       // FIXME do we really NEED this? dead players have servercommandframe
-       // == 0 and thus won't predict
+#if 0
+       // we don't need this
+       // darkplaces makes servercommandframe == 0 in these cases anyway
        if (getstatf(STAT_HEALTH) <= 0)
        {
                csqcplayer_moveframe = clientcommandframe;
@@ -144,6 +141,7 @@ void CSQCPlayer_PredictTo(float endframe, float apply_error)
                print("the Weird code path got hit\n");
                return;
        }
+#endif
 
        if(csqcplayer_moveframe >= endframe)
        {
@@ -195,7 +193,7 @@ void CSQCPlayer_SetCamera()
 
                        // get crouch state from the server
                        if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
-                               self.pmove_flags &~= PMF_DUCKED;
+                               self.pmove_flags &= ~PMF_DUCKED;
                        else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
                                self.pmove_flags |= PMF_DUCKED;
 
@@ -203,7 +201,7 @@ void CSQCPlayer_SetCamera()
                        if(pmove_onground)
                                self.pmove_flags |= PMF_ONGROUND;
                        else
-                               self.pmove_flags &~= PMF_ONGROUND;
+                               self.pmove_flags &= ~PMF_ONGROUND;
 
                        CSQCPlayer_SetMinsMaxs();
 
@@ -215,6 +213,11 @@ void CSQCPlayer_SetCamera()
                }
                else
                {
+                       float flg = self.iflags;
+                       self.iflags &= ~(IFLAG_ORIGIN | IFLAG_ANGLES);
+                       InterpolateOrigin_Do();
+                       self.iflags = flg;
+
                        if(csqcplayer_status == CSQCPLAYERSTATUS_FROMSERVER)
                        {
                                vector o, v;
@@ -228,7 +231,7 @@ void CSQCPlayer_SetCamera()
 
                                // get crouch state from the server
                                if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
-                                       self.pmove_flags &~= PMF_DUCKED;
+                                       self.pmove_flags &= ~PMF_DUCKED;
                                else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
                                        self.pmove_flags |= PMF_DUCKED;
 
@@ -236,12 +239,20 @@ void CSQCPlayer_SetCamera()
                                if(pmove_onground)
                                        self.pmove_flags |= PMF_ONGROUND;
                                else
-                                       self.pmove_flags &~= PMF_ONGROUND;
+                                       self.pmove_flags &= ~PMF_ONGROUND;
 
                                CSQCPlayer_SavePrediction();
                        }
                        CSQCPlayer_PredictTo(clientcommandframe + 1, TRUE);
 
+#ifdef CSQCMODEL_SERVERSIDE_CROUCH
+                       // get crouch state from the server (LAG)
+                       if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
+                               self.pmove_flags &= ~PMF_DUCKED;
+                       else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
+                               self.pmove_flags |= PMF_DUCKED;
+#endif
+
                        CSQCPlayer_SetMinsMaxs();
 
                        self.angles_y = input_angles_y;