]> git.lizzy.rs Git - minetest.git/blobdiff - src/client.h
Fix logic of checkbox formspec element validity checking
[minetest.git] / src / client.h
index 01cd3a01c6904dbdcf2d2ebed09a26026696980a..898fc4daa1698ed9297449a245421532c1a57240 100644 (file)
@@ -46,6 +46,8 @@ class ClientMediaDownloader;
 struct MapDrawControl;
 class MtEventManager;
 struct PointedThing;
+class Database;
+class Server;
 
 struct QueuedMeshUpdate
 {
@@ -57,6 +59,12 @@ struct QueuedMeshUpdate
        ~QueuedMeshUpdate();
 };
 
+enum LocalClientState {
+       LC_Created,
+       LC_Init,
+       LC_Ready
+};
+
 /*
        A thread-safe queue of mesh update tasks
 */
@@ -209,6 +217,7 @@ struct ClientEvent
                        v2f *align;
                        v2f *offset;
                        v3f *world_pos;
+                       v2s32 * size;
                } hudadd;
                struct{
                        u32 id;
@@ -220,6 +229,7 @@ struct ClientEvent
                        std::string *sdata;
                        u32 data;
                        v3f *v3fdata;
+                       v2s32 * v2s32data;
                } hudchange;
                struct{
                        video::SColor *bgcolor;
@@ -295,6 +305,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
                        IrrlichtDevice *device,
                        const char *playername,
                        std::string password,
+                       bool is_simple_singleplayer_game,
                        MapDrawControl &control,
                        IWritableTextureSource *tsrc,
                        IWritableShaderSource *shsrc,
@@ -319,14 +330,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
                calling this, as it is sent in the initialization.
        */
        void connect(Address address);
-       /*
-               returns true when
-                       m_con.Connected() == true
-                       AND m_server_ser_ver != SER_FMT_VER_INVALID
-               throws con::PeerNotFoundException if connection has been deleted,
-               eg. timed out.
-       */
-       bool connectedAndInitialized();
+
        /*
                Stuff that references the environment is valid only as
                long as this is not called. (eg. Players)
@@ -349,11 +353,12 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
                        const std::map<std::string, std::string> &fields);
        void sendInventoryAction(InventoryAction *a);
        void sendChatMessage(const std::wstring &message);
-       void sendChangePassword(const std::wstring oldpassword,
-                       const std::wstring newpassword);
+       void sendChangePassword(const std::wstring &oldpassword,
+                               const std::wstring &newpassword);
        void sendDamage(u8 damage);
        void sendBreath(u16 breath);
        void sendRespawn();
+       void sendReady();
 
        ClientEnvironment& getEnv()
        { return m_env; }
@@ -393,6 +398,9 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        int getCrackLevel();
        void setCrack(int level, v3s16 pos);
 
+       void setHighlighted(v3s16 pos, bool show_higlighted);
+       v3s16 getHighlighted(){ return m_highlighted_pos; }
+
        u16 getHP();
        u16 getBreath();
 
@@ -409,7 +417,8 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        void addUpdateMeshTaskWithEdge(v3s16 blockpos, bool ack_to_server=false, bool urgent=false);
        void addUpdateMeshTaskForNode(v3s16 nodepos, bool ack_to_server=false, bool urgent=false);
        
-       void updateCameraOffset(v3s16 camera_offset){ m_mesh_update_thread.m_camera_offset = camera_offset; }
+       void updateCameraOffset(v3s16 camera_offset)
+       { m_mesh_update_thread.m_camera_offset = camera_offset; }
 
        // Get event from queue. CE_NONE is returned if queue is empty.
        ClientEvent getClientEvent();
@@ -432,6 +441,8 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        void afterContentReceived(IrrlichtDevice *device, gui::IGUIFont* font);
 
        float getRTT(void);
+       float getCurRate(void);
+       float getAvgRate(void);
 
        // IGameDef interface
        virtual IItemDefManager* getItemDefManager();
@@ -439,9 +450,11 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        virtual ICraftDefManager* getCraftDefManager();
        virtual ITextureSource* getTextureSource();
        virtual IShaderSource* getShaderSource();
+       virtual scene::ISceneManager* getSceneManager();
        virtual u16 allocateUnknownNodeId(const std::string &name);
        virtual ISoundManager* getSoundManager();
        virtual MtEventManager* getEventManager();
+       virtual ParticleManager* getParticleManager();
        virtual bool checkLocalPrivilege(const std::string &priv)
        { return checkPrivilege(priv); }
        virtual scene::IAnimatedMesh* getMesh(const std::string &filename);
@@ -454,6 +467,10 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        // Send a notification that no conventional media transfer is needed
        void received_media();
 
+       LocalClientState getState() { return m_state; }
+
+       void makeScreenshot(IrrlichtDevice *device);
+
 private:
 
        // Virtual methods from con::PeerHandler
@@ -481,8 +498,10 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        ISoundManager *m_sound;
        MtEventManager *m_event;
 
+
        MeshUpdateThread m_mesh_update_thread;
        ClientEnvironment m_env;
+       ParticleManager m_particle_manager;
        con::Connection m_con;
        IrrlichtDevice *m_device;
        // Server serialization version
@@ -493,10 +512,12 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
        float m_inventory_from_server_age;
        std::set<v3s16> m_active_blocks;
        PacketCounter m_packetcounter;
+       bool m_show_highlighted;
        // Block mesh animation parameters
        float m_animation_time;
        int m_crack_level;
        v3s16 m_crack_pos;
+       v3s16 m_highlighted_pos;
        // 0 <= m_daynight_i < DAYNIGHT_CACHE_COUNT
        //s32 m_daynight_i;
        //u32 m_daynight_ratio;
@@ -537,6 +558,16 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef
 
        // Storage for mesh data for creating multiple instances of the same mesh
        std::map<std::string, std::string> m_mesh_data;
+
+       // own state
+       LocalClientState m_state;
+
+       // Used for saving server map to disk client-side
+       Database *localdb;
+       Server *localserver;
+
+       // TODO: Add callback to update this when g_settings changes
+       bool m_cache_smooth_lighting;
 };
 
 #endif // !CLIENT_HEADER