00001
00002
00003
#ifndef UNLOCK_SYSTEM_H
00004
#define UNLOCK_SYSTEM_H
00005
00006
#include "Grade.h"
00007
#include <set>
00008
00009
class Song;
00010
class Profile;
00011
00012 enum UnlockType
00013 {
00014
UNLOCK_ARCADE_POINTS,
00015
UNLOCK_DANCE_POINTS,
00016
UNLOCK_SONG_POINTS,
00017
UNLOCK_EXTRA_CLEARED,
00018
UNLOCK_EXTRA_FAILED,
00019
UNLOCK_TOASTY,
00020
UNLOCK_CLEARED,
00021
NUM_UNLOCK_TYPES,
00022
UNLOCK_INVALID,
00023 };
00024
00025 struct UnlockEntry
00026 {
00027
UnlockEntry();
00028
00029 CString m_sSongName;
00030
00031
00032
00033 Song *
m_pSong;
00034 Course *
m_pCourse;
00035
00036 float m_fRequired[
NUM_UNLOCK_TYPES];
00037 int m_iCode;
00038
00039 bool IsCourse()
const {
return m_pCourse != NULL; }
00040
00041
bool IsLocked() const;
00042 };
00043
00044 class
UnlockSystem
00045 {
00046
friend struct UnlockEntry;
00047
00048
public:
00049 UnlockSystem();
00050
00051
00052
float PointsUntilNextUnlock(
UnlockType t )
const;
00053 float ArcadePointsUntilNextUnlock()
const {
return PointsUntilNextUnlock(
UNLOCK_ARCADE_POINTS); }
00054 float DancePointsUntilNextUnlock()
const {
return PointsUntilNextUnlock(
UNLOCK_DANCE_POINTS); }
00055 float SongPointsUntilNextUnlock()
const {
return PointsUntilNextUnlock(
UNLOCK_SONG_POINTS); }
00056
00057
00058
bool SongIsLocked(
const Song *song )
const;
00059
bool SongIsRouletteOnly(
const Song *song )
const;
00060
bool CourseIsLocked(
const Course *course )
const;
00061
00062
00063
int GetNumUnlocks() const;
00064
00065 const
UnlockEntry *FindLockEntry( CString lockname ) const;
00066
00067
void GetPoints( const
Profile *pProfile,
float fScores[NUM_UNLOCK_TYPES] ) const;
00068
00069
void UnlockCode(
int num );
00070
00071
00072
void UnlockSong( const
Song *song );
00073
00074
00075 vector<
UnlockEntry> m_SongEntries;
00076
00077
00078
void UpdateSongs();
00079
00080 private:
00081
00082
bool Load();
00083
00084 const
UnlockEntry *FindSong( const
Song *pSong ) const;
00085 const
UnlockEntry *FindCourse( const
Course *pCourse ) const;
00086
00087 set<
int> m_RouletteCodes;
00088 };
00089
00090 extern UnlockSystem* UNLOCKMAN;
00091
00092 #endif
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117