1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 09:39:43 +01:00

Fix delayed notification of NDM unlock

No Death Mode is intended to be unlocked by getting at least S-rank in
at least 4 time trials. Before 2.3, completing a time trial put you at
the main menu, so you would always be notified of having unlocked No
Death Mode once you went to the play menu again. But since 2.3,
completing a time trial puts you back at the Time Trial selection
screen, which isn't the play menu, so you would need to back all the way
out first in order to get the notification. And since you don't actually
unlock No Death Mode until you see the notification, this would be
required to be able to play No Death Mode.

To fix this, I decided to do something a bit kludge-y and just re-use
the code to check and unlock No Death Mode when the player presses
ACTION on the Time Trial complete screen (and there's also another path
by pressing Escape). At least I put it in a function, so it's not a pure
copy-paste, although it might as well be. I don't have time to think of
a proper solution, but it would probably involve disentangling unlock
notifications from Menu::play, for starters. But that's for later.
This commit is contained in:
Misa 2024-01-10 01:33:10 -08:00
parent a806b072bd
commit 5948168a40
3 changed files with 43 additions and 13 deletions

View file

@ -6206,6 +6206,7 @@ void Game::returnmenu(void)
{ {
music.play(Music_PRESENTINGVVVVVV); music.play(Music_PRESENTINGVVVVVV);
} }
enum Menu::MenuName camefrom = currentmenuname;
MenuStackFrame& frame = menustack[menustack.size()-1]; MenuStackFrame& frame = menustack[menustack.size()-1];
@ -6221,6 +6222,15 @@ void Game::returnmenu(void)
{ {
menustack.pop_back(); menustack.pop_back();
} }
/* FIXME: Even more horrible kludge! */
if (camefrom == Menu::timetrialcomplete3)
{
if (can_unlock_ndm())
{
unlock_ndm();
}
}
} }
void Game::returntomenu(enum Menu::MenuName t) void Game::returntomenu(enum Menu::MenuName t)
@ -6858,20 +6868,9 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
else else
{ {
//Alright, we haven't unlocked any time trials. How about no death mode? //Alright, we haven't unlocked any time trials. How about no death mode?
temp = 0; if (can_unlock_ndm())
if (bestrank[TimeTrial_SPACESTATION1] >= 2) temp++;
if (bestrank[TimeTrial_LABORATORY] >= 2) temp++;
if (bestrank[TimeTrial_TOWER] >= 2) temp++;
if (bestrank[TimeTrial_SPACESTATION2] >= 2) temp++;
if (bestrank[TimeTrial_WARPZONE] >= 2) temp++;
if (bestrank[TimeTrial_FINALLEVEL] >= 2) temp++;
if (temp >= 4 && !unlocknotify[Unlock_NODEATHMODE])
{ {
//Unlock No Death Mode unlock_ndm();
unlocknotify[Unlock_NODEATHMODE] = true;
unlock[Unlock_NODEATHMODE] = true;
createmenu(Menu::unlocknodeathmode, true);
savestatsandsettings();
} }
//Alright then! Flip mode? //Alright then! Flip mode?
else if (unlock[UnlockTrophy_GAME_COMPLETE] else if (unlock[UnlockTrophy_GAME_COMPLETE]
@ -7078,6 +7077,26 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
menuxoff = (320-menuwidth)/2; menuxoff = (320-menuwidth)/2;
} }
bool Game::can_unlock_ndm(void)
{
int temp = 0;
if (bestrank[TimeTrial_SPACESTATION1] >= 2) temp++;
if (bestrank[TimeTrial_LABORATORY] >= 2) temp++;
if (bestrank[TimeTrial_TOWER] >= 2) temp++;
if (bestrank[TimeTrial_SPACESTATION2] >= 2) temp++;
if (bestrank[TimeTrial_WARPZONE] >= 2) temp++;
if (bestrank[TimeTrial_FINALLEVEL] >= 2) temp++;
return temp >= 4 && !unlocknotify[Unlock_NODEATHMODE];
}
void Game::unlock_ndm(void)
{
unlocknotify[Unlock_NODEATHMODE] = true;
unlock[Unlock_NODEATHMODE] = true;
createmenu(Menu::unlocknodeathmode, true);
savestatsandsettings();
}
void Game::deletequick(void) void Game::deletequick(void)
{ {
if (inspecial() || map.custommode) if (inspecial() || map.custommode)

View file

@ -214,6 +214,8 @@ public:
void returnmenu(void); void returnmenu(void);
void returntomenu(enum Menu::MenuName t); void returntomenu(enum Menu::MenuName t);
void createmenu(enum Menu::MenuName t, bool samemenu = false); void createmenu(enum Menu::MenuName t, bool samemenu = false);
bool can_unlock_ndm(void);
void unlock_ndm(void);
void lifesequence(void); void lifesequence(void);

View file

@ -2217,6 +2217,15 @@ static void menuactionpress(void)
music.play(Music_PRESENTINGVVVVVV); music.play(Music_PRESENTINGVVVVVV);
game.returntomenu(Menu::timetrials); game.returntomenu(Menu::timetrials);
map.nexttowercolour(); map.nexttowercolour();
/* FIXME: This is kinda bad kludge... but if we unlocked No Death Mode
* while in a Time Trial, the player wouldn't be notified until they went
* back to Menu::play first. This is the only case where something can be
* unlocked without being immediately notified after returning to title. */
if (game.can_unlock_ndm())
{
game.unlock_ndm();
}
break; break;
case 1: case 1:
/* Replay time trial */ /* Replay time trial */