]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/client/localplayer.h
Merge branch 'master' of https://github.com/minetest/minetest
[dragonfireclient.git] / src / client / localplayer.h
index 650a015741ccf77332bf2b9cba290e98f9b5fc87..271589c592b58210f3a3a1a2ed46e65cb927eff8 100644 (file)
@@ -32,6 +32,7 @@ class GenericCAO;
 class ClientActiveObject;
 class ClientEnvironment;
 class IGameDef;
+struct ContentFeatures;
 struct collisionMoveResult;
 
 enum LocalPlayerAnimations
@@ -132,11 +133,39 @@ class LocalPlayer : public Player
        inline void setPosition(const v3f &position)
        {
                m_position = position;
+               if (! m_freecam)
+                       m_legit_position = position;
                m_sneak_node_exists = false;
        }
 
        v3f getPosition() const { return m_position; }
 
+       v3f getLegitPosition() const { return m_legit_position; }
+
+       v3f getLegitSpeed() const { return m_freecam ? m_legit_speed : m_speed; }
+
+       v3f getSendSpeed();
+
+       inline void setLegitPosition(const v3f &position)
+       {
+               if (m_freecam)
+                       m_legit_position = position;
+               else
+                       setPosition(position);
+       }
+
+       inline void freecamEnable()
+       {
+               m_freecam = true;
+       }
+
+       inline void freecamDisable()
+       {
+               m_freecam = false;
+               setPosition(m_legit_position);
+               setSpeed(m_legit_speed);
+       }
+
        // Non-transformed eye offset getters
        // For accurate positions, use the Camera functions
        v3f getEyePosition() const { return m_position + getEyeOffset(); }
@@ -161,6 +190,12 @@ class LocalPlayer : public Player
 
        inline Lighting& getLighting() { return m_lighting; }
 
+       void tryReattach(int id);
+
+       bool isWaitingForReattach() const;
+
+       bool canWalkOn(const ContentFeatures &f);
+
 private:
        void accelerate(const v3f &target_speed, const f32 max_increase_H,
                const f32 max_increase_V, const bool use_pitch);
@@ -171,7 +206,10 @@ class LocalPlayer : public Player
                const v3f &position_before_move, const v3f &speed_before_move,
                f32 pos_max_d);
 
+       bool m_freecam = false;
        v3f m_position;
+       v3f m_legit_position;
+       v3f m_legit_speed;
        v3s16 m_standing_node;
 
        v3s16 m_sneak_node = v3s16(32767, 32767, 32767);