From 27be11a87ac0f345ce3824ad68b3f1caf938b2b5 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 18 Jun 2007 16:33:46 +0000 Subject: [PATCH] AlignMusicBeat only aligns the fractional part of the beat. This aligned to every four beats, so the light jumps when changing music. --- stepmania/src/LightsManager.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/stepmania/src/LightsManager.cpp b/stepmania/src/LightsManager.cpp index 6ec3372059..c3fb204527 100644 --- a/stepmania/src/LightsManager.cpp +++ b/stepmania/src/LightsManager.cpp @@ -230,10 +230,16 @@ void LightsManager::Update( float fDeltaTime ) FOREACH_CabinetLight( cl ) m_LightsState.m_bCabinetLights[cl] = false; - int iBeat = (int)(GAMESTATE->m_fLightSongBeat); - int iTopIndex = iBeat; - wrap( iTopIndex, 4 ); - switch( iTopIndex ) + static float fLastBeat; + static int iLight; + + if( fracf(GAMESTATE->m_fLightSongBeat) < fracf(fLastBeat) ) + { + ++iLight; + wrap( iLight, 4 ); + } + fLastBeat = GAMESTATE->m_fLightSongBeat; + switch( iLight ) { case 0: m_LightsState.m_bCabinetLights[LIGHT_MARQUEE_UP_LEFT] = true; break; case 1: m_LightsState.m_bCabinetLights[LIGHT_MARQUEE_LR_RIGHT] = true; break;