]> git.localhorst.tv Git - blank.git/blobdiff - src/client/InteractiveState.hpp
slight simplification of cull test
[blank.git] / src / client / InteractiveState.hpp
index 2bc459a330a875e9fb748a9e0a10fda43f61c020..f371c8ca837aeb094c7ef5dc719b3f1b84c494f7 100644 (file)
@@ -7,15 +7,15 @@
 #include "ChunkReceiver.hpp"
 #include "NetworkedInput.hpp"
 #include "../app/IntervalTimer.hpp"
+#include "../audio/SoundBank.hpp"
 #include "../graphics/SkyBox.hpp"
 #include "../io/WorldSave.hpp"
-#include "../model/ModelRegistry.hpp"
-#include "../model/ShapeRegistry.hpp"
 #include "../net/Packet.hpp"
+#include "../shared/ChatState.hpp"
+#include "../shared/WorldResources.hpp"
 #include "../ui/HUD.hpp"
 #include "../ui/InteractiveManipulator.hpp"
 #include "../ui/Interface.hpp"
-#include "../world/BlockTypeRegistry.hpp"
 #include "../world/ChunkRenderer.hpp"
 #include "../world/EntityState.hpp"
 #include "../world/Player.hpp"
@@ -32,17 +32,22 @@ class MasterState;
 
 class InteractiveState
 : public State
-, public ClientController {
+, public ClientController
+, public ChatState::Responder {
 
 public:
        explicit InteractiveState(MasterState &, std::uint32_t player_id);
 
        World &GetWorld() noexcept { return world; }
        Player &GetPlayer() noexcept { return player; }
+       PlayerController &GetPlayerController() noexcept { return input; }
        ChunkReceiver &GetChunkReceiver() noexcept { return chunk_receiver; }
-       ModelRegistry &GetModels() noexcept { return models; }
 
-       void OnEnter() override;
+       void OnResume() override;
+       void OnPause() override;
+
+       void OnFocus() override;
+       void OnBlur() override;
 
        void Handle(const SDL_Event &) override;
        void Update(int dt) override;
@@ -53,13 +58,17 @@ public:
        void Handle(const Packet::EntityUpdate &);
        void Handle(const Packet::PlayerCorrection &);
        void Handle(const Packet::BlockUpdate &);
+       void Handle(const Packet::Message &);
 
        void SetAudio(bool) override;
        void SetVideo(bool) override;
        void SetHUD(bool) override;
        void SetDebug(bool) override;
+       void NextCamera() override;
        void Exit() override;
 
+       void OnLineSubmit(const std::string &) override;
+
 private:
        /// flag entity as updated by given packet
        /// returns false if the update should be ignored
@@ -69,9 +78,8 @@ private:
 
 private:
        MasterState &master;
-       ShapeRegistry shapes;
-       BlockTypeRegistry block_types;
-       ModelRegistry models;
+       WorldResources res;
+       SoundBank sounds;
        WorldSave save;
        World world;
        Player &player;
@@ -81,7 +89,8 @@ private:
        Interface interface;
        ChunkReceiver chunk_receiver;
        ChunkRenderer chunk_renderer;
-       IntervalTimer loop_timer;
+       CoarseTimer loop_timer;
+       CoarseTimer stat_timer;
 
        SkyBox sky;
 
@@ -91,6 +100,11 @@ private:
        };
        std::map<std::uint32_t, UpdateStatus> update_status;
 
+       ChatState chat;
+
+       int time_skipped;
+       unsigned int packets_skipped;
+
 };
 
 }