1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-25 22:18:30 +02: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:
Misa 2020-04-19 13:14:49 -07:00 committed by Ethan Lee
parent c176127529
commit 9db96f004b
3 changed files with 1 additions and 5 deletions

View File

@ -121,7 +121,6 @@ void Game::init(void)
muted = false;
musicmuted = false;
musicmutebutton = 0;
globalsound = 128;
glitchrunkludge = false;
hascontrol = true;

View File

@ -350,7 +350,6 @@ public:
bool quickrestartkludge;
bool paused;
int globalsound;
//Custom stuff
std::string customscript[50];

View File

@ -528,14 +528,12 @@ int main(int argc, char *argv[])
if (game.muted)
{
game.globalsound = 0;
Mix_VolumeMusic(0) ;
Mix_Volume(-1,0);
}
if (!game.muted && game.globalsound == 0)
if (!game.muted)
{
game.globalsound = 1;
Mix_Volume(-1,MIX_MAX_VOLUME);
if (game.musicmuted)