2003-09-08 03:26:58 +00:00
|
|
|
#ifndef ProfileManager_H
|
|
|
|
|
#define ProfileManager_H
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: ProfileManager
|
|
|
|
|
|
|
|
|
|
Desc: Interface to profiles that exist on the machine or a memory card
|
|
|
|
|
plugged into the machine.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "PlayerNumber.h"
|
2003-12-07 07:09:13 +00:00
|
|
|
#include "GameConstantsAndTypes.h"
|
2003-09-08 03:26:58 +00:00
|
|
|
|
2003-09-08 07:21:41 +00:00
|
|
|
struct Profile
|
|
|
|
|
{
|
|
|
|
|
Profile() { Init(); }
|
|
|
|
|
void Init()
|
|
|
|
|
{
|
2003-11-01 19:36:52 +00:00
|
|
|
m_sName = "";
|
2003-09-08 07:21:41 +00:00
|
|
|
m_sLastUsedHighScoreName = "";
|
2003-11-10 04:32:12 +00:00
|
|
|
m_bUsingProfileDefaultModifiers = false;
|
|
|
|
|
m_sDefaultModifiers = "";
|
2003-12-08 04:02:43 +00:00
|
|
|
m_iTotalPlays = 0;
|
|
|
|
|
m_iTotalPlaySeconds = 0;
|
|
|
|
|
m_iTotalGameplaySeconds = 0;
|
2003-12-08 04:39:29 +00:00
|
|
|
m_iCurrentCombo = 0;
|
2003-09-08 07:21:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool LoadFromIni( CString sIniPath );
|
2003-11-01 19:36:52 +00:00
|
|
|
bool SaveToIni( CString sIniPath );
|
|
|
|
|
CString m_sName;
|
2003-09-08 07:21:41 +00:00
|
|
|
CString m_sLastUsedHighScoreName;
|
2003-11-10 04:32:12 +00:00
|
|
|
bool m_bUsingProfileDefaultModifiers;
|
|
|
|
|
CString m_sDefaultModifiers;
|
2003-12-08 04:02:43 +00:00
|
|
|
int m_iTotalPlays;
|
|
|
|
|
int m_iTotalPlaySeconds;
|
|
|
|
|
int m_iTotalGameplaySeconds;
|
2003-12-08 04:39:29 +00:00
|
|
|
int m_iCurrentCombo;
|
2003-09-08 07:21:41 +00:00
|
|
|
};
|
|
|
|
|
|
2003-09-08 03:26:58 +00:00
|
|
|
class ProfileManager
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ProfileManager();
|
|
|
|
|
~ProfileManager();
|
|
|
|
|
|
2003-12-07 08:19:10 +00:00
|
|
|
bool CreateLocalProfile( CString sName );
|
|
|
|
|
bool RenameLocalProfile( CString sProfileID, CString sNewName );
|
|
|
|
|
bool DeleteLocalProfile( CString sProfileID );
|
2003-09-08 07:21:41 +00:00
|
|
|
|
2003-11-01 22:04:43 +00:00
|
|
|
bool CreateMemoryCardProfile( CString sName );
|
|
|
|
|
|
2003-12-07 08:19:10 +00:00
|
|
|
void GetLocalProfileIDs( vector<CString> &asProfileIDsOut );
|
|
|
|
|
void GetLocalProfileNames( vector<CString> &asNamesOut );
|
2003-09-08 07:21:41 +00:00
|
|
|
|
2003-11-01 22:04:43 +00:00
|
|
|
bool LoadFirstAvailableProfile( PlayerNumber pn );
|
|
|
|
|
bool IsMemoryCardInserted( PlayerNumber pn );
|
2003-11-01 19:36:52 +00:00
|
|
|
bool SaveProfile( PlayerNumber pn );
|
2003-09-08 03:26:58 +00:00
|
|
|
void UnloadProfile( PlayerNumber pn );
|
|
|
|
|
|
2003-12-07 07:09:13 +00:00
|
|
|
void SaveMachineProfile();
|
|
|
|
|
|
2003-09-08 03:26:58 +00:00
|
|
|
bool IsUsingProfile( PlayerNumber pn ) { return !m_sProfileDir[pn].empty(); }
|
2003-11-01 19:36:52 +00:00
|
|
|
Profile* GetProfile( PlayerNumber pn );
|
2003-09-08 03:26:58 +00:00
|
|
|
|
2003-12-07 07:09:13 +00:00
|
|
|
Profile* GetMachineProfile() { return &m_MachineProfile; }
|
2003-11-01 19:36:52 +00:00
|
|
|
|
2003-09-08 03:26:58 +00:00
|
|
|
bool IsUsingMemoryCard( PlayerNumber pn ) { return m_bUsingMemoryCard[pn]; }
|
|
|
|
|
|
2003-12-07 07:09:13 +00:00
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// High scores
|
|
|
|
|
//
|
|
|
|
|
void InitMachineScoresFromDisk();
|
|
|
|
|
void SaveMachineScoresToDisk();
|
|
|
|
|
|
|
|
|
|
struct CategoryData
|
|
|
|
|
{
|
|
|
|
|
struct HighScore
|
|
|
|
|
{
|
|
|
|
|
int iScore;
|
|
|
|
|
CString sName;
|
|
|
|
|
|
|
|
|
|
HighScore()
|
|
|
|
|
{
|
|
|
|
|
iScore = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool operator>=( const HighScore& other ) const
|
|
|
|
|
{
|
|
|
|
|
return iScore >= other.iScore;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
vector<HighScore> vHighScores;
|
|
|
|
|
|
|
|
|
|
void AddHighScore( HighScore hs, int &iIndexOut );
|
|
|
|
|
|
2003-12-07 07:46:21 +00:00
|
|
|
} m_CategoryDatas[NUM_MEMORY_CARDS][NUM_STEPS_TYPES][NUM_RANKING_CATEGORIES];
|
2003-12-07 07:09:13 +00:00
|
|
|
|
|
|
|
|
void AddHighScore( StepsType nt, RankingCategory rc, PlayerNumber pn, CategoryData::HighScore hs, int &iMachineIndexOut )
|
|
|
|
|
{
|
|
|
|
|
hs.sName = RANKING_TO_FILL_IN_MARKER[pn];
|
2003-12-07 07:46:21 +00:00
|
|
|
m_CategoryDatas[pn][nt][rc].AddHighScore( hs, iMachineIndexOut );
|
|
|
|
|
m_CategoryDatas[MEMORY_CARD_MACHINE][nt][rc].AddHighScore( hs, iMachineIndexOut );
|
2003-12-07 07:09:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ReadSM300NoteScores();
|
2003-12-08 10:27:45 +00:00
|
|
|
void ReadSongScoresFromDir( CString sDir, MemoryCard mc );
|
|
|
|
|
void ReadCourseScoresFromDir( CString sDir, MemoryCard mc );
|
|
|
|
|
void ReadCategoryScoresFromDir( CString sDir, MemoryCard mc );
|
2003-12-07 07:09:13 +00:00
|
|
|
|
2003-12-08 10:27:45 +00:00
|
|
|
void SaveSongScoresToDir( CString sDir, MemoryCard mc );
|
|
|
|
|
void SaveCourseScoresToDir( CString sDir, MemoryCard mc );
|
|
|
|
|
void SaveCategoryScoresToDir( CString sDir, MemoryCard mc );
|
|
|
|
|
void SaveStatsWebPageToDir( CString sDir, MemoryCard mc );
|
2003-12-07 07:09:13 +00:00
|
|
|
|
2003-09-08 03:26:58 +00:00
|
|
|
private:
|
2003-11-01 22:04:43 +00:00
|
|
|
bool LoadDefaultProfileFromMachine( PlayerNumber pn );
|
|
|
|
|
bool LoadProfileFromMemoryCard( PlayerNumber pn );
|
|
|
|
|
bool LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard );
|
|
|
|
|
bool CreateProfile( CString sProfileDir, CString sName );
|
|
|
|
|
|
2003-11-01 19:36:52 +00:00
|
|
|
// Directory that contains the profile. Either on local machine or
|
|
|
|
|
// on a memory card.
|
2003-09-08 03:26:58 +00:00
|
|
|
CString m_sProfileDir[NUM_PLAYERS];
|
|
|
|
|
|
2003-11-01 19:36:52 +00:00
|
|
|
bool m_bUsingMemoryCard[NUM_PLAYERS];
|
|
|
|
|
|
|
|
|
|
// actual loaded profile data
|
|
|
|
|
Profile m_Profile[NUM_PLAYERS];
|
2003-12-07 07:09:13 +00:00
|
|
|
|
|
|
|
|
Profile m_MachineProfile;
|
|
|
|
|
|
2003-09-08 03:26:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern ProfileManager* PROFILEMAN; // global and accessable from anywhere in our program
|
|
|
|
|
|
|
|
|
|
#endif
|