diff --git a/src/Player.cpp b/src/Player.cpp index 2c793bb4c1..95353c1669 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -541,6 +541,8 @@ void Player::Load() if( GAMESTATE->m_pCurGame->m_bAllowHopos ) NoteDataUtil::SetHopoPossibleFlags( pSong, m_NoteData ); + m_Timing = &GAMESTATE->m_pCurSteps[pn]->m_Timing; + switch( GAMESTATE->m_PlayMode ) { case PLAY_MODE_RAVE: @@ -1528,7 +1530,7 @@ int Player::GetClosestNoteDirectional( int col, int iStartRow, int iEndRow, bool // Is this the row we want? do { const TapNote &tn = begin->second; - if( GAMESTATE->m_pCurSong->m_SongTiming.IsWarpAtRow( begin->first ) ) + if( m_Timing->IsWarpAtRow( begin->first ) ) break; if( tn.type == TapNote::empty ) break; @@ -1579,7 +1581,7 @@ int Player::GetClosestNonEmptyRowDirectional( int iStartRow, int iEndRow, bool b ++iter; continue; } - if( GAMESTATE->m_pCurSong->m_SongTiming.IsWarpAtRow( iter.Row() ) ) + if( m_Timing->IsWarpAtRow( iter.Row() ) ) { ++iter; continue; @@ -1873,7 +1875,16 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b break; } - const float fSongBeat = GAMESTATE->m_pCurSong ? GAMESTATE->m_pCurSong->m_SongTiming.GetBeatFromElapsedTime( fPositionSeconds ) : GAMESTATE->m_fSongBeat; + float fSongBeat = GAMESTATE->m_fSongBeat; + + if( GAMESTATE->m_pCurSong ) + { + fSongBeat = GAMESTATE->m_pCurSong->m_SongTiming.GetBeatFromElapsedTime( fPositionSeconds ); + + if( GAMESTATE->m_pCurSteps[m_pPlayerState->m_PlayerNumber] ) + fSongBeat = m_Timing->GetBeatFromElapsedTime( fPositionSeconds ); + } + const int iSongRow = row == -1 ? BeatToNoteRow( fSongBeat ) : row; if( col != -1 && !bRelease ) @@ -2011,8 +2022,8 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b * "jack hammers." Hmm. */ const int iStepSearchRows = max( - BeatToNoteRow( GAMESTATE->m_pCurSong->m_SongTiming.GetBeatFromElapsedTime( GAMESTATE->m_fMusicSeconds + StepSearchDistance ) ) - iSongRow, - iSongRow - BeatToNoteRow( GAMESTATE->m_pCurSong->m_SongTiming.GetBeatFromElapsedTime( GAMESTATE->m_fMusicSeconds - StepSearchDistance ) ) + BeatToNoteRow( m_Timing->GetBeatFromElapsedTime( GAMESTATE->m_fMusicSeconds + StepSearchDistance ) ) - iSongRow, + iSongRow - BeatToNoteRow( m_Timing->GetBeatFromElapsedTime( GAMESTATE->m_fMusicSeconds - StepSearchDistance ) ) ) + ROWS_PER_BEAT; int iRowOfOverlappingNoteOrRow = row; if( row == -1 ) @@ -2039,7 +2050,7 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b float fNoteOffset = 0.0f; // we need this later if we are autosyncing const float fStepBeat = NoteRowToBeat( iRowOfOverlappingNoteOrRow ); - const float fStepSeconds = GAMESTATE->m_pCurSong->m_SongTiming.GetElapsedTimeFromBeat(fStepBeat); + const float fStepSeconds = m_Timing->GetElapsedTimeFromBeat(fStepBeat); if( row == -1 ) { @@ -2089,7 +2100,7 @@ void Player::StepStrumHopo( int col, int row, const RageTimer &tm, bool bHeld, b // Stepped too close to mine? if( !bRelease && ( REQUIRE_STEP_ON_MINES == !bHeld ) && fSecondsFromExact <= GetWindowSeconds(TW_Mine) && - !GAMESTATE->m_pCurSong->m_SongTiming.IsWarpAtRow(iSongRow) ) + !m_Timing->IsWarpAtRow(iSongRow) ) score = TNS_HitMine; break; @@ -2564,7 +2575,7 @@ void Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds ) float fThrowAway; int iWarpBeginRow; float fWarpLength; - GAMESTATE->m_pCurSong->m_SongTiming.GetBeatAndBPSFromElapsedTime( fEarliestTime, fMissIfOlderThanThisBeat, fThrowAway, bFreeze, bDelay, iWarpBeginRow, fWarpLength ); + m_Timing->GetBeatAndBPSFromElapsedTime( fEarliestTime, fMissIfOlderThanThisBeat, fThrowAway, bFreeze, bDelay, iWarpBeginRow, fWarpLength ); iMissIfOlderThanThisRow = BeatToNoteRow( fMissIfOlderThanThisBeat ); if( bFreeze || bDelay ) @@ -2587,7 +2598,7 @@ void Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds ) continue; // Ignore all notes that are skipped via WARPS. - if( GAMESTATE->m_pCurSong->m_SongTiming.IsWarpAtRow( iter.Row() ) ) + if( m_Timing->IsWarpAtRow( iter.Row() ) ) continue; if( tn.type == TapNote::mine ) @@ -2622,7 +2633,7 @@ void Player::UpdateJudgedRows() int iRow = iter.Row(); // If row is within a warp section, ignore it. -aj - if( GAMESTATE->m_pCurSong->m_SongTiming.IsWarpAtRow(iRow) ) + if( m_Timing->IsWarpAtRow(iRow) ) continue; if( iLastSeenRow != iRow ) @@ -2843,13 +2854,13 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now ) int iCheckpointFrequencyRows = ROWS_PER_BEAT/2; if( CHECKPOINTS_USE_TICKCOUNTS ) { - int tickCurrent = GAMESTATE->m_pCurSong->m_SongTiming.GetTickcountAtRow( iLastRowCrossed ); + int tickCurrent = m_Timing->GetTickcountAtRow( iLastRowCrossed ); // There are some charts that don't want tickcounts involved at all. iCheckpointFrequencyRows = (tickCurrent > 0 ? ROWS_PER_BEAT / tickCurrent : 0); } else if( CHECKPOINTS_USE_TIME_SIGNATURES ) { - TimeSignatureSegment tSignature = GAMESTATE->m_pCurSong->m_SongTiming.GetTimeSignatureSegmentAtBeat( NoteRowToBeat( iLastRowCrossed ) ); + TimeSignatureSegment tSignature = m_Timing->GetTimeSignatureSegmentAtBeat( NoteRowToBeat( iLastRowCrossed ) ); // Most songs are in 4/4 time. The frequency for checking tick counts should reflect that. iCheckpointFrequencyRows = ROWS_PER_BEAT * tSignature.m_iDenominator / (tSignature.m_iNumerator * 4); @@ -2957,7 +2968,7 @@ void Player::HandleTapRowScore( unsigned row ) #endif // Warp hackery. -aj - if( GAMESTATE->m_pCurSong->m_SongTiming.IsWarpAtRow( row ) ) + if( m_Timing->IsWarpAtRow( row ) ) return; if( GAMESTATE->m_bDemonstrationOrJukebox ) @@ -3061,7 +3072,7 @@ void Player::HandleHoldCheckpoint( int iRow, int iNumHoldsHeldThisRow, int iNumH #endif // More warp hackery. -aj - if( GAMESTATE->m_pCurSong->m_SongTiming.IsWarpAtRow( iRow ) ) + if( m_Timing->IsWarpAtRow( iRow ) ) return; // don't accumulate combo if AutoPlay is on. diff --git a/src/Player.h b/src/Player.h index b8923b9372..2d699e4913 100644 --- a/src/Player.h +++ b/src/Player.h @@ -10,6 +10,7 @@ #include "ScreenMessage.h" #include "ThemeMetric.h" #include "InputEventPlus.h" +#include "TimingData.h" class ScoreDisplay; class LifeMeter; @@ -147,6 +148,7 @@ protected: PlayerState *m_pPlayerState; /** @brief The player's present stage stats. */ PlayerStageStats *m_pPlayerStageStats; + TimingData *m_Timing; float m_fNoteFieldHeight; bool m_bPaused;