From 54e490fd2063746cd5b02e6137be0aafeaedcac8 Mon Sep 17 00:00:00 2001 From: Andrew Wong Date: Fri, 19 Sep 2003 07:02:53 +0000 Subject: [PATCH] oops, forgot to commit: replace GAMESTATE->m_pUnlockingSys with UNLOCKSYS --- stepmania/src/MusicWheel.cpp | 8 ++++---- stepmania/src/ScoreKeeper5th.cpp | 2 +- stepmania/src/ScoreKeeperMAX2.cpp | 2 +- stepmania/src/ScreenEvaluation.cpp | 18 +++++++++--------- stepmania/src/ScreenGameplay.cpp | 2 +- stepmania/src/ScreenOptionsMenu.cpp | 2 +- stepmania/src/ScreenSelectGroup.cpp | 2 +- stepmania/src/ScreenTitleMenu.cpp | 2 +- stepmania/src/ScreenUnlock.cpp | 28 ++++++++++++++-------------- stepmania/src/UnlockSystem.cpp | 22 ++++++++++++---------- stepmania/src/UnlockSystem.h | 4 +--- 11 files changed, 46 insertions(+), 46 deletions(-) diff --git a/stepmania/src/MusicWheel.cpp b/stepmania/src/MusicWheel.cpp index d17c79bff4..c9fdbef5d8 100644 --- a/stepmania/src/MusicWheel.cpp +++ b/stepmania/src/MusicWheel.cpp @@ -335,12 +335,12 @@ void MusicWheel::GetSongList(vector &arraySongs, SongSortOrder so, CStrin if( so!=SORT_ROULETTE && !pSong->NormallyDisplayed() ) continue; if( so==SORT_ROULETTE && !(pSong->RouletteDisplayed() - || GAMESTATE->m_pUnlockingSys->SongIsRoulette( pSong )) ) + || UNLOCKSYS->SongIsRoulette( pSong )) ) continue; } // 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; vector arraySteps; @@ -625,7 +625,7 @@ void MusicWheel::BuildWheelItemDatas( vector &arrayWheelItemDatas Course* pCourse = apCourses[c]; // if unlocks are on, make sure it is unlocked - if ( GAMESTATE->m_pUnlockingSys->CourseIsLocked(pCourse) ) + if ( UNLOCKSYS->CourseIsLocked(pCourse) ) continue; CString sThisSection = ""; @@ -1203,7 +1203,7 @@ bool MusicWheel::Select() // return true if this selection ends the screen return false; case TYPE_SONG: 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 case TYPE_COURSE: return true; diff --git a/stepmania/src/ScoreKeeper5th.cpp b/stepmania/src/ScoreKeeper5th.cpp index 43cc9df30f..4adc00d9a6 100644 --- a/stepmania/src/ScoreKeeper5th.cpp +++ b/stepmania/src/ScoreKeeper5th.cpp @@ -355,7 +355,7 @@ void ScoreKeeper5th::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTap if( m_iCurToastyCombo==250 && !GAMESTATE->m_bDemonstrationOrJukebox ) { SCREENMAN->PostMessageToTopScreen( SM_PlayToasty, 0 ); - GAMESTATE->m_pUnlockingSys->UnlockToasty(); + UNLOCKSYS->UnlockToasty(); } break; default: diff --git a/stepmania/src/ScoreKeeperMAX2.cpp b/stepmania/src/ScoreKeeperMAX2.cpp index 657175501a..5f0cc98546 100644 --- a/stepmania/src/ScoreKeeperMAX2.cpp +++ b/stepmania/src/ScoreKeeperMAX2.cpp @@ -383,7 +383,7 @@ void ScoreKeeperMAX2::HandleTapRowScore( TapNoteScore scoreOfLastTap, int iNumTa if( m_iCurToastyCombo==250 && !GAMESTATE->m_bDemonstrationOrJukebox ) { SCREENMAN->PostMessageToTopScreen( SM_PlayToasty, 0 ); - GAMESTATE->m_pUnlockingSys->UnlockToasty(); + UNLOCKSYS->UnlockToasty(); } break; default: diff --git a/stepmania/src/ScreenEvaluation.cpp b/stepmania/src/ScreenEvaluation.cpp index de8084347e..e87dfaed90 100644 --- a/stepmania/src/ScreenEvaluation.cpp +++ b/stepmania/src/ScreenEvaluation.cpp @@ -150,7 +150,7 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type ) : Screen(sCl (GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() ) && grade[p] > GRADE_E && 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 if ( PREFSMAN->m_bUseUnlockSystem ) { - GAMESTATE->m_pUnlockingSys->UnlockClearStage(); - GAMESTATE->m_pUnlockingSys->UnlockAddAP( grade[p] ); - GAMESTATE->m_pUnlockingSys->UnlockAddSP( grade[p] ); + UNLOCKSYS->UnlockClearStage(); + UNLOCKSYS->UnlockAddAP( grade[p] ); + UNLOCKSYS->UnlockAddSP( grade[p] ); // we want to save dance points here if we are in event mode. // otherwise, dance points will never get saved except // in nonstop mode. 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( PREFSMAN->m_bUseUnlockSystem ) - GAMESTATE->m_pUnlockingSys->UnlockAddDP( fTotalDP ); + UNLOCKSYS->UnlockAddDP( fTotalDP ); } break; case course: @@ -247,9 +247,9 @@ ScreenEvaluation::ScreenEvaluation( CString sClassName, Type type ) : Screen(sCl if( !GAMESTATE->IsPlayerEnabled( (PlayerNumber)p ) ) continue; // skip - GAMESTATE->m_pUnlockingSys->UnlockAddDP( (float) stageStats.iActualDancePoints[p] ); - GAMESTATE->m_pUnlockingSys->UnlockAddAP( (float) stageStats.iSongsPassed[p] ); - GAMESTATE->m_pUnlockingSys->UnlockAddSP( (float) stageStats.iSongsPassed[p] ); + UNLOCKSYS->UnlockAddDP( (float) stageStats.iActualDancePoints[p] ); + UNLOCKSYS->UnlockAddAP( (float) stageStats.iSongsPassed[p] ); + UNLOCKSYS->UnlockAddSP( (float) stageStats.iSongsPassed[p] ); } } // cannot just use score since it may be nonstop mode diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index ad8d23e935..4773c1dbb4 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -1847,7 +1847,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) // if unlocks are on, update fail extra stage count if (PREFSMAN->m_bUseUnlockSystem) - GAMESTATE->m_pUnlockingSys->UnlockFailExtraStage(); + UNLOCKSYS->UnlockFailExtraStage(); } // Feels hackish. Feel free to make cleaner. diff --git a/stepmania/src/ScreenOptionsMenu.cpp b/stepmania/src/ScreenOptionsMenu.cpp index 106028cbe6..cb8811e57e 100644 --- a/stepmania/src/ScreenOptionsMenu.cpp +++ b/stepmania/src/ScreenOptionsMenu.cpp @@ -112,7 +112,7 @@ void ScreenOptionsMenu::GoToNextState() // case OM_SOUND: SCREENMAN->SetNewScreen("ScreenSoundOptions"); break; case OM_RELOAD: SONGMAN->Reload(); - GAMESTATE->m_pUnlockingSys->UpdateSongs(); + UNLOCKSYS->UpdateSongs(); SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); break; default: // Exit diff --git a/stepmania/src/ScreenSelectGroup.cpp b/stepmania/src/ScreenSelectGroup.cpp index 9bc871d80a..608774a254 100644 --- a/stepmania/src/ScreenSelectGroup.cpp +++ b/stepmania/src/ScreenSelectGroup.cpp @@ -71,7 +71,7 @@ ScreenSelectGroup::ScreenSelectGroup() : Screen("ScreenSelectGroup") // check if song is locked if (PREFSMAN->m_bUseUnlockSystem) { - UnlockEntry* m_UnlockSong = GAMESTATE->m_pUnlockingSys->FindSong( aAllSongs[j] ); + UnlockEntry* m_UnlockSong = UNLOCKSYS->FindSong( aAllSongs[j] ); if (m_UnlockSong) DisplaySong = (m_UnlockSong->SelectableWheel()); diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index deed2ae6aa..2fb8852b4d 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -91,7 +91,7 @@ ScreenTitleMenu::ScreenTitleMenu() : Screen("ScreenTitleMenu") m_textSongs.Command( SONGS_ON_COMMAND ); CString text = ssprintf("%d songs in %d groups, %d courses", SONGMAN->GetNumSongs(), SONGMAN->GetNumGroups(), SONGMAN->GetNumCourses() ); if( PREFSMAN->m_bUseUnlockSystem ) - text += ssprintf(", %d unlocks", GAMESTATE->m_pUnlockingSys->GetNumUnlocks() ); + text += ssprintf(", %d unlocks", UNLOCKSYS->GetNumUnlocks() ); m_textSongs.SetText( text ); this->AddChild( &m_textSongs ); diff --git a/stepmania/src/ScreenUnlock.cpp b/stepmania/src/ScreenUnlock.cpp index ec34fd5e4f..26facd7114 100644 --- a/stepmania/src/ScreenUnlock.cpp +++ b/stepmania/src/ScreenUnlock.cpp @@ -43,8 +43,8 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock") LOG->Trace("ScreenUnlock::ScreenUnlock()"); unsigned NumUnlocks = NUM_UNLOCKS; - if (GAMESTATE->m_pUnlockingSys->m_SongEntries.size() < NumUnlocks) - NumUnlocks = GAMESTATE->m_pUnlockingSys->m_SongEntries.size(); + if (UNLOCKSYS->m_SongEntries.size() < NumUnlocks) + NumUnlocks = UNLOCKSYS->m_SongEntries.size(); if (!PREFSMAN->m_bUseUnlockSystem || NumUnlocks == 0) { @@ -71,11 +71,11 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock") // get pertaining UnlockEntry CString SongTitle = DISPLAYED_SONG(i); if (USE_UNLOCKS_DAT == 1) - if ((unsigned)i <= GAMESTATE->m_pUnlockingSys->m_SongEntries.size() ) - SongTitle = GAMESTATE->m_pUnlockingSys->m_SongEntries[i-1].m_sSongName; + if ((unsigned)i <= UNLOCKSYS->m_SongEntries.size() ) + SongTitle = UNLOCKSYS->m_SongEntries[i-1].m_sSongName; LOG->Trace("UnlockScreen: Searching for %s", SongTitle.c_str()); - UnlockEntry *pSong = GAMESTATE->m_pUnlockingSys->FindLockEntry( SongTitle ); + UnlockEntry *pSong = UNLOCKSYS->FindLockEntry( SongTitle ); if( pSong == NULL) { @@ -121,11 +121,11 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock") CString DisplayedSong = DISPLAYED_SONG(i); if (USE_UNLOCKS_DAT == 1) - if ((unsigned)i <= GAMESTATE->m_pUnlockingSys->m_SongEntries.size() ) - DisplayedSong = GAMESTATE->m_pUnlockingSys->m_SongEntries[i-1].m_sSongName; + if ((unsigned)i <= UNLOCKSYS->m_SongEntries.size() ) + DisplayedSong = UNLOCKSYS->m_SongEntries[i-1].m_sSongName; DisplayedSong.MakeUpper(); - UnlockEntry *pSong = GAMESTATE->m_pUnlockingSys->FindLockEntry(DisplayedSong); + UnlockEntry *pSong = UNLOCKSYS->FindLockEntry(DisplayedSong); if ( pSong == NULL ) // no such song continue; @@ -249,12 +249,12 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock") CString DisplayedSong = DISPLAYED_SONG(NextIcon); if (USE_UNLOCKS_DAT == 1) { - if (NextIcon <= GAMESTATE->m_pUnlockingSys->m_SongEntries.size() ) - DisplayedSong = GAMESTATE->m_pUnlockingSys->m_SongEntries[NextIcon-1].m_sSongName; + if (NextIcon <= UNLOCKSYS->m_SongEntries.size() ) + DisplayedSong = UNLOCKSYS->m_SongEntries[NextIcon-1].m_sSongName; } DisplayedSong.MakeUpper(); - UnlockEntry *pSong = GAMESTATE->m_pUnlockingSys->FindLockEntry(DisplayedSong); + UnlockEntry *pSong = UNLOCKSYS->FindLockEntry(DisplayedSong); /* Reset zoom before using SetTextMaxWidth. */ NewText->SetZoom(UNLOCK_TEXT_SCROLL_ZOOM); @@ -313,13 +313,13 @@ ScreenUnlock::ScreenUnlock() : ScreenAttract("ScreenUnlock") CString PointDisplay = TYPE_TO_DISPLAY; if (PointDisplay == "DP" || PointDisplay == "Dance") { - CString sDP = ssprintf( "%d", (int)GAMESTATE->m_pUnlockingSys->DancePointsUntilNextUnlock() ); + CString sDP = ssprintf( "%d", (int)UNLOCKSYS->DancePointsUntilNextUnlock() ); PointsUntilNextUnlock.SetText( sDP ); } 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 ); } 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 ); } diff --git a/stepmania/src/UnlockSystem.cpp b/stepmania/src/UnlockSystem.cpp index e1fcecdb6d..572db03a56 100644 --- a/stepmania/src/UnlockSystem.cpp +++ b/stepmania/src/UnlockSystem.cpp @@ -28,8 +28,12 @@ using namespace std; #include "stdio.h" +UnlockSystem* UNLOCKSYS = NULL; // global and accessable from anywhere in our program + UnlockSystem::UnlockSystem() { + UNLOCKSYS = this; + ArcadePoints = 0; DancePoints = 0; SongPoints = 0; @@ -150,33 +154,31 @@ void UnlockEntry::UpdateLocked() if (!isLocked) return; - const UnlockSystem *UNLOCKS = GAMESTATE->m_pUnlockingSys; - isLocked = true; - if ( m_fArcadePointsRequired && UNLOCKS->ArcadePoints >= m_fArcadePointsRequired ) + if ( m_fArcadePointsRequired && UNLOCKSYS->ArcadePoints >= m_fArcadePointsRequired ) isLocked = false; - if ( m_fDancePointsRequired && UNLOCKS->DancePoints >= m_fDancePointsRequired ) + if ( m_fDancePointsRequired && UNLOCKSYS->DancePoints >= m_fDancePointsRequired ) isLocked = false; - if ( m_fSongPointsRequired && UNLOCKS->SongPoints >= m_fSongPointsRequired ) + if ( m_fSongPointsRequired && UNLOCKSYS->SongPoints >= m_fSongPointsRequired ) isLocked = false; - if ( m_fExtraStagesCleared && UNLOCKS->ExtraClearPoints >= m_fExtraStagesCleared ) + if ( m_fExtraStagesCleared && UNLOCKSYS->ExtraClearPoints >= m_fExtraStagesCleared ) isLocked = false; - if ( m_fExtraStagesFailed && UNLOCKS->ExtraFailPoints >= m_fExtraStagesFailed ) + if ( m_fExtraStagesFailed && UNLOCKSYS->ExtraFailPoints >= m_fExtraStagesFailed ) isLocked = false; - if ( m_fStagesCleared && UNLOCKS->StagesCleared >= m_fStagesCleared ) + if ( m_fStagesCleared && UNLOCKSYS->StagesCleared >= m_fStagesCleared ) isLocked = false; - if ( m_fToastysSeen && UNLOCKS->ToastyPoints >= m_fToastysSeen ) + if ( m_fToastysSeen && UNLOCKSYS->ToastyPoints >= m_fToastysSeen ) isLocked = false; 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() ); if( tmp[m_iRouletteSeed] == '1' ) diff --git a/stepmania/src/UnlockSystem.h b/stepmania/src/UnlockSystem.h index 9016dad124..75451ef695 100644 --- a/stepmania/src/UnlockSystem.h +++ b/stepmania/src/UnlockSystem.h @@ -13,9 +13,6 @@ Andrew Wong ----------------------------------------------------------------------------- */ -enum UnlockTypes { UNLOCK_AP, UNLOCK_DP, UNLOCK_SP, - UNLOCK_EC, UNLOCK_EF, UNLOCK_SC, - UNLOCK_TT, UNLOCK_RO}; class Song; @@ -117,5 +114,6 @@ private: // makes RouletteSeeds more efficient }; +extern UnlockSystem* UNLOCKSYS; // global and accessable from anywhere in program #endif