separate course popularities for each PlayMode
don't calculate autogen courses in best list if they're not shown
This commit is contained in:
@@ -40,11 +40,22 @@ Course::Course()
|
|||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayMode Course::GetPlayMode() const
|
CourseType Course::GetCourseType() const
|
||||||
{
|
{
|
||||||
if( m_bRepeat )
|
if( m_bRepeat )
|
||||||
return PLAY_MODE_ENDLESS;
|
return COURSE_TYPE_ENDLESS;
|
||||||
return m_iLives > 0? PLAY_MODE_ONI:PLAY_MODE_NONSTOP;
|
return m_iLives > 0? COURSE_TYPE_ONI:COURSE_TYPE_NONSTOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayMode Course::GetPlayMode() const
|
||||||
|
{
|
||||||
|
switch( GetCourseType() )
|
||||||
|
{
|
||||||
|
case COURSE_TYPE_ENDLESS: return PLAY_MODE_ENDLESS;
|
||||||
|
case COURSE_TYPE_ONI: return PLAY_MODE_ONI;
|
||||||
|
case COURSE_TYPE_NONSTOP: return PLAY_MODE_NONSTOP;
|
||||||
|
default: ASSERT(0); return PLAY_MODE_INVALID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Course::LoadFromCRSFile( CString sPath )
|
void Course::LoadFromCRSFile( CString sPath )
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include "Trail.h"
|
#include "Trail.h"
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include "EnumHelper.h"
|
||||||
|
|
||||||
struct PlayerOptions;
|
struct PlayerOptions;
|
||||||
struct SongOptions;
|
struct SongOptions;
|
||||||
@@ -17,6 +18,18 @@ class Steps;
|
|||||||
class Profile;
|
class Profile;
|
||||||
struct lua_State;
|
struct lua_State;
|
||||||
|
|
||||||
|
enum CourseType
|
||||||
|
{
|
||||||
|
COURSE_TYPE_NONSTOP, // if life meter type is BAR
|
||||||
|
COURSE_TYPE_ONI, // if life meter type is BATTERY
|
||||||
|
COURSE_TYPE_ENDLESS, // if set to REPEAT
|
||||||
|
NUM_COURSE_TYPES
|
||||||
|
};
|
||||||
|
#define FOREACH_CourseType( i ) FOREACH_ENUM( CourseType, NUM_COURSE_TYPES, i )
|
||||||
|
|
||||||
|
inline PlayMode CourseTypeToPlayMode( CourseType ct ) { return (PlayMode)(PLAY_MODE_NONSTOP+ct); }
|
||||||
|
inline CourseType PlayModeToCourseType( PlayMode pm ) { return (CourseType)(pm-PLAY_MODE_NONSTOP); }
|
||||||
|
|
||||||
enum CourseEntryType
|
enum CourseEntryType
|
||||||
{
|
{
|
||||||
COURSE_ENTRY_FIXED,
|
COURSE_ENTRY_FIXED,
|
||||||
@@ -125,6 +138,7 @@ public:
|
|||||||
bool IsNonstop() const { return GetPlayMode() == PLAY_MODE_NONSTOP; }
|
bool IsNonstop() const { return GetPlayMode() == PLAY_MODE_NONSTOP; }
|
||||||
bool IsOni() const { return GetPlayMode() == PLAY_MODE_ONI; }
|
bool IsOni() const { return GetPlayMode() == PLAY_MODE_ONI; }
|
||||||
bool IsEndless() const { return GetPlayMode() == PLAY_MODE_ENDLESS; }
|
bool IsEndless() const { return GetPlayMode() == PLAY_MODE_ENDLESS; }
|
||||||
|
CourseType GetCourseType() const;
|
||||||
PlayMode GetPlayMode() const;
|
PlayMode GetPlayMode() const;
|
||||||
|
|
||||||
bool IsFixed() const;
|
bool IsFixed() const;
|
||||||
|
|||||||
@@ -684,9 +684,9 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
|
|||||||
vector<Course*> apCourses;
|
vector<Course*> apCourses;
|
||||||
switch( so )
|
switch( so )
|
||||||
{
|
{
|
||||||
case SORT_NONSTOP_COURSES: SONGMAN->GetNonstopCourses( apCourses, PREFSMAN->m_bAutogenGroupCourses ); break;
|
case SORT_NONSTOP_COURSES: SONGMAN->GetCourses( COURSE_TYPE_NONSTOP, apCourses, PREFSMAN->m_bAutogenGroupCourses ); break;
|
||||||
case SORT_ONI_COURSES: SONGMAN->GetOniCourses( apCourses, PREFSMAN->m_bAutogenGroupCourses ); break;
|
case SORT_ONI_COURSES: SONGMAN->GetCourses( COURSE_TYPE_ONI, apCourses, PREFSMAN->m_bAutogenGroupCourses ); break;
|
||||||
case SORT_ENDLESS_COURSES: SONGMAN->GetEndlessCourses( apCourses, PREFSMAN->m_bAutogenGroupCourses ); break;
|
case SORT_ENDLESS_COURSES: SONGMAN->GetCourses( COURSE_TYPE_ENDLESS, apCourses, PREFSMAN->m_bAutogenGroupCourses ); break;
|
||||||
case SORT_ALL_COURSES: SONGMAN->GetAllCourses( apCourses, PREFSMAN->m_bAutogenGroupCourses ); break;
|
case SORT_ALL_COURSES: SONGMAN->GetAllCourses( apCourses, PREFSMAN->m_bAutogenGroupCourses ); break;
|
||||||
default: ASSERT(0); break;
|
default: ASSERT(0); break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,9 +250,10 @@ void PaneDisplay::SetContent( PaneContents c )
|
|||||||
|
|
||||||
case COURSE_MACHINE_RANK:
|
case COURSE_MACHINE_RANK:
|
||||||
{
|
{
|
||||||
const vector<Course*> best = SONGMAN->GetBestCourses( PROFILE_SLOT_MACHINE );
|
CourseType ct = PlayModeToCourseType( GAMESTATE->m_PlayMode );
|
||||||
val = (float) FindIndex( best.begin(), best.end(), pCourse );
|
const vector<Course*> best = SONGMAN->GetBestCourses( ct, PROFILE_SLOT_MACHINE );
|
||||||
val += 1;
|
val = (float) FindIndex( best.begin(), best.end(), pCourse );
|
||||||
|
val += 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -264,9 +265,12 @@ void PaneDisplay::SetContent( PaneContents c )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case COURSE_PROFILE_RANK:
|
case COURSE_PROFILE_RANK:
|
||||||
const vector<Course*> best = SONGMAN->GetBestCourses( PlayerMemCard(m_PlayerNumber) );
|
{
|
||||||
val = (float) FindIndex( best.begin(), best.end(), pCourse );
|
CourseType ct = PlayModeToCourseType( GAMESTATE->m_PlayMode );
|
||||||
val += 1;
|
const vector<Course*> best = SONGMAN->GetBestCourses( ct, PlayerMemCard(m_PlayerNumber) );
|
||||||
|
val = (float) FindIndex( best.begin(), best.end(), pCourse );
|
||||||
|
val += 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1709,7 +1709,8 @@ void ScreenSelectMusic::AfterMusicChange()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const vector<Course*> best = SONGMAN->GetBestCourses( PROFILE_SLOT_MACHINE );
|
CourseType ct = PlayModeToCourseType( GAMESTATE->m_PlayMode );
|
||||||
|
const vector<Course*> best = SONGMAN->GetBestCourses( ct, PROFILE_SLOT_MACHINE );
|
||||||
const int index = FindCourseIndexOfSameMode( best.begin(), best.end(), pCourse );
|
const int index = FindCourseIndexOfSameMode( best.begin(), best.end(), pCourse );
|
||||||
if( index != -1 )
|
if( index != -1 )
|
||||||
m_MachineRank.SetText( AddNumberSuffix( index+1 ) );
|
m_MachineRank.SetText( AddNumberSuffix( index+1 ) );
|
||||||
|
|||||||
@@ -642,7 +642,8 @@ void SongManager::FreeCourses()
|
|||||||
m_pCourses.clear();
|
m_pCourses.clear();
|
||||||
|
|
||||||
for( int i = 0; i < NUM_PROFILE_SLOTS; ++i )
|
for( int i = 0; i < NUM_PROFILE_SLOTS; ++i )
|
||||||
m_pBestCourses[i].clear();
|
FOREACH_CourseType( ct )
|
||||||
|
m_pBestCourses[i][ct].clear();
|
||||||
m_pShuffledCourses.clear();
|
m_pShuffledCourses.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -845,31 +846,14 @@ void SongManager::GetAllCourses( vector<Course*> &AddTo, bool bIncludeAutogen )
|
|||||||
AddTo.push_back( m_pCourses[i] );
|
AddTo.push_back( m_pCourses[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongManager::GetNonstopCourses( vector<Course*> &AddTo, bool bIncludeAutogen )
|
void SongManager::GetCourses( CourseType ct, vector<Course*> &AddTo, bool bIncludeAutogen )
|
||||||
{
|
{
|
||||||
for( unsigned i=0; i<m_pCourses.size(); i++ )
|
for( unsigned i=0; i<m_pCourses.size(); i++ )
|
||||||
if( m_pCourses[i]->IsNonstop() )
|
if( m_pCourses[i]->GetCourseType() == ct )
|
||||||
if( bIncludeAutogen || !m_pCourses[i]->m_bIsAutogen )
|
if( bIncludeAutogen || !m_pCourses[i]->m_bIsAutogen )
|
||||||
AddTo.push_back( m_pCourses[i] );
|
AddTo.push_back( m_pCourses[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongManager::GetOniCourses( vector<Course*> &AddTo, bool bIncludeAutogen )
|
|
||||||
{
|
|
||||||
for( unsigned i=0; i<m_pCourses.size(); i++ )
|
|
||||||
if( m_pCourses[i]->IsOni() )
|
|
||||||
if( bIncludeAutogen || !m_pCourses[i]->m_bIsAutogen )
|
|
||||||
AddTo.push_back( m_pCourses[i] );
|
|
||||||
}
|
|
||||||
|
|
||||||
void SongManager::GetEndlessCourses( vector<Course*> &AddTo, bool bIncludeAutogen )
|
|
||||||
{
|
|
||||||
for( unsigned i=0; i<m_pCourses.size(); i++ )
|
|
||||||
if( m_pCourses[i]->IsEndless() )
|
|
||||||
if( bIncludeAutogen || !m_pCourses[i]->m_bIsAutogen )
|
|
||||||
AddTo.push_back( m_pCourses[i] );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool SongManager::GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredGroup,
|
bool SongManager::GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredGroup,
|
||||||
Song*& pSongOut, Steps*& pStepsOut, PlayerOptions& po_out, SongOptions& so_out )
|
Song*& pSongOut, Steps*& pStepsOut, PlayerOptions& po_out, SongOptions& so_out )
|
||||||
{
|
{
|
||||||
@@ -1117,7 +1101,7 @@ Course *SongManager::FindCourse( CString sName )
|
|||||||
void SongManager::UpdateBest()
|
void SongManager::UpdateBest()
|
||||||
{
|
{
|
||||||
// update players best
|
// update players best
|
||||||
for( int i = 0; i < NUM_PROFILE_SLOTS; ++i )
|
FOREACH_ProfileSlot( i )
|
||||||
{
|
{
|
||||||
vector<Song*> &Best = m_pBestSongs[i];
|
vector<Song*> &Best = m_pBestSongs[i];
|
||||||
Best = m_pSongs;
|
Best = m_pSongs;
|
||||||
@@ -1141,11 +1125,16 @@ void SongManager::UpdateBest()
|
|||||||
}
|
}
|
||||||
|
|
||||||
SongUtil::SortSongPointerArrayByTitle( m_pBestSongs[i] );
|
SongUtil::SortSongPointerArrayByTitle( m_pBestSongs[i] );
|
||||||
SongUtil::SortSongPointerArrayByNumPlays( m_pBestSongs[i], (ProfileSlot) i, true );
|
SongUtil::SortSongPointerArrayByNumPlays( m_pBestSongs[i], i, true );
|
||||||
|
|
||||||
m_pBestCourses[i] = m_pCourses;
|
FOREACH_CourseType( ct )
|
||||||
CourseUtil::SortCoursePointerArrayByTitle( m_pBestCourses[i] );
|
{
|
||||||
CourseUtil::SortCoursePointerArrayByNumPlays( m_pBestCourses[i], (ProfileSlot) i, true );
|
vector<Course*> &vpCourses = m_pBestCourses[i][ct];
|
||||||
|
vpCourses.clear();
|
||||||
|
GetCourses( ct, vpCourses, PREFSMAN->m_bAutogenGroupCourses );
|
||||||
|
CourseUtil::SortCoursePointerArrayByTitle( vpCourses );
|
||||||
|
CourseUtil::SortCoursePointerArrayByNumPlays( vpCourses, i, true );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
class LoadingWindow;
|
class LoadingWindow;
|
||||||
class Song;
|
class Song;
|
||||||
class Style;
|
class Style;
|
||||||
class Course;
|
|
||||||
class Steps;
|
class Steps;
|
||||||
struct PlayerOptions;
|
struct PlayerOptions;
|
||||||
struct lua_State;
|
struct lua_State;
|
||||||
@@ -17,6 +16,7 @@ struct lua_State;
|
|||||||
#include "PlayerOptions.h"
|
#include "PlayerOptions.h"
|
||||||
#include "PlayerNumber.h"
|
#include "PlayerNumber.h"
|
||||||
#include "Difficulty.h"
|
#include "Difficulty.h"
|
||||||
|
#include "Course.h"
|
||||||
|
|
||||||
class SongManager
|
class SongManager
|
||||||
{
|
{
|
||||||
@@ -65,7 +65,7 @@ public:
|
|||||||
const vector<Song*> &GetAllSongs() const { return m_pSongs; }
|
const vector<Song*> &GetAllSongs() const { return m_pSongs; }
|
||||||
void GetBestSongs( vector<Song*> &AddTo, CString sGroupName, int iMaxStages = INT_MAX, ProfileSlot slot=PROFILE_SLOT_MACHINE ) const;
|
void GetBestSongs( vector<Song*> &AddTo, CString sGroupName, int iMaxStages = INT_MAX, ProfileSlot slot=PROFILE_SLOT_MACHINE ) const;
|
||||||
const vector<Song*> &GetBestSongs( ProfileSlot slot=PROFILE_SLOT_MACHINE ) const { return m_pBestSongs[slot]; }
|
const vector<Song*> &GetBestSongs( ProfileSlot slot=PROFILE_SLOT_MACHINE ) const { return m_pBestSongs[slot]; }
|
||||||
const vector<Course*> &GetBestCourses( ProfileSlot slot=PROFILE_SLOT_MACHINE ) const { return m_pBestCourses[slot]; }
|
const vector<Course*> &GetBestCourses( CourseType ct, ProfileSlot slot=PROFILE_SLOT_MACHINE ) const { return m_pBestCourses[slot][ct]; }
|
||||||
void GetSongs( vector<Song*> &AddTo, CString sGroupName, int iMaxStages = INT_MAX ) const;
|
void GetSongs( vector<Song*> &AddTo, CString sGroupName, int iMaxStages = INT_MAX ) const;
|
||||||
void GetSongs( vector<Song*> &AddTo, int iMaxStages ) const { GetSongs(AddTo,GROUP_ALL_MUSIC,iMaxStages); }
|
void GetSongs( vector<Song*> &AddTo, int iMaxStages ) const { GetSongs(AddTo,GROUP_ALL_MUSIC,iMaxStages); }
|
||||||
void GetSongs( vector<Song*> &AddTo ) const { GetSongs(AddTo,GROUP_ALL_MUSIC,INT_MAX); }
|
void GetSongs( vector<Song*> &AddTo ) const { GetSongs(AddTo,GROUP_ALL_MUSIC,INT_MAX); }
|
||||||
@@ -79,9 +79,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
void GetAllCourses( vector<Course*> &AddTo, bool bIncludeAutogen );
|
void GetAllCourses( vector<Course*> &AddTo, bool bIncludeAutogen );
|
||||||
void GetNonstopCourses( vector<Course*> &AddTo, bool bIncludeAutogen ); // add to if life meter type is BAR.
|
void GetCourses( CourseType ct, vector<Course*> &AddTo, bool bIncludeAutogen );
|
||||||
void GetOniCourses( vector<Course*> &AddTo, bool bIncludeAutogen ); // add to if life meter type is BATTERY.
|
|
||||||
void GetEndlessCourses( vector<Course*> &AddTo, bool bIncludeAutogen ); // add to if set to REPEAT.
|
|
||||||
|
|
||||||
void GetExtraStageInfo( bool bExtra2, const Style *s,
|
void GetExtraStageInfo( bool bExtra2, const Style *s,
|
||||||
Song*& pSongOut, Steps*& pStepsOut, PlayerOptions& po_out, SongOptions& so_out );
|
Song*& pSongOut, Steps*& pStepsOut, PlayerOptions& po_out, SongOptions& so_out );
|
||||||
@@ -116,7 +114,7 @@ protected:
|
|||||||
CStringArray m_sGroupNames;
|
CStringArray m_sGroupNames;
|
||||||
CStringArray m_sGroupBannerPaths; // each song group may have a banner associated with it
|
CStringArray m_sGroupBannerPaths; // each song group may have a banner associated with it
|
||||||
vector<Course*> m_pCourses;
|
vector<Course*> m_pCourses;
|
||||||
vector<Course*> m_pBestCourses[NUM_PROFILE_SLOTS];
|
vector<Course*> m_pBestCourses[NUM_PROFILE_SLOTS][NUM_COURSE_TYPES];
|
||||||
vector<Course*> m_pShuffledCourses; // used by GetRandomCourse
|
vector<Course*> m_pShuffledCourses; // used by GetRandomCourse
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user