diff --git a/stepmania/src/LightsManager.cpp b/stepmania/src/LightsManager.cpp index 5775765242..06d66bbc05 100644 --- a/stepmania/src/LightsManager.cpp +++ b/stepmania/src/LightsManager.cpp @@ -83,6 +83,8 @@ LightsManager::LightsManager() ZERO( m_fSecsLeftInGameButtonBlink ); ZERO( m_fActorLights ); ZERO( m_fSecsLeftInActorLightBlink ); + m_iQueuedCoinCounterPulses = 0; + m_CoinCounterTimer.SetZero(); m_LightsMode = LIGHTSMODE_JOINING; RString sDriver = g_sLightsDriver.Get(); @@ -104,6 +106,7 @@ LightsManager::~LightsManager() // XXX: make themable static const float g_fLightEffectRiseSeconds = 0.075f; static const float g_fLightEffectFalloffSeconds = 0.35f; +static const float g_fCoinPulseTime = 0.100f; void LightsManager::BlinkActorLight( CabinetLight cl ) { @@ -162,6 +165,23 @@ void LightsManager::Update( float fDeltaTime ) ZERO( m_LightsState.m_bGameButtonLights ); } + { + m_LightsState.m_bCoinCounter = false; + if( !m_CoinCounterTimer.IsZero() ) + { + float fAgo = m_CoinCounterTimer.Ago(); + if( fAgo < g_fCoinPulseTime ) + m_LightsState.m_bCoinCounter = true; + else if( fAgo >= g_fCoinPulseTime * 2 ) + m_CoinCounterTimer.SetZero(); + } + else if( m_iQueuedCoinCounterPulses ) + { + m_CoinCounterTimer.Touch(); + --m_iQueuedCoinCounterPulses; + } + } + if( m_LightsMode == LIGHTSMODE_TEST_AUTO_CYCLE ) { m_fTestAutoCycleCurrentIndex += fDeltaTime; diff --git a/stepmania/src/LightsManager.h b/stepmania/src/LightsManager.h index 5d31d28d32..4a58c1379a 100644 --- a/stepmania/src/LightsManager.h +++ b/stepmania/src/LightsManager.h @@ -7,6 +7,7 @@ #include "GameInput.h" #include "EnumHelper.h" #include "Preference.h" +#include "RageTimer.h" extern Preference g_fLightsFalloffSeconds; extern Preference g_fLightsAheadSeconds; @@ -48,6 +49,9 @@ struct LightsState { bool m_bCabinetLights[NUM_CabinetLight]; bool m_bGameButtonLights[NUM_GameController][NUM_GameButton]; + + // This isn't actually a light, but it's typically implemented in the same way. + bool m_bCoinCounter; }; class LightsDriver; @@ -64,6 +68,7 @@ public: void BlinkCabinetLight( CabinetLight cl ); void BlinkGameButton( GameInput gi ); void BlinkActorLight( CabinetLight cl ); + void PulseCoinCounter() { ++m_iQueuedCoinCounterPulses; } float GetActorLightLatencySeconds() const; void SetLightsMode( LightsMode lm ); @@ -90,6 +95,9 @@ private: LightsMode m_LightsMode; LightsState m_LightsState; + int m_iQueuedCoinCounterPulses; + RageTimer m_CoinCounterTimer; + int GetTestAutoCycleCurrentIndex() { return (int)m_fTestAutoCycleCurrentIndex; } float m_fTestAutoCycleCurrentIndex; diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 5225ddcd7a..496e7742e1 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -1195,6 +1195,8 @@ RString StepMania::SaveScreenshot( RString sDir, bool bSaveCompressed, bool bMak void StepMania::InsertCoin( int iNum, const RageTimer *pTime ) { + for( int i = 0; i < iNum; ++i ) + LIGHTSMAN->PulseCoinCounter(); GAMESTATE->m_iCoins += iNum; LOG->Trace("%i coins inserted, %i needed to play", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit.Get() ); BOOKKEEPER->CoinInserted();