1.1 --- a/core/MenuManager.cpp Tue Jul 31 02:08:25 2007 +0000
1.2 +++ b/core/MenuManager.cpp Tue Jul 31 18:56:55 2007 +0000
1.3 @@ -22,9 +22,12 @@
1.4 #include "MenuStyle_Valve.h"
1.5 #include "ShareSys.h"
1.6 #include "HandleSys.h"
1.7 +#include "sourcemm_api.h"
1.8
1.9 MenuManager g_Menus;
1.10
1.11 +ConVar sm_menu_sounds("sm_menu_sounds", "1", 0, "Sets whether SourceMod menus play trigger sounds");
1.12 +
1.13 /*******************************
1.14 *******************************
1.15 ******** VOTE HANDLER *********
1.16 @@ -803,3 +806,60 @@
1.17
1.18 m_VoteHandlers.push((VoteMenuHandler *)mh);
1.19 }
1.20 +
1.21 +bool MenuManager::MenuSoundsEnabled()
1.22 +{
1.23 + return (sm_menu_sounds.GetInt() != 0);
1.24 +}
1.25 +
1.26 +ConfigResult MenuManager::OnSourceModConfigChanged(const char *key,
1.27 + const char *value,
1.28 + ConfigSource source,
1.29 + char *error,
1.30 + size_t maxlength)
1.31 +{
1.32 + if (strcmp(key, "MenuItemSound") == 0)
1.33 + {
1.34 + m_SelectSound.assign(value);
1.35 + return ConfigResult_Accept;
1.36 + } else if (strcmp(key, "MenuExitBackSound") == 0) {
1.37 + m_ExitBackSound.assign(value);
1.38 + return ConfigResult_Accept;
1.39 + }
1.40 +
1.41 + return ConfigResult_Ignore;
1.42 +}
1.43 +
1.44 +const char *MenuManager::GetMenuSound(ItemSelection sel)
1.45 +{
1.46 + const char *sound = NULL;
1.47 +
1.48 + switch (sel)
1.49 + {
1.50 + case ItemSel_Back:
1.51 + case ItemSel_Next:
1.52 + case ItemSel_Exit:
1.53 + case ItemSel_Item:
1.54 + {
1.55 + if (m_SelectSound.size() > 0)
1.56 + {
1.57 + sound = m_SelectSound.c_str();
1.58 + }
1.59 + break;
1.60 + }
1.61 + case ItemSel_ExitBack:
1.62 + {
1.63 + if (m_ExitBackSound.size() > 0)
1.64 + {
1.65 + sound = m_ExitBackSound.c_str();
1.66 + }
1.67 + break;
1.68 + }
1.69 + default:
1.70 + {
1.71 + break;
1.72 + }
1.73 + }
1.74 +
1.75 + return sound;
1.76 +}