implemented unlock by roulette method [RO] (not ragnarok online, silly)
This commit is contained in:
@@ -314,9 +314,8 @@ void MusicWheel::GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CStrin
|
|||||||
/* Hide songs that asked to be hidden via #SELECTABLE. */
|
/* Hide songs that asked to be hidden via #SELECTABLE. */
|
||||||
if( so!=SORT_ROULETTE && !pSong->NormallyDisplayed() )
|
if( so!=SORT_ROULETTE && !pSong->NormallyDisplayed() )
|
||||||
continue;
|
continue;
|
||||||
if( so==SORT_ROULETTE && !pSong->RouletteDisplayed() )
|
if( so==SORT_ROULETTE && !(pSong->RouletteDisplayed()
|
||||||
continue;
|
|| GAMESTATE->m_pUnlockingSys->SongIsRoulette( pSong )) )
|
||||||
if( so==SORT_ROULETTE && GAMESTATE->m_pUnlockingSys->SongIsRoulette( pSong ) )
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,7 +325,7 @@ void MusicWheel::GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CStrin
|
|||||||
if( !arraySteps.empty() )
|
if( !arraySteps.empty() )
|
||||||
{
|
{
|
||||||
// If we're using unlocks, check it here to prevent from being shown
|
// If we're using unlocks, check it here to prevent from being shown
|
||||||
if( PREFSMAN->m_bUseUnlockSystem )
|
if( PREFSMAN->m_bUseUnlockSystem && so!=SORT_ROULETTE )
|
||||||
{
|
{
|
||||||
pSong->m_bIsLocked = GAMESTATE->m_pUnlockingSys->SongIsLocked( pSong );
|
pSong->m_bIsLocked = GAMESTATE->m_pUnlockingSys->SongIsLocked( pSong );
|
||||||
if( pSong->m_bIsLocked ) { continue; }
|
if( pSong->m_bIsLocked ) { continue; }
|
||||||
@@ -1116,6 +1115,9 @@ bool MusicWheel::Select() // return true if this selection ends the screen
|
|||||||
StartRandom();
|
StartRandom();
|
||||||
return false;
|
return false;
|
||||||
case TYPE_SONG:
|
case TYPE_SONG:
|
||||||
|
if (PREFSMAN->m_bUseUnlockSystem)
|
||||||
|
GAMESTATE->m_pUnlockingSys->RouletteUnlock( m_CurWheelItemData[m_iSelection]->m_pSong );
|
||||||
|
// fall-through - we want to check for unlocking only if its a song
|
||||||
case TYPE_COURSE:
|
case TYPE_COURSE:
|
||||||
return true;
|
return true;
|
||||||
case TYPE_SORT:
|
case TYPE_SORT:
|
||||||
|
|||||||
@@ -28,17 +28,48 @@ UnlockSystem::UnlockSystem()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool UnlockSystem::RouletteUnlock( const Song *song )
|
||||||
|
{
|
||||||
|
SongEntry *p = FindSong( song );
|
||||||
|
if (p->m_iRouletteSeed == 0) return false; // already unlocked
|
||||||
|
|
||||||
|
PREFSMAN->m_RouletteSeeds[p->m_iRouletteSeed] = '1';
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool UnlockSystem::SongIsLocked( const Song *song )
|
bool UnlockSystem::SongIsLocked( const Song *song )
|
||||||
{
|
{
|
||||||
SongEntry *p = FindSong( song );
|
SongEntry *p = FindSong( song );
|
||||||
|
|
||||||
|
CString tmp;
|
||||||
|
|
||||||
|
if (p)
|
||||||
|
{
|
||||||
|
p->updateLocked();
|
||||||
|
|
||||||
|
if (!p->isLocked) tmp = "un";
|
||||||
|
|
||||||
|
LOG->Trace( "UnlockSystem entry: %s", (p->m_sSongName).c_str() );
|
||||||
|
LOG->Trace( "current status: %slocked", tmp.c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
return p && p->isLocked;
|
return p && p->isLocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UnlockSystem::SongIsRoulette( const Song *song )
|
bool UnlockSystem::SongIsRoulette( const Song *song )
|
||||||
{
|
{
|
||||||
SongEntry *p = FindSong( song );
|
SongEntry *p = FindSong( song );
|
||||||
return p && p->m_iRouletteSeed != 0;
|
|
||||||
|
CString item;
|
||||||
|
|
||||||
|
if (p && (p->m_iRouletteSeed != 0))
|
||||||
|
LOG->Trace("Item %s is roulettable.");
|
||||||
|
else
|
||||||
|
LOG->Trace("Item %s is not roulettable.");
|
||||||
|
|
||||||
|
return p && (p->m_iRouletteSeed != 0) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
SongEntry *UnlockSystem::FindSong( const Song *pSong )
|
SongEntry *UnlockSystem::FindSong( const Song *pSong )
|
||||||
@@ -116,7 +147,7 @@ bool UnlockSystem::ParseRow(CString text, CString &type, float &qty,
|
|||||||
|
|
||||||
bool SongEntry::updateLocked()
|
bool SongEntry::updateLocked()
|
||||||
{
|
{
|
||||||
if (!isLocked) return true; // if its already true
|
if (!(isLocked)) return true; // if its already true
|
||||||
|
|
||||||
if (m_fArcadePointsRequired != 0)
|
if (m_fArcadePointsRequired != 0)
|
||||||
isLocked = (PREFSMAN->m_fArcadePointsAccumulated < m_fArcadePointsRequired);
|
isLocked = (PREFSMAN->m_fArcadePointsAccumulated < m_fArcadePointsRequired);
|
||||||
@@ -140,7 +171,18 @@ bool SongEntry::updateLocked()
|
|||||||
isLocked = (PREFSMAN->m_fTotalToastysSeen < m_fToastysSeen);
|
isLocked = (PREFSMAN->m_fTotalToastysSeen < m_fToastysSeen);
|
||||||
|
|
||||||
if (m_iRouletteSeed != 0)
|
if (m_iRouletteSeed != 0)
|
||||||
isLocked = (PREFSMAN->m_RouletteSeeds[m_iRouletteSeed] == '0');
|
{
|
||||||
|
CString tmp = PREFSMAN->m_RouletteSeeds;
|
||||||
|
|
||||||
|
LOG->Trace("Seed in question: %d Roulette seeds: %s",
|
||||||
|
m_iRouletteSeed, tmp.c_str() );
|
||||||
|
isLocked = (tmp[m_iRouletteSeed] != '1');
|
||||||
|
|
||||||
|
if (isLocked)
|
||||||
|
LOG->Trace("Song is currently LOCKED");
|
||||||
|
else
|
||||||
|
LOG->Trace("Song is currently UNLOCKED");
|
||||||
|
}
|
||||||
|
|
||||||
return !isLocked;
|
return !isLocked;
|
||||||
}
|
}
|
||||||
@@ -216,7 +258,7 @@ bool UnlockSystem::LoadFromDATFile( CString sPath )
|
|||||||
if (unlock_type == "RO")
|
if (unlock_type == "RO")
|
||||||
{
|
{
|
||||||
current.m_iRouletteSeed = (int)datavalue;
|
current.m_iRouletteSeed = (int)datavalue;
|
||||||
current.isLocked = (PREFSMAN->m_fArcadePointsAccumulated < datavalue);
|
current.isLocked = ((PREFSMAN->m_RouletteSeeds)[(int)datavalue] != '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
m_SongEntries.push_back(current);
|
m_SongEntries.push_back(current);
|
||||||
@@ -225,9 +267,12 @@ bool UnlockSystem::LoadFromDATFile( CString sPath )
|
|||||||
sort( m_SongEntries.begin(), m_SongEntries.end(), CompareSongEntries );
|
sort( m_SongEntries.begin(), m_SongEntries.end(), CompareSongEntries );
|
||||||
|
|
||||||
for(unsigned i=0; i < m_SongEntries.size(); i++)
|
for(unsigned i=0; i < m_SongEntries.size(); i++)
|
||||||
|
{
|
||||||
|
CString tmp = " ";
|
||||||
|
if (!m_SongEntries[i].isLocked) tmp = "un";
|
||||||
LOG->Trace( "UnlockSystem entry: %s", m_SongEntries[i].m_sSongName.c_str() );
|
LOG->Trace( "UnlockSystem entry: %s", m_SongEntries[i].m_sSongName.c_str() );
|
||||||
|
LOG->Trace( "Initial status:%slocked", tmp.c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
float UnlockFailExtraStage();
|
float UnlockFailExtraStage();
|
||||||
float UnlockClearStage();
|
float UnlockClearStage();
|
||||||
float UnlockToasty();
|
float UnlockToasty();
|
||||||
bool UnlockRouletteSeed(int seed);
|
bool RouletteUnlock( const Song *song );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SortSongEntriesArray(); // sorts unlocks
|
void SortSongEntriesArray(); // sorts unlocks
|
||||||
|
|||||||
Reference in New Issue
Block a user