diff --git a/src/modes/cutscene_world.cpp b/src/modes/cutscene_world.cpp index 319f901e5..f59c1937c 100644 --- a/src/modes/cutscene_world.cpp +++ b/src/modes/cutscene_world.cpp @@ -413,7 +413,7 @@ void CutsceneWorld::enterRaceOverState() OverWorld::enterOverWorld(); } // TODO: remove hardcoded knowledge of cutscenes, replace with scripting probably - else if (m_parts.size() == 1 && m_parts[0] == "gplose") + else if (m_parts.size() == 1 && m_parts[0] == "gplose") { race_manager->exitRace(); StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance()); @@ -438,6 +438,28 @@ void CutsceneWorld::enterRaceOverState() StateManager::get()->pushScreen( s ); } } + // TODO: remove hardcoded knowledge of cutscenes, replace with scripting probably + else if (m_parts.size() == 1 && m_parts[0] == "featunlocked") + { + if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX) + { + // in GP mode, continue GP after viewing this screen + StateManager::get()->popMenu(); + race_manager->next(); + } + else + { + // back to menu or overworld + race_manager->exitRace(); + StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance()); + //StateManager::get()->popMenu(); + + if (race_manager->raceWasStartedFromOverworld()) + { + OverWorld::enterOverWorld(); + } + } + } else { race_manager->exitRace(); diff --git a/src/states_screens/feature_unlocked.cpp b/src/states_screens/feature_unlocked.cpp index e414c06f3..624e99e0c 100644 --- a/src/states_screens/feature_unlocked.cpp +++ b/src/states_screens/feature_unlocked.cpp @@ -156,7 +156,7 @@ void FeatureUnlockedCutScene::onCutsceneEnd() irr_driver->removeNode(m_avoid_irrlicht_bug); m_avoid_irrlicht_bug = NULL; #endif - + m_unlocked_stuff.clearAndDeleteAll(); m_all_kart_models.clearAndDeleteAll(); @@ -353,7 +353,6 @@ void FeatureUnlockedCutScene::init() void FeatureUnlockedCutScene::tearDown() { Screen::tearDown(); - ((CutsceneWorld*)World::getWorld())->abortCutscene(); } // tearDown // ---------------------------------------------------------------------------- @@ -379,8 +378,6 @@ void FeatureUnlockedCutScene::onUpdate(float dt) float progress_factor = (m_global_time - GIFT_EXIT_FROM) / (GIFT_EXIT_TO - GIFT_EXIT_FROM); float smoothed_progress_factor = sin((progress_factor - 0.5f)*M_PI)/2.0f + 0.5f; - Log::info("smoothed_progress_factor", "%f", smoothed_progress_factor); - for (int n=0; nabortCutscene(); continueButtonPressed(); return false; // continueButtonPressed already pop'ed the menu } // onEscapePressed @@ -555,35 +551,20 @@ bool FeatureUnlockedCutScene::onEscapePressed() void FeatureUnlockedCutScene::continueButtonPressed() { - if (m_global_time < GIFT_EXIT_TO) - { - // If animation was not over yet, the button is used to skip the animation - while (m_global_time < GIFT_EXIT_TO) - { - // simulate all the steps of the animation until we reach the end - onUpdate(0.4f); - } - } - else - { - if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX) - { - // in GP mode, continue GP after viewing this screen - StateManager::get()->popMenu(); - race_manager->next(); - } - else - { - // back to menu or overworld - race_manager->exitRace(); - StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance()); - - if (race_manager->raceWasStartedFromOverworld()) - { - OverWorld::enterOverWorld(); - } - } - } + //if (m_global_time < GIFT_EXIT_TO) + //{ + // // If animation was not over yet, the button is used to skip the animation + // while (m_global_time < GIFT_EXIT_TO) + // { + // // simulate all the steps of the animation until we reach the end + // onUpdate(0.4f); + // World::getWorld()->updateWorld(0.4f); + // } + //} + //else + //{ + ((CutsceneWorld*)World::getWorld())->abortCutscene(); + //} } // continueButtonPressed diff --git a/src/states_screens/grand_prix_lose.cpp b/src/states_screens/grand_prix_lose.cpp index e5d3fca69..26e55b51f 100644 --- a/src/states_screens/grand_prix_lose.cpp +++ b/src/states_screens/grand_prix_lose.cpp @@ -117,9 +117,18 @@ void GrandPrixLose::onCutsceneEnd() PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges(); if (unlocked.size() > 0) { + StateManager::get()->enterGameState(); + race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE); + race_manager->setNumKarts(0); + race_manager->setNumPlayers(0); + race_manager->setNumLocalPlayers(0); + race_manager->startSingleRace("featunlocked", 999, false); FeatureUnlockedCutScene* scene = FeatureUnlockedCutScene::getInstance(); + std::vector parts; + parts.push_back("featunlocked"); + ((CutsceneWorld*)World::getWorld())->setParts(parts); scene->addTrophy(race_manager->getDifficulty()); scene->findWhatWasUnlocked(race_manager->getDifficulty()); diff --git a/src/states_screens/grand_prix_win.cpp b/src/states_screens/grand_prix_win.cpp index 18bf4c927..eb5ee8fb2 100644 --- a/src/states_screens/grand_prix_win.cpp +++ b/src/states_screens/grand_prix_win.cpp @@ -127,7 +127,18 @@ void GrandPrixWin::onCutsceneEnd() PlayerManager::getCurrentPlayer()->getRecentlyCompletedChallenges(); PlayerManager::getCurrentPlayer()->clearUnlocked(); - FeatureUnlockedCutScene* scene = FeatureUnlockedCutScene::getInstance(); + StateManager::get()->enterGameState(); + race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE); + race_manager->setNumKarts(0); + race_manager->setNumPlayers(0); + race_manager->setNumLocalPlayers(0); + race_manager->startSingleRace("featunlocked", 999, false); + + FeatureUnlockedCutScene* scene = + FeatureUnlockedCutScene::getInstance(); + std::vector parts; + parts.push_back("featunlocked"); + ((CutsceneWorld*)World::getWorld())->setParts(parts); assert(unlocked.size() > 0); scene->addTrophy(race_manager->getDifficulty()); diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index 8854a3d91..35afce0a5 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -275,6 +275,10 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget, { FeatureUnlockedCutScene* scene = FeatureUnlockedCutScene::getInstance(); + std::vector parts; + parts.push_back("featunlocked"); + ((CutsceneWorld*)World::getWorld())->setParts(parts); + scene->addTrophy(race_manager->getDifficulty()); scene->findWhatWasUnlocked(race_manager->getDifficulty()); StateManager::get()->popMenu();