added sneaking/crouching and changelog
[oweals/minetest.git] / src / player.h
index 3bbb4034d3ff5bfeb41c8af1404006b91b604aea..27ce1f5aafdc909116a61b9523e65e44e03f3012 100644 (file)
@@ -42,7 +42,7 @@ public:
        void resetInventory();
 
        //void move(f32 dtime, Map &map);
-       virtual void move(f32 dtime, Map &map) = 0;
+       virtual void move(f32 dtime, Map &map, f32 pos_max_d) = 0;
 
        v3f getSpeed()
        {
@@ -114,7 +114,10 @@ public:
        void deSerialize(std::istream &is);
 
        bool touching_ground;
+       // This oscillates so that the player jumps a bit above the surface
        bool in_water;
+       // This is more stable and defines the maximum speed of the player
+       bool in_water_stable;
        bool swimming_up;
        
        Inventory inventory;
@@ -144,7 +147,7 @@ public:
                return false;
        }
 
-       virtual void move(f32 dtime, Map &map)
+       virtual void move(f32 dtime, Map &map, f32 pos_max_d)
        {
        }
 
@@ -237,7 +240,7 @@ public:
                }
        }
        
-       void move(f32 dtime, Map &map);
+       void move(f32 dtime, Map &map, f32 pos_max_d);
 
 private:
        scene::IMeshSceneNode *m_node;
@@ -264,6 +267,7 @@ struct PlayerControl
                right = false;
                jump = false;
                aux1 = false;
+               sneak = false;
                pitch = 0;
                yaw = 0;
        }
@@ -274,6 +278,7 @@ struct PlayerControl
                bool a_right,
                bool a_jump,
                bool a_aux1,
+               bool a_sneak,
                float a_pitch,
                float a_yaw
        )
@@ -284,6 +289,7 @@ struct PlayerControl
                right = a_right;
                jump = a_jump;
                aux1 = a_aux1;
+               sneak = a_sneak;
                pitch = a_pitch;
                yaw = a_yaw;
        }
@@ -293,6 +299,7 @@ struct PlayerControl
        bool right;
        bool jump;
        bool aux1;
+       bool sneak;
        float pitch;
        float yaw;
 };
@@ -308,13 +315,15 @@ public:
                return true;
        }
 
-       void move(f32 dtime, Map &map);
+       void move(f32 dtime, Map &map, f32 pos_max_d);
 
        void applyControl(float dtime);
        
        PlayerControl control;
 
 private:
+       // This is used for determining the sneaking range
+       v3s16 m_last_walked_node;
 };
 #endif // !SERVER