From 87af9cf1f1518031f9d3139df1a9c93d7a5aca45 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 4 May 2005 06:48:34 +0000 Subject: [PATCH] split out ScreenGameplay::LoadLights --- stepmania/src/ScreenGameplay.cpp | 47 ++++++++++++++++++-------------- stepmania/src/ScreenGameplay.h | 1 + 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index b81f09ce1f..5f2f85c645 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -1081,27 +1081,7 @@ void ScreenGameplay::LoadNextSong() // // Load cabinet lights data // - if( LIGHTSMAN->IsEnabled() ) - { - 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 ); - } - else - { - pSteps = GAMESTATE->m_pCurSong->GetClosestNotes( GAMESTATE->GetCurrentStyle()->m_StepsType, StringToDifficulty(PREFSMAN->m_sLightsStepsDifficulty) ); - if( pSteps ) - { - NoteData TapNoteData; - pSteps->GetNoteData( TapNoteData ); - NoteDataUtil::LoadTransformedLights( TapNoteData, m_CabinetLightsNoteData, GameManager::StepsTypeToNumTracks(STEPS_TYPE_LIGHTS_CABINET) ); - } - } - } + LoadLights(); /* Load the music last, since it may start streaming and we don't want the music * to compete with other loading. */ @@ -1109,6 +1089,31 @@ void ScreenGameplay::LoadNextSong() m_pSoundMusic = m_AutoKeysounds.GetSound(); } +void ScreenGameplay::LoadLights() +{ + if( !LIGHTSMAN->IsEnabled() ) + return; + + 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 ); + } + else + { + pSteps = GAMESTATE->m_pCurSong->GetClosestNotes( GAMESTATE->GetCurrentStyle()->m_StepsType, StringToDifficulty(PREFSMAN->m_sLightsStepsDifficulty) ); + if( pSteps ) + { + NoteData TapNoteData; + pSteps->GetNoteData( TapNoteData ); + NoteDataUtil::LoadTransformedLights( TapNoteData, m_CabinetLightsNoteData, GameManager::StepsTypeToNumTracks(STEPS_TYPE_LIGHTS_CABINET) ); + } + } +} + float ScreenGameplay::StartPlayingSong(float MinTimeToNotes, float MinTimeToMusic) { ASSERT(MinTimeToNotes >= 0); diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index b6c10ab004..b3e86ba9af 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -64,6 +64,7 @@ protected: void LoadNextSong(); void LoadCourseSongNumber( int SongNumber ); float StartPlayingSong(float MinTimeToNotes, float MinTimeToMusic); + void LoadLights(); void PauseGame( bool bPause, GameController gc = GAME_CONTROLLER_INVALID ); void ShowSavePrompt( ScreenMessage SM_SendWhenDone ); void PlayAnnouncer( CString type, float fSeconds );