diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 0d3058a1ea..1e55caffa0 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -194,6 +194,7 @@ void GameState::Reset() m_iCurrentStageIndex = 0; m_bGameplayLeadIn.Set( false ); m_iNumStagesOfThisSong = 0; + m_bLoadingNextSong = false; NOTESKIN->RefreshNoteSkinData( this->m_pCurGame ); @@ -758,6 +759,16 @@ int GameState::GetCourseSongIndex() const return iSongIndex; } +/* Hack: when we're loading a new course song, we want to display the new song number, even + * though we havn't started that song yet. */ +int GameState::GetLoadingCourseSongIndex() const +{ + int iIndex = GetCourseSongIndex(); + if( m_bLoadingNextSong ) + ++iIndex; + return iIndex; +} + static LocalizedString PLAYER1 ("GameState","Player 1"); static LocalizedString PLAYER2 ("GameState","Player 2"); static LocalizedString CPU ("GameState","CPU"); @@ -1910,6 +1921,7 @@ public: static int IsGoalComplete( T* p, lua_State *L ) { lua_pushboolean(L, p->IsGoalComplete((PlayerNumber)IArg(1)) ); return 1; } static int PlayerIsUsingModifier( T* p, lua_State *L ) { lua_pushboolean(L, p->PlayerIsUsingModifier((PlayerNumber)IArg(1),SArg(2)) ); return 1; } 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 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; } @@ -2025,6 +2037,7 @@ public: ADD_METHOD( IsGoalComplete ); ADD_METHOD( PlayerIsUsingModifier ); ADD_METHOD( GetCourseSongIndex ); + ADD_METHOD( GetLoadingCourseSongIndex ); ADD_METHOD( IsFinalStage ); ADD_METHOD( IsExtraStage ); ADD_METHOD( IsExtraStage2 ); diff --git a/stepmania/src/GameState.h b/stepmania/src/GameState.h index 4e50f85db8..cabfd289e8 100644 --- a/stepmania/src/GameState.h +++ b/stepmania/src/GameState.h @@ -132,6 +132,8 @@ public: int GetCourseSongIndex() const; RString GetPlayerDisplayName( PlayerNumber pn ) const; + bool m_bLoadingNextSong; + int GetLoadingCourseSongIndex() const; // // State Info used during gameplay diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 2ef8b642d6..cab21e22b8 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -2435,19 +2435,23 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM ) int iPlaySongIndex = GAMESTATE->GetCourseSongIndex()+1; iPlaySongIndex %= m_apSongsQueue.size(); + GAMESTATE->m_bLoadingNextSong = true; MESSAGEMAN->Broadcast( "BeforeLoadingNextCourseSong" ); m_NextSong.Reset(); m_NextSong.PlayCommand( "Start" ); m_NextSong.StartTransitioning( SM_LoadNextSong ); LoadCourseSongNumber( GAMESTATE->GetCourseSongIndex()+1 ); + MESSAGEMAN->Broadcast( "ChangeCourseSongIn" ); COMMAND( m_sprCourseSongNumber, "ChangeIn" ); } else if( SM == SM_LoadNextSong ) { SongFinished(); + MESSAGEMAN->Broadcast( "ChangeCourseSongOut" ); COMMAND( m_sprCourseSongNumber, "ChangeOut" ); + GAMESTATE->m_bLoadingNextSong = false; LoadNextSong(); m_NextSong.Reset();