updated support for course unlocking (very basic)
This commit is contained in:
@@ -552,6 +552,11 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
|
||||
{
|
||||
Course* pCourse = apCourses[c];
|
||||
|
||||
// if unlocks are on, make sure it is unlocked
|
||||
if ( PREFSMAN->m_bUseUnlockSystem)
|
||||
if ( GAMESTATE->m_pUnlockingSys->CourseIsLocked( pCourse) )
|
||||
continue;
|
||||
|
||||
// check that this course has at least one song playable in the current style
|
||||
if( pCourse->IsPlayableIn(GAMESTATE->GetCurrentStyleDef()->m_NotesType) )
|
||||
arrayWheelItemDatas.push_back( WheelItemData(TYPE_COURSE, NULL, "", pCourse, pCourse->GetColor(), SORT_INVALID) );
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "PrefsManager.h"
|
||||
#include "RageLog.h"
|
||||
#include "song.h"
|
||||
#include "course.h"
|
||||
#include "RageException.h"
|
||||
#include "RageUtil.h"
|
||||
#include "UnlockSystem.h"
|
||||
@@ -39,7 +40,25 @@ bool UnlockSystem::RouletteUnlock( const Song *song )
|
||||
return true;
|
||||
}
|
||||
|
||||
bool UnlockSystem::CourseIsLocked( const Course *course )
|
||||
{
|
||||
// I know, its not a song, but for purposes of title
|
||||
// comparison, its the same thing.
|
||||
SongEntry *p = FindCourse( course );
|
||||
|
||||
CString tmp;
|
||||
|
||||
if (p)
|
||||
{
|
||||
p->updateLocked();
|
||||
|
||||
if (!p->isLocked) tmp = "un";
|
||||
LOG->Trace( "current status: %slocked", tmp.c_str() );
|
||||
}
|
||||
|
||||
return (p != NULL) && (p->isLocked);
|
||||
|
||||
}
|
||||
|
||||
bool UnlockSystem::SongIsLocked( const Song *song )
|
||||
{
|
||||
@@ -72,6 +91,22 @@ bool UnlockSystem::SongIsRoulette( const Song *song )
|
||||
return p && (p->m_iRouletteSeed != 0) ;
|
||||
}
|
||||
|
||||
SongEntry *UnlockSystem::FindCourse( const Course *pCourse )
|
||||
{
|
||||
CString CourseName = pCourse->m_sName;
|
||||
|
||||
CourseName.MakeUpper();
|
||||
|
||||
for(unsigned i = 0; i < m_SongEntries.size(); i++)
|
||||
{
|
||||
if( CourseName == m_SongEntries[i].m_sSongName )
|
||||
return &m_SongEntries[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SongEntry *UnlockSystem::FindSong( const Song *pSong )
|
||||
{
|
||||
/* Manual binary searches are a bad idea; they're insanely easy to get
|
||||
@@ -396,7 +431,4 @@ void UnlockSystem::InitRouletteSeeds(int MaxRouletteSlot)
|
||||
seeds += "0";
|
||||
|
||||
PREFSMAN->m_RouletteSeeds = seeds;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -51,12 +51,17 @@ class UnlockSystem
|
||||
{
|
||||
public:
|
||||
UnlockSystem();
|
||||
|
||||
float DancePointsUntilNextUnlock();
|
||||
float ArcadePointsUntilNextUnlock();
|
||||
float SongPointsUntilNextUnlock();
|
||||
|
||||
bool SongIsLocked( const Song *song );
|
||||
bool CourseIsLocked( const Course *course );
|
||||
|
||||
bool SongIsRoulette( const Song *song );
|
||||
bool LoadFromDATFile( CString sPath );
|
||||
|
||||
vector<SongEntry> m_SongEntries; // All locked songs are stored here
|
||||
|
||||
// functions that add to values, which don't really work.
|
||||
@@ -75,6 +80,7 @@ private:
|
||||
void SortSongEntriesArray(); // sorts unlocks
|
||||
bool ParseRow(CString text, CString &type, float &qty, CString &songname);
|
||||
SongEntry *FindSong( const Song *pSong );
|
||||
SongEntry *FindCourse( const Course *pCourse );
|
||||
void InitRouletteSeeds(int MaxRouletteSlot);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user