diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 75d9f04bb6..5a599a1505 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -394,7 +394,8 @@ int Player::GetClosestNote( int col, float fBeat, float fMaxBeatsAhead, float fM return Fwd; } -void Player::Step( int col ) + +void Player::Step( int col, RageTimer tm ) { if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && GAMESTATE->m_CurStageStats.bFailed[m_PlayerNumber] ) // Oni dead return; // do nothing @@ -414,14 +415,20 @@ void Player::Step( int col ) if( iIndexOverlappingNote != -1 ) { // compute the score for this hit - float fStepBeat = NoteRowToBeat( (float)iIndexOverlappingNote ); + const float fStepBeat = NoteRowToBeat( (float)iIndexOverlappingNote ); - float fStepSeconds = GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(fStepBeat); + const float fStepSeconds = GAMESTATE->m_pCurSong->GetElapsedTimeFromBeat(fStepBeat); + + /* XXX: Double-check that we're handling m_fMusicRate correctly. */ + /* We actually stepped on the note this long ago: */ + const float fAgo = tm.Ago(); + /* ... which means it happened at this point in the music: */ + const float fMusicSeconds = GAMESTATE->m_fMusicSeconds - (fAgo / GAMESTATE->m_SongOptions.m_fMusicRate); // The offset from the actual step in seconds: - float fNoteOffset = fStepSeconds - GAMESTATE->m_fMusicSeconds; + const float fNoteOffset = fStepSeconds - fMusicSeconds; - float fSecondsFromPerfect = fabsf( fNoteOffset ) / GAMESTATE->m_SongOptions.m_fMusicRate; // account for music rate + const float fSecondsFromPerfect = fabsf( fNoteOffset ) / GAMESTATE->m_SongOptions.m_fMusicRate; // account for music rate // calculate TapNoteScore TapNoteScore score; @@ -606,10 +613,13 @@ void Player::CrossedRow( int iNoteRow ) RandomiseNotes( iNoteRow ); // check to see if there's at the crossed row - for( int t=0; tm_PlayerController[m_PlayerNumber] != PC_HUMAN ) - Step( t ); + RageTimer now; + if( GAMESTATE->m_PlayerController[m_PlayerNumber] != PC_HUMAN ) + { + for( int t=0; tm_bAutoPlay ) - m_Player.Step( StyleI.col ); - return; + case PLAYER_1: + if( !PREFSMAN->m_bAutoPlay ) + m_Player.Step( StyleI.col, DeviceI.ts ); + break; } } diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index da715fcff3..c04ffd0086 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -1330,7 +1330,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ StyleI.IsValid() && GAMESTATE->IsPlayerEnabled( StyleI.player ) ) { - m_Player[StyleI.player].Step( StyleI.col ); + m_Player[StyleI.player].Step( StyleI.col, DeviceI.ts ); } else if( type==IET_FIRST_PRESS && !PREFSMAN->m_bAutoPlay &&