SwitchToPreferredSongDifficulty -> SwitchToPreferredDifficulty; handle

course difficulty
don't re-tween course list after changing course difficulty
This commit is contained in:
Glenn Maynard
2004-06-03 21:41:54 +00:00
parent 4cc4349c4c
commit 76a190e5f3
2 changed files with 53 additions and 16 deletions
+44 -7
View File
@@ -1242,8 +1242,12 @@ void ScreenSelectMusic::AfterTrailChange( PlayerNumber pn )
// m_AutoGenIcon[pn].SetEffectNone(); // m_AutoGenIcon[pn].SetEffectNone();
// m_AutoGenIcon[pn].SetDiffuse( RageColor(1,1,1,0) ); // m_AutoGenIcon[pn].SetDiffuse( RageColor(1,1,1,0) );
//} //}
/* Update the trail list, but don't actually start the tween; only do that when
* the actual course changes (AfterMusicChange). */
m_CourseContentsFrame.SetFromGameState(); m_CourseContentsFrame.SetFromGameState();
m_CourseContentsFrame.TweenInAfterChangedCourse(); // m_CourseContentsFrame.TweenInAfterChangedCourse();
m_DifficultyMeter[pn].SetFromGameState( pn ); m_DifficultyMeter[pn].SetFromGameState( pn );
if( SHOW_DIFFICULTY_LIST ) if( SHOW_DIFFICULTY_LIST )
m_DifficultyList.SetFromGameState(); m_DifficultyList.SetFromGameState();
@@ -1253,24 +1257,47 @@ void ScreenSelectMusic::AfterTrailChange( PlayerNumber pn )
m_PaneDisplay[pn].SetFromGameState(); m_PaneDisplay[pn].SetFromGameState();
} }
void ScreenSelectMusic::SwitchToPreferredSongDifficulty() void ScreenSelectMusic::SwitchToPreferredDifficulty()
{ {
FOREACH_HumanPlayer( p ) if( !GAMESTATE->m_pCurCourse )
{
FOREACH_HumanPlayer( pn )
{ {
/* Find the closest match to the user's preferred difficulty. */ /* Find the closest match to the user's preferred difficulty. */
int CurDifference = -1; int CurDifference = -1;
for( unsigned i=0; i<m_vpSteps.size(); i++ ) for( unsigned i=0; i<m_vpSteps.size(); i++ )
{ {
int Diff = abs(m_vpSteps[i]->GetDifficulty() - GAMESTATE->m_PreferredDifficulty[p]); int Diff = abs(m_vpSteps[i]->GetDifficulty() - GAMESTATE->m_PreferredDifficulty[pn]);
if( CurDifference == -1 || Diff < CurDifference ) if( CurDifference == -1 || Diff < CurDifference )
{ {
m_iSelection[p] = i; m_iSelection[pn] = i;
CurDifference = Diff; CurDifference = Diff;
} }
} }
m_iSelection[p] = clamp( m_iSelection[p], 0, int(m_vpSteps.size()) ) ; CLAMP( m_iSelection[pn],0,m_vpSteps.size()-1 );
}
}
else
{
FOREACH_HumanPlayer( pn )
{
/* Find the closest match to the user's preferred difficulty. */
int CurDifference = -1;
for( unsigned i=0; i<m_vpTrails.size(); i++ )
{
int Diff = abs(m_vpTrails[i]->m_CourseDifficulty - GAMESTATE->m_PreferredCourseDifficulty[pn]);
if( CurDifference == -1 || Diff < CurDifference )
{
m_iSelection[pn] = i;
CurDifference = Diff;
}
}
CLAMP( m_iSelection[pn],0,m_vpTrails.size()-1 );
}
} }
} }
@@ -1429,7 +1456,7 @@ void ScreenSelectMusic::AfterMusicChange()
m_DifficultyDisplay.SetDifficulties( pSong, GAMESTATE->GetCurrentStyleDef()->m_StepsType ); m_DifficultyDisplay.SetDifficulties( pSong, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
SwitchToPreferredSongDifficulty(); SwitchToPreferredDifficulty();
/* Short delay before actually showing these, so they don't show /* Short delay before actually showing these, so they don't show
* up when scrolling fast. It'll still show up in "slow" scrolling, * up when scrolling fast. It'll still show up in "slow" scrolling,
@@ -1506,6 +1533,7 @@ void ScreenSelectMusic::AfterMusicChange()
Course* pCourse = m_MusicWheel.GetSelectedCourse(); Course* pCourse = m_MusicWheel.GetSelectedCourse();
StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType; StepsType st = GAMESTATE->GetCurrentStyleDef()->m_StepsType;
Trail *pTrail = pCourse->GetTrail( st, COURSE_DIFFICULTY_REGULAR ); Trail *pTrail = pCourse->GetTrail( st, COURSE_DIFFICULTY_REGULAR );
ASSERT( pTrail );
pCourse->GetTrails( m_vpTrails, GAMESTATE->GetCurrentStyleDef()->m_StepsType ); pCourse->GetTrails( m_vpTrails, GAMESTATE->GetCurrentStyleDef()->m_StepsType );
@@ -1525,6 +1553,8 @@ void ScreenSelectMusic::AfterMusicChange()
m_DifficultyDisplay.UnsetDifficulties(); m_DifficultyDisplay.UnsetDifficulties();
SwitchToPreferredDifficulty();
FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e ) FOREACH_CONST( TrailEntry, pTrail->m_vEntries, e )
{ {
if( e->bMystery ) if( e->bMystery )
@@ -1588,6 +1618,13 @@ void ScreenSelectMusic::AfterMusicChange()
AfterStepsChange( p ); AfterStepsChange( p );
} }
switch( m_MusicWheel.GetSelectedType() )
{
case TYPE_COURSE:
m_CourseContentsFrame.TweenInAfterChangedCourse();
break;
}
/* Make sure we never start the sample when moving fast. */ /* Make sure we never start the sample when moving fast. */
if(m_MusicWheel.IsMoving()) if(m_MusicWheel.IsMoving())
m_fPlaySampleCountdown = 0; m_fPlaySampleCountdown = 0;
+1 -1
View File
@@ -62,7 +62,7 @@ protected:
void AfterStepsChange( PlayerNumber pn ); void AfterStepsChange( PlayerNumber pn );
void AfterTrailChange( PlayerNumber pn ); void AfterTrailChange( PlayerNumber pn );
void SwitchToPreferredSongDifficulty(); void SwitchToPreferredDifficulty();
void AfterMusicChange(); void AfterMusicChange();
void SortOrderChanged(); void SortOrderChanged();