Display soccer timer after a goal (#3411)

* Use shouldDrawTimer overrides for tutorial and soccer worlds

* Add isActiveRacePhase

* Update shouldDrawTimer

* Remove duplicate check

It also allows displaying time in soccer after a goal
This commit is contained in:
Alayan-stk-2 2018-08-30 00:33:01 +02:00 committed by auriamg
parent 279e15f894
commit 80555f4905
5 changed files with 9 additions and 5 deletions

View File

@ -328,6 +328,8 @@ public:
virtual const std::string& getIdent() const OVERRIDE;
virtual void update(int ticks) OVERRIDE;
bool shouldDrawTimer() const OVERRIDE { return !isStartPhase(); }
// ------------------------------------------------------------------------
void onCheckGoalTriggered(bool first_goal);
// ------------------------------------------------------------------------

View File

@ -45,6 +45,7 @@ public:
return WorldWithRank::getRescueTransform(index);
}
bool shouldDrawTimer() const OVERRIDE { return false; }
}; // class TutorialWorld

View File

@ -327,7 +327,7 @@ public:
/** The code that draws the timer should call this first to know
* whether the game mode wants a timer drawn. */
virtual bool shouldDrawTimer() const
{ return isRacePhase() && getClockMode() != CLOCK_NONE; }
{ return isActiveRacePhase() && getClockMode() != CLOCK_NONE; }
// ------------------------------------------------------------------------
/** \return whether this world can generate/have highscores */
bool useHighScores() const { return m_use_highscores; }

View File

@ -156,6 +156,9 @@ public:
bool isRacePhase() const { return m_phase>=GO_PHASE &&
m_phase<FINISH_PHASE; }
// ------------------------------------------------------------------------
bool isActiveRacePhase() const { return m_phase>=GO_PHASE &&
m_phase<DELAY_FINISH_PHASE; }
// ------------------------------------------------------------------------
/** While the race menu is being displayed, m_phase is limbo, and
* m_previous_phase is finish. So we have to test this case, too. */
bool isFinishPhase() const { return m_phase==FINISH_PHASE ||

View File

@ -245,13 +245,11 @@ void RaceGUI::renderGlobal(float dt)
if(!world->isRacePhase()) return;
if (!m_enabled) return;
//drawGlobalTimer checks if it should display in the current phase/mode
drawGlobalTimer();
if (!m_is_tutorial)
{
//stop displaying timer as soon as race is over
if (world->getPhase()<WorldStatus::DELAY_FINISH_PHASE)
drawGlobalTimer();
if (race_manager->isLinearRaceMode() &&
race_manager->hasGhostKarts() &&
race_manager->getNumberOfKarts() >= 2 )