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:
parent
a806b072bd
commit
5948168a40
3 changed files with 43 additions and 13 deletions
|
@ -6206,6 +6206,7 @@ void Game::returnmenu(void)
|
|||
{
|
||||
music.play(Music_PRESENTINGVVVVVV);
|
||||
}
|
||||
enum Menu::MenuName camefrom = currentmenuname;
|
||||
|
||||
MenuStackFrame& frame = menustack[menustack.size()-1];
|
||||
|
||||
|
@ -6221,6 +6222,15 @@ void Game::returnmenu(void)
|
|||
{
|
||||
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)
|
||||
|
@ -6858,20 +6868,9 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
|||
else
|
||||
{
|
||||
//Alright, we haven't unlocked any time trials. How about no death mode?
|
||||
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++;
|
||||
if (temp >= 4 && !unlocknotify[Unlock_NODEATHMODE])
|
||||
if (can_unlock_ndm())
|
||||
{
|
||||
//Unlock No Death Mode
|
||||
unlocknotify[Unlock_NODEATHMODE] = true;
|
||||
unlock[Unlock_NODEATHMODE] = true;
|
||||
createmenu(Menu::unlocknodeathmode, true);
|
||||
savestatsandsettings();
|
||||
unlock_ndm();
|
||||
}
|
||||
//Alright then! Flip mode?
|
||||
else if (unlock[UnlockTrophy_GAME_COMPLETE]
|
||||
|
@ -7078,6 +7077,26 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
|
|||
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)
|
||||
{
|
||||
if (inspecial() || map.custommode)
|
||||
|
|
|
@ -214,6 +214,8 @@ public:
|
|||
void returnmenu(void);
|
||||
void returntomenu(enum Menu::MenuName t);
|
||||
void createmenu(enum Menu::MenuName t, bool samemenu = false);
|
||||
bool can_unlock_ndm(void);
|
||||
void unlock_ndm(void);
|
||||
|
||||
void lifesequence(void);
|
||||
|
||||
|
|
|
@ -2217,6 +2217,15 @@ static void menuactionpress(void)
|
|||
music.play(Music_PRESENTINGVVVVVV);
|
||||
game.returntomenu(Menu::timetrials);
|
||||
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;
|
||||
case 1:
|
||||
/* Replay time trial */
|
||||
|
|
Loading…
Reference in a new issue