From cfe1441b6de94ce3526a75534da53262505fe059 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 25 Jun 2003 06:30:13 +0000 Subject: [PATCH] Retain the difficulty specified in extra1/extra2.crs. This has a side-effect: with "pick extra stage" on, you're stuck with the difficulty of the song specified, even if you pick a different stage. --- stepmania/src/ScreenSelectMusic.cpp | 46 ++++++++++++++++------------- stepmania/src/ScreenSelectMusic.h | 1 + 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 89dde33d61..36d361894d 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -768,6 +768,30 @@ void ScreenSelectMusic::AfterNotesChange( PlayerNumber pn ) m_MusicWheel.NotesChanged( pn ); } +void ScreenSelectMusic::SwitchToPreferredDifficulty() +{ + for( int p=0; pIsHumanPlayer( PlayerNumber(p) ) ) + continue; + + /* Find the closest match to the user's preferred difficulty. */ + int CurDifference = -1; + for( unsigned i=0; iGetDifficulty() - GAMESTATE->m_PreferredDifficulty[p]); + + if( CurDifference == -1 || Diff < CurDifference ) + { + m_iSelection[p] = i; + CurDifference = Diff; + } + } + + m_iSelection[p] = clamp( m_iSelection[p], 0, int(m_arrayNotes[p].size()) ) ; + } +} + void ScreenSelectMusic::AfterMusicChange() { m_Menu.m_MenuTimer.Stall(); @@ -848,27 +872,9 @@ void ScreenSelectMusic::AfterMusicChange() FlipSpriteHorizontally(m_sprCDTitleBack); m_DifficultyDisplay.SetDifficulties( pSong, GAMESTATE->GetCurrentStyleDef()->m_NotesType ); - - for( int p=0; pIsHumanPlayer( PlayerNumber(p) ) ) - continue; - /* Find the closest match to the user's preferred difficulty. */ - int CurDifference = -1; - for( unsigned i=0; iGetDifficulty() - GAMESTATE->m_PreferredDifficulty[p]); - - if( CurDifference == -1 || Diff < CurDifference ) - { - m_iSelection[p] = i; - CurDifference = Diff; - } - } - - m_iSelection[p] = clamp( m_iSelection[p], 0, int(m_arrayNotes[p].size()) ) ; - } + if( !GAMESTATE->IsExtraStage() && !GAMESTATE->IsExtraStage2() ) + SwitchToPreferredDifficulty(); /* Short delay before actually showing these, so they don't show * up when scrolling fast. It'll still show up in "slow" scrolling, diff --git a/stepmania/src/ScreenSelectMusic.h b/stepmania/src/ScreenSelectMusic.h index 8d5da69565..e6daca8fb7 100644 --- a/stepmania/src/ScreenSelectMusic.h +++ b/stepmania/src/ScreenSelectMusic.h @@ -50,6 +50,7 @@ protected: void HarderDifficulty( PlayerNumber pn ); void AfterNotesChange( PlayerNumber pn ); + void SwitchToPreferredDifficulty(); void AfterMusicChange(); void SortOrderChanged();