diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 9e73414a..20d7c4af 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -119,6 +119,8 @@ void Game::init(void) infocus = true; paused = false; muted = false; + musicmuted = false; + musicmutebutton = 0; globalsound = 128; m_globalVol = 1.0f; diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index e55df22e..6047d19f 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -192,6 +192,8 @@ public: bool infocus; bool muted; int mutebutton; + bool musicmuted; + int musicmutebutton; private: float m_globalVol; diff --git a/desktop_version/src/KeyPoll.h b/desktop_version/src/KeyPoll.h index 56333461..53630450 100644 --- a/desktop_version/src/KeyPoll.h +++ b/desktop_version/src/KeyPoll.h @@ -21,6 +21,7 @@ enum Kybrd KEYBOARD_a = SDLK_a, KEYBOARD_d = SDLK_d, KEYBOARD_m = SDLK_m, + KEYBOARD_n = SDLK_n, KEYBOARD_v = SDLK_v, KEYBOARD_z = SDLK_z, diff --git a/desktop_version/src/main.cpp b/desktop_version/src/main.cpp index b130ac41..d0898c04 100644 --- a/desktop_version/src/main.cpp +++ b/desktop_version/src/main.cpp @@ -519,6 +519,16 @@ int main(int argc, char *argv[]) game.mutebutton--; } + if (key.isDown(KEYBOARD_n) && game.musicmutebutton <= 0 && !inEditor) + { + game.musicmutebutton = 8; + game.musicmuted = !game.musicmuted; + } + if (game.musicmutebutton > 0) + { + game.musicmutebutton--; + } + if (game.muted) { game.globalsound = 0; @@ -529,8 +539,16 @@ int main(int argc, char *argv[]) if (!game.muted && game.globalsound == 0) { game.globalsound = 1; - Mix_VolumeMusic(MIX_MAX_VOLUME) ; Mix_Volume(-1,MIX_MAX_VOLUME); + + if (game.musicmuted) + { + Mix_VolumeMusic(0); + } + else + { + Mix_VolumeMusic(MIX_MAX_VOLUME); + } } if (key.resetWindow)