Move script.hardreset() to after quit to menu

This cleans up a whole lot of kludge variables, because this aggressive
hardreset() right as ACTION is pressed doesn't do anyone any favors.

This aggressive hardreset() was probably here because of the whole fact
that exiting to the menu uses Terry's State Machine, to minimize the
chances of interruption, but it actually causes more issues and allows
towers to interrupt the fadeout. And we should fix the root cause (the
usage of the state machine) instead of patching together some kludge.
This commit is contained in:
Misa authored and Ethan Lee committed 2020-05-08 08:34:46 -04:00
1 parent 6ac41e112c
commit b59e5a8346
4 files changed
+9 -33

No files matched your search

+5 -14
View File
@@ -135,7 +135,6 @@ void Game::init(void)
teleportscript = "";
savemystats = false;
menukludge = false;
quickrestartkludge = false;
tapleft = 0;
@@ -231,11 +230,6 @@ void Game::init(void)
customleveltitle="";
createmenu(Menu::mainmenu);
wasintimetrial = false;
wasinintermission = false;
wasinnodeathmode = false;
wasincustommode = false;
deathcounts = 0;
gameoverdelay = 0;
frames = 0;
@@ -7334,19 +7328,19 @@ void Game::quittomenu()
//or "who do you want to play the level with?"
//or "do you want cutscenes?"
//or the confirm-load-quicksave menu
if (wasintimetrial)
if (intimetrial)
{
returntomenu(Menu::timetrials);
}
else if (wasinintermission)
else if (inintermission)
{
returntomenu(Menu::intermissionmenu);
}
else if (wasinnodeathmode)
else if (nodeathmode)
{
returntomenu(Menu::playmodes);
}
else if (wasincustommode)
else if (map.custommode)
{
returntomenu(Menu::levellist);
}
@@ -7358,8 +7352,5 @@ void Game::quittomenu()
{
createmenu(Menu::mainmenu);
}
wasintimetrial = false;
wasinintermission = false;
wasinnodeathmode = false;
wasincustommode = false;
script.hardreset();
}
-7
View File
@@ -234,12 +234,6 @@ public:
int creditposx, creditposy, creditposdelay;
//Menu kludge...
bool wasintimetrial;
bool wasinintermission;
bool wasinnodeathmode;
bool wasincustommode;
//Sine Wave Ninja Minigame
bool swnmode;
@@ -351,7 +345,6 @@ public:
int stretchMode;
int controllerSensitivity;
bool menukludge;
bool quickrestartkludge;
//Custom stuff
-8
View File
@@ -1879,7 +1879,6 @@ void mapinput()
graphics.resumegamemode = true;
obj.removeallblocks();
game.activeactivity = -1;
game.menukludge = false;
if (game.menupage >= 20)
{
game.state = 96;
@@ -1968,13 +1967,6 @@ void mapinput()
//Kill contents of offset render buffer, since we do that for some reason.
//This fixes an apparent frame flicker.
FillRect(graphics.tempBuffer, 0x000000);
if (game.intimetrial || game.insecretlab || game.nodeathmode) game.menukludge = true;
game.wasintimetrial = game.intimetrial;
game.wasinintermission = game.inintermission;
game.wasinnodeathmode = game.nodeathmode;
game.wasincustommode = map.custommode;
script.hardreset();
if(graphics.setflipmode) graphics.flipmode = true;
graphics.fademode = 2;
music.fadeout();
map.nexttowercolour();
+4 -4
View File
@@ -2353,7 +2353,7 @@ void maprender()
if (graphics.flipmode)
{
if (game.intimetrial || game.insecretlab || game.nodeathmode || game.menukludge)
if (game.intimetrial || game.insecretlab || game.nodeathmode)
{
graphics.Print(0, 135, "Return to main menu?", 196, 196, 255 - help.glow, true);
}
@@ -2369,7 +2369,7 @@ void maprender()
else
{
if (game.intimetrial || game.insecretlab || game.nodeathmode || game.menukludge)
if (game.intimetrial || game.insecretlab || game.nodeathmode)
{
graphics.Print(0, 80, "Return to main menu?", 196, 196, 255 - help.glow, true);
}
@@ -2389,7 +2389,7 @@ void maprender()
if (graphics.flipmode)
{
if (game.intimetrial || game.insecretlab || game.nodeathmode || game.menukludge)
if (game.intimetrial || game.insecretlab || game.nodeathmode)
{
graphics.Print(0, 135, "Return to main menu?", 196, 196, 255 - help.glow, true);
}
@@ -2404,7 +2404,7 @@ void maprender()
}
else
{
if (game.intimetrial || game.insecretlab || game.nodeathmode || game.menukludge)
if (game.intimetrial || game.insecretlab || game.nodeathmode)
{
graphics.Print(0, 80, "Return to main menu?", 196, 196, 255 - help.glow, true);
}