1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-28 15:38:30 +02:00

Add being able to disable unfocus pause

It's sometimes unwanted by people, and it's unwanted enough that there
exist instructions to hexedit the binary to remove it (
https://distractionware.com/forum/index.php?topic=3247.0 ).

Fun fact, the unfocus pause didn't exist in 2.0.
This commit is contained in:
Misa 2020-06-29 19:49:14 -07:00 committed by Ethan Lee
parent 3f077ee56a
commit 35c540449e
5 changed files with 48 additions and 7 deletions

View File

@ -401,6 +401,8 @@ void Game::init(void)
kludge_ingametemp = Menu::mainmenu; kludge_ingametemp = Menu::mainmenu;
shouldreturntopausemenu = false; shouldreturntopausemenu = false;
disablepause = false;
/* Terry's Patrons... */ /* Terry's Patrons... */
const char* superpatrons_arr[] = { const char* superpatrons_arr[] = {
"Anders Ekermo", "Anders Ekermo",
@ -4811,6 +4813,11 @@ void Game::loadstats()
skipfakeload = atoi(pText); skipfakeload = atoi(pText);
} }
if (pKey == "disablepause")
{
disablepause = atoi(pText);
}
if (pKey == "over30mode") if (pKey == "over30mode")
{ {
over30mode = atoi(pText); over30mode = atoi(pText);
@ -5059,6 +5066,10 @@ void Game::savestats()
msg->LinkEndChild(doc.NewText(help.String((int) skipfakeload).c_str())); msg->LinkEndChild(doc.NewText(help.String((int) skipfakeload).c_str()));
dataNode->LinkEndChild(msg); dataNode->LinkEndChild(msg);
msg = doc.NewElement("disablepause");
msg->LinkEndChild(doc.NewText(help.String((int) disablepause).c_str()));
dataNode->LinkEndChild(msg);
msg = doc.NewElement("notextoutline"); msg = doc.NewElement("notextoutline");
msg->LinkEndChild(doc.NewText(help.String((int) graphics.notextoutline).c_str())); msg->LinkEndChild(doc.NewText(help.String((int) graphics.notextoutline).c_str()));
dataNode->LinkEndChild(msg); dataNode->LinkEndChild(msg);
@ -7216,6 +7227,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option("text outline"); option("text outline");
option("invincibility", !ingame_titlemode || (!game.insecretlab && !game.intimetrial && !game.nodeathmode)); option("invincibility", !ingame_titlemode || (!game.insecretlab && !game.intimetrial && !game.nodeathmode));
option("slowdown", !ingame_titlemode || (!game.insecretlab && !game.intimetrial && !game.nodeathmode)); option("slowdown", !ingame_titlemode || (!game.insecretlab && !game.intimetrial && !game.nodeathmode));
option("unfocus pause");
option("load screen"); option("load screen");
option("room name bg"); option("room name bg");
option("return"); option("return");

View File

@ -415,6 +415,8 @@ public:
bool shouldreturntopausemenu; bool shouldreturntopausemenu;
void returntopausemenu(); void returntopausemenu();
bool disablepause;
}; };
extern Game game; extern Game game;

View File

@ -527,16 +527,21 @@ void menuactionpress()
} }
break; break;
case 5: case 5:
// toggle unfocus pause
game.disablepause = !game.disablepause;
music.playef(11);
break;
case 6:
// toggle fake load screen // toggle fake load screen
game.skipfakeload = !game.skipfakeload; game.skipfakeload = !game.skipfakeload;
music.playef(11); music.playef(11);
break; break;
case 6: case 7:
// toggle translucent roomname BG // toggle translucent roomname BG
graphics.translucentroomname = !graphics.translucentroomname; graphics.translucentroomname = !graphics.translucentroomname;
music.playef(11); music.playef(11);
break; break;
case 7: case 8:
//back //back
music.playef(11); music.playef(11);
game.returnmenu(); game.returnmenu();

View File

@ -244,7 +244,10 @@ void KeyPoll::Poll()
/* Window Focus */ /* Window Focus */
case SDL_WINDOWEVENT_FOCUS_GAINED: case SDL_WINDOWEVENT_FOCUS_GAINED:
isActive = true; if (!game.disablepause)
{
isActive = true;
}
if (!useFullscreenSpaces) if (!useFullscreenSpaces)
{ {
if (wasFullscreen) if (wasFullscreen)
@ -257,14 +260,17 @@ void KeyPoll::Poll()
} }
} }
SDL_DisableScreenSaver(); SDL_DisableScreenSaver();
if (Mix_PlayingMusic()) if (!game.disablepause && Mix_PlayingMusic())
{ {
// Correct songStart for how long we were paused // Correct songStart for how long we were paused
music.songStart += SDL_GetPerformanceCounter() - pauseStart; music.songStart += SDL_GetPerformanceCounter() - pauseStart;
} }
break; break;
case SDL_WINDOWEVENT_FOCUS_LOST: case SDL_WINDOWEVENT_FOCUS_LOST:
isActive = false; if (!game.disablepause)
{
isActive = false;
}
if (!useFullscreenSpaces) if (!useFullscreenSpaces)
{ {
wasFullscreen = !graphics.screenbuffer->isWindowed; wasFullscreen = !graphics.screenbuffer->isWindowed;
@ -275,7 +281,10 @@ void KeyPoll::Poll()
); );
} }
SDL_EnableScreenSaver(); SDL_EnableScreenSaver();
pauseStart = SDL_GetPerformanceCounter(); if (!game.disablepause)
{
pauseStart = SDL_GetPerformanceCounter();
}
break; break;
/* Mouse Focus */ /* Mouse Focus */

View File

@ -465,13 +465,26 @@ void menurender()
} }
break; break;
case 5: case 5:
graphics.bigprint( -1, 40, "Unfocus Pause", tr, tg, tb, true);
graphics.Print( -1, 75, "Toggle if the game will pause", tr, tg, tb, true);
graphics.Print( -1, 85, "when you're unfocused.", tr, tg, tb, true);
if (game.disablepause)
{
graphics.Print(-1, 105, "Unfocus pause is OFF", tr/2, tg/2, tb/2, true);
}
else
{
graphics.Print(-1, 105, "Unfocus pause is ON", tr, tg, tb, true);
}
break;
case 6:
graphics.bigprint(-1, 30, "Fake Load Screen", tr, tg, tb, true); graphics.bigprint(-1, 30, "Fake Load Screen", tr, tg, tb, true);
if (game.skipfakeload) if (game.skipfakeload)
graphics.Print(-1, 75, "Fake loading screen is OFF", tr/2, tg/2, tb/2, true); graphics.Print(-1, 75, "Fake loading screen is OFF", tr/2, tg/2, tb/2, true);
else else
graphics.Print(-1, 75, "Fake loading screen is ON", tr, tg, tb, true); graphics.Print(-1, 75, "Fake loading screen is ON", tr, tg, tb, true);
break; break;
case 6: case 7:
graphics.bigprint(-1, 30, "Room Name BG", tr, tg, tb, true); graphics.bigprint(-1, 30, "Room Name BG", tr, tg, tb, true);
graphics.Print( -1, 75, "Lets you see through what is behind", tr, tg, tb, true); graphics.Print( -1, 75, "Lets you see through what is behind", tr, tg, tb, true);
graphics.Print( -1, 85, "the name at the bottom of the screen.", tr, tg, tb, true); graphics.Print( -1, 85, "the name at the bottom of the screen.", tr, tg, tb, true);