2002-11-16 08:07:38 +00:00
|
|
|
#ifndef SONGMANAGER_H
|
|
|
|
|
#define SONGMANAGER_H
|
2002-02-28 19:40:40 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: SongManager
|
|
|
|
|
|
2003-08-03 00:13:55 +00:00
|
|
|
Desc: Holder for all Songs and Steps. Also keeps track of the current
|
|
|
|
|
Song and Steps, and loads/saves statistics.
|
2002-02-28 19:40:40 +00:00
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-02-28 19:40:40 +00:00
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2002-11-17 09:13:35 +00:00
|
|
|
class LoadingWindow;
|
|
|
|
|
class Song;
|
|
|
|
|
class StyleDef;
|
2003-07-17 20:11:24 +00:00
|
|
|
class Course;
|
2003-08-03 00:13:55 +00:00
|
|
|
class Steps;
|
2002-11-17 09:13:35 +00:00
|
|
|
struct PlayerOptions;
|
2002-02-28 19:40:40 +00:00
|
|
|
|
2003-07-17 20:11:24 +00:00
|
|
|
#include "RageTypes.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
|
|
|
|
#include "SongOptions.h"
|
|
|
|
|
#include "PlayerOptions.h"
|
|
|
|
|
#include "PlayerNumber.h"
|
|
|
|
|
|
2002-02-28 19:40:40 +00:00
|
|
|
class SongManager
|
|
|
|
|
{
|
|
|
|
|
public:
|
2002-11-17 09:13:35 +00:00
|
|
|
SongManager( LoadingWindow *ld );
|
2002-02-28 19:40:40 +00:00
|
|
|
~SongManager();
|
|
|
|
|
|
2003-08-06 05:28:58 +00:00
|
|
|
void InitSongsFromDisk( LoadingWindow *ld );
|
|
|
|
|
void FreeSongs();
|
2003-12-21 02:54:23 +00:00
|
|
|
void Cleanup();
|
|
|
|
|
|
2004-02-08 01:05:53 +00:00
|
|
|
void LoadAllFromProfiles(); // song, edits
|
|
|
|
|
void FreeAllLoadedFromProfiles();
|
|
|
|
|
|
2003-09-05 09:14:11 +00:00
|
|
|
void LoadGroupSymLinks( CString sDir, CString sGroupFolder );
|
2003-08-06 05:28:58 +00:00
|
|
|
|
|
|
|
|
void InitCoursesFromDisk( LoadingWindow *ld );
|
|
|
|
|
void InitAutogenCourses();
|
|
|
|
|
void FreeCourses();
|
2003-08-06 08:06:27 +00:00
|
|
|
|
2004-02-21 01:52:00 +00:00
|
|
|
void Reload( LoadingWindow *ld=NULL ); // songs, courses, groups - everything.
|
2003-11-25 22:56:48 +00:00
|
|
|
void PreloadSongImages();
|
2002-03-06 08:25:09 +00:00
|
|
|
|
|
|
|
|
|
2002-03-19 07:09:49 +00:00
|
|
|
CString GetGroupBannerPath( CString sGroupName );
|
2002-04-01 02:04:43 +00:00
|
|
|
void GetGroupNames( CStringArray &AddTo );
|
2003-02-16 23:54:30 +00:00
|
|
|
bool DoesGroupExist( CString sGroupName );
|
|
|
|
|
|
2002-10-28 05:30:45 +00:00
|
|
|
RageColor GetGroupColor( const CString &sGroupName );
|
2002-12-17 05:22:32 +00:00
|
|
|
RageColor GetSongColor( const Song* pSong );
|
2003-11-16 19:07:52 +00:00
|
|
|
RageColor GetDifficultyColor( Difficulty dc ) const;
|
2004-03-25 06:21:58 +00:00
|
|
|
|
2003-02-10 05:30:12 +00:00
|
|
|
static CString ShortenGroupName( CString sLongGroupName );
|
|
|
|
|
static int GetNumStagesForSong( const Song* pSong ); // LongVer songs take 2 stages, MarathonVer take 3
|
2002-04-01 02:04:43 +00:00
|
|
|
|
2002-03-06 08:25:09 +00:00
|
|
|
|
2003-01-22 05:29:27 +00:00
|
|
|
// Lookup
|
2003-02-05 18:34:27 +00:00
|
|
|
const vector<Song*> &GetAllSongs() const { return m_pSongs; }
|
2004-03-07 00:17:50 +00:00
|
|
|
void GetBestSongs( vector<Song*> &AddTo, CString sGroupName, int iMaxStages = 100000 /*inf*/, ProfileSlot slot=PROFILE_SLOT_MACHINE ) const;
|
2004-03-07 00:02:51 +00:00
|
|
|
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]; }
|
2003-02-10 05:30:12 +00:00
|
|
|
void GetSongs( vector<Song*> &AddTo, CString sGroupName, int iMaxStages = 100000 /*inf*/ ) const;
|
|
|
|
|
void GetSongs( vector<Song*> &AddTo, int iMaxStages ) const { GetSongs(AddTo,"",iMaxStages); }
|
|
|
|
|
void GetSongs( vector<Song*> &AddTo ) const { GetSongs(AddTo,"",100000 /*inf*/ ); }
|
2003-07-22 05:45:30 +00:00
|
|
|
Song *FindSong( CString sPath );
|
2003-07-17 12:14:19 +00:00
|
|
|
Course *FindCourse( CString sName );
|
2003-02-05 18:34:27 +00:00
|
|
|
int GetNumSongs() const;
|
|
|
|
|
int GetNumGroups() const;
|
2003-02-14 21:42:44 +00:00
|
|
|
int GetNumCourses() const;
|
2003-01-22 05:29:27 +00:00
|
|
|
Song* GetRandomSong();
|
2004-02-01 23:06:07 +00:00
|
|
|
Course* GetRandomCourse();
|
2003-02-14 21:42:44 +00:00
|
|
|
|
2003-01-22 05:29:27 +00:00
|
|
|
|
2003-07-20 00:30:24 +00:00
|
|
|
void GetAllCourses( vector<Course*> &AddTo, bool bIncludeAutogen );
|
2003-03-27 01:56:21 +00:00
|
|
|
void GetNonstopCourses( vector<Course*> &AddTo, bool bIncludeAutogen ); // add to if life meter type is BAR.
|
|
|
|
|
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.
|
2003-01-21 05:14:59 +00:00
|
|
|
|
2003-07-30 02:01:19 +00:00
|
|
|
void GetExtraStageInfo( bool bExtra2, const StyleDef *s,
|
2003-08-03 00:13:55 +00:00
|
|
|
Song*& pSongOut, Steps*& pNotesOut, PlayerOptions& po_out, SongOptions& so_out );
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2002-12-02 05:25:44 +00:00
|
|
|
Song* GetSongFromDir( CString sDir );
|
2003-01-21 05:14:59 +00:00
|
|
|
Course* GetCourseFromPath( CString sPath ); // path to .crs file, or path to song group dir
|
2003-02-14 21:42:44 +00:00
|
|
|
Course* GetCourseFromName( CString sName );
|
2002-11-08 08:17:59 +00:00
|
|
|
|
2003-01-22 05:29:27 +00:00
|
|
|
|
2004-02-27 21:28:15 +00:00
|
|
|
void UpdateBest(); // update Players Best
|
|
|
|
|
void UpdateShuffled(); // re-shuffle songs and courses
|
|
|
|
|
void SortSongs(); // sort m_pSongs
|
2003-01-22 05:29:27 +00:00
|
|
|
|
2003-12-07 07:09:13 +00:00
|
|
|
void UpdateRankingCourses(); // courses shown on the ranking screen
|
2003-09-08 07:21:41 +00:00
|
|
|
|
2002-02-28 19:40:40 +00:00
|
|
|
protected:
|
2002-11-17 09:13:35 +00:00
|
|
|
void LoadStepManiaSongDir( CString sDir, LoadingWindow *ld );
|
2002-03-06 08:25:09 +00:00
|
|
|
void LoadDWISongDir( CString sDir );
|
2002-08-30 20:49:56 +00:00
|
|
|
bool GetExtraStageInfoFromCourse( bool bExtra2, CString sPreferredGroup,
|
2003-08-03 00:13:55 +00:00
|
|
|
Song*& pSongOut, Steps*& pNotesOut, PlayerOptions& po_out, SongOptions& so_out );
|
2002-09-10 07:05:14 +00:00
|
|
|
void SanityCheckGroupDir( CString sDir ) const;
|
2002-09-10 07:11:29 +00:00
|
|
|
void AddGroup( CString sDir, CString sGroupDirName );
|
2002-08-30 20:49:56 +00:00
|
|
|
|
2003-07-22 05:45:30 +00:00
|
|
|
Song *FindSong( CString sGroup, CString sSong );
|
2003-06-30 04:24:59 +00:00
|
|
|
|
2003-02-03 05:53:59 +00:00
|
|
|
vector<Song*> m_pSongs; // all songs that can be played
|
2004-02-08 01:05:53 +00:00
|
|
|
vector<Song*> m_pBestSongs[NUM_PROFILE_SLOTS];
|
2004-02-01 23:06:07 +00:00
|
|
|
vector<Song*> m_pShuffledSongs; // used by GetRandomSong
|
2003-08-06 08:06:27 +00:00
|
|
|
CStringArray m_sGroupNames;
|
|
|
|
|
CStringArray m_sGroupBannerPaths; // each song group may have a banner associated with it
|
2003-11-17 03:20:39 +00:00
|
|
|
vector<Course*> m_pCourses;
|
2004-02-08 01:05:53 +00:00
|
|
|
vector<Course*> m_pBestCourses[NUM_PROFILE_SLOTS];
|
2004-02-01 23:06:07 +00:00
|
|
|
vector<Course*> m_pShuffledCourses; // used by GetRandomCourse
|
2002-02-28 19:40:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
extern SongManager* SONGMAN; // global and accessable from anywhere in our program
|
2002-11-16 08:07:38 +00:00
|
|
|
|
|
|
|
|
#endif
|