#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" #include "GameConstantsAndTypes.h" #include "Style.h" struct Profile { Profile() { Init(); } void Init() { m_sName = ""; m_sLastUsedHighScoreName = ""; m_bUsingProfileDefaultModifiers = false; m_sDefaultModifiers = ""; m_iTotalPlays = 0; m_iTotalPlaySeconds = 0; m_iTotalGameplaySeconds = 0; m_iCurrentCombo = 0; m_fWeightPounds = 0; m_fCaloriesBurned = 0; int i; for( i=0; i &asProfileIDsOut ); void GetLocalProfileNames( vector &asNamesOut ); bool LoadProfileFromMemoryCard( PlayerNumber pn ); bool LoadFirstAvailableProfile( PlayerNumber pn ); // memory card or local profile bool SaveProfile( PlayerNumber pn ); void UnloadProfile( PlayerNumber pn ); void SaveMachineProfile(); bool IsUsingProfile( PlayerNumber pn ) { return !m_sProfileDir[pn].empty(); } Profile* GetProfile( PlayerNumber pn ); Profile* GetMachineProfile() { return &m_MachineProfile; } CString GetPlayerName( PlayerNumber pn ); bool ProfileWasLoadedFromMemoryCard( PlayerNumber pn ); // // High scores // void InitMachineScoresFromDisk(); void SaveMachineScoresToDisk(); struct CategoryData { struct HighScore { CString sName; int iScore; float fPercentDP; HighScore() { iScore = 0; fPercentDP = 0; } bool operator>=( const HighScore& other ) const; }; vector vHighScores; void AddHighScore( HighScore hs, int &iIndexOut ); } m_CategoryDatas[NUM_MEMORY_CARDS][NUM_STEPS_TYPES][NUM_RANKING_CATEGORIES]; void AddHighScore( StepsType nt, RankingCategory rc, PlayerNumber pn, CategoryData::HighScore hs, int &iPersonalIndexOut, int &iMachineIndexOut ) { hs.sName = RANKING_TO_FILL_IN_MARKER[pn]; m_CategoryDatas[pn][nt][rc].AddHighScore( hs, iPersonalIndexOut ); m_CategoryDatas[MEMORY_CARD_MACHINE][nt][rc].AddHighScore( hs, iMachineIndexOut ); } void ReadSM300NoteScores(); void ReadSongScoresFromDir( CString sDir, MemoryCard mc ); void ReadCourseScoresFromDir( CString sDir, MemoryCard mc ); void ReadCategoryScoresFromDir( CString sDir, MemoryCard mc ); void SaveSongScoresToDir( CString sDir, MemoryCard mc ); void SaveCourseScoresToDir( CString sDir, MemoryCard mc ); void SaveCategoryScoresToDir( CString sDir, MemoryCard mc ); void SaveStatsWebPageToDir( CString sDir, MemoryCard mc ); private: bool LoadDefaultProfileFromMachine( PlayerNumber pn ); bool CreateMemoryCardProfile( PlayerNumber pn ); bool LoadProfile( PlayerNumber pn, CString sProfileDir, bool bIsMemCard ); bool CreateProfile( CString sProfileDir, CString sName ); // Directory that contains the profile. Either on local machine or // on a memory card. CString m_sProfileDir[NUM_PLAYERS]; bool m_bWasLoadedFromMemoryCard[NUM_PLAYERS]; // actual loaded profile data Profile m_Profile[NUM_PLAYERS]; Profile m_MachineProfile; }; extern ProfileManager* PROFILEMAN; // global and accessable from anywhere in our program #endif