From a89e8b9cb278d401e6b068175a009ba997eb7f8f Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Sun, 6 Aug 2006 02:36:23 +0000 Subject: [PATCH] IsAnExtraStage(). --- stepmania/src/GameState.cpp | 17 ++++++++++------- stepmania/src/GameState.h | 1 + 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 6618d890a3..4cfdc7574b 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -688,7 +688,7 @@ int GameState::GetStageIndex() const int GameState::GetNumStagesLeft() const { - if( IsExtraStage() || IsExtraStage2() ) + if( IsAnExtraStage() ) return 1; if( GAMESTATE->IsEventMode() ) return 999; @@ -710,18 +710,19 @@ bool GameState::IsFinalStage() const return m_iCurrentStageIndex + iPredictedStageForCurSong == PREFSMAN->m_iSongsPerPlay; } +bool GameState::IsAnExtraStage() const +{ + return !IsEventMode() && m_iCurrentStageIndex >= PREFSMAN->m_iSongsPerPlay; +} + bool GameState::IsExtraStage() const { - if( GAMESTATE->IsEventMode() ) - return false; - return m_iCurrentStageIndex == PREFSMAN->m_iSongsPerPlay; + return !IsEventMode() && m_iCurrentStageIndex == PREFSMAN->m_iSongsPerPlay; } bool GameState::IsExtraStage2() const { - if( GAMESTATE->IsEventMode() ) - return false; - return m_iCurrentStageIndex == PREFSMAN->m_iSongsPerPlay+1; + return !IsEventMode() && m_iCurrentStageIndex == PREFSMAN->m_iSongsPerPlay+1; } Stage GameState::GetCurrentStage() const @@ -1916,6 +1917,7 @@ public: static int GetCourseSongIndex( T* p, lua_State *L ) { lua_pushnumber(L, p->GetCourseSongIndex() ); return 1; } static int GetLoadingCourseSongIndex( T* p, lua_State *L ) { lua_pushnumber(L, p->GetLoadingCourseSongIndex() ); return 1; } static int IsFinalStage( T* p, lua_State *L ) { lua_pushboolean(L, p->IsFinalStage() ); return 1; } + static int IsAnExtraStage( T* p, lua_State *L ) { lua_pushboolean(L, p->IsAnExtraStage() ); return 1; } static int IsExtraStage( T* p, lua_State *L ) { lua_pushboolean(L, p->IsExtraStage() ); return 1; } static int IsExtraStage2( T* p, lua_State *L ) { lua_pushboolean(L, p->IsExtraStage2() ); return 1; } static int GetCurrentStage( T* p, lua_State *L ) { lua_pushnumber(L, p->GetCurrentStage() ); return 1; } @@ -2035,6 +2037,7 @@ public: ADD_METHOD( GetCourseSongIndex ); ADD_METHOD( GetLoadingCourseSongIndex ); ADD_METHOD( IsFinalStage ); + ADD_METHOD( IsAnExtraStage ); ADD_METHOD( IsExtraStage ); ADD_METHOD( IsExtraStage2 ); ADD_METHOD( GetCurrentStage ); diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 23b23ca7f2..a4510cbf15 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -125,6 +125,7 @@ public: void FinishStage(); int GetNumStagesLeft() const; bool IsFinalStage() const; + bool IsAnExtraStage() const; bool IsExtraStage() const; bool IsExtraStage2() const; Stage GetCurrentStage() const;