Fix issue in Rocket.lua script.
[cafu-Engine.git] / Ca3DE / Client / ClientStateInGame.hpp
blobefac64139d104cb76948b3f43667658294b3fac5
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
7 #ifndef CAFU_CLIENT_STATE_INGAME_HPP_INCLUDED
8 #define CAFU_CLIENT_STATE_INGAME_HPP_INCLUDED
10 #include "ClientState.hpp"
11 #include "Graphs.hpp"
12 #include "ScrlInfo.hpp"
13 #include "../PlayerCommand.hpp"
14 #include "Fonts/Font.hpp"
15 #include "Network/Network.hpp"
18 struct lua_State;
19 class CaClientWorldT;
20 struct CaKeyboardEventT;
21 struct CaMouseEventT;
22 class ClientT;
23 class PathRecorderT;
26 /// This class implements the state of the client when it is fully connected and thus "in-game".
27 class ClientStateInGameT : public ClientStateT
29 public:
31 ClientStateInGameT(ClientT& Client_);
32 ~ClientStateInGameT();
34 // Implement the ClientStateT interface.
35 int GetID() const override;
36 bool ProcessInputEvent(const CaKeyboardEventT& KE) override;
37 bool ProcessInputEvent(const CaMouseEventT& ME) override;
38 void Render(float FrameTime) override;
39 void MainLoop(float FrameTime) override;
42 static int ConFunc_say_Callback(lua_State* LuaState);
43 static int ConFunc_chatPrint_Callback(lua_State* LuaState);
44 static int ConFunc_showPath_Callback(lua_State* LuaState);
45 static int ConFunc_recordPath_Callback(lua_State* LuaState);
48 private:
50 ClientStateInGameT(const ClientStateInGameT&); ///< Use of the Copy Constructor is not allowed.
51 void operator = (const ClientStateInGameT&); ///< Use of the Assignment Operator is not allowed.
53 void ProcessConnectionLessPacket(NetDataT& InData, const NetAddressT& SenderAddress);
54 void ParseServerPacket (NetDataT& InData);
55 static void ParseServerPacketHelper(NetDataT& InData, unsigned long /*LastIncomingSequenceNr*/);
58 ClientT& Client;
60 GameProtocol1T GameProtocol;
61 ArrayT< ArrayT<char> > ReliableDatas;
62 NetDataT UnreliableData;
64 FontT Font_v;
65 FontT Font_f;
66 CaClientWorldT* World;
67 bool IsLoadingWorld; ///< True while the world is loaded, false at all other times. This is relevant only because cf::GuiSys::GuiMan->Yield() is called while loading, which in turn calls our Render() method.
69 ScrollInfoT ChatScrollInfo;
70 ScrollInfoT SystemScrollInfo;
71 GraphsT Graphs;
72 unsigned long ClientFrameNr; ///< Counts the calls to Render(). Only used with Graphs; should be integrated there.
73 PlayerCommandT m_PlayerCommand; ///< The player command structure that collects the input until the next call to MainLoop().
74 unsigned int m_PlayerCommandCount; ///< The unique number of the next player command that is sent to the server (and locally processed for prediction).
75 PathRecorderT* m_PathRecorder; ///< Records the path of this client in a pointfile that can be loaded into CaWE.
78 #endif