From eddd05a5b6d4bc2bdca0ecddf5a3a95addfff217 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 1 Aug 2005 05:16:52 +0000 Subject: [PATCH] remove CourseEntryDisplay::SetFromTrailEntry. Use SetFromGameState instead. --- stepmania/src/CourseContentsList.cpp | 16 ++------ stepmania/src/CourseEntryDisplay.cpp | 59 ++++++++++++++++++---------- stepmania/src/CourseEntryDisplay.h | 1 - 3 files changed, 42 insertions(+), 34 deletions(-) diff --git a/stepmania/src/CourseContentsList.cpp b/stepmania/src/CourseContentsList.cpp index 646eb8fdac..c76f8e43f3 100644 --- a/stepmania/src/CourseContentsList.cpp +++ b/stepmania/src/CourseContentsList.cpp @@ -24,6 +24,9 @@ CourseContentsList::CourseContentsList() { for( int i=0; iAddChild( &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.SetFromTrailEntry( (int)(truncf(m_fItemAtPosition0InList))+i+1, pte ); + d.SetFromGameState( (int)(truncf(m_fItemAtPosition0InList))+i ); } bool bLoop = pMasterTrail->m_vEntries.size() > uNumEntriesToShow; diff --git a/stepmania/src/CourseEntryDisplay.cpp b/stepmania/src/CourseEntryDisplay.cpp index 9c28d51326..fd8ce6fdde 100644 --- a/stepmania/src/CourseEntryDisplay.cpp +++ b/stepmania/src/CourseEntryDisplay.cpp @@ -88,8 +88,28 @@ void CourseEntryDisplay::SetDifficulty( PlayerNumber pn, const CString &text, Ra m_textFoot[pn].SetDiffuse( c ); } -void CourseEntryDisplay::SetFromTrailEntry( int iCourseEntryIndex, const TrailEntry *tes[NUM_PLAYERS] ) +void CourseEntryDisplay::SetFromGameState( int iCourseEntryIndex ) { + Course *pCourse = GAMESTATE->m_pCurCourse; + + const TrailEntry *tes[NUM_PLAYERS]; + const CourseEntry *ces[NUM_PLAYERS]; + FOREACH_PlayerNumber( p ) + { + Trail *pTrail = GAMESTATE->m_pCurTrail[p]; + if( pTrail && iCourseEntryIndex < pTrail->m_vEntries.size() ) + { + tes[p] = &pTrail->m_vEntries[iCourseEntryIndex]; + ces[p] = &pCourse->m_vEntries[iCourseEntryIndex]; + } + else + { + tes[p] = NULL; + ces[p] = NULL; + } + } + + const TrailEntry *te = tes[GAMESTATE->m_MasterPlayerNumber]; if( te == NULL ) return; @@ -99,16 +119,28 @@ void CourseEntryDisplay::SetFromTrailEntry( int iCourseEntryIndex, const TrailEn FOREACH_EnabledPlayer(pn) { const TrailEntry *te = tes[pn]; - if( te == NULL ) + const CourseEntry *ce = ces[pn]; + if( te == NULL || ce == NULL ) continue; Difficulty dc = te->dc; if( dc == DIFFICULTY_INVALID ) { - int iLow = te->iLowMeter; - int iHigh = te->iHighMeter; + int iLow = ce->iLowMeter; + int iHigh = ce->iHighMeter; + + CString s; + if( iLow == -1 && iHigh != -1 ) + s = ssprintf( "<=%d", iHigh ); + else if( iLow != -1 && iHigh == -1 ) + s = ssprintf( ">=%d", iLow ); + else if( iLow != -1 && iHigh != -1 ) + s = ssprintf( "%d-%d", iLow, iHigh ); + else + s = "?"; + RageColor colorNotes = SONGMAN->GetDifficultyColor( te->pSteps->GetDifficulty() ); - SetDifficulty( pn, ssprintf(iLow==iHigh?"%d":"%d-%d", iLow, iHigh), colorNotes ); + SetDifficulty( pn, s, colorNotes ); } else { @@ -134,26 +166,11 @@ void CourseEntryDisplay::SetFromTrailEntry( int iCourseEntryIndex, const TrailEn m_TextBanner.SetDiffuse( SONGMAN->GetSongColor( te->pSong ) ); } - m_textNumber.SetText( ssprintf("%d", iCourseEntryIndex) ); + m_textNumber.SetText( ssprintf("%d", iCourseEntryIndex+1) ); m_textModifiers.SetText( te->Modifiers ); } -void CourseEntryDisplay::SetFromGameState( int iCourseEntryIndex ) -{ - const TrailEntry *pTrailEntry[NUM_PLAYERS]; - FOREACH_PlayerNumber( p ) - { - Trail *pTrail = GAMESTATE->m_pCurTrail[p]; - if( pTrail ) - pTrailEntry[p] = &pTrail->m_vEntries[iCourseEntryIndex]; - else - pTrailEntry[p] = NULL; - } - - SetFromTrailEntry( iCourseEntryIndex, pTrailEntry ); -} - // lua start #include "LuaBinding.h" diff --git a/stepmania/src/CourseEntryDisplay.h b/stepmania/src/CourseEntryDisplay.h index b2d8db4fe2..056b18b9b5 100644 --- a/stepmania/src/CourseEntryDisplay.h +++ b/stepmania/src/CourseEntryDisplay.h @@ -20,7 +20,6 @@ public: void Load(); void LoadFromNode( const CString& sDir, const XNode* pNode ); - void SetFromTrailEntry( int iCourseEntryIndex, const TrailEntry *te[NUM_PLAYERS] ); void SetFromGameState( int iCourseEntryIndex ); // Lua