diff --git a/Docs/Changelog_sm-ssc.txt b/Docs/Changelog_sm-ssc.txt index 78c193406e..89221355bd 100644 --- a/Docs/Changelog_sm-ssc.txt +++ b/Docs/Changelog_sm-ssc.txt @@ -20,6 +20,13 @@ sm-ssc v1.0 Release Candidate 2 | 201008xx * [ScreenNetEvaluation] add Score, Grade, PlayerOptions params to UpdateNetEvalStats message * [PlayerState] add GetHealthState Lua binding +* [Player] fix a warning [shakesoda] +* [Player] Change combo coloring logic in course mode: + "PERCENT_UNTIL_COLOR_COMBO refers to how long through the course the combo + color should appear (scaling to the number of songs). (This may not be + desired behavior, however.)" Let me know if I should add an alternate way to + specify course combo color logic. -aj +* [ScreenRanking] Cleanup and un-hardcode shadowlength 20100814 -------- diff --git a/src/Background.cpp b/src/Background.cpp index 93ed8a532e..624551a391 100644 --- a/src/Background.cpp +++ b/src/Background.cpp @@ -700,10 +700,10 @@ void BackgroundImpl::Layer::UpdateCurBGChange( const Song *pSong, float fLastMus if( m_aBGChanges.size() == 0 ) return; - float fBeat, fBPS; + float fBeat, fBPS, fThrowAway; bool bFreeze; - int iThrowAway1, iThrowAway2; - pSong->m_Timing.GetBeatAndBPSFromElapsedTime( fCurrentTime, fBeat, fBPS, bFreeze, bFreeze, iThrowAway1, iThrowAway2 ); + int iThrowAway; + pSong->m_Timing.GetBeatAndBPSFromElapsedTime( fCurrentTime, fBeat, fBPS, bFreeze, bFreeze, iThrowAway, fThrowAway ); /* Calls to Update() should *not* be scaled by music rate; fCurrentTime is. Undo it. */ const float fRate = GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; diff --git a/src/GameState.cpp b/src/GameState.cpp index d9f4864432..8e20f86ec9 100644 --- a/src/GameState.cpp +++ b/src/GameState.cpp @@ -896,7 +896,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_iWarpEndRow = -1; // Set when a warp is encountered. also see above. -aj + m_fWarpLength = -1; // Set when a warp is encountered. also see above. -aj m_fMusicSecondsVisible = 0; m_fSongBeatVisible = 0; Actor::SetBGMTime( 0, 0, 0, 0 ); @@ -956,16 +956,16 @@ 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_iWarpEndRow ); + timing.GetBeatAndBPSFromElapsedTime( fPositionSeconds, m_fSongBeat, m_fCurBPS, m_bFreeze, m_bDelay, m_iWarpBeginRow, m_fWarpLength ); // "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_iWarpEndRow == -1 ) + if( m_iWarpBeginRow != -1 && m_fWarpLength > 0.f ) { // we got a warp in this section. - LOG->Trace("warp at %i jumps to %i",m_iWarpBeginRow,m_iWarpEndRow); - // i hate this part because how the hell do i convert rows to seconds? + 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); } /* // xxx testing: only do this on monotune survivor @@ -983,10 +983,10 @@ void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &ti m_fSongBeatNoOffset = timing.GetBeatFromElapsedTimeNoOffset( fPositionSeconds ); m_fMusicSecondsVisible = fPositionSeconds - g_fVisualDelaySeconds.Get(); - float fThrowAway; + float fThrowAway, fThrowAway2; bool bThrowAway; - int iThrowAway1, iThrowAway2; - timing.GetBeatAndBPSFromElapsedTime( m_fMusicSecondsVisible, m_fSongBeatVisible, fThrowAway, bThrowAway, bThrowAway, iThrowAway1, iThrowAway2 ); + int iThrowAway; + timing.GetBeatAndBPSFromElapsedTime( m_fMusicSecondsVisible, m_fSongBeatVisible, fThrowAway, bThrowAway, bThrowAway, iThrowAway, fThrowAway2 ); /* // xxx testing: only do this on monotune survivor diff --git a/src/GameState.h b/src/GameState.h index 62e2767406..b553269888 100644 --- a/src/GameState.h +++ b/src/GameState.h @@ -184,10 +184,18 @@ public: //bool m_bStop; // in the middle of a stop (freeze or delay) bool m_bFreeze; // in the middle of a freeze bool m_bDelay; // in the middle of a delay - int m_iWarpBeginRow, m_iWarpEndRow; // used for warping + // used for warping: + int m_iWarpBeginRow; + float m_fWarpLength; RageTimer m_LastBeatUpdate; // time of last m_fSongBeat, etc. update BroadcastOnChange m_bGameplayLeadIn; + // Metricable noteskin things + // void LoadNoteSkinMetrics( PlayerNumber pn ); + // int m_iRowSpacing; + // int m_iColSpacing; + // int m_iArrowSize; + float m_fMusicSecondsVisible; float m_fSongBeatVisible; diff --git a/src/NotesLoaderSM.cpp b/src/NotesLoaderSM.cpp index a0c414c1f2..7c1219fef9 100644 --- a/src/NotesLoaderSM.cpp +++ b/src/NotesLoaderSM.cpp @@ -208,12 +208,13 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) split( arrayBPMChangeExpressions[b+1], "=", arrayNextBPMChangeValues ); const float fNextPositiveBeat = StringToFloat( arrayNextBPMChangeValues[0] ); const float fNextPositiveBPM = StringToFloat( arrayNextBPMChangeValues[1] ); - //LOG->Trace( ssprintf("String (%s) vs. BPM (%f)",arrayNextBPMChangeValues[1].c_str(),fNextPositiveBPM) ); + // tJumpPos = (tPosBPS-abs(negBPS)) + (gPosBPMPosition - fNegPosition) float fDeltaBeat = ((fNextPositiveBPM/60.0f)-abs(fNewBPM/60.0f)) + (fNextPositiveBeat-fBeat); - float fWarpToBeat = fNextPositiveBeat + fDeltaBeat; - WarpSegment wsTemp(BeatToNoteRow(fBeat),BeatToNoteRow(fWarpToBeat)); + //float fWarpLengthBeats = fNextPositiveBeat + fDeltaBeat; + WarpSegment wsTemp(BeatToNoteRow(fBeat),fDeltaBeat); arrayWarpsFromNegativeBPMs.push_back(wsTemp); + /* LOG->Trace( ssprintf("==NotesLoSM negbpm==\nfnextposbeat = %f, fnextposbpm = %f,\nfdelta = %f, fwarpto = %f", fNextPositiveBeat, @@ -236,6 +237,7 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) fDeltaBeat,(fNextPositiveBPM/60.0f),abs(fNewBPM/60.0f),BeatToNoteRow(fNextPositiveBeat),BeatToNoteRow(fBeat)) ); */ + continue; } else { @@ -302,6 +304,7 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) } } + // warps (replacement for Negative BPM and Negative Stops) /* else if( sValueName=="WARPS" ) { @@ -320,27 +323,28 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) continue; } - const float fWarpAt = StringToFloat( arrayWarpValues[0] ); - const float fWarpTo = StringToFloat( arrayWarpValues[1] ); + const float fWarpStart = StringToFloat( arrayWarpValues[0] ); + const float fWarpBeats = StringToFloat( arrayWarpValues[1] ); - if( fWarpAt > 0.0f && fWarpTo > 0.0f ) + if( fWarpStart > 0.0f && fWarpBeats > 0.0f ) { - WarpSegment new_seg( BeatToNoteRow(fWarpAt), BeatToNoteRow(fWarpTo) ); - // LOG->Trace( "Adding a warp segment: starts at %f, jumps to %f", new_seg.m_iStartRow, new_seg.m_iEndRow ); + WarpSegment new_seg( BeatToNoteRow(fWarpStart), fWarpBeats ); out.AddWarpSegment( new_seg ); } else { - // Disallow negative warps, to prevent the same kind of - // problem that happened when Negative/Subtractive BPMs - // arrived on the StepMania scene. -aj - LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid warp: from beat %f to beat %f.", fWarpAt, fWarpTo ); + // Currently disallow negative warps, to prevent the same + // kind of problem that happened when Negative/Subtractive + // BPMs arrived on the StepMania scene. -aj + LOG->UserLog( "Song file", "(UNKNOWN)", "has an invalid warp at beat %f lasting %f beats.", fWarpStart, fWarpBeats ); } } } */ - // We should not support files that contain both Negative BPMs & Warps. + // Note: Even though it is possible to have Negative BPMs and Stops in + // a song along with Warps, we should not support files that contain + // both styles of warp tricks (Negatives vs. #WARPS). // If Warps have been populated from Negative BPMs, then go through that // instead of using the data in the Warps tag. This should be above, // but it breaks compiling so... @@ -351,9 +355,9 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out ) { out.AddWarpSegment( arrayWarpsFromNegativeBPMs[i] ); } - // sorting will need to take place somewhere. } - + // warp sorting will need to take place. + //sort(out.m_WarpSegments.begin(), out.m_WarpSegments.end()); } } diff --git a/src/NotesWriterSM.cpp b/src/NotesWriterSM.cpp index 38ac7fbec8..296d11dff0 100644 --- a/src/NotesWriterSM.cpp +++ b/src/NotesWriterSM.cpp @@ -141,14 +141,11 @@ static void WriteGlobalTags( RageFile &f, const Song &out ) f.Write( "#WARPS:" ); for( unsigned i=0; i& f.PutLine( ssprintf( "// end cache tags" ) ); } - // // Save specified Steps to this file - // FOREACH_CONST( Steps*, vpStepsToSave, s ) { const Steps* pSteps = *s; @@ -311,8 +306,8 @@ void NotesWriterSM::GetEditFileContents( const Song *pSong, const Steps *pSteps, { sOut = ""; RString sDir = pSong->GetSongDir(); - - /* "Songs/foo/bar"; strip off "Songs/". */ + + // "Songs/foo/bar"; strip off "Songs/". vector asParts; split( sDir, "/", asParts ); if( asParts.size() ) @@ -323,7 +318,7 @@ void NotesWriterSM::GetEditFileContents( const Song *pSong, const Steps *pSteps, RString NotesWriterSM::GetEditFileName( const Song *pSong, const Steps *pSteps ) { - /* Try to make a unique name. This isn't guaranteed. Edit descriptions are + /* Try to make a unique name. This isn't guaranteed. Edit descriptions are * case-sensitive, filenames on disk are usually not, and we decimate certain * characters for FAT filesystems. */ RString sFile = pSong->GetTranslitFullTitle() + " - " + pSteps->GetDescription(); @@ -331,7 +326,7 @@ RString NotesWriterSM::GetEditFileName( const Song *pSong, const Steps *pSteps ) // HACK: if( pSteps->m_StepsType == StepsType_dance_double ) sFile += " (doubles)"; - + sFile += ".edit"; MakeValidFilename( sFile ); @@ -372,7 +367,7 @@ bool NotesWriterSM::WriteEditFileToMachine( const Song *pSong, Steps *pSteps, RS } /* If the file name of the edit has changed since the last save, then delete the old - * file after saving the new one. If we delete it first, then we'll lose data on error. */ + * file after saving the new one. If we delete it first, then we'll lose data on error. */ if( bFileNameChanging ) FILEMAN->Remove( pSteps->GetFilename() ); diff --git a/src/Player.cpp b/src/Player.cpp index b174afd165..b005f03118 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -850,7 +850,7 @@ void Player::Update( float fDeltaTime ) { if( !vHoldNotesToGradeTogether.empty() ) { - LOG->Trace( ssprintf("UpdateHoldNotes; %i != %i || !judge holds on same row together",iRow,iRowOfLastHoldNote) ); + //LOG->Trace( ssprintf("UpdateHoldNotes; %i != %i || !judge holds on same row together",iRow,iRowOfLastHoldNote) ); UpdateHoldNotes( iSongRow, fDeltaTime, vHoldNotesToGradeTogether ); vHoldNotesToGradeTogether.clear(); } @@ -861,7 +861,7 @@ void Player::Update( float fDeltaTime ) if( !vHoldNotesToGradeTogether.empty() ) { - LOG->Trace("UpdateHoldNotes since !vHoldNotesToGradeTogether.empty()"); + //LOG->Trace("UpdateHoldNotes since !vHoldNotesToGradeTogether.empty()"); UpdateHoldNotes( iSongRow, fDeltaTime, vHoldNotesToGradeTogether ); vHoldNotesToGradeTogether.clear(); } @@ -913,8 +913,8 @@ void Player::UpdateHoldNotes( int iSongRow, float fDeltaTime, vectorTrace("--------------------------------"); /* - LOG->Trace("--------------------------------"); LOG->Trace("[Player::UpdateHoldNotes] begins"); LOG->Trace( ssprintf("song row %i, deltaTime = %f",iSongRow,fDeltaTime) ); */ @@ -947,6 +947,7 @@ void Player::UpdateHoldNotes( int iSongRow, float fDeltaTime, vectorTrace( ssprintf("start row: %i; max/end row: = %i",iStartRow,iMaxEndRow) ); //LOG->Trace( ssprintf("first track with max end row = %i",iFirstTrackWithMaxEndRow) ); + //LOG->Trace( ssprintf("max end row - start row (in beats) = %f",NoteRowToBeat(iMaxEndRow)-NoteRowToBeat(iStartRow)) ); FOREACH( TrackRowTapNote, vTN, trtn ) { @@ -1011,11 +1012,11 @@ void Player::UpdateHoldNotes( int iSongRow, float fDeltaTime, vectorm_pCurSong->m_Timing.GetBeatAndBPSFromElapsedTime( fEarliestTime, fMissIfOlderThanThisBeat, fThrowAway, bFreeze, bDelay, iWarpBeginRow, iWarpEndRow ); + int iWarpBeginRow; + float fWarpLength; + GAMESTATE->m_pCurSong->m_Timing.GetBeatAndBPSFromElapsedTime( fEarliestTime, fMissIfOlderThanThisBeat, fThrowAway, bFreeze, bDelay, iWarpBeginRow, fWarpLength ); iMissIfOlderThanThisRow = BeatToNoteRow( fMissIfOlderThanThisBeat ); if( bFreeze || bDelay ) @@ -2521,7 +2523,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_iWarpEndRow ) + if( iter.Row() >= GAMESTATE->m_iWarpBeginRow && iter.Row() <= (GAMESTATE->m_iWarpBeginRow + BeatToNoteRow(GAMESTATE->m_fWarpLength)) ) continue; tn.result.tns = TNS_Miss; @@ -2547,7 +2549,8 @@ void Player::UpdateJudgedRows() iLastSeenRow = iRow; // if row is within a warp section, ignore it. -aj - if(iRow >= GAMESTATE->m_iWarpBeginRow && iRow <= GAMESTATE->m_iWarpEndRow) + if( iRow >= GAMESTATE->m_iWarpBeginRow && + iRow <= (GAMESTATE->m_iWarpBeginRow + BeatToNoteRow(GAMESTATE->m_fWarpLength)) ) continue; // crossed a nonempty row @@ -2910,7 +2913,8 @@ void Player::HandleTapRowScore( unsigned row ) #endif // more warp hackery. -aj - if(row >= (unsigned)GAMESTATE->m_iWarpBeginRow && row <= (unsigned)GAMESTATE->m_iWarpEndRow) + if( row >= (unsigned)GAMESTATE->m_iWarpBeginRow && + row <= (unsigned)(GAMESTATE->m_iWarpBeginRow + BeatToNoteRow(GAMESTATE->m_fWarpLength)) ) return; if( GAMESTATE->m_bDemonstrationOrJukebox ) @@ -2982,14 +2986,11 @@ void Player::HandleTapRowScore( unsigned row ) if( m_pPlayerStageStats ) m_pPlayerStageStats->m_iMaxCombo = max(m_pPlayerStageStats->m_iMaxCombo, iCurCombo); - /* - * Use the real current beat, not the beat we've been passed. That's because we - * want to record the current life/combo to the current time; eg. if it's a MISS, - * the beat we're registering is in the past, but the life is changing now. - * - * We need to include time from previous songs in a course, so we can't use - * GAMESTATE->m_fMusicSeconds. Use fStepsSeconds instead. - */ + /* Use the real current beat, not the beat we've been passed. That's because + * we want to record the current life/combo to the current time; eg. if it's + * a MISS, the beat we're registering is in the past, but the life is changing + * now. We need to include time from previous songs in a course, so we + * can't use GAMESTATE->m_fMusicSeconds. Use fStepsSeconds instead. */ if( m_pPlayerStageStats ) m_pPlayerStageStats->UpdateComboList( STATSMAN->m_CurStageStats.m_fStepsSeconds, false ); @@ -3188,9 +3189,29 @@ void Player::SetCombo( int iCombo, int iMisses ) if( b1000Milestone ) this->PlayCommand( "ThousandMilestone" ); - // don't show a colored combo until 1/4 of the way through the song - bool bPastBeginning = (!GAMESTATE->IsCourseMode() || GAMESTATE->GetCourseSongIndex()>0) && - GAMESTATE->m_fMusicSeconds > GAMESTATE->m_pCurSong->m_fMusicLengthSeconds * PERCENT_UNTIL_COLOR_COMBO; + /* Colored combo logic differs between Songs and Courses. + * Songs: + * The theme decides how far into the song the combo color should appear. + * (PERCENT_UNTIL_COLOR_COMBO) + * + * Courses: + * PERCENT_UNTIL_COLOR_COMBO refers to how long through the course the + * combo color should appear (scaling to the number of songs). This may + * not be desired behavior, however. -aj + * + * TODO: Add a metric that determines Course combo colors logic? + * Or possibly move the logic to a Lua function? -aj */ + bool bPastBeginning = false; + if( GAMESTATE->IsCourseMode() ) + { + int iSongIndexStartColoring = GAMESTATE->m_pCurCourse->GetEstimatedNumStages(); + iSongIndexStartColoring = floor(iSongIndexStartColoring*PERCENT_UNTIL_COLOR_COMBO); + bPastBeginning = GAMESTATE->GetCourseSongIndex() >= iSongIndexStartColoring; + } + else + { + bPastBeginning = GAMESTATE->m_fMusicSeconds > GAMESTATE->m_pCurSong->m_fMusicLengthSeconds * PERCENT_UNTIL_COLOR_COMBO; + } if( m_bSendJudgmentAndComboMessages ) { diff --git a/src/TimingData.cpp b/src/TimingData.cpp index 54b86dac23..5af204256a 100644 --- a/src/TimingData.cpp +++ b/src/TimingData.cpp @@ -110,7 +110,7 @@ void TimingData::SetDelayAtRow( int iRow, float fSeconds ) } /* -void TimingData::SetWarpAtRow( int iRowAt, int iRowTo ) +void TimingData::SetWarpAtRow( int iRowAt, float fLengthBeats ) { // todo: code this -aj } @@ -137,7 +137,7 @@ int TimingData::GetWarpToRow( int iWarpBeginRow ) const { if( m_WarpSegments[i].m_iStartRow == iWarpBeginRow ) { - return m_WarpSegments[i].m_iEndRow; + return iWarpBeginRow + BeatToNoteRow(m_WarpSegments[i].m_fWarpBeats); } } return 0; @@ -223,14 +223,14 @@ BPMSegment& TimingData::GetBPMSegmentAtBeat( float fBeat ) return m_BPMSegments[i]; } -void TimingData::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut, bool &bDelayOut, int &iWarpBeginOut, int &iWarpEndOut ) const +void TimingData::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut, bool &bDelayOut, int &iWarpBeginOut, float &fWarpLengthOut ) const { fElapsedTime += PREFSMAN->m_fGlobalOffsetSeconds; - GetBeatAndBPSFromElapsedTimeNoOffset( fElapsedTime, fBeatOut, fBPSOut, bFreezeOut, bDelayOut, iWarpBeginOut, iWarpEndOut ); + GetBeatAndBPSFromElapsedTimeNoOffset( fElapsedTime, fBeatOut, fBPSOut, bFreezeOut, bDelayOut, iWarpBeginOut, fWarpLengthOut ); } -void TimingData::GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut, bool &bDelayOut, int &iWarpBeginOut, int &iWarpEndOut ) const +void TimingData::GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut, bool &bDelayOut, int &iWarpBeginOut, float &fWarpLengthOut ) const { // LOG->Trace( "GetBeatAndBPSFromElapsedTime( fElapsedTime = %f )", fElapsedTime ); const float fTime = fElapsedTime; @@ -277,7 +277,7 @@ void TimingData::GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float bFreezeOut = !bIsDelay; bDelayOut = bIsDelay; //iWarpBeginOut = -1; - //iWarpEndOut = -1; + //fWarpLengthOut = -1; return; } } @@ -290,17 +290,31 @@ void TimingData::GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float if( !bIsLastBPMSegment && m_WarpSegments[j].m_iStartRow > iStartRowNextSegment ) continue; - // this warp lies within this BPMSegment. - iWarpBeginOut = m_WarpSegments[j].m_iStartRow; - iWarpEndOut = m_WarpSegments[j].m_iEndRow; - - // this warp lies within this BPMSegment, and these are wrong - // huh? -aj + // are these wrong? am I second guessing myself? /* const int iRowsBeatsSinceStartOfSegment = m_WarpSegments[j].m_iStartRow - iStartRowThisSegment; const float fBeatsSinceStartOfSegment = NoteRowToBeat(iRowsBeatsSinceStartOfSegment); const float fWarpStartSecond = fBeatsSinceStartOfSegment / fBPS; */ + + // the freeze segment is <= current time + //fElapsedTime -= m_WarpSegments[j].m_fWarpBeats; + + // this warp lies within this BPMSegment. + /* + if( fWarpStartSecond >= fElapsedTime ) + { + // this WarpSegment IS the current segment. + // don't know how to properly handle beatout -aj + //fBeatOut = NoteRowToBeat(m_WarpSegments[j].m_iStartRow); + fBPSOut = m_BPMSegments[i+1].m_fBPS; + bFreezeOut = false; + bDelayOut = false; + iWarpBeginOut = m_WarpSegments[j].m_iStartRow; + fWarpLengthOut = m_WarpSegments[j].m_fWarpBeats; + return; + } + */ } const float fBeatsInThisSegment = fStartBeatNextSegment - fStartBeatThisSegment; @@ -320,7 +334,7 @@ void TimingData::GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float bFreezeOut = false; bDelayOut = false; //iWarpBeginOut; - //iWarpEndOut; + //fWarpLengthOut; return; } diff --git a/src/TimingData.h b/src/TimingData.h index ef0d537dfb..86ac600492 100644 --- a/src/TimingData.h +++ b/src/TimingData.h @@ -91,15 +91,15 @@ struct TimeSignatureSegment * both rows though.) */ struct WarpSegment { - WarpSegment() : m_iStartRow(-1), m_iEndRow(-1) { } - WarpSegment( int s, int e ){ m_iStartRow = max( 0, s ); m_iEndRow = max( 0, e ); } + WarpSegment() : m_iStartRow(-1), m_fWarpBeats(-1) { } + WarpSegment( int s, float b ){ m_iStartRow = max( 0, s ); m_fWarpBeats = max( 0, b ); } int m_iStartRow; - int m_iEndRow; + float m_fWarpBeats; bool operator==( const WarpSegment &other ) const { COMPARE( m_iStartRow ); - COMPARE( m_iEndRow ); + COMPARE( m_fWarpBeats ); return true; } bool operator!=( const WarpSegment &other ) const { return !operator==(other); } @@ -132,24 +132,24 @@ public: BPMSegment& GetBPMSegmentAtBeat( float fBeat ); void NoteRowToMeasureAndBeat( int iNoteRow, int &iMeasureIndexOut, int &iBeatIndexOut, int &iRowsRemainder ) const; - void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut, bool &bDelayOut, int &iWarpBeginOut, int &iWarpEndOut ) const; + void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut, bool &bDelayOut, int &iWarpBeginOut, float &fWarpLengthOut ) const; float GetBeatFromElapsedTime( float fElapsedTime ) const // shortcut for places that care only about the beat { - float fBeat, fThrowAway; + float fBeat, fThrowAway, fThrowAway2; bool bThrowAway, bThrowAway2; - int iThrowAway, iThrowAway2; - GetBeatAndBPSFromElapsedTime( fElapsedTime, fBeat, fThrowAway, bThrowAway, bThrowAway2, iThrowAway, iThrowAway2 ); + int iThrowAway; + GetBeatAndBPSFromElapsedTime( fElapsedTime, fBeat, fThrowAway, bThrowAway, bThrowAway2, iThrowAway, fThrowAway2 ); return fBeat; } float GetElapsedTimeFromBeat( float fBeat ) const; - void GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut, bool &bDelayOut, int &iWarpBeginOut, int &iWarpEndOut ) const; + void GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut, bool &bDelayOut, int &iWarpBeginOut, float &iWarpLengthOut ) const; float GetBeatFromElapsedTimeNoOffset( float fElapsedTime ) const // shortcut for places that care only about the beat { - float fBeat, fThrowAway; + float fBeat, fThrowAway, fThrowAway2; bool bThrowAway, bThrowAway2; - int iThrowAway, iThrowAway2; - GetBeatAndBPSFromElapsedTimeNoOffset( fElapsedTime, fBeat, fThrowAway, bThrowAway, bThrowAway2, iThrowAway, iThrowAway2 ); + int iThrowAway; + GetBeatAndBPSFromElapsedTimeNoOffset( fElapsedTime, fBeat, fThrowAway, bThrowAway, bThrowAway2, iThrowAway, fThrowAway2 ); return fBeat; } float GetElapsedTimeFromBeatNoOffset( float fBeat ) const;