2003-07-09 03:10:01 +00:00
|
|
|
#ifndef UNLOCK_SYSTEM_H
|
|
|
|
|
#define UNLOCK_SYSTEM_H
|
|
|
|
|
|
|
|
|
|
#include "Grade.h"
|
|
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: UnlockSystem
|
|
|
|
|
|
|
|
|
|
Desc: The unlock system for Stepmania.
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved.
|
|
|
|
|
Kevin Slaughter
|
2003-07-10 07:22:31 +00:00
|
|
|
Andrew Wong
|
2003-07-09 03:10:01 +00:00
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
2003-07-09 04:46:24 +00:00
|
|
|
class Song;
|
|
|
|
|
|
2003-08-11 20:57:57 +00:00
|
|
|
struct UnlockEntry
|
2003-07-09 03:10:01 +00:00
|
|
|
{
|
2003-08-11 20:57:57 +00:00
|
|
|
UnlockEntry();
|
2003-07-18 07:34:43 +00:00
|
|
|
|
2003-07-18 06:38:05 +00:00
|
|
|
CString m_sSongName;
|
2003-07-09 03:10:01 +00:00
|
|
|
|
2003-07-18 06:38:05 +00:00
|
|
|
/* A cached pointer to the song or course this entry refers to. Only one of
|
|
|
|
|
* these will be non-NULL. */
|
|
|
|
|
Song *m_pSong;
|
|
|
|
|
Course *m_pCourse;
|
2003-07-16 12:58:02 +00:00
|
|
|
|
2003-07-09 03:10:01 +00:00
|
|
|
float m_fDancePointsRequired; // Ways to unlock/lock songs.
|
|
|
|
|
float m_fArcadePointsRequired;
|
|
|
|
|
float m_fSongPointsRequired;
|
|
|
|
|
float m_fExtraStagesCleared;
|
|
|
|
|
float m_fExtraStagesFailed;
|
|
|
|
|
float m_fStagesCleared;
|
|
|
|
|
float m_fToastysSeen;
|
|
|
|
|
int m_iRouletteSeed;
|
|
|
|
|
|
|
|
|
|
bool isLocked; // cached locked tag
|
2003-07-18 06:38:05 +00:00
|
|
|
bool IsCourse() const { return m_pCourse != NULL; }
|
2003-07-09 03:10:01 +00:00
|
|
|
|
|
|
|
|
// if song is selectable vai two means
|
2004-01-24 19:39:18 +00:00
|
|
|
bool SelectableWheel() const;
|
|
|
|
|
bool SelectableRoulette() const;
|
2003-07-09 03:10:01 +00:00
|
|
|
|
2003-07-18 06:38:05 +00:00
|
|
|
void UpdateLocked(); // updates isLocked
|
|
|
|
|
|
|
|
|
|
void UpdateData();
|
2003-07-09 03:10:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class UnlockSystem
|
|
|
|
|
{
|
2004-01-24 19:39:18 +00:00
|
|
|
friend struct UnlockEntry;
|
|
|
|
|
|
2003-07-09 03:10:01 +00:00
|
|
|
public:
|
2004-01-24 19:39:18 +00:00
|
|
|
/* TODO:
|
|
|
|
|
enum UnlockType
|
|
|
|
|
{
|
|
|
|
|
UNLOCK_ARCADE_POINTS,
|
|
|
|
|
UNLOCK_DANCE_POINTS,
|
|
|
|
|
UNLOCK_SONG_POINTS,
|
|
|
|
|
UNLOCK_EXTRA_CLEARED,
|
|
|
|
|
UNLOCK_EXTRA_FAILED,
|
|
|
|
|
UNLOCK_TOASTY,
|
|
|
|
|
UNLOCK_CLEARED,
|
|
|
|
|
NUM_UNLOCK_TYPES
|
|
|
|
|
};
|
|
|
|
|
*/
|
2003-07-09 03:10:01 +00:00
|
|
|
UnlockSystem();
|
2003-07-10 11:24:16 +00:00
|
|
|
|
2003-07-09 06:05:43 +00:00
|
|
|
float DancePointsUntilNextUnlock();
|
|
|
|
|
float ArcadePointsUntilNextUnlock();
|
|
|
|
|
float SongPointsUntilNextUnlock();
|
2003-07-15 08:00:59 +00:00
|
|
|
// returns # of points till next unlock - used for ScreenUnlock
|
2003-07-10 11:24:16 +00:00
|
|
|
|
2003-07-18 06:38:05 +00:00
|
|
|
// Used on select screens:
|
2003-07-09 04:46:24 +00:00
|
|
|
bool SongIsLocked( const Song *song );
|
|
|
|
|
bool SongIsRoulette( const Song *song );
|
2003-07-15 08:00:59 +00:00
|
|
|
bool CourseIsLocked( const Course *course );
|
2003-07-10 11:24:16 +00:00
|
|
|
|
2003-07-15 08:00:59 +00:00
|
|
|
// executed when program is first executed
|
2004-01-24 19:39:18 +00:00
|
|
|
bool LoadFromDATFile();
|
2003-07-09 03:10:01 +00:00
|
|
|
|
2003-07-25 00:03:05 +00:00
|
|
|
// Gets number of unlocks for title screen
|
|
|
|
|
int GetNumUnlocks() const;
|
|
|
|
|
|
2003-07-11 09:35:28 +00:00
|
|
|
// functions that add to values
|
2003-07-09 03:10:01 +00:00
|
|
|
float UnlockAddAP(Grade credit);
|
2003-07-11 09:35:28 +00:00
|
|
|
float UnlockAddAP(float credit);
|
2003-07-09 03:10:01 +00:00
|
|
|
float UnlockAddDP(float credit);
|
|
|
|
|
float UnlockAddSP(Grade credit);
|
2003-07-11 09:35:28 +00:00
|
|
|
float UnlockAddSP(float credit);
|
2003-07-09 03:10:01 +00:00
|
|
|
float UnlockClearExtraStage();
|
|
|
|
|
float UnlockFailExtraStage();
|
|
|
|
|
float UnlockClearStage();
|
|
|
|
|
float UnlockToasty();
|
|
|
|
|
|
2003-07-18 08:04:47 +00:00
|
|
|
void RouletteUnlock( const Song *song );
|
2003-07-15 08:00:59 +00:00
|
|
|
// unlocks given song in roulette
|
|
|
|
|
|
|
|
|
|
// read and write unlock in values
|
2003-07-11 09:35:28 +00:00
|
|
|
bool ReadValues( CString filename);
|
|
|
|
|
bool WriteValues( CString filename);
|
|
|
|
|
|
2003-07-18 06:38:05 +00:00
|
|
|
void UpdateSongs();
|
|
|
|
|
|
2003-08-11 20:57:57 +00:00
|
|
|
UnlockEntry *FindLockEntry( CString lockname );
|
2003-07-18 06:38:05 +00:00
|
|
|
|
2003-08-02 09:56:24 +00:00
|
|
|
// so class can access FindSong
|
|
|
|
|
friend class ScreenSelectGroup;
|
2003-07-09 03:10:01 +00:00
|
|
|
private:
|
2003-08-11 20:57:57 +00:00
|
|
|
UnlockEntry *FindSong( const Song *pSong );
|
|
|
|
|
UnlockEntry *FindCourse( const Course *pCourse );
|
2003-07-15 08:00:59 +00:00
|
|
|
|
|
|
|
|
void InitRouletteSeeds(int MaxRouletteSlot);
|
|
|
|
|
// makes RouletteSeeds more efficient
|
2004-01-24 19:39:18 +00:00
|
|
|
|
|
|
|
|
public: // XXX
|
|
|
|
|
// All locked songs are stored here
|
|
|
|
|
vector<UnlockEntry> m_SongEntries;
|
|
|
|
|
|
|
|
|
|
// float m_fScores[NUM_UNLOCK_TYPES];
|
|
|
|
|
|
|
|
|
|
// unlock values, cached
|
|
|
|
|
float ArcadePoints;
|
|
|
|
|
float DancePoints;
|
|
|
|
|
float SongPoints;
|
|
|
|
|
float ExtraClearPoints;
|
|
|
|
|
float ExtraFailPoints;
|
|
|
|
|
float ToastyPoints;
|
|
|
|
|
float StagesCleared;
|
|
|
|
|
CString RouletteSeeds;
|
2003-07-09 03:10:01 +00:00
|
|
|
};
|
|
|
|
|
|
2003-09-19 07:02:53 +00:00
|
|
|
extern UnlockSystem* UNLOCKSYS; // global and accessable from anywhere in program
|
2003-07-09 03:10:01 +00:00
|
|
|
|
|
|
|
|
#endif
|