From ded50f4d8880e52df07f442c1f97fe90d819c2db Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 22 Jan 2004 02:16:50 +0000 Subject: [PATCH] add GameState::IncrementStageIndex --- stepmania/src/GameState.cpp | 19 +++++++++++++++++++ stepmania/src/GameState.h | 1 + 2 files changed, 20 insertions(+) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 6eee20bce0..e89d23f9fe 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -420,6 +420,25 @@ float GameState::GetSongPercent( float beat ) const return (beat - m_pCurSong->m_fFirstBeat) / m_pCurSong->m_fLastBeat; } +void GameState::IncrementStageIndex() +{ + // Increment the stage counter. + int iNumStagesOfLastSong = SongManager::GetNumStagesForSong( GAMESTATE->m_pCurSong ); + + if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() ) + { + /* If it's an extra stage, always increment by one. This is because in some + * unusual cases we can pick a long or marathon song as an extra stage. The + * most common cause of this is when an entire group of songs is long/nonstop mixes. + * + * We can't simply not choose long songs as extra stages: if there are no + * regular songs to choose, we'll end up with no song to use as an extra stage. */ + iNumStagesOfLastSong = 1; + } + + m_iCurrentStageIndex += iNumStagesOfLastSong; +} + int GameState::GetStageIndex() const { return m_iCurrentStageIndex; diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 6435a0ae7e..470d5889d7 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -109,6 +109,7 @@ public: int m_iCurrentStageIndex; // incremented on Eval screen. For a Course, this is always 0 int GetStageIndex() const; + void IncrementStageIndex(); int GetNumStagesLeft() const; bool IsFinalStage() const; bool IsExtraStage() const;