1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-01 18:43:33 +02:00

Add audiopause(on/off) command

If you have unfocus pause off, and unfocus audio pause off, then this command will go into effect.
When it's set to on, the audio will pause when you unfocus the game. When it's set to off, the
audio will not. This is different from the setting, and gets saved to the save file.
This commit is contained in:
AllyTally 2021-08-11 22:08:32 -03:00 committed by Ethan Lee
parent 7699f5aaf1
commit 3500888971
4 changed files with 23 additions and 2 deletions

View File

@ -391,6 +391,7 @@ void Game::init(void)
disablepause = false;
disableaudiopause = false;
disabletemporaryaudiopause = true;
inputdelay = false;
}
@ -5193,6 +5194,10 @@ void Game::customloadquick(std::string savfile)
{
map.customshowmm = help.Int(pText);
}
else if (SDL_strcmp(pKey, "disabletemporaryaudiopause") == 0)
{
disabletemporaryaudiopause = help.Int(pText);
}
}
@ -5674,6 +5679,8 @@ bool Game::customsavequick(std::string savfile)
xml::update_tag(msgs, "showminimap", (int) map.customshowmm);
xml::update_tag(msgs, "disabletemporaryaudiopause", (int) disabletemporaryaudiopause);
std::string summary = savearea + ", " + timestring();
xml::update_tag(msgs, "summary", summary.c_str());

View File

@ -475,6 +475,7 @@ public:
bool disablepause;
bool disableaudiopause;
bool disabletemporaryaudiopause;
bool inputdelay;
};

View File

@ -327,7 +327,7 @@ void KeyPoll::Poll(void)
if (!game.disablepause)
{
isActive = true;
if (!game.disableaudiopause)
if (!game.disableaudiopause || !game.disabletemporaryaudiopause)
{
music.resume();
music.resumeef();
@ -350,7 +350,7 @@ void KeyPoll::Poll(void)
if (!game.disablepause)
{
isActive = false;
if (!game.disableaudiopause)
if (!game.disableaudiopause || !game.disabletemporaryaudiopause)
{
music.pause();
music.pauseef();

View File

@ -326,6 +326,17 @@ void scriptclass::run(void)
{
graphics.showcutscenebars = false;
}
if (words[0] == "audiopause")
{
if (words[1] == "on")
{
game.disabletemporaryaudiopause = false;
}
else if (words[1] == "off")
{
game.disabletemporaryaudiopause = true;
}
}
if (words[0] == "untilbars")
{
if (graphics.showcutscenebars)
@ -3465,6 +3476,8 @@ void scriptclass::hardreset(void)
game.activeactivity = -1;
game.act_fade = 5;
game.disabletemporaryaudiopause = true;
//dwgraphicsclass
graphics.backgrounddrawn = false;
graphics.textbox.clear();