mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Add being able to mute the music by pressing N
This is for people who want to use their own soundtrack while playing the game, but who don't want to mute the sound effects as well. This feature was added to VCE, but it was added in the strangest way. It was made an option in "game options" instead of being a keybind, and I don't know why.
This commit is contained in:
parent
68bb84f90b
commit
43b1b71da1
4 changed files with 24 additions and 1 deletions
|
@ -119,6 +119,8 @@ void Game::init(void)
|
|||
infocus = true;
|
||||
paused = false;
|
||||
muted = false;
|
||||
musicmuted = false;
|
||||
musicmutebutton = 0;
|
||||
globalsound = 128;
|
||||
m_globalVol = 1.0f;
|
||||
|
||||
|
|
|
@ -192,6 +192,8 @@ public:
|
|||
bool infocus;
|
||||
bool muted;
|
||||
int mutebutton;
|
||||
bool musicmuted;
|
||||
int musicmutebutton;
|
||||
private:
|
||||
float m_globalVol;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue