diff options
| author | oy <Tom_Adams@web.de> | 2010-09-12 12:43:03 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-09-12 12:43:03 +0200 |
| commit | e226b4721238c84600fe25dc4dd46cec16d1fa5d (patch) | |
| tree | ee577e0a9535d38dc434af5848ef28ef58d88b8d /src/game | |
| parent | d913af1ab2d383832a49ed6a4460523f80b8337d (diff) | |
| download | zcatch-e226b4721238c84600fe25dc4dd46cec16d1fa5d.tar.gz zcatch-e226b4721238c84600fe25dc4dd46cec16d1fa5d.zip | |
close the emote selector, chat history and the scoreboard when closing the chat, console or ingame menu. Closes #111
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/component.h | 1 | ||||
| -rw-r--r-- | src/game/client/components/chat.cpp | 9 | ||||
| -rw-r--r-- | src/game/client/components/chat.h | 1 | ||||
| -rw-r--r-- | src/game/client/components/console.cpp | 1 | ||||
| -rw-r--r-- | src/game/client/components/emoticon.cpp | 5 | ||||
| -rw-r--r-- | src/game/client/components/emoticon.h | 1 | ||||
| -rw-r--r-- | src/game/client/components/menus.cpp | 14 | ||||
| -rw-r--r-- | src/game/client/components/scoreboard.cpp | 5 | ||||
| -rw-r--r-- | src/game/client/components/scoreboard.h | 1 | ||||
| -rw-r--r-- | src/game/client/gameclient.cpp | 7 | ||||
| -rw-r--r-- | src/game/client/gameclient.h | 1 |
11 files changed, 43 insertions, 3 deletions
diff --git a/src/game/client/component.h b/src/game/client/component.h index 6e4b3715..64e0588d 100644 --- a/src/game/client/component.h +++ b/src/game/client/component.h @@ -35,6 +35,7 @@ public: virtual void OnInit() {}; virtual void OnReset() {}; virtual void OnRender() {}; + virtual void OnRelease() {}; virtual void OnMapLoad() {}; virtual void OnMessage(int Msg, void *pRawMsg) {} virtual bool OnMouseMove(float x, float y) { return false; } diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index 60b62188..d0b216a5 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -33,6 +33,11 @@ void CChat::OnReset() m_Show = false; } +void CChat::OnRelease() +{ + m_Show = false; +} + void CChat::OnStateChange(int NewState, int OldState) { if(OldState <= IClient::STATE_CONNECTING) @@ -84,12 +89,16 @@ bool CChat::OnInput(IInput::CEvent e) return false; if(e.m_Flags&IInput::FLAG_PRESS && e.m_Key == KEY_ESCAPE) + { m_Mode = MODE_NONE; + m_pClient->OnRelease(); + } else if(e.m_Flags&IInput::FLAG_PRESS && (e.m_Key == KEY_RETURN || e.m_Key == KEY_KP_ENTER)) { if(m_Input.GetString()[0]) Say(m_Mode == MODE_ALL ? 0 : 1, m_Input.GetString()); m_Mode = MODE_NONE; + m_pClient->OnRelease(); } else m_Input.ProcessInput(e); diff --git a/src/game/client/components/chat.h b/src/game/client/components/chat.h index 02afc902..c1867c00 100644 --- a/src/game/client/components/chat.h +++ b/src/game/client/components/chat.h @@ -56,6 +56,7 @@ public: virtual void OnConsoleInit(); virtual void OnStateChange(int NewState, int OldState); virtual void OnRender(); + virtual void OnRelease(); virtual void OnMessage(int MsgType, void *pRawMsg); virtual bool OnInput(IInput::CEvent Event); }; diff --git a/src/game/client/components/console.cpp b/src/game/client/components/console.cpp index cb8c31ce..cdf4239a 100644 --- a/src/game/client/components/console.cpp +++ b/src/game/client/components/console.cpp @@ -565,6 +565,7 @@ void CGameConsole::Toggle(int Type) { Input()->MouseModeRelative(); m_pClient->m_pMenus->UseMouseButtons(true); + m_pClient->OnRelease(); m_ConsoleState = CONSOLE_CLOSING; } } diff --git a/src/game/client/components/emoticon.cpp b/src/game/client/components/emoticon.cpp index cb54dbcd..9139c2c1 100644 --- a/src/game/client/components/emoticon.cpp +++ b/src/game/client/components/emoticon.cpp @@ -39,6 +39,11 @@ void CEmoticon::OnReset() m_SelectedEmote = -1; } +void CEmoticon::OnRelease() +{ + m_Active = false; +} + void CEmoticon::OnMessage(int MsgType, void *pRawMsg) { } diff --git a/src/game/client/components/emoticon.h b/src/game/client/components/emoticon.h index e10b57da..580c8736 100644 --- a/src/game/client/components/emoticon.h +++ b/src/game/client/components/emoticon.h @@ -22,6 +22,7 @@ public: virtual void OnReset(); virtual void OnConsoleInit(); virtual void OnRender(); + virtual void OnRelease(); virtual void OnMessage(int MsgType, void *pRawMsg); virtual bool OnMouseMove(float x, float y); diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index b1e3e3d0..05817d3a 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -1015,10 +1015,18 @@ int CMenus::Render() void CMenus::SetActive(bool Active) { m_MenuActive = Active; - if(!m_MenuActive && m_NeedSendinfo) + if(!m_MenuActive) { - m_pClient->SendInfo(false); - m_NeedSendinfo = false; + if(m_NeedSendinfo) + { + m_pClient->SendInfo(false); + m_NeedSendinfo = false; + } + + if(Client()->State() == IClient::STATE_ONLINE) + { + m_pClient->OnRelease(); + } } } diff --git a/src/game/client/components/scoreboard.cpp b/src/game/client/components/scoreboard.cpp index 2214c2d1..7d5530c6 100644 --- a/src/game/client/components/scoreboard.cpp +++ b/src/game/client/components/scoreboard.cpp @@ -27,6 +27,11 @@ void CScoreboard::OnReset() m_Active = false; } +void CScoreboard::OnRelease() +{ + m_Active = false; +} + void CScoreboard::OnConsoleInit() { Console()->Register("+scoreboard", "", CFGFLAG_CLIENT, ConKeyScoreboard, this, "Show scoreboard"); diff --git a/src/game/client/components/scoreboard.h b/src/game/client/components/scoreboard.h index be0292cf..871b34fd 100644 --- a/src/game/client/components/scoreboard.h +++ b/src/game/client/components/scoreboard.h @@ -18,6 +18,7 @@ public: virtual void OnReset(); virtual void OnConsoleInit(); virtual void OnRender(); + virtual void OnRelease(); bool Active(); }; diff --git a/src/game/client/gameclient.cpp b/src/game/client/gameclient.cpp index b67e5628..1c0633b9 100644 --- a/src/game/client/gameclient.cpp +++ b/src/game/client/gameclient.cpp @@ -471,6 +471,13 @@ void CGameClient::OnRender() } } +void CGameClient::OnRelease() +{ + // release all systems + for(int i = 0; i < m_All.m_Num; i++) + m_All.m_paComponents[i]->OnRelease(); +} + void CGameClient::OnMessage(int MsgId, CUnpacker *pUnpacker) { diff --git a/src/game/client/gameclient.h b/src/game/client/gameclient.h index 888188db..be46c678 100644 --- a/src/game/client/gameclient.h +++ b/src/game/client/gameclient.h @@ -167,6 +167,7 @@ public: // hooks virtual void OnConnected(); virtual void OnRender(); + virtual void OnRelease(); virtual void OnInit(); virtual void OnConsoleInit(); virtual void OnStateChange(int NewState, int OldState); |