oops, forgot to commit:

replace GAMESTATE->m_pUnlockingSys with UNLOCKSYS
This commit is contained in:
Andrew Wong
2003-09-19 07:02:53 +00:00
parent 79c2560527
commit 54e490fd20
11 changed files with 46 additions and 46 deletions
+4 -4
View File
@@ -335,12 +335,12 @@ void MusicWheel::GetSongList(vector<Song*> &arraySongs, SongSortOrder so, CStrin
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()
|| GAMESTATE->m_pUnlockingSys->SongIsRoulette( pSong )) ) || UNLOCKSYS->SongIsRoulette( pSong )) )
continue; continue;
} }
// 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( so!=SORT_ROULETTE && GAMESTATE->m_pUnlockingSys->SongIsLocked(pSong) ) if( so!=SORT_ROULETTE && UNLOCKSYS->SongIsLocked(pSong) )
continue; continue;
vector<Steps*> arraySteps; vector<Steps*> arraySteps;
@@ -625,7 +625,7 @@ void MusicWheel::BuildWheelItemDatas( vector<WheelItemData> &arrayWheelItemDatas
Course* pCourse = apCourses[c]; Course* pCourse = apCourses[c];
// if unlocks are on, make sure it is unlocked // if unlocks are on, make sure it is unlocked
if ( GAMESTATE->m_pUnlockingSys->CourseIsLocked(pCourse) ) if ( UNLOCKSYS->CourseIsLocked(pCourse) )
continue; continue;
CString sThisSection = ""; CString sThisSection = "";
@@ -1203,7 +1203,7 @@ bool MusicWheel::Select() // return true if this selection ends the screen
return false; return false;
case TYPE_SONG: case TYPE_SONG:
if (PREFSMAN->m_bUseUnlockSystem) if (PREFSMAN->m_bUseUnlockSystem)
GAMESTATE->m_pUnlockingSys->RouletteUnlock( m_CurWheelItemData[m_iSelection]->m_pSong ); UNLOCKSYS->RouletteUnlock( m_CurWheelItemData[m_iSelection]->m_pSong );
// fall-through - we want to check for unlocking only if its a song // fall-through - we want to check for unlocking only if its a song
case TYPE_COURSE: case TYPE_COURSE:
return true; return true;
+1 -1
View File
@@ -355,7 +355,7 @@ void ScoreKeeper5th::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTap
if( m_iCurToastyCombo==250 && !GAMESTATE->m_bDemonstrationOrJukebox ) if( m_iCurToastyCombo==250 && !GAMESTATE->m_bDemonstrationOrJukebox )
{ {
SCREENMAN->PostMessageToTopScreen( SM_PlayToasty, 0 ); SCREENMAN->PostMessageToTopScreen( SM_PlayToasty, 0 );
GAMESTATE->m_pUnlockingSys->UnlockToasty(); UNLOCKSYS->UnlockToasty();
} }
break; break;
default: default:
+1 -1
View File
@@ -383,7 +383,7 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa
if( m_iCurToastyCombo==250 && !GAMESTATE->m_bDemonstrationOrJukebox ) if( m_iCurToastyCombo==250 && !GAMESTATE->m_bDemonstrationOrJukebox )
{ {
SCREENMAN->PostMessageToTopScreen( SM_PlayToasty, 0 ); SCREENMAN->PostMessageToTopScreen( SM_PlayToasty, 0 );
GAMESTATE->m_pUnlockingSys->UnlockToasty(); UNLOCKSYS->UnlockToasty();
} }
break; break;
default: default:
+9 -9
View File
@@ -150,7 +150,7 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type ) : Screen(sCl
(GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() ) && (GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() ) &&
grade[p] > GRADE_E && grade[p] > GRADE_E &&
m_Type != summary) m_Type != summary)
GAMESTATE->m_pUnlockingSys->UnlockClearExtraStage(); UNLOCKSYS->UnlockClearExtraStage();
} }
@@ -174,15 +174,15 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type ) : Screen(sCl
// update unlock data if unlocks are on // update unlock data if unlocks are on
if ( PREFSMAN->m_bUseUnlockSystem ) if ( PREFSMAN->m_bUseUnlockSystem )
{ {
GAMESTATE->m_pUnlockingSys->UnlockClearStage(); UNLOCKSYS->UnlockClearStage();
GAMESTATE->m_pUnlockingSys->UnlockAddAP( grade[p] ); UNLOCKSYS->UnlockAddAP( grade[p] );
GAMESTATE->m_pUnlockingSys->UnlockAddSP( grade[p] ); UNLOCKSYS->UnlockAddSP( grade[p] );
// we want to save dance points here if we are in event mode. // we want to save dance points here if we are in event mode.
// otherwise, dance points will never get saved except // otherwise, dance points will never get saved except
// in nonstop mode. // in nonstop mode.
if( PREFSMAN->m_bEventMode ) if( PREFSMAN->m_bEventMode )
GAMESTATE->m_pUnlockingSys->UnlockAddDP( (float)stageStats.iActualDancePoints[p] ); UNLOCKSYS->UnlockAddDP( (float)stageStats.iActualDancePoints[p] );
} }
} }
@@ -214,7 +214,7 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type ) : Screen(sCl
// If unlocking is enabled, save the dance points // If unlocking is enabled, save the dance points
if( PREFSMAN->m_bUseUnlockSystem ) if( PREFSMAN->m_bUseUnlockSystem )
GAMESTATE->m_pUnlockingSys->UnlockAddDP( fTotalDP ); UNLOCKSYS->UnlockAddDP( fTotalDP );
} }
break; break;
case course: case course:
@@ -247,9 +247,9 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type ) : Screen(sCl
if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) ) if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) )
continue; // skip continue; // skip
GAMESTATE->m_pUnlockingSys->UnlockAddDP( (float) stageStats.iActualDancePoints[p] ); UNLOCKSYS->UnlockAddDP( (float) stageStats.iActualDancePoints[p] );
GAMESTATE->m_pUnlockingSys->UnlockAddAP( (float) stageStats.iSongsPassed[p] ); UNLOCKSYS->UnlockAddAP( (float) stageStats.iSongsPassed[p] );
GAMESTATE->m_pUnlockingSys->UnlockAddSP( (float) stageStats.iSongsPassed[p] ); UNLOCKSYS->UnlockAddSP( (float) stageStats.iSongsPassed[p] );
} }
} }
// cannot just use score since it may be nonstop mode // cannot just use score since it may be nonstop mode
+1 -1
View File
@@ -1847,7 +1847,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
// if unlocks are on, update fail extra stage count // if unlocks are on, update fail extra stage count
if (PREFSMAN->m_bUseUnlockSystem) if (PREFSMAN->m_bUseUnlockSystem)
GAMESTATE->m_pUnlockingSys->UnlockFailExtraStage(); UNLOCKSYS->UnlockFailExtraStage();
} }
// Feels hackish. Feel free to make cleaner. // Feels hackish. Feel free to make cleaner.
+1 -1
View File
@@ -112,7 +112,7 @@ void ScreenOptionsMenu::GoToNextState()
// case OM_SOUND: SCREENMAN->SetNewScreen("ScreenSoundOptions"); break; // case OM_SOUND: SCREENMAN->SetNewScreen("ScreenSoundOptions"); break;
case OM_RELOAD: case OM_RELOAD:
SONGMAN->Reload(); SONGMAN->Reload();
GAMESTATE->m_pUnlockingSys->UpdateSongs(); UNLOCKSYS->UpdateSongs();
SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
break; break;
default: // Exit default: // Exit
+1 -1
View File
@@ -71,7 +71,7 @@ ScreenSelectGroup::ScreenSelectGroup() : Screen("ScreenSelectGroup")
// check if song is locked // check if song is locked
if (PREFSMAN->m_bUseUnlockSystem) if (PREFSMAN->m_bUseUnlockSystem)
{ {
UnlockEntry* m_UnlockSong = GAMESTATE->m_pUnlockingSys->FindSong( aAllSongs[j] ); UnlockEntry* m_UnlockSong = UNLOCKSYS->FindSong( aAllSongs[j] );
if (m_UnlockSong) if (m_UnlockSong)
DisplaySong = (m_UnlockSong->SelectableWheel()); DisplaySong = (m_UnlockSong->SelectableWheel());
+1 -1
View File
@@ -91,7 +91,7 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu")
m_textSongs.Command( SONGS_ON_COMMAND ); m_textSongs.Command( SONGS_ON_COMMAND );
CString text = ssprintf("%d songs in %d groups, %d courses", SONGMAN->GetNumSongs(), SONGMAN->GetNumGroups(), SONGMAN->GetNumCourses() ); CString text = ssprintf("%d songs in %d groups, %d courses", SONGMAN->GetNumSongs(), SONGMAN->GetNumGroups(), SONGMAN->GetNumCourses() );
if( PREFSMAN->m_bUseUnlockSystem ) if( PREFSMAN->m_bUseUnlockSystem )
text += ssprintf(", %d unlocks", GAMESTATE->m_pUnlockingSys->GetNumUnlocks() ); text += ssprintf(", %d unlocks", UNLOCKSYS->GetNumUnlocks() );
m_textSongs.SetText( text ); m_textSongs.SetText( text );
this->AddChild( &m_textSongs ); this->AddChild( &m_textSongs );
+14 -14
View File
@@ -43,8 +43,8 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
LOG->Trace("ScreenUnlock::ScreenUnlock()"); LOG->Trace("ScreenUnlock::ScreenUnlock()");
unsigned NumUnlocks = NUM_UNLOCKS; unsigned NumUnlocks = NUM_UNLOCKS;
if (GAMESTATE->m_pUnlockingSys->m_SongEntries.size() < NumUnlocks) if (UNLOCKSYS->m_SongEntries.size() < NumUnlocks)
NumUnlocks = GAMESTATE->m_pUnlockingSys->m_SongEntries.size(); NumUnlocks = UNLOCKSYS->m_SongEntries.size();
if (!PREFSMAN->m_bUseUnlockSystem || NumUnlocks == 0) if (!PREFSMAN->m_bUseUnlockSystem || NumUnlocks == 0)
{ {
@@ -71,11 +71,11 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
// get pertaining UnlockEntry // get pertaining UnlockEntry
CString SongTitle = DISPLAYED_SONG(i); CString SongTitle = DISPLAYED_SONG(i);
if (USE_UNLOCKS_DAT == 1) if (USE_UNLOCKS_DAT == 1)
if ((unsigned)i <= GAMESTATE->m_pUnlockingSys->m_SongEntries.size() ) if ((unsigned)i <= UNLOCKSYS->m_SongEntries.size() )
SongTitle = GAMESTATE->m_pUnlockingSys->m_SongEntries[i-1].m_sSongName; SongTitle = UNLOCKSYS->m_SongEntries[i-1].m_sSongName;
LOG->Trace("UnlockScreen: Searching for %s", SongTitle.c_str()); LOG->Trace("UnlockScreen: Searching for %s", SongTitle.c_str());
UnlockEntry *pSong = GAMESTATE->m_pUnlockingSys->FindLockEntry( SongTitle ); UnlockEntry *pSong = UNLOCKSYS->FindLockEntry( SongTitle );
if( pSong == NULL) if( pSong == NULL)
{ {
@@ -121,11 +121,11 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
CString DisplayedSong = DISPLAYED_SONG(i); CString DisplayedSong = DISPLAYED_SONG(i);
if (USE_UNLOCKS_DAT == 1) if (USE_UNLOCKS_DAT == 1)
if ((unsigned)i <= GAMESTATE->m_pUnlockingSys->m_SongEntries.size() ) if ((unsigned)i <= UNLOCKSYS->m_SongEntries.size() )
DisplayedSong = GAMESTATE->m_pUnlockingSys->m_SongEntries[i-1].m_sSongName; DisplayedSong = UNLOCKSYS->m_SongEntries[i-1].m_sSongName;
DisplayedSong.MakeUpper(); DisplayedSong.MakeUpper();
UnlockEntry *pSong = GAMESTATE->m_pUnlockingSys->FindLockEntry(DisplayedSong); UnlockEntry *pSong = UNLOCKSYS->FindLockEntry(DisplayedSong);
if ( pSong == NULL ) // no such song if ( pSong == NULL ) // no such song
continue; continue;
@@ -249,12 +249,12 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
CString DisplayedSong = DISPLAYED_SONG(NextIcon); CString DisplayedSong = DISPLAYED_SONG(NextIcon);
if (USE_UNLOCKS_DAT == 1) if (USE_UNLOCKS_DAT == 1)
{ {
if (NextIcon <= GAMESTATE->m_pUnlockingSys->m_SongEntries.size() ) if (NextIcon <= UNLOCKSYS->m_SongEntries.size() )
DisplayedSong = GAMESTATE->m_pUnlockingSys->m_SongEntries[NextIcon-1].m_sSongName; DisplayedSong = UNLOCKSYS->m_SongEntries[NextIcon-1].m_sSongName;
} }
DisplayedSong.MakeUpper(); DisplayedSong.MakeUpper();
UnlockEntry *pSong = GAMESTATE->m_pUnlockingSys->FindLockEntry(DisplayedSong); UnlockEntry *pSong = UNLOCKSYS->FindLockEntry(DisplayedSong);
/* Reset zoom before using SetTextMaxWidth. */ /* Reset zoom before using SetTextMaxWidth. */
NewText->SetZoom(UNLOCK_TEXT_SCROLL_ZOOM); NewText->SetZoom(UNLOCK_TEXT_SCROLL_ZOOM);
@@ -313,13 +313,13 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock")
CString PointDisplay = TYPE_TO_DISPLAY; CString PointDisplay = TYPE_TO_DISPLAY;
if (PointDisplay == "DP" || PointDisplay == "Dance") if (PointDisplay == "DP" || PointDisplay == "Dance")
{ {
CString sDP = ssprintf( "%d", (int)GAMESTATE->m_pUnlockingSys->DancePointsUntilNextUnlock() ); CString sDP = ssprintf( "%d", (int)UNLOCKSYS->DancePointsUntilNextUnlock() );
PointsUntilNextUnlock.SetText( sDP ); PointsUntilNextUnlock.SetText( sDP );
} else if (PointDisplay == "AP" || PointDisplay == "Arcade") { } else if (PointDisplay == "AP" || PointDisplay == "Arcade") {
CString sAP = ssprintf( "%d", (int)GAMESTATE->m_pUnlockingSys->ArcadePointsUntilNextUnlock() ); CString sAP = ssprintf( "%d", (int)UNLOCKSYS->ArcadePointsUntilNextUnlock() );
PointsUntilNextUnlock.SetText( sAP ); PointsUntilNextUnlock.SetText( sAP );
} else if (PointDisplay == "SP" || PointDisplay == "Song") { } else if (PointDisplay == "SP" || PointDisplay == "Song") {
CString sSP = ssprintf( "%d", (int)GAMESTATE->m_pUnlockingSys->SongPointsUntilNextUnlock() ); CString sSP = ssprintf( "%d", (int)UNLOCKSYS->SongPointsUntilNextUnlock() );
PointsUntilNextUnlock.SetText( sSP ); PointsUntilNextUnlock.SetText( sSP );
} }
+12 -10
View File
@@ -28,8 +28,12 @@ using namespace std;
#include "stdio.h" #include "stdio.h"
UnlockSystem* UNLOCKSYS = NULL; // global and accessable from anywhere in our program
UnlockSystem::UnlockSystem() UnlockSystem::UnlockSystem()
{ {
UNLOCKSYS = this;
ArcadePoints = 0; ArcadePoints = 0;
DancePoints = 0; DancePoints = 0;
SongPoints = 0; SongPoints = 0;
@@ -150,33 +154,31 @@ void UnlockEntry::UpdateLocked()
if (!isLocked) if (!isLocked)
return; return;
const UnlockSystem *UNLOCKS = GAMESTATE->m_pUnlockingSys;
isLocked = true; isLocked = true;
if ( m_fArcadePointsRequired && UNLOCKS->ArcadePoints >= m_fArcadePointsRequired ) if ( m_fArcadePointsRequired && UNLOCKSYS->ArcadePoints >= m_fArcadePointsRequired )
isLocked = false; isLocked = false;
if ( m_fDancePointsRequired && UNLOCKS->DancePoints >= m_fDancePointsRequired ) if ( m_fDancePointsRequired && UNLOCKSYS->DancePoints >= m_fDancePointsRequired )
isLocked = false; isLocked = false;
if ( m_fSongPointsRequired && UNLOCKS->SongPoints >= m_fSongPointsRequired ) if ( m_fSongPointsRequired && UNLOCKSYS->SongPoints >= m_fSongPointsRequired )
isLocked = false; isLocked = false;
if ( m_fExtraStagesCleared && UNLOCKS->ExtraClearPoints >= m_fExtraStagesCleared ) if ( m_fExtraStagesCleared && UNLOCKSYS->ExtraClearPoints >= m_fExtraStagesCleared )
isLocked = false; isLocked = false;
if ( m_fExtraStagesFailed && UNLOCKS->ExtraFailPoints >= m_fExtraStagesFailed ) if ( m_fExtraStagesFailed && UNLOCKSYS->ExtraFailPoints >= m_fExtraStagesFailed )
isLocked = false; isLocked = false;
if ( m_fStagesCleared && UNLOCKS->StagesCleared >= m_fStagesCleared ) if ( m_fStagesCleared && UNLOCKSYS->StagesCleared >= m_fStagesCleared )
isLocked = false; isLocked = false;
if ( m_fToastysSeen && UNLOCKS->ToastyPoints >= m_fToastysSeen ) if ( m_fToastysSeen && UNLOCKSYS->ToastyPoints >= m_fToastysSeen )
isLocked = false; isLocked = false;
if ( m_iRouletteSeed ) if ( m_iRouletteSeed )
{ {
const CString &tmp = UNLOCKS->RouletteSeeds; const CString &tmp = UNLOCKSYS->RouletteSeeds;
LOG->Trace("Seed in question: %d Roulette seeds: %s", m_iRouletteSeed, tmp.c_str() ); LOG->Trace("Seed in question: %d Roulette seeds: %s", m_iRouletteSeed, tmp.c_str() );
if( tmp[m_iRouletteSeed] == '1' ) if( tmp[m_iRouletteSeed] == '1' )
+1 -3
View File
@@ -13,9 +13,6 @@
Andrew Wong Andrew Wong
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
*/ */
enum UnlockTypes { UNLOCK_AP, UNLOCK_DP, UNLOCK_SP,
UNLOCK_EC, UNLOCK_EF, UNLOCK_SC,
UNLOCK_TT, UNLOCK_RO};
class Song; class Song;
@@ -117,5 +114,6 @@ private:
// makes RouletteSeeds more efficient // makes RouletteSeeds more efficient
}; };
extern UnlockSystem* UNLOCKSYS; // global and accessable from anywhere in program
#endif #endif