mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-13 03:28:19 +00:00
fixed that music resets on password prompt. Closes #695
This commit is contained in:
parent
47cdd2524b
commit
fdf6db5fd6
|
@ -1337,7 +1337,8 @@ void CMenus::OnStateChange(int NewState, int OldState)
|
||||||
|
|
||||||
if(NewState == IClient::STATE_OFFLINE)
|
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;
|
m_Popup = POPUP_NONE;
|
||||||
if(Client()->ErrorString() && Client()->ErrorString()[0] != 0)
|
if(Client()->ErrorString() && Client()->ErrorString()[0] != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -759,7 +759,10 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
|
||||||
{
|
{
|
||||||
g_Config.m_SndEnable ^= 1;
|
g_Config.m_SndEnable ^= 1;
|
||||||
if(g_Config.m_SndEnable)
|
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
|
else
|
||||||
m_pClient->m_pSounds->Stop(SOUND_MENU);
|
m_pClient->m_pSounds->Stop(SOUND_MENU);
|
||||||
m_NeedRestartSound = g_Config.m_SndEnable && (!s_SndEnable || s_SndRate != g_Config.m_SndRate);
|
m_NeedRestartSound = g_Config.m_SndEnable && (!s_SndEnable || s_SndRate != g_Config.m_SndRate);
|
||||||
|
|
|
@ -65,8 +65,17 @@ void CSounds::OnInit()
|
||||||
|
|
||||||
void CSounds::OnReset()
|
void CSounds::OnReset()
|
||||||
{
|
{
|
||||||
Sound()->StopAll();
|
if(Client()->State() >= IClient::STATE_ONLINE)
|
||||||
ClearQueue();
|
{
|
||||||
|
Sound()->StopAll();
|
||||||
|
ClearQueue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSounds::OnStateChange(int NewState, int OldState)
|
||||||
|
{
|
||||||
|
if(NewState == IClient::STATE_ONLINE || NewState == IClient::STATE_DEMOPLAYBACK)
|
||||||
|
OnReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSounds::OnRender()
|
void CSounds::OnRender()
|
||||||
|
|
|
@ -32,6 +32,7 @@ public:
|
||||||
|
|
||||||
virtual void OnInit();
|
virtual void OnInit();
|
||||||
virtual void OnReset();
|
virtual void OnReset();
|
||||||
|
virtual void OnStateChange(int NewState, int OldState);
|
||||||
virtual void OnRender();
|
virtual void OnRender();
|
||||||
|
|
||||||
void ClearQueue();
|
void ClearQueue();
|
||||||
|
|
Loading…
Reference in a new issue