From 66469a79224064ca958ec4616d96e14336ea2efa Mon Sep 17 00:00:00 2001 From: Kevin Slaughter Date: Fri, 16 Jul 2004 07:57:07 +0000 Subject: [PATCH] Fix lights driver.. Was really screwed up before. I know it's a re-vamp of CNLohr's old code, but this works perfectly. If there are any objections, please talk to me BEFORE removing it. This was really hard to fix up after the last 'improvement' :p --- stepmania/src/ScreenGameplay.cpp | 34 ++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index a0dac587c3..a35cca89f0 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -1026,12 +1026,31 @@ void ScreenGameplay::LoadNextSong() // Load cabinet lights data // { + int i; + vector vSteps; m_CabinetLightsNoteData.Init(); ASSERT( GAMESTATE->m_pCurSong ); - - Steps *pSteps = GAMESTATE->m_pCurSong->GetClosestNotes( STEPS_TYPE_LIGHTS_CABINET, StringToDifficulty(PREFSMAN->m_sLightsStepsDifficulty) ); - if( pSteps != NULL ) - pSteps->GetNoteData( &m_CabinetLightsNoteData ); + + // From what I understood, if there is no pre-defined step set for lights, then we fall-back + // onto the specified difficulty's stepchart, flashing all cabinet lights on each tap note. + // -- Miryokuteki + // Steps *pSteps = GAMESTATE->m_pCurSong->GetClosestNotes( STEPS_TYPE_LIGHTS_CABINET, StringToDifficulty(PREFSMAN->m_sLightsStepsDifficulty) ); + + StepsType lightsSteps = GAMESTATE->GetCurrentStyle()->m_StepsType; //STEPS_TYPE_DANCE_SINGLE; + GAMESTATE->m_pCurSong->GetSteps(vSteps,lightsSteps); + + if(!vSteps.empty()) {vSteps[0]->GetNoteData(&m_CabinetLightsNoteData);} + for (i=0;im_sLightsStepsDifficulty); + Difficulty DC2 = vSteps[i]->GetDifficulty(); + if(DC == DC2) {vSteps[i]->GetNoteData( &m_CabinetLightsNoteData );} + } + + + + + //if( pSteps != NULL ) + // pSteps->GetNoteData( &m_CabinetLightsNoteData ); // Convert to 4s so that we can check if we're inside a hold with just // GetTapNote(). @@ -1443,9 +1462,12 @@ void ScreenGameplay::Update( float fDeltaTime ) for( int r=iRowLastCrossed+1; r<=iRowNow; r++ ) // for each index we crossed since the last update { FOREACH_CabinetLight( cl ) - { + { + // Somehow, step data was getting majorly corrupted, therefor causing light + // signals to be sent at incorrect times where notes were not even present. bool bBlink = (m_CabinetLightsNoteData.GetTapNote( cl, r ) != TAP_EMPTY); - bBlinkCabinetLight[cl] |= bBlink; + bBlinkCabinetLight[cl] |= bBlink; // Why are we OR'ing a boolean?? + //bBlinkCabinetLight[cl] = m_CabinetLightsNoteData.IsThereATapAtRow(iRowNow); //(m_CabinetLightsNoteData.GetTapNote(cl,r) != TAP_EMPTY); } FOREACH_EnabledPlayer( pn ) {