Fixed graphical error in FTL races when music is enabled

(see bug 3072740): the countdown timer caused incorrect
values to be used for the 'music credit' display.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6121 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-09-23 07:17:04 +00:00
parent 6b46f3162f
commit 2c98d511fe
3 changed files with 16 additions and 0 deletions

View File

@ -51,6 +51,15 @@ FollowTheLeaderRace::~FollowTheLeaderRace()
#pragma mark -
#pragma mark clock events
#endif
//-----------------------------------------------------------------------------
/** Returns the original time at which the countdown timer started. This is
* used by the race_gui to display the music credits in FTL mode correctly.
*/
float FollowTheLeaderRace::getClockStartTime()
{
return m_leader_intervals[0];
} // getClockStartTime
//-----------------------------------------------------------------------------
/** Called when a kart must be eliminated.
*/

View File

@ -41,6 +41,7 @@ public:
// overriding World methods
virtual void restartRace();
virtual std::string getIdent() const;
float getClockStartTime();
virtual bool useFastMusicNearEnd() const { return false; }
virtual RaceGUIBase::KartIconDisplayInfo* getKartsDisplayInfo();

View File

@ -38,6 +38,7 @@ using namespace irr;
#include "items/attachment_manager.hpp"
#include "items/powerup_manager.hpp"
#include "karts/kart_properties_manager.hpp"
#include "modes/follow_the_leader.hpp"
#include "modes/linear_world.hpp"
#include "modes/world.hpp"
#include "race/race_manager.hpp"
@ -1107,6 +1108,11 @@ void RaceGUI::drawGlobalMusicDescription()
gui::IGUIFont* font = GUIEngine::getFont();
float race_time = World::getWorld()->getTime();
// In follow the leader the clock counts backwards, so convert the
// countdown time to time since start:
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER)
race_time = ((FollowTheLeaderRace*)World::getWorld())->getClockStartTime()
- race_time;
// ---- Manage pulsing effect
// 3.0 is the duration of ready/set (TODO: don't hardcode)
float timeProgression = (float)(race_time) /