2002-11-16 08:07:38 +00:00
|
|
|
#ifndef SONGMANAGER_H
|
|
|
|
|
#define SONGMANAGER_H
|
2002-02-28 19:40:40 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: SongManager
|
|
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Desc: Holder for all Songs and Notes. Also keeps track of the current
|
|
|
|
|
Song and Notes, 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-06-14 22:25:22 +00:00
|
|
|
#include "Course.h"
|
2002-02-28 19:40:40 +00:00
|
|
|
|
2002-11-17 09:13:35 +00:00
|
|
|
class LoadingWindow;
|
|
|
|
|
class Song;
|
|
|
|
|
class StyleDef;
|
|
|
|
|
struct PlayerOptions;
|
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-01-03 05:56:28 +00:00
|
|
|
vector<Song*> m_pSongs; // all songs that can be played
|
2002-02-28 19:40:40 +00:00
|
|
|
|
2002-11-17 09:13:35 +00:00
|
|
|
void InitSongArrayFromDisk( LoadingWindow *ld );
|
2002-06-14 22:25:22 +00:00
|
|
|
void FreeSongArray();
|
|
|
|
|
void ReloadSongArray();
|
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 );
|
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 );
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2002-07-23 01:41:40 +00:00
|
|
|
static CString ShortenGroupName( const CString &sOrigGroupName );
|
2002-04-01 02:04:43 +00:00
|
|
|
|
|
|
|
|
|
2002-03-06 08:25:09 +00:00
|
|
|
|
2003-01-21 05:14:59 +00:00
|
|
|
//
|
|
|
|
|
// Courses for Nonstop, Oni, and Endless
|
|
|
|
|
//
|
2003-01-22 05:29:27 +00:00
|
|
|
vector<Course*> m_pCourses;
|
2002-06-14 22:25:22 +00:00
|
|
|
|
|
|
|
|
void InitCoursesFromDisk();
|
2003-01-22 05:29:27 +00:00
|
|
|
void FreeCourses();
|
2002-12-21 18:23:37 +00:00
|
|
|
void CleanCourses();
|
2002-06-14 22:25:22 +00:00
|
|
|
|
2003-01-22 05:29:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
// Lookup
|
|
|
|
|
void GetSongsInGroup( const CString sGroupName, vector<Song*> &AddTo );
|
|
|
|
|
Song* GetRandomSong();
|
|
|
|
|
|
2003-01-21 05:14:59 +00:00
|
|
|
void GetNonstopCourses( vector<Course*> AddTo ); // add to if life meter type is BAR.
|
|
|
|
|
void GetOniCourses( vector<Course*> AddTo ); // add to if life meter type is BATTERY.
|
|
|
|
|
void GetEndlessCourses( vector<Course*> AddTo ); // add to if set to REPEAT.
|
|
|
|
|
|
2002-09-06 08:56:28 +00:00
|
|
|
void GetExtraStageInfo( bool bExtra2, CString sPreferredGroup, const StyleDef *s,
|
2002-08-01 13:42:56 +00:00
|
|
|
Song*& pSongOut, Notes*& 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
|
2002-11-08 08:17:59 +00:00
|
|
|
|
2003-01-22 05:29:27 +00:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// High scores
|
|
|
|
|
//
|
|
|
|
|
void InitMachineScoresFromDisk();
|
|
|
|
|
void SaveMachineScoresToDisk();
|
|
|
|
|
|
2003-01-24 02:43:07 +00:00
|
|
|
bool MemoryCardIsInserted( PlayerNumber pn );
|
2003-01-22 05:29:27 +00:00
|
|
|
bool IsUsingMemoryCard( PlayerNumber pn );
|
|
|
|
|
|
2003-01-24 02:43:07 +00:00
|
|
|
void LoadMemoryCardScores( PlayerNumber pn );
|
|
|
|
|
void SaveMemoryCardScores( PlayerNumber pn );
|
|
|
|
|
|
|
|
|
|
struct MachineScore
|
|
|
|
|
{
|
|
|
|
|
float fScore;
|
|
|
|
|
CString sName;
|
2003-01-26 07:33:03 +00:00
|
|
|
} m_MachineScores[NUM_NOTES_TYPES][NUM_RANKING_CATEGORIES][NUM_HIGH_SCORE_LINES];
|
2003-01-24 02:43:07 +00:00
|
|
|
|
2003-01-26 07:33:03 +00:00
|
|
|
bool IsNewMachineRecord( RankingCategory hsc, float fScore ) const; // return true if this is would be a new machine record
|
|
|
|
|
void AddMachineRecord( RankingCategory hsc, float fScore[NUM_PLAYERS], int iNewRecordIndexOut[NUM_PLAYERS] ); // set iNewRecordIndex = -1 if not a new record
|
2003-01-24 02:43:07 +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,
|
|
|
|
|
Song*& pSongOut, Notes*& 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
|
|
|
|
2002-04-16 17:31:00 +00:00
|
|
|
CStringArray m_arrayGroupNames;
|
2002-09-07 07:24:44 +00:00
|
|
|
CStringArray m_GroupBannerPaths; // each song group has a banner associated with it
|
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
|