Fixed displaying time in race gui and race result - soccer mode

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14151 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
deveee 2013-09-24 17:57:13 +00:00
parent bc4006cefa
commit ee61e8f52a
2 changed files with 16 additions and 11 deletions

View File

@ -53,6 +53,7 @@ void SoccerWorld::init()
{ {
WorldWithRank::init(); WorldWithRank::init();
m_display_rank = false; m_display_rank = false;
m_goal_timer = 0.f;
// check for possible problems if AI karts were incorrectly added // check for possible problems if AI karts were incorrectly added
if(getNumKarts() > race_manager->getNumPlayers()) if(getNumKarts() > race_manager->getNumPlayers())
@ -90,9 +91,6 @@ void SoccerWorld::reset()
obj->reset(); obj->reset();
obj->getPhysics()->reset(); obj->getPhysics()->reset();
} }
World *world = World::getWorld();
world->setClockMode(World::CLOCK_NONE);
initKartList(); initKartList();
} // reset } // reset
@ -111,9 +109,21 @@ const std::string& SoccerWorld::getIdent() const
*/ */
void SoccerWorld::update(float dt) void SoccerWorld::update(float dt)
{ {
World *world = World::getWorld();
WorldWithRank::update(dt); WorldWithRank::update(dt);
WorldWithRank::updateTrack(dt); WorldWithRank::updateTrack(dt);
if (world->getPhase() == World::GOAL_PHASE)
{
m_goal_timer += dt;
}
if (m_goal_timer > 3.0f)
{
world->setPhase(WorldStatus::RACE_PHASE);
m_goal_timer = 0;
}
// TODO // TODO
} // update } // update
@ -131,7 +141,6 @@ void SoccerWorld::onCheckGoalTriggered(bool first_goal)
//printf("Score:\nTeam One %d : %d Team Two\n", m_team_goals[0], m_team_goals[1]); //printf("Score:\nTeam One %d : %d Team Two\n", m_team_goals[0], m_team_goals[1]);
World *world = World::getWorld(); World *world = World::getWorld();
world->setPhase(WorldStatus::GOAL_PHASE); world->setPhase(WorldStatus::GOAL_PHASE);
world->setClockMode(World::CLOCK_COUNTDOWN, 1.0);
m_goal_sound->play(); m_goal_sound->play();
} }
@ -450,8 +459,4 @@ AbstractKart *SoccerWorld::createKart(const std::string &kart_ident, int index,
} // createKart } // createKart
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void SoccerWorld::countdownReachedZero()
{
World *world = World::getWorld();
world->setPhase(World::RACE_PHASE);
} // countdownReachedZero

View File

@ -49,6 +49,8 @@ private:
and re-enabled when the next game can be played)*/ and re-enabled when the next game can be played)*/
bool m_can_score_points; bool m_can_score_points;
SFXBase *m_goal_sound; SFXBase *m_goal_sound;
/** Timer for displaying goal text*/
float m_goal_timer;
public: public:
@ -75,8 +77,6 @@ public:
virtual void update(float dt); virtual void update(float dt);
virtual void countdownReachedZero();
void onCheckGoalTriggered(bool first_goal); void onCheckGoalTriggered(bool first_goal);
int getTeamLeader(unsigned int i); int getTeamLeader(unsigned int i);