From 18e5412358a9f6b8805a33efc5772e2deed25979 Mon Sep 17 00:00:00 2001 From: oy Date: Sun, 20 Mar 2011 15:58:59 +0100 Subject: added sound for highlighted chat message. Closes #508 --- data/audio/sfx_msg-highlight.wv | Bin 0 -> 1648 bytes datasrc/content.py | 1 + src/game/client/components/chat.cpp | 7 ++++++- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 data/audio/sfx_msg-highlight.wv diff --git a/data/audio/sfx_msg-highlight.wv b/data/audio/sfx_msg-highlight.wv new file mode 100644 index 00000000..6b68b312 Binary files /dev/null and b/data/audio/sfx_msg-highlight.wv differ diff --git a/datasrc/content.py b/datasrc/content.py index b4b95c9b..accc9010 100644 --- a/datasrc/content.py +++ b/datasrc/content.py @@ -214,6 +214,7 @@ container.sounds.Add(SoundSet("hit", FileList("audio/sfx_hit_weak-%02d.wv", 2))) container.sounds.Add(SoundSet("chat_server", ["audio/sfx_msg-server.wv"])) container.sounds.Add(SoundSet("chat_client", ["audio/sfx_msg-client.wv"])) +container.sounds.Add(SoundSet("chat_highlight", ["audio/sfx_msg-highlight.wv"])) container.sounds.Add(SoundSet("ctf_drop", ["audio/sfx_ctf_drop.wv"])) container.sounds.Add(SoundSet("ctf_return", ["audio/sfx_ctf_rtn.wv"])) container.sounds.Add(SoundSet("ctf_grab_pl", ["audio/sfx_ctf_grab_pl.wv"])) diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index 308493bb..8187f8d2 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -202,6 +202,7 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine) if(ClientID != -1 && m_pClient->m_aClients[ClientID].m_aName[0] == '\0') // unknown client return; + bool Highlighted = false; char *p = const_cast(pLine); while(*p) { @@ -224,6 +225,8 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine) m_aLines[m_CurrentLine].m_Team = Team; m_aLines[m_CurrentLine].m_NameColor = -2; m_aLines[m_CurrentLine].m_Highlighted = str_find_nocase(pLine, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientID].m_aName) != 0; + if(m_aLines[m_CurrentLine].m_Highlighted) + Highlighted = true; if(ClientID == -1) // server message { @@ -253,7 +256,9 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine) } // play sound - if(ClientID >= 0) + if(Highlighted) + m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_HIGHLIGHT, 0, vec2(0.0f, 0.0f)); + else if(ClientID >= 0) m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_CLIENT, 0, vec2(0,0)); else m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_SERVER, 0, vec2(0,0)); -- cgit 1.4.1