From f98cae8ae13298dddd91fbe4ef1f7207c002a9b8 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 12 Sep 2005 08:04:47 +0000 Subject: [PATCH] lesson mode polish --- stepmania/src/PlayerStageStats.cpp | 1 - stepmania/src/ScreenGameplay.cpp | 6 +++--- stepmania/src/ScreenGameplay.h | 2 +- stepmania/src/ScreenGameplayLesson.cpp | 24 +++++++++++++++++++++++- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/stepmania/src/PlayerStageStats.cpp b/stepmania/src/PlayerStageStats.cpp index 370c0964b5..5bfd9265bf 100644 --- a/stepmania/src/PlayerStageStats.cpp +++ b/stepmania/src/PlayerStageStats.cpp @@ -238,7 +238,6 @@ int PlayerStageStats::GetLessonScoreActual() const switch( tns ) { case TNS_AVOIDED_MINE: - case TNS_MISS: case TNS_BOO: case TNS_GOOD: case TNS_GREAT: diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 83a4e67d32..0352578162 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -1841,7 +1841,7 @@ void ScreenGameplay::Update( float fDeltaTime ) if( GIVING_UP_GOES_TO_PREV_SCREEN ) { - BackOutFromGameplay(); + BeginBackingOutFromGameplay(); } else if( GIVING_UP_GOES_TO_NEXT_SCREEN ) @@ -2069,7 +2069,7 @@ void ScreenGameplay::SendCrossedMessages() } } -void ScreenGameplay::BackOutFromGameplay() +void ScreenGameplay::BeginBackingOutFromGameplay() { m_DancingState = STATE_OUTRO; AbortGiveUp( false ); @@ -2164,7 +2164,7 @@ void ScreenGameplay::Input( const InputEventPlus &input ) (input.DeviceI.device!=DEVICE_KEYBOARD && input.type==IET_FAST_REPEAT)) ) { LOG->Trace("Player %i went back", input.MenuI.player+1); - BackOutFromGameplay(); + BeginBackingOutFromGameplay(); } else if( PREFSMAN->m_bDelayedBack && input.type==IET_FIRST_PRESS ) { diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index 8a03b7154f..52b684cff4 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -144,7 +144,7 @@ protected: void PlayAnnouncer( CString type, float fSeconds ); void UpdateLights(); void SendCrossedMessages(); - void BackOutFromGameplay(); + void BeginBackingOutFromGameplay(); void PlayTicks(); void UpdateSongPosition( float fDeltaTime ); diff --git a/stepmania/src/ScreenGameplayLesson.cpp b/stepmania/src/ScreenGameplayLesson.cpp index d7730bb45e..cd0873815f 100644 --- a/stepmania/src/ScreenGameplayLesson.cpp +++ b/stepmania/src/ScreenGameplayLesson.cpp @@ -62,6 +62,13 @@ void ScreenGameplayLesson::Init() } this->SortByDrawOrder(); + + // Reset stage number (not relevant in lessons) + GAMESTATE->m_iCurrentStageIndex = 0; + + // Autoplay during demonstration + FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) + pi->GetPlayerState()->m_PlayerController = PC_AUTOPLAY; } void ScreenGameplayLesson::Input( const InputEventPlus &input ) @@ -94,13 +101,19 @@ void ScreenGameplayLesson::HandleScreenMessage( const ScreenMessage SM ) else { PlayerStageStats &pss = STATSMAN->m_CurStageStats.m_player[PLAYER_1]; - bool bCleared = pss.GetLessonScoreActual() >= pss.GetLessonScoreNeeded(); + int iActual = pss.GetLessonScoreActual(); + int iNeeded = pss.GetLessonScoreNeeded(); + bool bCleared = iActual >= iNeeded; bool bAnyTriesLeft = m_Try + 1 < NUM_Try; if( bCleared ) { MESSAGEMAN->Broadcast( Message_LessonCleared ); this->HandleScreenMessage( SM_LeaveGameplay ); + + // Commit scores here since we don't go through an eval screen. + // Only commit if we've cleared. Don't commit if we've failed all 3 tries. + STATSMAN->m_CurStageStats.CommitScores( false ); } else if( bAnyTriesLeft ) { @@ -130,6 +143,11 @@ void ScreenGameplayLesson::MenuStart( PlayerNumber pn ) void ScreenGameplayLesson::MenuBack( PlayerNumber pn ) { + if( m_iCurrentPageIndex == 0 ) + { + BeginBackingOutFromGameplay(); + return; + } if( m_iCurrentPageIndex == -1 ) return; ChangeLessonPage( -1 ); @@ -150,6 +168,10 @@ void ScreenGameplayLesson::ChangeLessonPage( int iDir ) ResetAndRestartCurrentSong(); MESSAGEMAN->Broadcast( (Message)(Message_LessonTry1+m_Try) ); + + // Change back to the current autoplay setting (in most cases, human controlled). + FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) + pi->GetPlayerState()->m_PlayerController = PREFSMAN->m_AutoPlay; } else {