Some fixes with end-of-race messages;don't display 'you have finished the race' when you're killed in 3-strikes mode; don't display 'you have won' when using the 'race again' button at the end of three strikes; improved FTL end
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@4859 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
c5d98cf73f
commit
9b7a0fdc31
@ -327,13 +327,6 @@ void PlayerController::setPosition(int p)
|
||||
void PlayerController::finishedRace(float time)
|
||||
{
|
||||
|
||||
RaceGUI* m=World::getWorld()->getRaceGUI();
|
||||
if(m)
|
||||
{
|
||||
m->addMessage(m_kart->getPosition()==1 ? _("You won the race!")
|
||||
: _("You finished the race!") ,
|
||||
m_kart, 2.0f, 60);
|
||||
}
|
||||
} // finishedRace
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -477,10 +477,22 @@ void Kart::finishedRace(float time)
|
||||
|
||||
// Not all karts have a camera
|
||||
if (m_camera) m_camera->setMode(Camera::CM_REVERSE);
|
||||
|
||||
RaceGUI* m = World::getWorld()->getRaceGUI();
|
||||
if(m)
|
||||
{
|
||||
m->addMessage((getPosition() == 1 ? _("You won the race!") : _("You finished the race!")) ,
|
||||
this, 2.0f, 60);
|
||||
}
|
||||
}
|
||||
else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_FOLLOW_LEADER)
|
||||
{
|
||||
//TODO: what to do on FTL end?
|
||||
{
|
||||
RaceGUI* m = World::getWorld()->getRaceGUI();
|
||||
if(m)
|
||||
{
|
||||
m->addMessage((getPosition() == 1 ? _("You won the race!") : _("You finished the race!")) ,
|
||||
this, 2.0f, 60);
|
||||
}
|
||||
}
|
||||
else if (race_manager->getMinorMode() == RaceManager::MINOR_MODE_3_STRIKES)
|
||||
{
|
||||
|
@ -81,14 +81,17 @@ void FollowTheLeaderRace::countdownReachedZero()
|
||||
}
|
||||
|
||||
// almost over, use fast music
|
||||
if(getCurrentNumKarts()==3)
|
||||
if(getCurrentNumKarts()==3)
|
||||
{
|
||||
sound_manager->switchToFastMusic();
|
||||
// End of race is detected from the World::update()
|
||||
}
|
||||
|
||||
// End of race is also detected from the World::update(),
|
||||
} // countdownReachedZero
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** The follow the leader race is over if there is only one kart left (plus
|
||||
* the leader), or if all players have gone.
|
||||
* the leader), or if all (human) players have been eliminated.
|
||||
*/
|
||||
bool FollowTheLeaderRace::isRaceOver()
|
||||
{
|
||||
|
@ -148,6 +148,10 @@ void World::init()
|
||||
|
||||
if(!history->replayHistory()) history->initRecording();
|
||||
network_manager->worldLoaded();
|
||||
|
||||
// erase messages left over
|
||||
RaceGUI* m = World::getWorld()->getRaceGUI();
|
||||
if (m) m->clearAllMessages();
|
||||
} // init
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -288,6 +292,10 @@ void World::terminateRace()
|
||||
updateHighscores();
|
||||
WorldStatus::pause();
|
||||
unlock_manager->raceFinished();
|
||||
|
||||
RaceGUI* m = World::getWorld()->getRaceGUI();
|
||||
if (m) m->clearAllMessages();
|
||||
|
||||
WorldStatus::terminateRace();
|
||||
} // terminateRace
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
WorldStatus::WorldStatus()
|
||||
{
|
||||
m_mode = CLOCK_CHRONO;
|
||||
m_clock_mode = CLOCK_CHRONO;
|
||||
m_time = 0.0f;
|
||||
m_auxiliary_timer = 0.0f;
|
||||
m_phase = SETUP_PHASE;
|
||||
@ -65,7 +65,7 @@ WorldStatus::~WorldStatus()
|
||||
*/
|
||||
void WorldStatus::setClockMode(const ClockType mode, const float initial_time)
|
||||
{
|
||||
m_mode = mode;
|
||||
m_clock_mode = mode;
|
||||
m_time = initial_time;
|
||||
} // setClockMode
|
||||
|
||||
@ -163,12 +163,19 @@ void WorldStatus::update(const float dt)
|
||||
default: break; // default for RACE_PHASE, LIMBO_PHASE
|
||||
}
|
||||
|
||||
switch(m_mode)
|
||||
switch(m_clock_mode)
|
||||
{
|
||||
case CLOCK_CHRONO:
|
||||
m_time += dt;
|
||||
break;
|
||||
case CLOCK_COUNTDOWN:
|
||||
// stop countdown when race is over
|
||||
if (m_phase == DELAY_FINISH_PHASE || m_phase == FINISH_PHASE || m_phase == LIMBO_PHASE)
|
||||
{
|
||||
m_time = 0.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
m_time -= dt;
|
||||
|
||||
if(m_time <= 0.0)
|
||||
@ -177,7 +184,7 @@ void WorldStatus::update(const float dt)
|
||||
countdownReachedZero();
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
} // update
|
||||
|
@ -64,16 +64,16 @@ protected:
|
||||
SFXBase *m_start_sound;
|
||||
|
||||
/**
|
||||
* Elasped/remaining time in seconds
|
||||
*/
|
||||
* Elasped/remaining time in seconds
|
||||
*/
|
||||
float m_time;
|
||||
ClockType m_mode;
|
||||
ClockType m_clock_mode;
|
||||
|
||||
Phase m_phase;
|
||||
|
||||
/**
|
||||
* Remember previous phase e.g. on pause
|
||||
*/
|
||||
* Remember previous phase e.g. on pause
|
||||
*/
|
||||
Phase m_previous_phase;
|
||||
public:
|
||||
WorldStatus();
|
||||
@ -104,7 +104,7 @@ public:
|
||||
* for countdowns)
|
||||
*/
|
||||
void setClockMode(const ClockType mode, const float initial_time=0.0f);
|
||||
int getClockMode() const { return m_mode; }
|
||||
int getClockMode() const { return m_clock_mode; }
|
||||
/**
|
||||
* Call each frame, with the elapsed time as argument.
|
||||
*/
|
||||
|
@ -177,6 +177,8 @@ public:
|
||||
int fonst_size,
|
||||
const video::SColor &color=video::SColor(255, 255, 0, 255));
|
||||
|
||||
void clearAllMessages() { m_messages.clear(); }
|
||||
|
||||
/** Returns the size of the texture on which to render the minimap to. */
|
||||
const core::dimension2du getMiniMapSize() const
|
||||
{ return core::dimension2du(m_map_width, m_map_height); }
|
||||
|
Loading…
Reference in New Issue
Block a user