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
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
enum UnlockTypes { UNLOCK_AP, UNLOCK_DP, UNLOCK_SP,
|
|
|
|
|
UNLOCK_EC, UNLOCK_EF, UNLOCK_SC,
|
|
|
|
|
UNLOCK_TT, UNLOCK_RO};
|
|
|
|
|
|
2003-07-09 04:46:24 +00:00
|
|
|
class Song;
|
|
|
|
|
|
2003-07-09 03:10:01 +00:00
|
|
|
struct SongEntry
|
|
|
|
|
{
|
|
|
|
|
CString m_sSongName; /* Name of the song in the DWI/SM file itself.. This allows
|
|
|
|
|
for a lot easier compatibility since a lot of people's
|
|
|
|
|
song folders are named differantly, song names tend to
|
|
|
|
|
be the same in the file.*/
|
|
|
|
|
|
2003-07-16 12:58:02 +00:00
|
|
|
Song* ActualSong; // pointer to actual song
|
|
|
|
|
|
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-10 14:44:13 +00:00
|
|
|
bool isCourse; // used for unlock screen
|
2003-07-09 03:10:01 +00:00
|
|
|
|
|
|
|
|
SongEntry();
|
|
|
|
|
|
|
|
|
|
// if song is selectable vai two means
|
|
|
|
|
bool SelectableWheel();
|
|
|
|
|
bool SelectableRoulette();
|
|
|
|
|
|
|
|
|
|
bool updateLocked(); //updates isLocked flag
|
2003-07-09 05:01:37 +00:00
|
|
|
Song *GetSong() const;
|
2003-07-09 03:10:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class UnlockSystem
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
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-10 14:44:13 +00:00
|
|
|
SongEntry *FindSong( CString songname );
|
2003-07-15 08:00:59 +00:00
|
|
|
// retrieves a corresponding SongEntry, or NULL if none exists
|
2003-07-10 14:44:13 +00:00
|
|
|
|
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 );
|
|
|
|
|
// used on select screens
|
2003-07-10 11:24:16 +00:00
|
|
|
|
2003-07-15 08:00:59 +00:00
|
|
|
bool LoadFromDATFile( CString sPath );
|
|
|
|
|
// executed when program is first executed
|
|
|
|
|
|
|
|
|
|
vector<SongEntry> m_SongEntries;
|
|
|
|
|
// All locked songs are stored here
|
2003-07-09 03:10:01 +00:00
|
|
|
|
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-15 08:00:59 +00:00
|
|
|
bool RouletteUnlock( const Song *song );
|
|
|
|
|
// 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);
|
|
|
|
|
|
|
|
|
|
// unlock values, cached
|
|
|
|
|
float ArcadePoints;
|
|
|
|
|
float DancePoints;
|
|
|
|
|
float SongPoints;
|
|
|
|
|
float ExtraClearPoints;
|
|
|
|
|
float ExtraFailPoints;
|
|
|
|
|
float ToastyPoints;
|
|
|
|
|
float StagesCleared;
|
|
|
|
|
CString RouletteSeeds;
|
2003-07-10 14:44:13 +00:00
|
|
|
|
2003-07-09 03:10:01 +00:00
|
|
|
private:
|
|
|
|
|
void SortSongEntriesArray(); // sorts unlocks
|
2003-07-09 05:01:37 +00:00
|
|
|
SongEntry *FindSong( const Song *pSong );
|
2003-07-10 11:24:16 +00:00
|
|
|
SongEntry *FindCourse( const Course *pCourse );
|
2003-07-15 08:00:59 +00:00
|
|
|
|
|
|
|
|
void InitRouletteSeeds(int MaxRouletteSlot);
|
|
|
|
|
// makes RouletteSeeds more efficient
|
2003-07-09 03:10:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|