From ee61e8f52accb85a2742cdb0bf9d4ce2e46be066 Mon Sep 17 00:00:00 2001 From: deveee Date: Tue, 24 Sep 2013 17:57:13 +0000 Subject: [PATCH] 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 --- src/modes/soccer_world.cpp | 23 ++++++++++++++--------- src/modes/soccer_world.hpp | 4 ++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/modes/soccer_world.cpp b/src/modes/soccer_world.cpp index c02bf7c97..be11f3a5e 100644 --- a/src/modes/soccer_world.cpp +++ b/src/modes/soccer_world.cpp @@ -53,6 +53,7 @@ void SoccerWorld::init() { WorldWithRank::init(); m_display_rank = false; + m_goal_timer = 0.f; // check for possible problems if AI karts were incorrectly added if(getNumKarts() > race_manager->getNumPlayers()) @@ -90,9 +91,6 @@ void SoccerWorld::reset() obj->reset(); obj->getPhysics()->reset(); } - - World *world = World::getWorld(); - world->setClockMode(World::CLOCK_NONE); initKartList(); } // reset @@ -111,9 +109,21 @@ const std::string& SoccerWorld::getIdent() const */ void SoccerWorld::update(float dt) { + World *world = World::getWorld(); + WorldWithRank::update(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 } // 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]); World *world = World::getWorld(); world->setPhase(WorldStatus::GOAL_PHASE); - world->setClockMode(World::CLOCK_COUNTDOWN, 1.0); m_goal_sound->play(); } @@ -450,8 +459,4 @@ AbstractKart *SoccerWorld::createKart(const std::string &kart_ident, int index, } // createKart //----------------------------------------------------------------------------- -void SoccerWorld::countdownReachedZero() -{ - World *world = World::getWorld(); - world->setPhase(World::RACE_PHASE); -} // countdownReachedZero + diff --git a/src/modes/soccer_world.hpp b/src/modes/soccer_world.hpp index 91d512de3..b2d43be13 100644 --- a/src/modes/soccer_world.hpp +++ b/src/modes/soccer_world.hpp @@ -49,6 +49,8 @@ private: and re-enabled when the next game can be played)*/ bool m_can_score_points; SFXBase *m_goal_sound; + /** Timer for displaying goal text*/ + float m_goal_timer; public: @@ -75,8 +77,6 @@ public: virtual void update(float dt); - virtual void countdownReachedZero(); - void onCheckGoalTriggered(bool first_goal); int getTeamLeader(unsigned int i);