diff options
| author | oy <Tom_Adams@web.de> | 2011-06-27 23:26:01 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-06-27 23:26:01 +0200 |
| commit | fdf6db5fd6ba56cc4cb1993b0ca8153a890c769f (patch) | |
| tree | 1c133fc53f26540fc316511335e0bf56b9fa77d7 /src | |
| parent | 47cdd2524b4d5bff7f171686af8260aa8a083c50 (diff) | |
| download | zcatch-fdf6db5fd6ba56cc4cb1993b0ca8153a890c769f.tar.gz zcatch-fdf6db5fd6ba56cc4cb1993b0ca8153a890c769f.zip | |
fixed that music resets on password prompt. Closes #695
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/client/components/menus.cpp | 3 | ||||
| -rw-r--r-- | src/game/client/components/menus_settings.cpp | 5 | ||||
| -rw-r--r-- | src/game/client/components/sounds.cpp | 13 | ||||
| -rw-r--r-- | src/game/client/components/sounds.h | 1 |
4 files changed, 18 insertions, 4 deletions
diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 8e41e81e..9bd59730 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -1337,7 +1337,8 @@ void CMenus::OnStateChange(int NewState, int OldState) if(NewState == IClient::STATE_OFFLINE) { - m_pClient->m_pSounds->Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f, vec2(0, 0)); + if(OldState >= IClient::STATE_ONLINE) + m_pClient->m_pSounds->Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f, vec2(0, 0)); m_Popup = POPUP_NONE; if(Client()->ErrorString() && Client()->ErrorString()[0] != 0) { diff --git a/src/game/client/components/menus_settings.cpp b/src/game/client/components/menus_settings.cpp index 0a26a087..82d3f652 100644 --- a/src/game/client/components/menus_settings.cpp +++ b/src/game/client/components/menus_settings.cpp @@ -759,7 +759,10 @@ void CMenus::RenderSettingsSound(CUIRect MainView) { g_Config.m_SndEnable ^= 1; if(g_Config.m_SndEnable) - m_pClient->m_pSounds->Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f, vec2(0, 0)); + { + if(g_Config.m_SndMusic) + m_pClient->m_pSounds->Play(CSounds::CHN_MUSIC, SOUND_MENU, 1.0f, vec2(0, 0)); + } else m_pClient->m_pSounds->Stop(SOUND_MENU); m_NeedRestartSound = g_Config.m_SndEnable && (!s_SndEnable || s_SndRate != g_Config.m_SndRate); diff --git a/src/game/client/components/sounds.cpp b/src/game/client/components/sounds.cpp index 4e9ef5b5..c4ade00e 100644 --- a/src/game/client/components/sounds.cpp +++ b/src/game/client/components/sounds.cpp @@ -65,8 +65,17 @@ void CSounds::OnInit() void CSounds::OnReset() { - Sound()->StopAll(); - ClearQueue(); + if(Client()->State() >= IClient::STATE_ONLINE) + { + Sound()->StopAll(); + ClearQueue(); + } +} + +void CSounds::OnStateChange(int NewState, int OldState) +{ + if(NewState == IClient::STATE_ONLINE || NewState == IClient::STATE_DEMOPLAYBACK) + OnReset(); } void CSounds::OnRender() diff --git a/src/game/client/components/sounds.h b/src/game/client/components/sounds.h index 2670f793..ab9cc8e6 100644 --- a/src/game/client/components/sounds.h +++ b/src/game/client/components/sounds.h @@ -32,6 +32,7 @@ public: virtual void OnInit(); virtual void OnReset(); + virtual void OnStateChange(int NewState, int OldState); virtual void OnRender(); void ClearQueue(); |