mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Add unfocus audio pause option
Some people prefer the 2.2 behavior where unfocusing pauses the game, but the music still plays. One such person is Trinket9 on the VVVVVV Discord server, who wanted it that way. The reason audio pausing was added in the first place was to prevent desyncing music in levels with cutscenes that synced to music. Rather than reverting it, let's add this option instead.
This commit is contained in:
parent
b114be88d5
commit
3095871683
5 changed files with 39 additions and 4 deletions
|
@ -390,6 +390,7 @@ void Game::init(void)
|
|||
slidermode = SLIDER_NONE;
|
||||
|
||||
disablepause = false;
|
||||
disableaudiopause = false;
|
||||
inputdelay = false;
|
||||
}
|
||||
|
||||
|
@ -4198,6 +4199,11 @@ void Game::deserializesettings(tinyxml2::XMLElement* dataNode, ScreenSettings* s
|
|||
disablepause = help.Int(pText);
|
||||
}
|
||||
|
||||
if (SDL_strcmp(pKey, "disableaudiopause") == 0)
|
||||
{
|
||||
disableaudiopause = help.Int(pText);
|
||||
}
|
||||
|
||||
if (SDL_strcmp(pKey, "over30mode") == 0)
|
||||
{
|
||||
over30mode = help.Int(pText);
|
||||
|
@ -4469,6 +4475,8 @@ void Game::serializesettings(tinyxml2::XMLElement* dataNode, const ScreenSetting
|
|||
|
||||
xml::update_tag(dataNode, "disablepause", (int) disablepause);
|
||||
|
||||
xml::update_tag(dataNode, "disableaudiopause", (int) disableaudiopause);
|
||||
|
||||
xml::update_tag(dataNode, "notextoutline", (int) graphics.notextoutline);
|
||||
|
||||
xml::update_tag(dataNode, "translucentroomname", (int) graphics.translucentroomname);
|
||||
|
@ -6118,6 +6126,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
|||
}
|
||||
case Menu::advancedoptions:
|
||||
option("unfocus pause");
|
||||
option("unfocus audio pause");
|
||||
option("room name background");
|
||||
option("return");
|
||||
menuyoff = 0;
|
||||
|
|
|
@ -472,6 +472,7 @@ public:
|
|||
void unlockAchievement(const char *name);
|
||||
|
||||
bool disablepause;
|
||||
bool disableaudiopause;
|
||||
bool inputdelay;
|
||||
};
|
||||
|
||||
|
|
|
@ -715,6 +715,12 @@ static void menuactionpress(void)
|
|||
music.playef(11);
|
||||
break;
|
||||
case 1:
|
||||
/* toggle unfocus music pause */
|
||||
game.disableaudiopause = !game.disableaudiopause;
|
||||
game.savestatsandsettings_menu();
|
||||
music.playef(11);
|
||||
break;
|
||||
case 2:
|
||||
// toggle translucent roomname BG
|
||||
graphics.translucentroomname = !graphics.translucentroomname;
|
||||
game.savestatsandsettings_menu();
|
||||
|
|
|
@ -327,8 +327,11 @@ void KeyPoll::Poll(void)
|
|||
if (!game.disablepause)
|
||||
{
|
||||
isActive = true;
|
||||
music.resume();
|
||||
music.resumeef();
|
||||
if (!game.disableaudiopause)
|
||||
{
|
||||
music.resume();
|
||||
music.resumeef();
|
||||
}
|
||||
}
|
||||
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0)
|
||||
{
|
||||
|
@ -347,8 +350,11 @@ void KeyPoll::Poll(void)
|
|||
if (!game.disablepause)
|
||||
{
|
||||
isActive = false;
|
||||
music.pause();
|
||||
music.pauseef();
|
||||
if (!game.disableaudiopause)
|
||||
{
|
||||
music.pause();
|
||||
music.pauseef();
|
||||
}
|
||||
}
|
||||
if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0)
|
||||
{
|
||||
|
|
|
@ -684,6 +684,19 @@ static void menurender(void)
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
graphics.bigprint(-1, 30, "Unfocus Audio", tr, tg, tb, true);
|
||||
graphics.Print(-1, 65, "Toggle if the audio will pause", tr, tg, tb, true);
|
||||
graphics.Print(-1, 75, "when the window is unfocused.", tr, tg, tb, true);
|
||||
if (game.disableaudiopause)
|
||||
{
|
||||
graphics.Print(-1, 95, "Unfocus audio pause is OFF", tr/2, tg/2, tb/2, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.Print(-1, 95, "Unfocus audio pause is ON", tr, tg, tb, true);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
graphics.bigprint(-1, 30, "Room Name BG", tr, tg, tb, true);
|
||||
graphics.Print( -1, 65, "Lets you see through what is behind", tr, tg, tb, true);
|
||||
graphics.Print( -1, 75, "the name at the bottom of the screen.", tr, tg, tb, true);
|
||||
|
|
Loading…
Reference in a new issue