]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/localplayer.h
Position entity nametags relative to selection-box (#7031)
[dragonfireclient.git] / src / localplayer.h
index 3d293ecf44963c9a298459afe9ae4cd2daf11fa6..77d79e47221c8a1790de5d456542ada37e804e77 100644 (file)
@@ -17,12 +17,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-#ifndef LOCALPLAYER_HEADER
-#define LOCALPLAYER_HEADER
+#pragma once
 
 #include "player.h"
 #include "environment.h"
 #include "constants.h"
+#include "settings.h"
 #include <list>
 
 class Client;
@@ -44,7 +44,7 @@ class LocalPlayer : public Player
 {
 public:
        LocalPlayer(Client *client, const char *name);
-       virtual ~LocalPlayer();
+       virtual ~LocalPlayer() = default;
 
        ClientActiveObject *parent = nullptr;
 
@@ -61,6 +61,7 @@ class LocalPlayer : public Player
        u8 liquid_viscosity = 0;
        bool is_climbing = false;
        bool swimming_vertical = false;
+       bool is_slipping = false;
 
        float physics_override_speed = 1.0f;
        float physics_override_jump = 1.0f;
@@ -124,11 +125,9 @@ class LocalPlayer : public Player
        v3s16 getLightPosition() const;
 
        void setYaw(f32 yaw) { m_yaw = yaw; }
-
        f32 getYaw() const { return m_yaw; }
 
        void setPitch(f32 pitch) { m_pitch = pitch; }
-
        f32 getPitch() const { return m_pitch; }
 
        inline void setPosition(const v3f &position)
@@ -140,16 +139,21 @@ class LocalPlayer : public Player
        v3f getPosition() const { return m_position; }
        v3f getEyePosition() const { return m_position + getEyeOffset(); }
        v3f getEyeOffset() const;
+       void setEyeHeight(float eye_height) { m_eye_height = eye_height; }
 
        void setCollisionbox(const aabb3f &box) { m_collisionbox = box; }
 
+       float getZoomFOV() const { return m_zoom_fov; }
+       void setZoomFOV(float zoom_fov) { m_zoom_fov = zoom_fov; }
+
 private:
-       void accelerateHorizontal(const v3f &target_speed,
-               const f32 max_increase, bool slippery);
+       void accelerateHorizontal(const v3f &target_speed, const f32 max_increase);
        void accelerateVertical(const v3f &target_speed, const f32 max_increase);
        bool updateSneakNode(Map *map, const v3f &position, const v3f &sneak_max);
+       float getSlipFactor(Environment *env, const v3f &speedH);
 
        v3f m_position;
+       v3s16 m_standing_node;
 
        v3s16 m_sneak_node = v3s16(32767, 32767, 32767);
        // Stores the top bounding box of m_sneak_node
@@ -172,15 +176,15 @@ class LocalPlayer : public Player
        // ***** End of variables for temporary option *****
 
        bool m_can_jump = false;
-       u16 m_breath = PLAYER_MAX_BREATH;
+       u16 m_breath = PLAYER_MAX_BREATH_DEFAULT;
        f32 m_yaw = 0.0f;
        f32 m_pitch = 0.0f;
        bool camera_barely_in_ceiling = false;
        aabb3f m_collisionbox = aabb3f(-BS * 0.30f, 0.0f, -BS * 0.30f, BS * 0.30f,
                        BS * 1.75f, BS * 0.30f);
+       float m_eye_height = 1.625f;
+       float m_zoom_fov = 0.0f;
 
        GenericCAO *m_cao = nullptr;
        Client *m_client;
 };
-
-#endif