]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/csqcmodellib/cl_player.qc
Merge branch 'master' into Mario/qc_physics_prehax
[xonotic/xonotic-data.pk3dir.git] / qcsrc / csqcmodellib / cl_player.qc
index 1f5f2251f168dd491284ca2cedf3931f8ba69fd7..4360527674e16be74180abadb8a95aac5279e226 100644 (file)
@@ -35,7 +35,7 @@
 #endif
 
 float autocvar_cl_movement_errorcompensation = 0;
-float autocvar_cl_movement = 2; // testing purposes
+int autocvar_cl_movement = 1;
 
 // engine stuff
 float pmove_onground; // weird engine flag we shouldn't really use but have to for now
@@ -135,12 +135,23 @@ void CSQCPlayer_SavePrediction()
 
 void CSQC_ClientMovement_PlayerMove_Frame();
 
+void PM_Movement_Move()
+{
+       runstandardplayerphysics(self);
+#ifdef CSQC
+       self.flags = 
+                       ((self.pmove_flags & PMF_DUCKED) ? FL_DUCKED : 0) |
+                       (!(self.pmove_flags & PMF_JUMP_HELD) ? FL_JUMPRELEASED : 0) |
+                       ((self.pmove_flags & PMF_ONGROUND) ? FL_ONGROUND : 0);
+#endif
+}
+
 void CSQCPlayer_Physics(void)
 {
        switch(autocvar_cl_movement)
        {
-               case 1: runstandardplayerphysics(self); break;
-               case 2: CSQC_ClientMovement_PlayerMove_Frame(); break;
+               case 1: CSQC_ClientMovement_PlayerMove_Frame(); break;
+               case 2: PM_Movement_Move(); break;
        }
 }
 
@@ -189,7 +200,7 @@ void CSQCPlayer_PredictTo(float endframe, float apply_error)
        input_angles = view_angles;
 }
 
-float CSQCPlayer_IsLocalPlayer()
+bool CSQCPlayer_IsLocalPlayer()
 {
        return (self == csqcplayer);
 }
@@ -211,9 +222,9 @@ void CSQCPlayer_SetCamera()
                        self.view_ofs = '0 0 1' * getstati(STAT_VIEWHEIGHT);
 
                        // get crouch state from the server
-                       if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
+                       if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS.z)
                                self.flags &= ~FL_DUCKED;
-                       else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
+                       else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS.z)
                                self.flags |= FL_DUCKED;
 
                        // get onground state from the server
@@ -249,9 +260,9 @@ void CSQCPlayer_SetCamera()
                                self.velocity = v;
 
                                // get crouch state from the server
-                               if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
+                               if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS.z)
                                        self.flags &= ~FL_DUCKED;
-                               else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
+                               else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS.z)
                                        self.flags |= FL_DUCKED;
 
                                // get onground state from the server
@@ -266,9 +277,9 @@ void CSQCPlayer_SetCamera()
 
 #ifdef CSQCMODEL_SERVERSIDE_CROUCH
                        // get crouch state from the server (LAG)
-                       if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS_z)
+                       if(getstati(STAT_VIEWHEIGHT) == PL_VIEW_OFS.z)
                                self.flags &= ~FL_DUCKED;
-                       else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS_z)
+                       else if(getstati(STAT_VIEWHEIGHT) == PL_CROUCH_VIEW_OFS.z)
                                self.flags |= FL_DUCKED;
 #endif