diff --git a/src/engine/client.h b/src/engine/client.h index f2be14a64..2f0adad7e 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -201,6 +201,7 @@ public: virtual void OnEnterGame() = 0; virtual void OnShutdown() = 0; virtual void OnRender() = 0; + virtual void OnUpdate() = 0; virtual void OnStateChange(int NewState, int OldState) = 0; virtual void OnConnected() = 0; virtual void OnMessage(int MsgID, CUnpacker *pUnpacker, bool IsDummy = 0) = 0; diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index ab071ae07..6438d7fa5 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -2463,6 +2463,10 @@ void CClient::Update() // update the server browser m_ServerBrowser.Update(m_ResortServerBrowser); m_ResortServerBrowser = false; + + // update gameclient + if(!m_EditorActive) + GameClient()->OnUpdate(); } void CClient::VersionUpdate() @@ -2752,11 +2756,6 @@ void CClient::Run() Input()->MouseModeRelative(); } - /* - if(!gfx_window_open()) - break; - */ - // render { if(g_Config.m_ClEditor) diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index a33ed429b..cd0fb891f 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -366,7 +366,7 @@ void CGameClient::OnInit() } } -void CGameClient::DispatchInput() +void CGameClient::OnUpdate() { // handle mouse movement float x = 0.0f, y = 0.0f; @@ -390,10 +390,7 @@ void CGameClient::DispatchInput() for(int h = 0; h < m_Input.m_Num; h++) { if(m_Input.m_paComponents[h]->OnInput(e)) - { - //dbg_msg("", "%d char=%d key=%d flags=%d", h, e.ch, e.key, e.flags); break; - } } } @@ -559,27 +556,9 @@ static void Evolve(CNetObj_Character *pCharacter, int Tick) void CGameClient::OnRender() { - /*Graphics()->Clear(1,0,0); - - menus->render_background(); - return;*/ - /* - Graphics()->Clear(1,0,0); - Graphics()->MapScreen(0,0,100,100); - - Graphics()->QuadsBegin(); - Graphics()->SetColor(1,1,1,1); - Graphics()->QuadsDraw(50, 50, 30, 30); - Graphics()->QuadsEnd(); - - return;*/ - // update the local character and spectate position UpdatePositions(); - // dispatch all input to systems - DispatchInput(); - // render all systems for(int i = 0; i < m_All.m_Num; i++) m_All.m_paComponents[i]->OnRender(); diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index b29eb1cd0..3818a5886 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -102,7 +102,6 @@ class CGameClient : public IGameClient class CCollision m_Collision; CUI m_UI; - void DispatchInput(); void ProcessEvents(); void UpdatePositions(); @@ -292,6 +291,7 @@ public: // hooks virtual void OnConnected(); virtual void OnRender(); + virtual void OnUpdate(); virtual void OnDummyDisconnect(); virtual void OnRelease(); virtual void OnInit();