@@ -1922,29 +1922,47 @@ void Game::processKeyInput()
1922
1922
toggleFast ();
1923
1923
} else if (wasKeyDown (KeyType::NOCLIP)) {
1924
1924
toggleNoClip ();
1925
+ #if USE_SOUND
1925
1926
} else if (wasKeyDown (KeyType::MUTE)) {
1926
- bool new_mute_sound = !g_settings->getBool (" mute_sound" );
1927
- g_settings->setBool (" mute_sound" , new_mute_sound);
1928
- if (new_mute_sound)
1929
- m_game_ui->showTranslatedStatusText (" Sound muted" );
1930
- else
1931
- m_game_ui->showTranslatedStatusText (" Sound unmuted" );
1927
+ if (g_settings->getBool (" enable_sound" )) {
1928
+ bool new_mute_sound = !g_settings->getBool (" mute_sound" );
1929
+ g_settings->setBool (" mute_sound" , new_mute_sound);
1930
+ if (new_mute_sound)
1931
+ m_game_ui->showTranslatedStatusText (" Sound muted" );
1932
+ else
1933
+ m_game_ui->showTranslatedStatusText (" Sound unmuted" );
1934
+ } else {
1935
+ m_game_ui->showTranslatedStatusText (" Sound system is disabled" );
1936
+ }
1932
1937
} else if (wasKeyDown (KeyType::INC_VOLUME)) {
1933
- float new_volume = rangelim (g_settings->getFloat (" sound_volume" ) + 0 .1f , 0 .0f , 1 .0f );
1934
- wchar_t buf[100 ];
1935
- g_settings->setFloat (" sound_volume" , new_volume);
1936
- const wchar_t *str = wgettext (" Volume changed to %d%%" );
1937
- swprintf (buf, sizeof (buf) / sizeof (wchar_t ), str, myround (new_volume * 100 ));
1938
- delete[] str;
1939
- m_game_ui->showStatusText (buf);
1938
+ if (g_settings->getBool (" enable_sound" )) {
1939
+ float new_volume = rangelim (g_settings->getFloat (" sound_volume" ) + 0 .1f , 0 .0f , 1 .0f );
1940
+ wchar_t buf[100 ];
1941
+ g_settings->setFloat (" sound_volume" , new_volume);
1942
+ const wchar_t *str = wgettext (" Volume changed to %d%%" );
1943
+ swprintf (buf, sizeof (buf) / sizeof (wchar_t ), str, myround (new_volume * 100 ));
1944
+ delete[] str;
1945
+ m_game_ui->showStatusText (buf);
1946
+ } else {
1947
+ m_game_ui->showTranslatedStatusText (" Sound system is disabled" );
1948
+ }
1940
1949
} else if (wasKeyDown (KeyType::DEC_VOLUME)) {
1941
- float new_volume = rangelim (g_settings->getFloat (" sound_volume" ) - 0 .1f , 0 .0f , 1 .0f );
1942
- wchar_t buf[100 ];
1943
- g_settings->setFloat (" sound_volume" , new_volume);
1944
- const wchar_t *str = wgettext (" Volume changed to %d%%" );
1945
- swprintf (buf, sizeof (buf) / sizeof (wchar_t ), str, myround (new_volume * 100 ));
1946
- delete[] str;
1947
- m_game_ui->showStatusText (buf);
1950
+ if (g_settings->getBool (" enable_sound" )) {
1951
+ float new_volume = rangelim (g_settings->getFloat (" sound_volume" ) - 0 .1f , 0 .0f , 1 .0f );
1952
+ wchar_t buf[100 ];
1953
+ g_settings->setFloat (" sound_volume" , new_volume);
1954
+ const wchar_t *str = wgettext (" Volume changed to %d%%" );
1955
+ swprintf (buf, sizeof (buf) / sizeof (wchar_t ), str, myround (new_volume * 100 ));
1956
+ delete[] str;
1957
+ m_game_ui->showStatusText (buf);
1958
+ } else {
1959
+ m_game_ui->showTranslatedStatusText (" Sound system is disabled" );
1960
+ }
1961
+ #else
1962
+ } else if (wasKeyDown (KeyType::MUTE) || wasKeyDown (KeyType::INC_VOLUME)
1963
+ || wasKeyDown (KeyType::DEC_VOLUME)) {
1964
+ m_game_ui->showTranslatedStatusText (" Sound system is not supported on this build" );
1965
+ #endif
1948
1966
} else if (wasKeyDown (KeyType::CINEMATIC)) {
1949
1967
toggleCinematic ();
1950
1968
} else if (wasKeyDown (KeyType::SCREENSHOT)) {
@@ -4162,8 +4180,12 @@ void Game::showPauseMenu()
4162
4180
}
4163
4181
4164
4182
#ifndef __ANDROID__
4165
- os << " button_exit[4," << (ypos++) << " ;3,0.5;btn_sound;"
4166
- << strgettext (" Sound Volume" ) << " ]" ;
4183
+ #if USE_SOUND
4184
+ if (g_settings->getBool (" enable_sound" )) {
4185
+ os << " button_exit[4," << (ypos++) << " ;3,0.5;btn_sound;"
4186
+ << strgettext (" Sound Volume" ) << " ]" ;
4187
+ }
4188
+ #endif
4167
4189
os << " button_exit[4," << (ypos++) << " ;3,0.5;btn_key_config;"
4168
4190
<< strgettext (" Change Keys" ) << " ]" ;
4169
4191
#endif
0 commit comments