updated course unlocking to take transliterated (non-translated) titles

redid code for unlock screen so courses and songs are displayed
This commit is contained in:
Andrew Wong
2003-07-10 14:44:13 +00:00
parent a49208c5fb
commit 721df8ea02
5 changed files with 37 additions and 9 deletions
+3 -1
View File
@@ -121,8 +121,10 @@ void Course::LoadFromCRSFile( CString sPath )
// handle the data // handle the data
if( 0 == stricmp(sValueName, "COURSE") ) if( 0 == stricmp(sValueName, "COURSE") )
{
m_sName = sParams[1]; m_sName = sParams[1];
m_sTranslitName = m_sName;
}
else if( 0 == stricmp(sValueName, "REPEAT") ) else if( 0 == stricmp(sValueName, "REPEAT") )
{ {
CString str = sParams[1]; CString str = sParams[1];
+1
View File
@@ -47,6 +47,7 @@ public:
bool m_bIsAutogen; // was this created by AutoGen? bool m_bIsAutogen; // was this created by AutoGen?
CString m_sPath; CString m_sPath;
CString m_sName; CString m_sName;
CString m_sTranslitName; // used for unlocks
bool HasBanner() const; bool HasBanner() const;
+11 -4
View File
@@ -36,19 +36,26 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
for(int i=1; i <= THEME->GetMetricI("ScreenUnlock", "NumUnlocks"); i++) for(int i=1; i <= THEME->GetMetricI("ScreenUnlock", "NumUnlocks"); i++)
{ {
// new unlock graphic // new unlock graphic
Unlocks[i].Load( THEME->GetPathToG(ssprintf("ScreenUnlock icon %d", i)) ); Unlocks[i].Load( THEME->GetPathToG(ssprintf("ScreenUnlock %d icon", i)) );
// set graphic location
Unlocks[i].SetName( ssprintf("Unlock%d",i) ); Unlocks[i].SetName( ssprintf("Unlock%d",i) );
SET_XY( Unlocks[i] ); SET_XY( Unlocks[i] );
Song *pSong = SONGMAN->FindSong("", THEME->GetMetric("ScreenUnlock", ssprintf("Unlock%dSong", i)) ); // get pertaining songentry
SongEntry *pSong = GAMESTATE->m_pUnlockingSys->FindSong(
THEME->GetMetric("ScreenUnlock",
ssprintf("Unlock%dSong", i)) );
LOG->Trace("UnlockScreen: Searching for %s", THEME->GetMetric("ScreenUnlock",
ssprintf("Unlock%dSong", i)).c_str() );
if( pSong == NULL) if( pSong == NULL)
continue; continue;
Unlocks[i].Command(IconCommand); Unlocks[i].Command(IconCommand);
const bool SongIsLocked = GAMESTATE->m_pUnlockingSys->SongIsLocked( pSong ); if ( !pSong->isLocked )
if ( !SongIsLocked )
this->AddChild(&Unlocks[i]); this->AddChild(&Unlocks[i]);
} }
+14 -2
View File
@@ -50,6 +50,7 @@ bool UnlockSystem::CourseIsLocked( const Course *course )
if (p) if (p)
{ {
p->isCourse = true; // updates flag here
p->updateLocked(); p->updateLocked();
if (!p->isLocked) tmp = "un"; if (!p->isLocked) tmp = "un";
@@ -91,14 +92,25 @@ bool UnlockSystem::SongIsRoulette( const Song *song )
return p && (p->m_iRouletteSeed != 0) ; return p && (p->m_iRouletteSeed != 0) ;
} }
SongEntry *UnlockSystem::FindSong( CString songname )
{
songname.MakeUpper();
for(int i = 0; i < m_SongEntries.size(); i++)
if (songname == m_SongEntries[i].m_sSongName)
return &m_SongEntries[i];
return NULL;
}
SongEntry *UnlockSystem::FindCourse( const Course *pCourse ) SongEntry *UnlockSystem::FindCourse( const Course *pCourse )
{ {
CString CourseName = pCourse->m_sName; CString CourseName = pCourse->m_sTranslitName;
CourseName.MakeUpper(); CourseName.MakeUpper();
for(unsigned i = 0; i < m_SongEntries.size(); i++) for(unsigned i = 0; i < m_SongEntries.size(); i++)
{ {
if( CourseName == m_SongEntries[i].m_sSongName ) if( CourseName == m_SongEntries[i].m_sSongName )
return &m_SongEntries[i]; return &m_SongEntries[i];
} }
@@ -106,7 +118,6 @@ SongEntry *UnlockSystem::FindCourse( const Course *pCourse )
return NULL; return NULL;
} }
SongEntry *UnlockSystem::FindSong( const Song *pSong ) SongEntry *UnlockSystem::FindSong( const Song *pSong )
{ {
/* Manual binary searches are a bad idea; they're insanely easy to get /* Manual binary searches are a bad idea; they're insanely easy to get
@@ -165,6 +176,7 @@ SongEntry::SongEntry()
m_iRouletteSeed = 0; m_iRouletteSeed = 0;
isLocked = true; isLocked = true;
isCourse = false;
} }
+6
View File
@@ -36,6 +36,7 @@ struct SongEntry
int m_iRouletteSeed; int m_iRouletteSeed;
bool isLocked; // cached locked tag bool isLocked; // cached locked tag
bool isCourse; // used for unlock screen
SongEntry(); SongEntry();
@@ -56,6 +57,9 @@ public:
float ArcadePointsUntilNextUnlock(); float ArcadePointsUntilNextUnlock();
float SongPointsUntilNextUnlock(); float SongPointsUntilNextUnlock();
SongEntry *FindSong( CString songname );
// used for screen unlock
bool SongIsLocked( const Song *song ); bool SongIsLocked( const Song *song );
bool CourseIsLocked( const Course *course ); bool CourseIsLocked( const Course *course );
@@ -74,6 +78,8 @@ public:
float UnlockToasty(); float UnlockToasty();
bool RouletteUnlock( const Song *song ); bool RouletteUnlock( const Song *song );
void DebugPrint(); void DebugPrint();
private: private: