remove CourseEntryDisplay::SetFromTrailEntry. Use SetFromGameState instead.

This commit is contained in:
Chris Danford
2005-08-01 05:16:52 +00:00
parent 0c7b0b5529
commit eddd05a5b6
3 changed files with 42 additions and 34 deletions
+4 -12
View File
@@ -24,6 +24,9 @@ CourseContentsList::CourseContentsList()
{
for( int i=0; i<MAX_ITEMS; i++ )
m_vpDisplay.push_back( new CourseEntryDisplay );
m_fTimeUntilScroll = 0;
m_fItemAtPosition0InList = 0;
}
CourseContentsList::~CourseContentsList()
@@ -69,18 +72,7 @@ void CourseContentsList::SetFromGameState()
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.SetFromTrailEntry( (int)(truncf(m_fItemAtPosition0InList))+i+1, pte );
d.SetFromGameState( (int)(truncf(m_fItemAtPosition0InList))+i );
}
bool bLoop = pMasterTrail->m_vEntries.size() > uNumEntriesToShow;
+38 -21
View File
@@ -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"
-1
View File
@@ -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