00001
00002
00003
#ifndef ProfileManager_H
00004
#define ProfileManager_H
00005
00006
#include "PlayerNumber.h"
00007
#include "GameConstantsAndTypes.h"
00008
#include "Profile.h"
00009
00010
class Song;
00011
class Style;
00012
00013 class ProfileManager
00014 {
00015
public:
00016
ProfileManager();
00017
~ProfileManager();
00018
00019
void Init();
00020
00021
bool CreateLocalProfile(
CString sName );
00022
bool RenameLocalProfile(
CString sProfileID,
CString sNewName );
00023
bool DeleteLocalProfile(
CString sProfileID );
00024
00025
void GetLocalProfileIDs( vector<CString> &asProfileIDsOut )
const;
00026
void GetLocalProfileNames( vector<CString> &asNamesOut )
const;
00027
00028
bool LoadFirstAvailableProfile(
PlayerNumber pn );
00029
bool LoadLocalProfileFromMachine(
PlayerNumber pn );
00030
bool LoadProfileFromMemoryCard(
PlayerNumber pn );
00031
void SaveAllProfiles()
const;
00032
bool SaveProfile(
PlayerNumber pn )
const;
00033
void UnloadProfile(
PlayerNumber pn );
00034
00035
00036
00037
00038
void IncrementToastiesCount(
PlayerNumber pn );
00039
void AddStepTotals(
PlayerNumber pn,
int iNumTapsAndHolds,
int iNumJumps,
int iNumHolds,
int iNumMines,
int iNumHands );
00040
00041
00042
00043
00044
00045
void LoadMachineProfile();
00046
void SaveMachineProfile()
const;
00047
00048 bool IsUsingProfile( PlayerNumber pn )
const {
return !
m_sProfileDir[pn].empty(); }
00049
bool IsUsingProfile( ProfileSlot slot )
const;
00050
const Profile* GetProfile( PlayerNumber pn )
const;
00051 Profile* GetProfile( PlayerNumber pn ) {
return (
Profile*) ((
const ProfileManager *)
this)->GetProfile(pn); }
00052
const Profile* GetProfile( ProfileSlot slot )
const;
00053 Profile* GetProfile( ProfileSlot slot ) {
return (
Profile*) ((
const ProfileManager *)
this)->GetProfile(slot); }
00054
CString GetProfileDir( ProfileSlot slot )
const;
00055
00056 Profile*
GetMachineProfile() {
return &
m_MachineProfile; }
00057
00058
CString GetPlayerName( PlayerNumber pn )
const;
00059
bool ProfileWasLoadedFromMemoryCard( PlayerNumber pn )
const;
00060
bool LastLoadWasTamperedOrCorrupt( PlayerNumber pn )
const;
00061
bool LastLoadWasFromLastGood( PlayerNumber pn )
const;
00062
00063
00064
00065
00066
00067
int GetSongNumTimesPlayed(
const Song* pSong, ProfileSlot card )
const;
00068 bool IsSongNew(
const Song* pSong )
const {
return GetSongNumTimesPlayed(pSong,
PROFILE_SLOT_MACHINE)==0; }
00069
void AddStepsScore(
const Song* pSong,
const Steps* pSteps, PlayerNumber pn,
HighScore hs,
int &iPersonalIndexOut,
int &iMachineIndexOut );
00070
void IncrementStepsPlayCount(
const Song* pSong,
const Steps* pSteps, PlayerNumber pn );
00071
HighScore GetHighScoreForDifficulty(
const Song *s,
const Style *st, ProfileSlot slot, Difficulty dc )
const;
00072
00073
00074
00075
00076
void AddCourseScore(
const Course* pCourse,
const Trail* pTrail, PlayerNumber pn,
HighScore hs,
int &iPersonalIndexOut,
int &iMachineIndexOut );
00077
void IncrementCoursePlayCount(
const Course* pCourse,
const Trail* pTrail, PlayerNumber pn );
00078
00079
00080
00081
00082
void AddCategoryScore( StepsType st, RankingCategory rc, PlayerNumber pn,
HighScore hs,
int &iPersonalIndexOut,
int &iMachineIndexOut );
00083
void IncrementCategoryPlayCount( StepsType st, RankingCategory rc, PlayerNumber pn );
00084
00085
00086
00087
private:
00088
bool LoadProfile( PlayerNumber pn, CString sProfileDir,
bool bIsMemCard );
00089
00090
00091
00092 CString m_sProfileDir[
NUM_PLAYERS];
00093
00094 bool m_bWasLoadedFromMemoryCard[
NUM_PLAYERS];
00095 bool m_bLastLoadWasTamperedOrCorrupt[
NUM_PLAYERS];
00096 bool m_bLastLoadWasFromLastGood[
NUM_PLAYERS];
00097
00098
00099 Profile m_Profile[
NUM_PLAYERS];
00100
00101 Profile m_MachineProfile;
00102
00103 };
00104
00105
00106 extern ProfileManager*
PROFILEMAN;
00107
00108
#endif
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133