Work on new feature unlocked cutscene, starting to work correctly, more testing (and art work) needed

This commit is contained in:
Marianne Gagnon 2014-06-05 20:06:27 -04:00
parent 3cd2b97202
commit be5577045d
5 changed files with 63 additions and 36 deletions

View File

@ -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();

View File

@ -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; n<unlockedStuffCount; n++)
{
if (m_unlocked_stuff[n].m_root_gift_node == NULL) continue;
@ -546,7 +543,6 @@ void FeatureUnlockedCutScene::addUnlockedGP(const GrandPrixData* gp)
bool FeatureUnlockedCutScene::onEscapePressed()
{
((CutsceneWorld*)World::getWorld())->abortCutscene();
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

View File

@ -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<std::string> parts;
parts.push_back("featunlocked");
((CutsceneWorld*)World::getWorld())->setParts(parts);
scene->addTrophy(race_manager->getDifficulty());
scene->findWhatWasUnlocked(race_manager->getDifficulty());

View File

@ -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<std::string> parts;
parts.push_back("featunlocked");
((CutsceneWorld*)World::getWorld())->setParts(parts);
assert(unlocked.size() > 0);
scene->addTrophy(race_manager->getDifficulty());

View File

@ -275,6 +275,10 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
{
FeatureUnlockedCutScene* scene =
FeatureUnlockedCutScene::getInstance();
std::vector<std::string> parts;
parts.push_back("featunlocked");
((CutsceneWorld*)World::getWorld())->setParts(parts);
scene->addTrophy(race_manager->getDifficulty());
scene->findWhatWasUnlocked(race_manager->getDifficulty());
StateManager::get()->popMenu();