mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-09 18:39:45 +01:00
Clean up all exit paths to the menu to use common code
There are multiple different exit paths to the main menu. In 2.2, they all had a bunch of copy-pasted code. In 2.3 currently, most of them use game.quittomenu(), but there are some stragglers that still use hand-copied code. This is a bit of a problem, because all exit paths should consistently have FILESYSTEM_unmountassets(), as part of the 2.3 feature of per-level custom assets. Furthermore, most (but not all) of the paths call script.hardreset() too, and some of the stragglers don't. So there could be something persisting through to the title screen (like a really long flash/shake timer) that could only persist if exiting to the title screen through those paths. But, actually, it seems like there's a good reason for some of those to not call script.hardreset() - namely, dying or completing No Death Mode and completing a Time Trial presents some information onscreen that would get reset by script.hardreset(), so I'll fix that in a later commit. So what I've done for this commit is found every exit path that didn't already use game.quittomenu(), and made them use game.quittomenu(). As well, some of them had special handling that existed on top of them already having a corresponding entry in game.quittomenu() (but the path would take the special handling because it never did game.quittomenu()), so I removed that special handling as well (e.g. exiting from a custom level used returntomenu(Menu::levellist) when quittomenu() already had that same returntomenu()). The menu that exiting from the level editor returns to is now handled in game.quittomenu() as well, where the map.custommode branch now also checks for map.custommodeforreal. Unfortunately, it seems like entering the level editor doesn't properly initialize map.custommode, so entering the level editor now initializes map.custommode, too. I've also taken the music.play(6) out of game.quittomenu(), because not all exit paths immediately play Presenting VVVVVV, so all exit paths that DO immediately play Presenting VVVVVV now have music.play(6) special-cased for them, which is fine enough for me. Here is the list of all exit paths to the menu: - Exiting through the pause menu (without glitchrunner mode) - Exiting through the pause menu (with glitchrunner mode) - Completing a custom level - Completing a Time Trial - Dying in No Death Mode - Completing No Death Mode - Completing an Intermission replay - Exiting from the level editor - Completing the main game
This commit is contained in:
parent
07cc5f68ac
commit
ee0ba8a723
5 changed files with 24 additions and 42 deletions
|
@ -1288,6 +1288,7 @@ void Game::updatestate()
|
||||||
break;
|
break;
|
||||||
case 81:
|
case 81:
|
||||||
quittomenu();
|
quittomenu();
|
||||||
|
music.play(6); //should be after quittomenu()
|
||||||
state = 0;
|
state = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1341,11 +1342,7 @@ void Game::updatestate()
|
||||||
if(graphics.fademode == 1) state++;
|
if(graphics.fademode == 1) state++;
|
||||||
break;
|
break;
|
||||||
case 84:
|
case 84:
|
||||||
graphics.flipmode = false;
|
quittomenu();
|
||||||
gamestate = TITLEMODE;
|
|
||||||
graphics.fademode = 4;
|
|
||||||
graphics.backgrounddrawn = true;
|
|
||||||
graphics.titlebg.tdrawback = true;
|
|
||||||
createmenu(Menu::timetrialcomplete);
|
createmenu(Menu::timetrialcomplete);
|
||||||
state = 0;
|
state = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -1871,7 +1868,6 @@ void Game::updatestate()
|
||||||
if(!muted && ed.levmusic>0) music.fadeMusicVolumeIn(3000);
|
if(!muted && ed.levmusic>0) music.fadeMusicVolumeIn(3000);
|
||||||
}
|
}
|
||||||
graphics.showcutscenebars = false;
|
graphics.showcutscenebars = false;
|
||||||
returntomenu(Menu::levellist);
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 1014:
|
case 1014:
|
||||||
|
@ -1896,6 +1892,7 @@ void Game::updatestate()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
quittomenu();
|
quittomenu();
|
||||||
|
music.play(6); //should be after quittomenu()
|
||||||
state = 0;
|
state = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2852,7 +2849,6 @@ void Game::updatestate()
|
||||||
{
|
{
|
||||||
graphics.fademode = 2;
|
graphics.fademode = 2;
|
||||||
companion = 0;
|
companion = 0;
|
||||||
returnmenu();
|
|
||||||
state=3100;
|
state=3100;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2883,7 +2879,6 @@ void Game::updatestate()
|
||||||
state++;
|
state++;
|
||||||
graphics.fademode = 2;
|
graphics.fademode = 2;
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
returnmenu();
|
|
||||||
state=3100;
|
state=3100;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2909,12 +2904,8 @@ void Game::updatestate()
|
||||||
if(graphics.fademode == 1) state++;
|
if(graphics.fademode == 1) state++;
|
||||||
break;
|
break;
|
||||||
case 3101:
|
case 3101:
|
||||||
graphics.flipmode = false;
|
quittomenu();
|
||||||
gamestate = TITLEMODE;
|
music.play(6); //should be after quittomenu();
|
||||||
graphics.fademode = 4;
|
|
||||||
graphics.backgrounddrawn = true;
|
|
||||||
graphics.titlebg.tdrawback = true;
|
|
||||||
music.play(6);
|
|
||||||
state = 0;
|
state = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3218,11 +3209,7 @@ void Game::updatestate()
|
||||||
if(graphics.fademode == 1) state++;
|
if(graphics.fademode == 1) state++;
|
||||||
break;
|
break;
|
||||||
case 3522:
|
case 3522:
|
||||||
graphics.flipmode = false;
|
quittomenu();
|
||||||
gamestate = TITLEMODE;
|
|
||||||
graphics.fademode = 4;
|
|
||||||
graphics.backgrounddrawn = true;
|
|
||||||
graphics.titlebg.tdrawback = true;
|
|
||||||
createmenu(Menu::nodeathmodecomplete);
|
createmenu(Menu::nodeathmodecomplete);
|
||||||
state = 0;
|
state = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -6972,9 +6959,7 @@ void Game::quittomenu()
|
||||||
{
|
{
|
||||||
gamestate = TITLEMODE;
|
gamestate = TITLEMODE;
|
||||||
graphics.fademode = 4;
|
graphics.fademode = 4;
|
||||||
FILESYSTEM_unmountassets(); // should be before music.play(6)
|
FILESYSTEM_unmountassets();
|
||||||
music.play(6);
|
|
||||||
graphics.backgrounddrawn = false;
|
|
||||||
graphics.titlebg.tdrawback = true;
|
graphics.titlebg.tdrawback = true;
|
||||||
graphics.flipmode = false;
|
graphics.flipmode = false;
|
||||||
//Don't be stuck on the summary screen,
|
//Don't be stuck on the summary screen,
|
||||||
|
@ -6995,7 +6980,15 @@ void Game::quittomenu()
|
||||||
}
|
}
|
||||||
else if (map.custommode)
|
else if (map.custommode)
|
||||||
{
|
{
|
||||||
returntomenu(Menu::levellist);
|
if (map.custommodeforreal)
|
||||||
|
{
|
||||||
|
returntomenu(Menu::levellist);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Returning from editor
|
||||||
|
returntomenu(Menu::playerworlds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (save_exists() || anything_unlocked())
|
else if (save_exists() || anything_unlocked())
|
||||||
{
|
{
|
||||||
|
|
|
@ -2117,6 +2117,7 @@ void mapinput()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
game.quittomenu();
|
game.quittomenu();
|
||||||
|
music.play(6); //should be after game.quittomenu()
|
||||||
game.fadetomenu = false;
|
game.fadetomenu = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,13 +113,9 @@ void gamecompletelogic2()
|
||||||
game.savetele();
|
game.savetele();
|
||||||
music.currentsong=tmp;
|
music.currentsong=tmp;
|
||||||
//Return to game
|
//Return to game
|
||||||
graphics.titlebg.colstate = 10;
|
game.quittomenu();
|
||||||
game.gamestate = TITLEMODE;
|
|
||||||
graphics.fademode = 4;
|
|
||||||
FILESYSTEM_unmountassets(); // should be before music.playef(18)
|
|
||||||
music.playef(18);
|
|
||||||
game.returntomenu(Menu::play);
|
|
||||||
game.createmenu(Menu::gamecompletecontinue);
|
game.createmenu(Menu::gamecompletecontinue);
|
||||||
|
graphics.titlebg.colstate = 10;
|
||||||
map.nexttowercolour();
|
map.nexttowercolour();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2627,11 +2627,8 @@ void scriptclass::run()
|
||||||
|
|
||||||
void scriptclass::resetgametomenu()
|
void scriptclass::resetgametomenu()
|
||||||
{
|
{
|
||||||
game.gamestate = TITLEMODE;
|
|
||||||
graphics.flipmode = false;
|
|
||||||
obj.entities.clear();
|
obj.entities.clear();
|
||||||
graphics.fademode = 4;
|
game.quittomenu();
|
||||||
graphics.titlebg.tdrawback = true;
|
|
||||||
game.createmenu(Menu::gameover);
|
game.createmenu(Menu::gameover);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3262,6 +3259,8 @@ void scriptclass::startgamemode( int t )
|
||||||
hardreset();
|
hardreset();
|
||||||
ed.reset();
|
ed.reset();
|
||||||
music.fadeout();
|
music.fadeout();
|
||||||
|
map.custommode = true;
|
||||||
|
map.custommodeforreal = false;
|
||||||
|
|
||||||
game.gamestate = EDITORMODE;
|
game.gamestate = EDITORMODE;
|
||||||
game.jumpheld = true;
|
game.jumpheld = true;
|
||||||
|
|
|
@ -3627,18 +3627,11 @@ void editorlogic()
|
||||||
if (graphics.fademode == 1)
|
if (graphics.fademode == 1)
|
||||||
{
|
{
|
||||||
//Return to game
|
//Return to game
|
||||||
map.nexttowercolour();
|
|
||||||
graphics.titlebg.colstate = 10;
|
graphics.titlebg.colstate = 10;
|
||||||
game.gamestate = TITLEMODE;
|
|
||||||
script.hardreset();
|
|
||||||
graphics.fademode = 4;
|
|
||||||
music.haltdasmusik();
|
|
||||||
FILESYSTEM_unmountassets(); // should be before music.play(6)
|
|
||||||
music.play(6);
|
|
||||||
map.nexttowercolour();
|
map.nexttowercolour();
|
||||||
|
game.quittomenu();
|
||||||
|
music.play(6); //should be before game.quittomenu()
|
||||||
ed.settingsmod=false;
|
ed.settingsmod=false;
|
||||||
graphics.backgrounddrawn=false;
|
|
||||||
game.returntomenu(Menu::playerworlds);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue