diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 60751186..7474cf73 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -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) diff --git a/desktop_version/src/Game.h b/desktop_version/src/Game.h index 0a7215c3..dfce1d7c 100644 --- a/desktop_version/src/Game.h +++ b/desktop_version/src/Game.h @@ -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); diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 904071c3..aaa09e0b 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -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 */