mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Remove Game::globalsound
It looks like this variable was originally intended to keep track of th volume of the game, but then it was used as a boolean in main.cpp to make sure the game didn't call Mix_Volume() and Mix_VolumeMusic() every frame. However, it is now a problem, because I put the music mute handling code in the very branch that game.globalsound protects against, but since game.globalsound is here, if I mute the music, then mute the whole game, then unmute the music, and then unmute the whole game, sound effects will no longer be muted but the music will still be muted, until I mute and unmute the whole game again. This is annoying and inconsistent, so I'm removing this check from the 'if (!game.muted)' branch. Plus, given that the Mix_VolumeMusic() and Mix_Volume() calls happen every frame if the game is muted anyways, it doesn't seem to be a problem to call these every frame.
This commit is contained in:
parent
c176127529
commit
9db96f004b
3 changed files with 1 additions and 5 deletions
|
@ -121,7 +121,6 @@ void Game::init(void)
|
||||||
muted = false;
|
muted = false;
|
||||||
musicmuted = false;
|
musicmuted = false;
|
||||||
musicmutebutton = 0;
|
musicmutebutton = 0;
|
||||||
globalsound = 128;
|
|
||||||
|
|
||||||
glitchrunkludge = false;
|
glitchrunkludge = false;
|
||||||
hascontrol = true;
|
hascontrol = true;
|
||||||
|
|
|
@ -350,7 +350,6 @@ public:
|
||||||
bool quickrestartkludge;
|
bool quickrestartkludge;
|
||||||
|
|
||||||
bool paused;
|
bool paused;
|
||||||
int globalsound;
|
|
||||||
|
|
||||||
//Custom stuff
|
//Custom stuff
|
||||||
std::string customscript[50];
|
std::string customscript[50];
|
||||||
|
|
|
@ -528,14 +528,12 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (game.muted)
|
if (game.muted)
|
||||||
{
|
{
|
||||||
game.globalsound = 0;
|
|
||||||
Mix_VolumeMusic(0) ;
|
Mix_VolumeMusic(0) ;
|
||||||
Mix_Volume(-1,0);
|
Mix_Volume(-1,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!game.muted && game.globalsound == 0)
|
if (!game.muted)
|
||||||
{
|
{
|
||||||
game.globalsound = 1;
|
|
||||||
Mix_Volume(-1,MIX_MAX_VOLUME);
|
Mix_Volume(-1,MIX_MAX_VOLUME);
|
||||||
|
|
||||||
if (game.musicmuted)
|
if (game.musicmuted)
|
||||||
|
|
Loading…
Reference in a new issue