don't allow stalling the music select timer indefinitely
This commit is contained in:
@@ -25,11 +25,13 @@
|
|||||||
#define WARNING_COMMAND(i) THEME->GetMetric ("MenuTimer", ssprintf("WarningCommand%i",i))
|
#define WARNING_COMMAND(i) THEME->GetMetric ("MenuTimer", ssprintf("WarningCommand%i",i))
|
||||||
#define ON_COMMAND THEME->GetMetric ("MenuTimer","OnCommand")
|
#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()
|
MenuTimer::MenuTimer()
|
||||||
{
|
{
|
||||||
m_fStallSeconds = 0;
|
m_fStallSeconds = 0;
|
||||||
|
m_fStallSecondsLeft = MAX_STALL_SECONDS;
|
||||||
m_bPaused = false;
|
m_bPaused = false;
|
||||||
|
|
||||||
m_textDigit1.LoadFromNumbers( THEME->GetPathToN("MenuTimer") );
|
m_textDigit1.LoadFromNumbers( THEME->GetPathToN("MenuTimer") );
|
||||||
@@ -125,7 +127,14 @@ void MenuTimer::Disable()
|
|||||||
|
|
||||||
void MenuTimer::Stall()
|
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 )
|
void MenuTimer::SetSeconds( int iSeconds )
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
float m_fSecondsLeft;
|
float m_fSecondsLeft;
|
||||||
float m_fStallSeconds;
|
float m_fStallSeconds, m_fStallSecondsLeft;
|
||||||
bool m_bPaused;
|
bool m_bPaused;
|
||||||
|
|
||||||
void SetText( int iSeconds );
|
void SetText( int iSeconds );
|
||||||
|
|||||||
Reference in New Issue
Block a user