]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/csqcmodellib/cl_player.qc
Merge remote-tracking branch 'origin/Mario/mute_bot_warnings'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / csqcmodellib / cl_player.qc
index 3c75b399f7b31a310979443620a048a6c1301655..2711867dbc445cb68f9930c4a81600d9d3601d14 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
 
-entity csqcplayer;
 vector csqcplayer_origin, csqcplayer_velocity;
 float csqcplayer_sequence, player_pmflags;
 float csqcplayer_moveframe;
@@ -136,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;
@@ -145,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)
        {
@@ -216,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;
@@ -243,6 +245,14 @@ void CSQCPlayer_SetCamera()
                        }
                        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;