Display different message when the player win a grand prix
This commit is contained in:
parent
78b1d5c672
commit
f32b6059e6
@ -782,6 +782,7 @@ void RaceManager::exitRace(bool delete_world)
|
||||
}
|
||||
StateManager::get()->resetAndGoToScreen( MainMenuScreen::getInstance() );
|
||||
|
||||
bool some_human_player_well_ranked = false;
|
||||
bool some_human_player_won = false;
|
||||
const unsigned int kart_status_count = (unsigned int)m_kart_status.size();
|
||||
|
||||
@ -805,6 +806,8 @@ void RaceManager::exitRace(bool delete_world)
|
||||
if (m_kart_status[i].m_kart_type == KT_PLAYER ||
|
||||
m_kart_status[i].m_kart_type == KT_NETWORK_PLAYER)
|
||||
{
|
||||
some_human_player_well_ranked = true;
|
||||
if (rank == 0)
|
||||
some_human_player_won = true;
|
||||
}
|
||||
}
|
||||
@ -830,13 +833,14 @@ void RaceManager::exitRace(bool delete_world)
|
||||
race_manager->setNumKarts(0);
|
||||
race_manager->setNumPlayers(0);
|
||||
|
||||
if (some_human_player_won)
|
||||
if (some_human_player_well_ranked)
|
||||
{
|
||||
race_manager->startSingleRace("gpwin", 999,
|
||||
race_manager->raceWasStartedFromOverworld());
|
||||
GrandPrixWin* scene = GrandPrixWin::getInstance();
|
||||
scene->push();
|
||||
scene->setKarts(winners);
|
||||
scene->setPlayerWon(some_human_player_won);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -113,6 +113,7 @@ GrandPrixWin::GrandPrixWin() : GrandPrixCutscene("grand_prix_win.stkgui")
|
||||
m_kart_node[i] = NULL;
|
||||
m_podium_steps[i] = NULL;
|
||||
}
|
||||
m_player_won = false;
|
||||
} // GrandPrixWin
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
@ -316,10 +317,11 @@ void GrandPrixWin::onUpdate(float dt)
|
||||
|
||||
static int test_y = 0;
|
||||
|
||||
GUIEngine::getTitleFont()->draw(_("You completed the Grand Prix!"),
|
||||
core::rect< s32 >( 0, test_y, w, h/10 ),
|
||||
color,
|
||||
true/* center h */, true /* center v */ );
|
||||
irr::core::stringw message = (m_player_won) ? _("You won the Grand Prix!") :
|
||||
_("You completed the Grand Prix!");
|
||||
|
||||
GUIEngine::getTitleFont()->draw(message, core::rect< s32 >( 0, test_y, w, h/10 ),
|
||||
color, true/* center h */, true /* center v */ );
|
||||
} // onUpdate
|
||||
|
||||
|
||||
|
@ -62,6 +62,9 @@ class GrandPrixWin :
|
||||
|
||||
float m_podium_x[3], m_podium_y[3], m_podium_z[3];
|
||||
|
||||
/** Used to display a different message if a player is 1st */
|
||||
bool m_player_won;
|
||||
|
||||
public:
|
||||
// implement callbacks from parent class GUIEngine::Screen
|
||||
void init() OVERRIDE;
|
||||
@ -72,6 +75,7 @@ public:
|
||||
|
||||
/** \pre must be called after pushing the screen, but before onUpdate had the chance to be invoked */
|
||||
void setKarts(const std::string idents[3]);
|
||||
void setPlayerWon(bool some_player_won) { m_player_won = some_player_won; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user