Files
itgmania212121/stepmania/src/UnlockSystem.h
T

138 lines
3.1 KiB
C++
Raw Normal View History

#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
Andrew Wong
-----------------------------------------------------------------------------
*/
2003-07-09 04:46:24 +00:00
class Song;
2003-08-11 20:57:57 +00:00
struct UnlockEntry
{
2003-08-11 20:57:57 +00:00
UnlockEntry();
2003-07-18 06:38:05 +00:00
CString m_sSongName;
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
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; }
// if song is selectable vai two means
bool SelectableWheel() const;
bool SelectableRoulette() const;
2003-07-18 06:38:05 +00:00
void UpdateLocked(); // updates isLocked
void UpdateData();
};
class UnlockSystem
{
friend struct UnlockEntry;
public:
/* 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
};
*/
UnlockSystem();
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-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-15 08:00:59 +00:00
// executed when program is first executed
bool LoadFromDATFile();
// Gets number of unlocks for title screen
int GetNumUnlocks() const;
// functions that add to values
float UnlockAddAP(Grade credit);
float UnlockAddAP(float credit);
float UnlockAddDP(float credit);
float UnlockAddSP(Grade credit);
float UnlockAddSP(float credit);
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
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
// so class can access FindSong
friend class ScreenSelectGroup;
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
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-09-19 07:02:53 +00:00
extern UnlockSystem* UNLOCKSYS; // global and accessable from anywhere in program
#endif