00001
00002
00003
#ifndef SONGMANAGER_H
00004
#define SONGMANAGER_H
00005
00006
class LoadingWindow;
00007
class Song;
00008
class Style;
00009
class Course;
00010
class Steps;
00011
struct PlayerOptions;
00012
00013
#include "RageTypes.h"
00014
#include "GameConstantsAndTypes.h"
00015
#include "SongOptions.h"
00016
#include "PlayerOptions.h"
00017
#include "PlayerNumber.h"
00018
#include "Difficulty.h"
00019
00020 class SongManager
00021 {
00022
public:
00023
SongManager();
00024
~SongManager();
00025
00026
void InitSongsFromDisk(
LoadingWindow *ld );
00027
void FreeSongs();
00028
void Cleanup();
00029
00030
void Invalidate(
Song *pStaleSong );
00031
void RevertFromDisk(
Song *pSong,
bool bAllowNotesLoss=
false );
00032
00033
void RegenerateNonFixedCourses();
00034
void SetPreferences();
00035
00036
void LoadAllFromProfiles();
00037
void FreeAllLoadedFromProfiles();
00038
00039
void LoadGroupSymLinks(
CString sDir,
CString sGroupFolder );
00040
00041
void InitCoursesFromDisk(
LoadingWindow *ld );
00042
void InitAutogenCourses();
00043
void FreeCourses();
00044
00045
void InitAll(
LoadingWindow *ld );
00046
void Reload(
LoadingWindow *ld=NULL );
00047
void PreloadSongImages();
00048
00049
00050
CString GetGroupBannerPath(
CString sGroupName );
00051
void GetGroupNames(
CStringArray &AddTo );
00052
bool DoesGroupExist(
CString sGroupName );
00053
00054
RageColor GetGroupColor(
const CString &sGroupName );
00055
RageColor GetSongColor(
const Song* pSong );
00056
RageColor GetDifficultyColor(
Difficulty dc )
const;
00057
00058
static CString ShortenGroupName(
CString sLongGroupName );
00059
static int GetNumStagesForSong(
const Song* pSong );
00060
00061
00062
00063 const vector<Song*> &
GetAllSongs()
const {
return m_pSongs; }
00064
void GetBestSongs( vector<Song*> &AddTo, CString sGroupName,
int iMaxStages = 100000 , ProfileSlot slot=PROFILE_SLOT_MACHINE )
const;
00065 const vector<Song*> &GetBestSongs( ProfileSlot slot=PROFILE_SLOT_MACHINE )
const {
return m_pBestSongs[slot]; }
00066 const vector<Course*> &
GetBestCourses( ProfileSlot slot=PROFILE_SLOT_MACHINE )
const {
return m_pBestCourses[slot]; }
00067
void GetSongs( vector<Song*> &AddTo, CString sGroupName,
int iMaxStages = 100000 )
const;
00068 void GetSongs( vector<Song*> &AddTo,
int iMaxStages )
const { GetSongs(AddTo,
GROUP_ALL_MUSIC,iMaxStages); }
00069 void GetSongs( vector<Song*> &AddTo )
const { GetSongs(AddTo,
GROUP_ALL_MUSIC,100000 ); }
00070
Song *FindSong( CString sPath );
00071
Course *FindCourse( CString sName );
00072
int GetNumSongs() const;
00073
int GetNumGroups() const;
00074
int GetNumCourses() const;
00075
Song* GetRandomSong();
00076
Course* GetRandomCourse();
00077
00078
00079
void GetAllCourses( vector<
Course*> &AddTo,
bool bIncludeAutogen );
00080
void GetNonstopCourses( vector<
Course*> &AddTo,
bool bIncludeAutogen );
00081
void GetOniCourses( vector<
Course*> &AddTo,
bool bIncludeAutogen );
00082
void GetEndlessCourses( vector<
Course*> &AddTo,
bool bIncludeAutogen );
00083
00084
void GetExtraStageInfo(
bool bExtra2, const
Style *s,
00085
Song*& pSongOut,
Steps*& pStepsOut,
PlayerOptions& po_out,
SongOptions& so_out );
00086
00087
Song* GetSongFromDir( CString sDir );
00088
Course* GetCourseFromPath( CString sPath );
00089
Course* GetCourseFromName( CString sName );
00090
00091
00092
void UpdateBest();
00093
void UpdateShuffled();
00094
void SortSongs();
00095
00096
void UpdateRankingCourses();
00097
00098 protected:
00099
void LoadStepManiaSongDir( CString sDir,
LoadingWindow *ld );
00100
void LoadDWISongDir( CString sDir );
00101
bool GetExtraStageInfoFromCourse(
bool bExtra2, CString sPreferredGroup,
00102
Song*& pSongOut,
Steps*& pStepsOut,
PlayerOptions& po_out,
SongOptions& so_out );
00103
void SanityCheckGroupDir( CString sDir ) const;
00104
void AddGroup( CString sDir, CString sGroupDirName );
00105
00106
Song *FindSong( CString sGroup, CString sSong );
00107
00108 vector<
Song*> m_pSongs;
00109 vector<
Song*> m_pBestSongs[NUM_PROFILE_SLOTS];
00110 vector<
Song*> m_pShuffledSongs;
00111 CStringArray m_sGroupNames;
00112 CStringArray m_sGroupBannerPaths;
00113 vector<
Course*> m_pCourses;
00114 vector<
Course*> m_pBestCourses[NUM_PROFILE_SLOTS];
00115 vector<
Course*> m_pShuffledCourses;
00116 };
00117
00118
00119 extern
SongManager* SONGMAN;
00120
00121 #endif
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146