Readd chat sounds and add option to disable them

This commit is contained in:
def 2013-10-08 17:23:00 +02:00
parent 7dbce81bbf
commit f0b6ff9c4c
5 changed files with 8 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View file

@ -56,6 +56,7 @@ MACRO_CONFIG_INT(SndVolume, snd_volume, 100, 0, 100, CFGFLAG_SAVE|CFGFLAG_CLIENT
MACRO_CONFIG_INT(SndDevice, snd_device, -1, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "(deprecated) Sound device to use")
MACRO_CONFIG_INT(SndNonactiveMute, snd_nonactive_mute, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
MACRO_CONFIG_INT(SndChat, snd_chat, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "")
MACRO_CONFIG_INT(GfxScreenWidth, gfx_screen_width, 800, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen resolution width")
MACRO_CONFIG_INT(GfxScreenHeight, gfx_screen_height, 600, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen resolution height")

View file

@ -337,7 +337,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
int64 Now = time_get();
if(ClientID == -1)
{
if(Now-m_aLastSoundPlayed[CHAT_SERVER] >= time_freq()*3/10)
if(Now-m_aLastSoundPlayed[CHAT_SERVER] >= time_freq()*3/10 && g_Config.m_SndChat)
{
m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_SERVER, 0);
m_aLastSoundPlayed[CHAT_SERVER] = Now;
@ -353,8 +353,9 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
}
else
{
if(Now-m_aLastSoundPlayed[CHAT_CLIENT] >= time_freq()*3/10)
if(Now-m_aLastSoundPlayed[CHAT_CLIENT] >= time_freq()*3/10 && g_Config.m_SndChat)
{
if (g_Config.m_SndChat)
m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_HIGHLIGHT, 0);
m_aLastSoundPlayed[CHAT_CLIENT] = Now;
}

View file

@ -794,6 +794,10 @@ void CMenus::RenderSettingsSound(CUIRect MainView)
if(DoButton_CheckBox(&g_Config.m_SndNonactiveMute, Localize("Mute when not active"), g_Config.m_SndNonactiveMute, &Button))
g_Config.m_SndNonactiveMute ^= 1;
MainView.HSplitTop(20.0f, &Button, &MainView);
if(DoButton_CheckBox(&g_Config.m_SndChat, Localize("Enable chat sound"), g_Config.m_SndChat, &Button))
g_Config.m_SndChat ^= 1;
// sample rate box
{
char aBuf[64];