#include "global.h" #include "CourseContentsList.h" #include "RageUtil.h" #include "GameConstantsAndTypes.h" #include "PrefsManager.h" #include "RageLog.h" #include "PrefsManager.h" #include "Course.h" #include "SongManager.h" #include "ThemeManager.h" #include "Steps.h" #include "GameState.h" #include "Style.h" #include "RageTexture.h" #include "CourseEntryDisplay.h" const int MAX_VISIBLE_ITEMS = 5; const int MAX_ITEMS = MAX_VISIBLE_ITEMS+2; CourseContentsList::CourseContentsList() { for( int i=0; iSetName( "CourseEntryDisplay" ); (*d)->Load(); (*d)->SetUseZBuffer( true ); } } void CourseContentsList::SetFromGameState() { RemoveAllChildren(); // FIXME: Is there a better way to handle when players don't have // the same number of TrailEntries? // They have to have the same number, and of the same songs, or gameplay // isn't going to line up. Trail* pMasterTrail = GAMESTATE->m_pCurTrail[GAMESTATE->m_MasterPlayerNumber]; if( pMasterTrail == NULL ) return; unsigned uNumEntriesToShow = min( pMasterTrail->m_vEntries.size(), m_vpDisplay.size() ); for( int i=0; i<(int)uNumEntriesToShow; i++ ) { CourseEntryDisplay &d = *m_vpDisplay[i]; this->AddChild( &d ); const TrailEntry* pte[NUM_PLAYERS]; ZERO( pte ); FOREACH_EnabledPlayer(pn) { Trail* pTrail = GAMESTATE->m_pCurTrail[pn]; if( pTrail == NULL ) continue; // skip if( unsigned(i) < pTrail->m_vEntries.size() ) pte[pn] = &pTrail->m_vEntries[i]; } d.LoadFromTrailEntry( (int)(truncf(m_fItemAtPosition0InList))+i+1, pte ); } bool bLoop = pMasterTrail->m_vEntries.size() > uNumEntriesToShow; this->Load2( (float)MAX_VISIBLE_ITEMS, m_vpDisplay[0]->GetUnzoomedWidth(), m_vpDisplay[0]->GetUnzoomedHeight(), bLoop, 0.7f, 0.7f ); this->SetCurrentAndDestinationItem( (MAX_VISIBLE_ITEMS-1)/2 ); if( bLoop ) { SetPauseCountdownSeconds( 1.5f ); this->SetDestinationItem( MAX_ITEMS+1 ); // loop forever } } void CourseContentsList::TweenInAfterChangedCourse() { /* m_fItemAtTopOfList = 0; m_fTimeUntilScroll = 3; for( int i=0; i