1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01: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; disablepause = false;
disableaudiopause = false; disableaudiopause = false;
disabletemporaryaudiopause = true;
inputdelay = false; inputdelay = false;
} }
@ -5193,6 +5194,10 @@ void Game::customloadquick(std::string savfile)
{ {
map.customshowmm = help.Int(pText); 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, "showminimap", (int) map.customshowmm);
xml::update_tag(msgs, "disabletemporaryaudiopause", (int) disabletemporaryaudiopause);
std::string summary = savearea + ", " + timestring(); std::string summary = savearea + ", " + timestring();
xml::update_tag(msgs, "summary", summary.c_str()); xml::update_tag(msgs, "summary", summary.c_str());

View file

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

View file

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

View file

@ -326,6 +326,17 @@ void scriptclass::run(void)
{ {
graphics.showcutscenebars = false; 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 (words[0] == "untilbars")
{ {
if (graphics.showcutscenebars) if (graphics.showcutscenebars)
@ -3465,6 +3476,8 @@ void scriptclass::hardreset(void)
game.activeactivity = -1; game.activeactivity = -1;
game.act_fade = 5; game.act_fade = 5;
game.disabletemporaryaudiopause = true;
//dwgraphicsclass //dwgraphicsclass
graphics.backgrounddrawn = false; graphics.backgrounddrawn = false;
graphics.textbox.clear(); graphics.textbox.clear();