diff --git a/src/GameState.cpp b/src/GameState.cpp index c1f5b0b0f4..7bceea64db 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -897,7 +897,7 @@ void GameState::ResetMusicStatistics() m_bFreeze = false; m_bDelay = false; m_iWarpBeginRow = -1; // Set to -1 because some song may want to warp to row 0. -aj - m_fWarpLength = -1; // Set when a warp is encountered. also see above. -aj + m_fWarpDestination = -1; // Set when a warp is encountered. also see above. -aj m_fMusicSecondsVisible = 0; m_fSongBeatVisible = 0; Actor::SetBGMTime( 0, 0, 0, 0 ); @@ -943,7 +943,7 @@ void GameState::ResetStageStatistics() } static Preference g_fVisualDelaySeconds( "VisualDelaySeconds", 0.0f ); -// todo: modify for warps -aj + void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &timing, const RageTimer ×tamp ) { if( !timestamp.IsZero() ) @@ -957,16 +957,21 @@ void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &ti LOG->Trace( ssprintf("[GameState::UpdateSongPosition] cur BPS = %f, fPositionSeconds = %f",m_fCurBPS,fPositionSeconds) ); */ - timing.GetBeatAndBPSFromElapsedTime( fPositionSeconds, m_fSongBeat, m_fCurBPS, m_bFreeze, m_bDelay, m_iWarpBeginRow, m_fWarpLength ); + timing.GetBeatAndBPSFromElapsedTime( fPositionSeconds, m_fSongBeat, m_fCurBPS, m_bFreeze, m_bDelay, m_iWarpBeginRow, m_fWarpDestination ); // "Crash reason : -243478.890625 -48695.773438" ASSERT_M( m_fSongBeat > -2000, ssprintf("Song beat %f at %f seconds", m_fSongBeat, fPositionSeconds) ); //if( m_iWarpBeginRow != -1 || m_iWarpEndRow == -1 ) - if( m_iWarpBeginRow != -1 && m_fWarpLength > 0.0f ) + + if( m_iWarpBeginRow != -1 && m_fWarpDestination > 0.0f ) { + float fWarpLength = m_fWarpDestination-NoteRowToBeat(m_iWarpBeginRow); // There is a warp in this section. - LOG->Trace("warp at %i lasts for %f, jumps to %i",m_iWarpBeginRow,m_fWarpLength,m_iWarpBeginRow+BeatToNoteRow(m_fWarpLength)); - //fPositionSeconds += (m_fWarpLength * m_fCurBPS); + LOG->Trace("warp at row %i lasts for %f beats, jumps to row %i", + m_iWarpBeginRow, + fWarpLength, + BeatToNoteRow(m_fWarpDestination)); + fPositionSeconds += (fWarpLength * m_fCurBPS); } m_fMusicSeconds = fPositionSeconds; diff --git a/src/GameState.h b/src/GameState.h index d26fe5b308..406e4784b1 100644 --- a/src/GameState.h +++ b/src/GameState.h @@ -208,9 +208,10 @@ public: bool m_bFreeze; /** @brief A flag to determine if we're in the middle of a delay (Pump style stop). */ bool m_bDelay; - // used for warping: + /** @brief The row used to start a warp. */ int m_iWarpBeginRow; - float m_fWarpLength; + /** @brief The beat to warp to afterwards. */ + float m_fWarpDestination; RageTimer m_LastBeatUpdate; // time of last m_fSongBeat, etc. update BroadcastOnChange m_bGameplayLeadIn; diff --git a/src/Player.cpp b/src/Player.cpp index 2f505d391a..92ef0dc81d 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -2551,8 +2551,8 @@ void Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds ) if( !NeedsTapJudging(tn) ) continue; - // warp hackery - if( iter.Row() >= GAMESTATE->m_iWarpBeginRow && iter.Row() <= (GAMESTATE->m_iWarpBeginRow + BeatToNoteRow(GAMESTATE->m_fWarpLength)) ) + // Ignore all notes that are skipped via WARPS. + if( iter.Row() >= GAMESTATE->m_iWarpBeginRow && iter.Row() < BeatToNoteRow(GAMESTATE->m_fWarpDestination) ) continue; if( tn.type == TapNote::mine ) @@ -2570,7 +2570,7 @@ void Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds ) { // warp hackery: don't score notes within the warp region. // (Only useful when QuirksMode is enabled.) -aj - if( iter.Row() >= GAMESTATE->m_iWarpBeginRow && iter.Row() <= (GAMESTATE->m_iWarpBeginRow + BeatToNoteRow(GAMESTATE->m_fWarpLength)) ) + if( iter.Row() >= GAMESTATE->m_iWarpBeginRow && iter.Row() < BeatToNoteRow(GAMESTATE->m_fWarpDestination) ) continue; tn.result.tns = TNS_Miss; @@ -2593,7 +2593,7 @@ void Player::UpdateJudgedRows() // if row is within a warp section, ignore it. -aj if( iRow >= GAMESTATE->m_iWarpBeginRow && - iRow <= (GAMESTATE->m_iWarpBeginRow + BeatToNoteRow(GAMESTATE->m_fWarpLength)) ) + iRow < BeatToNoteRow(GAMESTATE->m_fWarpDestination) ) continue; if( iLastSeenRow != iRow ) @@ -2929,7 +2929,7 @@ void Player::HandleTapRowScore( unsigned row ) // more warp hackery. -aj if( row >= (unsigned)GAMESTATE->m_iWarpBeginRow && - row <= (unsigned)(GAMESTATE->m_iWarpBeginRow + BeatToNoteRow(GAMESTATE->m_fWarpLength)) ) + row < (unsigned)(BeatToNoteRow(GAMESTATE->m_fWarpDestination)) ) return; if( GAMESTATE->m_bDemonstrationOrJukebox ) @@ -3034,7 +3034,7 @@ void Player::HandleHoldCheckpoint( int iRow, int iNumHoldsHeldThisRow, int iNumH // more warp hackery. -aj if( iRow >= GAMESTATE->m_iWarpBeginRow && - iRow <= (GAMESTATE->m_iWarpBeginRow + BeatToNoteRow(GAMESTATE->m_fWarpLength)) ) + iRow < BeatToNoteRow(GAMESTATE->m_fWarpDestination) ) return; // don't accumulate combo if AutoPlay is on.