#include "global.h" /* ----------------------------------------------------------------------------- Class: CourseContentsList Desc: See header. Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. Chris Danford ----------------------------------------------------------------------------- */ #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 "StyleDef.h" #include "RageTexture.h" CourseContentsList::CourseContentsList() { m_iNumContents = 0; m_quad.SetDiffuse( RageColor(0,0,0,1) ); m_quad.SetBlendMode( BLEND_NO_EFFECT ); // invisible, since we want to write only to the Zbuffer m_fTimeUntilScroll = 0; m_fItemAtTopOfList = 0; m_quad.SetUseZBuffer( true ); for( int i = 0; i < MAX_TOTAL_CONTENTS; ++i ) { m_CourseContentDisplays[i].SetName( "CourseEntryDisplay" ); m_CourseContentDisplays[i].Load(); m_CourseContentDisplays[i].SetUseZBuffer( true ); } /* These are all the same; grab the dimensions. */ ContentsBarHeight = m_CourseContentDisplays[0].GetUnzoomedHeight(); ContentsBarWidth = m_CourseContentDisplays[0].GetUnzoomedWidth(); } void CourseContentsList::SetFromCourse( const Course* pCourse ) { if( pCourse == NULL ) { m_iNumContents = 0; return; } Trail* pTrail[NUM_PLAYERS]; FOREACH_PlayerNumber(pn) { pTrail[pn] = pCourse->GetTrail( GAMESTATE->GetCurrentStyleDef()->m_StepsType, GAMESTATE->m_PreferredCourseDifficulty[pn] ); } // 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. m_iNumContents = 0; for( int i=0; im_vEntries.size(), MAX_TOTAL_CONTENTS); i++ ) { CourseEntryDisplay& display = m_CourseContentDisplays[m_iNumContents]; TrailEntry* pte[NUM_PLAYERS]; FOREACH_EnabledPlayer(pn) pte[pn] = &pTrail[0]->m_vEntries[i]; display.LoadFromTrailEntry( m_iNumContents+1, pCourse, pte ); m_iNumContents++; } } void CourseContentsList::Update( float fDeltaTime ) { ActorFrame::Update( fDeltaTime ); if( m_fTimeUntilScroll > 0 && m_iNumContents > MAX_VISIBLE_CONTENTS) m_fTimeUntilScroll -= fDeltaTime; if( m_fTimeUntilScroll <= 0 ) { m_fItemAtTopOfList += fDeltaTime; m_fItemAtTopOfList = fmodf(m_fItemAtTopOfList, float(m_iNumContents)); } for( int i=0; i