From 271fb872fba10cdfb4e0cd1b6094dee0e9b18c90 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 3 Dec 2003 03:03:54 +0000 Subject: [PATCH] don't allow stalling the music select timer indefinitely --- stepmania/src/MenuTimer.cpp | 13 +++++++++++-- stepmania/src/MenuTimer.h | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/stepmania/src/MenuTimer.cpp b/stepmania/src/MenuTimer.cpp index a3802891bd..ad533f11fb 100644 --- a/stepmania/src/MenuTimer.cpp +++ b/stepmania/src/MenuTimer.cpp @@ -25,11 +25,13 @@ #define WARNING_COMMAND(i) THEME->GetMetric ("MenuTimer", ssprintf("WarningCommand%i",i)) #define ON_COMMAND THEME->GetMetric ("MenuTimer","OnCommand") -const int TIMER_SECONDS = 99; +static const int TIMER_SECONDS = 99; +static const int MAX_STALL_SECONDS = 30; MenuTimer::MenuTimer() { m_fStallSeconds = 0; + m_fStallSecondsLeft = MAX_STALL_SECONDS; m_bPaused = false; m_textDigit1.LoadFromNumbers( THEME->GetPathToN("MenuTimer") ); @@ -125,7 +127,14 @@ void MenuTimer::Disable() void MenuTimer::Stall() { - m_fStallSeconds = 0.5f; + /* Max amount of stall time we'll use: */ + const float Amt = min( 0.5f, m_fStallSecondsLeft ); + + /* Amount of stall time to add: */ + const float ToAdd = Amt - m_fStallSeconds; + + m_fStallSeconds += ToAdd; + m_fStallSecondsLeft -= ToAdd; } void MenuTimer::SetSeconds( int iSeconds ) diff --git a/stepmania/src/MenuTimer.h b/stepmania/src/MenuTimer.h index 2af2c1832d..713cd795ef 100644 --- a/stepmania/src/MenuTimer.h +++ b/stepmania/src/MenuTimer.h @@ -35,7 +35,7 @@ public: protected: float m_fSecondsLeft; - float m_fStallSeconds; + float m_fStallSeconds, m_fStallSecondsLeft; bool m_bPaused; void SetText( int iSeconds );