Tune caves
[oweals/minetest.git] / src / player.h
index c9dbe76bb93858f6b7f14b54aa4a547387076f31..d0e1ac79923b7d521fe362e4d65513dc75e97d49 100644 (file)
@@ -22,7 +22,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "common_irrlicht.h"
 #include "inventory.h"
-#include "collision.h"
 
 #define PLAYERNAME_SIZE 20
 
@@ -31,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 class Map;
 class IGameDef;
+struct CollisionInfo;
 
 class Player
 {
@@ -102,21 +102,22 @@ public:
                return m_yaw;
        }
 
-       virtual void updateName(const char *name)
+       f32 getRadPitch()
        {
-               snprintf(m_name, PLAYERNAME_SIZE, "%s", name);
+               return -1.0 * m_pitch * core::DEGTORAD;
+       }
+
+       f32 getRadYaw()
+       {
+               return (m_yaw + 90.) * core::DEGTORAD;
        }
 
-       virtual void wieldItem(u16 item);
-       virtual const InventoryItem *getWieldItem() const
+       virtual void updateName(const char *name)
        {
-               const InventoryList *list = inventory.getList("main");
-               if (list)
-                       return list->getItem(m_selected_item);
-               return NULL;
+               snprintf(m_name, PLAYERNAME_SIZE, "%s", name);
        }
 
-       const char * getName()
+       const char * getName() const
        {
                return m_name;
        }
@@ -154,8 +155,6 @@ public:
        // Actual inventory is backed up here when creative mode is used
        Inventory *inventory_backup;
 
-       bool craftresult_is_preview;
-
        u16 hp;
 
        u16 peer_id;
@@ -164,7 +163,6 @@ protected:
        IGameDef *m_gamedef;
 
        char m_name[PLAYERNAME_SIZE];
-       u16 m_selected_item;
        f32 m_pitch;
        f32 m_yaw;
        v3f m_speed;
@@ -174,82 +172,6 @@ public:
 
 };
 
-/*
-       Player on the server
-*/
-
-#include "serverobject.h"
-#include "content_object.h" // Object type IDs
-
-class PlayerSAO;
-
-class ServerRemotePlayer : public Player, public ServerActiveObject
-{
-public:
-       ServerRemotePlayer(ServerEnvironment *env);
-       ServerRemotePlayer(ServerEnvironment *env, v3f pos_, u16 peer_id_,
-                       const char *name_);
-
-       virtual ~ServerRemotePlayer();
-
-       virtual bool isLocal() const
-       { return false; }
-
-       virtual void move(f32 dtime, Map &map, f32 pos_max_d)
-       {
-       }
-       
-       virtual void setPosition(const v3f &position);
-       
-       // Returns a reference
-       virtual InventoryItem* getWieldedItem();
-       
-       /* ServerActiveObject interface */
-
-       u8 getType() const
-       {return ACTIVEOBJECT_TYPE_PLAYER;}
-       
-       // Called after id has been set and has been inserted in environment
-       void addedToEnvironment();
-       // Called before removing from environment
-       void removingFromEnvironment();
-       
-       bool environmentDeletes() const
-       { return false; }
-       bool isStaticAllowed() const
-       { return false; }
-
-       void step(float dtime, bool send_recommended);
-       std::string getClientInitializationData();
-       std::string getStaticData();
-       void punch(ServerActiveObject *puncher, float time_from_last_punch);
-       void rightClick(ServerActiveObject *clicker);
-       void setPos(v3f pos);
-       void moveTo(v3f pos, bool continuous);
-       virtual std::string getDescription(){return getName();}
-
-       virtual void getWieldDiggingProperties(ToolDiggingProperties *dst);
-       virtual void damageWieldedItem(u16 amount);
-       // If all fits, eats item and returns true. Otherwise returns false.
-       virtual bool addToInventory(InventoryItem *item);
-       virtual void addToInventoryLater(InventoryItem *item);
-       void clearAddToInventoryLater();
-       void completeAddToInventoryLater(u16 preferred_index);
-       virtual void setHP(s16 hp_);
-       virtual s16 getHP();
-       
-       v3f m_last_good_position;
-       float m_last_good_position_age;
-       std::vector<InventoryItem*> m_additional_items;
-       bool m_inventory_not_sent;
-       bool m_hp_not_sent;
-       bool m_respawn_active;
-       
-private:
-       bool m_is_in_environment;
-       bool m_position_not_sent;
-};
-
 #ifndef SERVER
 struct PlayerControl
 {
@@ -314,6 +236,8 @@ public:
        void move(f32 dtime, Map &map, f32 pos_max_d);
 
        void applyControl(float dtime);
+
+       v3s16 getStandingNodePos();
        
        PlayerControl control;