fix current song/course being reset after changing modes
set GAMESTATE->m_pCurSong/Course immediately when moving
This commit is contained in:
@@ -210,30 +210,9 @@ void MusicWheel::Load()
|
|||||||
&& !GAMESTATE->IsExtraStage() && !GAMESTATE->IsExtraStage2() )
|
&& !GAMESTATE->IsExtraStage() && !GAMESTATE->IsExtraStage2() )
|
||||||
GAMESTATE->m_pCurSong = NULL;
|
GAMESTATE->m_pCurSong = NULL;
|
||||||
|
|
||||||
// If there is no currently selected song, select one.
|
|
||||||
if( GAMESTATE->m_pCurSong == NULL )
|
|
||||||
{
|
|
||||||
//Select the first selectable song based on the sort order...
|
|
||||||
vector<WheelItemData> &wiWheelItems = m_WheelItemDatas[GAMESTATE->m_SongSortOrder];
|
|
||||||
for( unsigned i = 0; i < wiWheelItems.size(); i++ )
|
|
||||||
{
|
|
||||||
if( wiWheelItems[i].m_pSong != NULL )
|
|
||||||
{
|
|
||||||
GAMESTATE->m_pCurSong = wiWheelItems[i].m_pSong;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( GAMESTATE->m_pCurSong == NULL )
|
|
||||||
LOG->Trace("MusicWheel::MusicWheel() - No selectable songs found in WheelData");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Select the the previously selected song (if any)
|
// Select the the previously selected song (if any)
|
||||||
bool selected = SelectSong(GAMESTATE->m_pCurSong);
|
if( !SelectSongOrCourse() )
|
||||||
// Select the the previously selected course (if any)
|
SetOpenGroup("");
|
||||||
if(!selected) selected = SelectCourse(GAMESTATE->m_pCurCourse);
|
|
||||||
if(!selected) SetOpenGroup("");
|
|
||||||
|
|
||||||
// rebuild the WheelItems that appear on screen
|
// rebuild the WheelItems that appear on screen
|
||||||
RebuildMusicWheelItems();
|
RebuildMusicWheelItems();
|
||||||
@@ -243,11 +222,37 @@ MusicWheel::~MusicWheel()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MusicWheel::SelectSong( const Song *p )
|
/* If a song or course is set in GAMESTATE and avaialble, select it. Otherwise, choose the
|
||||||
|
* first available song or course. Return true if an item was set, false if no items are
|
||||||
|
* available. */
|
||||||
|
bool MusicWheel::SelectSongOrCourse()
|
||||||
|
{
|
||||||
|
if( GAMESTATE->m_pCurSong && SelectSong( GAMESTATE->m_pCurSong ) )
|
||||||
|
return true;
|
||||||
|
if( GAMESTATE->m_pCurCourse && SelectCourse( GAMESTATE->m_pCurCourse ) )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Select the first selectable song based on the sort order...
|
||||||
|
vector<WheelItemData> &wiWheelItems = m_WheelItemDatas[GAMESTATE->m_SongSortOrder];
|
||||||
|
for( unsigned i = 0; i < wiWheelItems.size(); i++ )
|
||||||
|
{
|
||||||
|
if( wiWheelItems[i].m_pSong )
|
||||||
|
return SelectSong( wiWheelItems[i].m_pSong );
|
||||||
|
else if ( wiWheelItems[i].m_pCourse )
|
||||||
|
return SelectCourse( wiWheelItems[i].m_pCourse );
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG->Trace( "MusicWheel::MusicWheel() - No selectable songs or courses found in WheelData" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MusicWheel::SelectSong( Song *p )
|
||||||
{
|
{
|
||||||
if(p == NULL)
|
if(p == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
GAMESTATE->m_pCurSong = p;
|
||||||
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
vector<WheelItemData> &from = m_WheelItemDatas[GAMESTATE->m_SongSortOrder];
|
vector<WheelItemData> &from = m_WheelItemDatas[GAMESTATE->m_SongSortOrder];
|
||||||
for( i=0; i<from.size(); i++ )
|
for( i=0; i<from.size(); i++ )
|
||||||
@@ -271,11 +276,13 @@ bool MusicWheel::SelectSong( const Song *p )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MusicWheel::SelectCourse( const Course *p )
|
bool MusicWheel::SelectCourse( Course *p )
|
||||||
{
|
{
|
||||||
if(p == NULL)
|
if(p == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
GAMESTATE->m_pCurCourse = p;
|
||||||
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
vector<WheelItemData> &from = m_WheelItemDatas[GAMESTATE->m_SongSortOrder];
|
vector<WheelItemData> &from = m_WheelItemDatas[GAMESTATE->m_SongSortOrder];
|
||||||
for( i=0; i<from.size(); i++ )
|
for( i=0; i<from.size(); i++ )
|
||||||
@@ -904,34 +911,14 @@ void MusicWheel::Update( float fDeltaTime )
|
|||||||
//
|
//
|
||||||
switch( GAMESTATE->m_SongSortOrder )
|
switch( GAMESTATE->m_SongSortOrder )
|
||||||
{
|
{
|
||||||
case SORT_PREFERRED:
|
default:
|
||||||
case SORT_GROUP:
|
|
||||||
case SORT_TITLE:
|
|
||||||
case SORT_BPM:
|
|
||||||
case SORT_GRADE:
|
|
||||||
case SORT_ARTIST:
|
|
||||||
case SORT_MOST_PLAYED:
|
|
||||||
case SORT_ROULETTE:
|
|
||||||
case SORT_EASY_METER:
|
|
||||||
case SORT_MEDIUM_METER:
|
|
||||||
case SORT_HARD_METER:
|
|
||||||
case SORT_CHALLENGE_METER:
|
|
||||||
case SORT_ALL_COURSES:
|
|
||||||
case SORT_NONSTOP_COURSES:
|
|
||||||
case SORT_ONI_COURSES:
|
|
||||||
case SORT_ENDLESS_COURSES:
|
|
||||||
// Look for the last selected song or course
|
// Look for the last selected song or course
|
||||||
if( GAMESTATE->m_pCurCourse )
|
SelectSongOrCourse();
|
||||||
SelectCourse( GAMESTATE->m_pCurCourse );
|
|
||||||
if( GAMESTATE->m_pCurSong )
|
|
||||||
SelectSong( GAMESTATE->m_pCurSong );
|
|
||||||
break;
|
break;
|
||||||
case SORT_SORT_MENU:
|
case SORT_SORT_MENU:
|
||||||
case SORT_MODE_MENU:
|
case SORT_MODE_MENU:
|
||||||
SelectSort( m_LastSongSortOrder );
|
SelectSort( m_LastSongSortOrder );
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
ASSERT(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -956,7 +943,11 @@ void MusicWheel::Update( float fDeltaTime )
|
|||||||
// Unselect the current song if this is a course mode.
|
// Unselect the current song if this is a course mode.
|
||||||
// Unselect the current course if this is a song sort.
|
// Unselect the current course if this is a song sort.
|
||||||
//
|
//
|
||||||
switch( GAMESTATE->m_SongSortOrder )
|
/* If we do this, then switching to course mode and back will put you
|
||||||
|
* back on the default song. From the CVS commit, this looks like it
|
||||||
|
* was originally to fix ScreenOptionsMaster difficulty display, and
|
||||||
|
* isn't needed anymore ... -glenn */
|
||||||
|
/* switch( GAMESTATE->m_SongSortOrder )
|
||||||
{
|
{
|
||||||
case SORT_PREFERRED:
|
case SORT_PREFERRED:
|
||||||
case SORT_GROUP:
|
case SORT_GROUP:
|
||||||
@@ -979,7 +970,7 @@ void MusicWheel::Update( float fDeltaTime )
|
|||||||
GAMESTATE->m_pCurSong = NULL;
|
GAMESTATE->m_pCurSong = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
SCREENMAN->PostMessageToTopScreen( SM_SongChanged, 0 );
|
SCREENMAN->PostMessageToTopScreen( SM_SongChanged, 0 );
|
||||||
RebuildMusicWheelItems();
|
RebuildMusicWheelItems();
|
||||||
|
|||||||
@@ -80,8 +80,9 @@ protected:
|
|||||||
void GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CString sPreferredGroup );
|
void GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CString sPreferredGroup );
|
||||||
void BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItems, SongSortOrder so );
|
void BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItems, SongSortOrder so );
|
||||||
void SetOpenGroup(CString group, SongSortOrder so = SORT_INVALID);
|
void SetOpenGroup(CString group, SongSortOrder so = SORT_INVALID);
|
||||||
bool SelectSong(const Song *p);
|
bool SelectSongOrCourse();
|
||||||
bool SelectCourse(const Course *p);
|
bool SelectSong( Song *p );
|
||||||
|
bool SelectCourse( Course *p );
|
||||||
bool SelectSort( SongSortOrder so );
|
bool SelectSort( SongSortOrder so );
|
||||||
void ChangeMusic(int dist); /* +1 or -1 */
|
void ChangeMusic(int dist); /* +1 or -1 */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user