diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 82a803c226..c354a9a02d 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -450,17 +450,17 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac } // change BG every BPM change that is at the beginning of a measure - int iStartIndex = BeatToNoteRow(fFirstBeat); - int iEndIndex = BeatToNoteRow(fEndBeat); + int iStartRow = BeatToNoteRow(fFirstBeat); + int iEndRow = BeatToNoteRow(fEndBeat); for( unsigned i=0; i= iStartIndex && bpmseg.m_iStartIndex < iEndIndex; + bool bInRange = bpmseg.m_iStartRow >= iStartRow && bpmseg.m_iStartRow < iEndRow; if( !bInRange ) continue; // skip @@ -470,7 +470,7 @@ void BackgroundImpl::LoadFromRandom( float fFirstBeat, float fEndBeat, const Bac BackgroundChange c = change; c.m_def.m_sFile1 = bd.m_sFile1; c.m_def.m_sFile2 = bd.m_sFile2; - c.m_fStartBeat = NoteRowToBeat(bpmseg.m_iStartIndex); + c.m_fStartBeat = NoteRowToBeat(bpmseg.m_iStartRow); m_Layer[0].m_aBGChanges.push_back( c ); } } diff --git a/stepmania/src/NoteField.cpp b/stepmania/src/NoteField.cpp index 3cf448adf7..0a1f2c04cd 100644 --- a/stepmania/src/NoteField.cpp +++ b/stepmania/src/NoteField.cpp @@ -591,10 +591,10 @@ void NoteField::DrawPrimitives() const vector &aBPMSegments = GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments; for( unsigned i=0; i= iFirstIndexToDraw && - aBPMSegments[i].m_iStartIndex <= iLastIndexToDraw) + if( aBPMSegments[i].m_iStartRow >= iFirstIndexToDraw && + aBPMSegments[i].m_iStartRow <= iLastIndexToDraw) { - float fBeat = NoteRowToBeat(aBPMSegments[i].m_iStartIndex); + float fBeat = NoteRowToBeat(aBPMSegments[i].m_iStartRow); if( IS_ON_SCREEN(fBeat) ) DrawBPMText( fBeat, aBPMSegments[i].GetBPM() ); } diff --git a/stepmania/src/NotesLoaderBMS.cpp b/stepmania/src/NotesLoaderBMS.cpp index 13c61ca45a..dd631975da 100644 --- a/stepmania/src/NotesLoaderBMS.cpp +++ b/stepmania/src/NotesLoaderBMS.cpp @@ -899,7 +899,7 @@ static void ReadGlobalTags( const NameToData_t &mapNameToData, Song &out, Measur { BPMSegment newSeg( iStepIndex, fBPM ); out.AddBPMSegment( newSeg ); - LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", NoteRowToBeat(newSeg.m_iStartIndex), newSeg.GetBPM() ); + LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", NoteRowToBeat(newSeg.m_iStartRow), newSeg.GetBPM() ); } else diff --git a/stepmania/src/NotesLoaderMidi.cpp b/stepmania/src/NotesLoaderMidi.cpp index 1235cc9691..fd71a02857 100644 --- a/stepmania/src/NotesLoaderMidi.cpp +++ b/stepmania/src/NotesLoaderMidi.cpp @@ -628,7 +628,7 @@ static bool LoadFromMidi( const RString &sPath, Song &songOut ) FOREACH_CONST( MidiFileIn::TempoChange, midi.tempoEvents_, iter ) { BPMSegment bpmSeg; - bpmSeg.m_iStartIndex = MidiCountToNoteRow( iter->count ); + bpmSeg.m_iStartRow = MidiCountToNoteRow( iter->count ); double fSecondsPerBeat = (iter->tickSeconds * GUITAR_MIDI_COUNTS_PER_BEAT); bpmSeg.m_fBPS = 1 / fSecondsPerBeat; diff --git a/stepmania/src/NotesWriterDWI.cpp b/stepmania/src/NotesWriterDWI.cpp index 94b6b48b54..cea35df065 100644 --- a/stepmania/src/NotesWriterDWI.cpp +++ b/stepmania/src/NotesWriterDWI.cpp @@ -358,7 +358,7 @@ bool NotesWriterDWI::Write( RString sPath, const Song &out ) /* Write transliterations, if we have them, since DWI doesn't support UTF-8. */ f.PutLine( ssprintf("#TITLE:%s;", DwiEscape(out.GetTranslitFullTitle()).c_str()) ); f.PutLine( ssprintf("#ARTIST:%s;", DwiEscape(out.GetTranslitArtist()).c_str()) ); - ASSERT( out.m_Timing.m_BPMSegments[0].m_iStartIndex == 0 ); + ASSERT( out.m_Timing.m_BPMSegments[0].m_iStartRow == 0 ); f.PutLine( ssprintf("#FILE:%s;", DwiEscape(out.m_sMusicFile).c_str()) ); f.PutLine( ssprintf("#BPM:%.3f;", out.m_Timing.m_BPMSegments[0].GetBPM()) ); f.PutLine( ssprintf("#GAP:%ld;", -lrintf( out.m_Timing.m_fBeat0OffsetInSeconds*1000 )) ); @@ -403,7 +403,7 @@ bool NotesWriterDWI::Write( RString sPath, const Song &out ) for( unsigned i=1; i= iNoteRow ) + if( m_BPMSegments[i].m_iStartRow >= iNoteRow ) break; - if( i == m_BPMSegments.size() || m_BPMSegments[i].m_iStartIndex != iNoteRow ) + if( i == m_BPMSegments.size() || m_BPMSegments[i].m_iStartRow != iNoteRow ) { // There is no BPMSegment at the specified beat. If the BPM being set differs // from the last BPMSegment's BPM, create a new BPMSegment. @@ -99,9 +99,9 @@ void TimingData::MultiplyBPMInBeatRange( int iStartIndex, int iEndIndex, float f /* Change all other BPM segments in this range. */ for( unsigned i=0; i iStartIndex ) { BPMSegment b = m_BPMSegments[i]; - b.m_iStartIndex = iStartIndexNextSegment; + b.m_iStartRow = iStartIndexNextSegment; m_BPMSegments.insert( m_BPMSegments.begin()+i+1, b ); /* Don't apply the BPM change to the first half of the segment we just split, @@ -122,7 +122,7 @@ void TimingData::MultiplyBPMInBeatRange( int iStartIndex, int iEndIndex, float f if( iStartIndexThisSegment < iEndIndex && iStartIndexNextSegment > iEndIndex ) { BPMSegment b = m_BPMSegments[i]; - b.m_iStartIndex = iEndIndex; + b.m_iStartRow = iEndIndex; m_BPMSegments.insert( m_BPMSegments.begin()+i+1, b ); } else if( iStartIndexNextSegment > iEndIndex ) @@ -137,7 +137,7 @@ float TimingData::GetBPMAtBeat( float fBeat ) const int iIndex = BeatToNoteRow( fBeat ); unsigned i; for( i=0; i iIndex ) + if( m_BPMSegments[i+1].m_iStartRow > iIndex ) break; return m_BPMSegments[i].GetBPM(); } @@ -147,7 +147,7 @@ int TimingData::GetBPMSegmentIndexAtBeat( float fBeat ) int iIndex = BeatToNoteRow( fBeat ); int i; for( i=0; i<(int)(m_BPMSegments.size())-1; i++ ) - if( m_BPMSegments[i+1].m_iStartIndex > iIndex ) + if( m_BPMSegments[i+1].m_iStartRow > iIndex ) break; return i; } @@ -178,11 +178,11 @@ void TimingData::GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float for( unsigned i=0; i iEndIndex ) - m_BPMSegments[i].m_iStartIndex += lrintf( (iEndIndex - iStartIndex) * (fScale - 1) ); + m_BPMSegments[i].m_iStartRow += lrintf( (iEndIndex - iStartIndex) * (fScale - 1) ); else - m_BPMSegments[i].m_iStartIndex = lrintf( (iSegStart - iStartIndex) * fScale ) + iStartIndex; + m_BPMSegments[i].m_iStartRow = lrintf( (iSegStart - iStartIndex) * fScale ) + iStartIndex; } for( unsigned i = 0; i < m_StopSegments.size(); i++ ) @@ -309,9 +309,9 @@ void TimingData::InsertRows( int iStartRow, int iRowsToAdd ) for( unsigned i = 0; i < m_BPMSegments.size(); i++ ) { BPMSegment &bpm = m_BPMSegments[i]; - if( bpm.m_iStartIndex < iStartRow ) + if( bpm.m_iStartRow < iStartRow ) continue; - bpm.m_iStartIndex += iRowsToAdd; + bpm.m_iStartRow += iRowsToAdd; } for( unsigned i = 0; i < m_StopSegments.size(); i++ ) @@ -327,7 +327,7 @@ void TimingData::InsertRows( int iStartRow, int iRowsToAdd ) /* If we're shifting up at the beginning, we just shifted up the first BPMSegment. That * segment must always begin at 0. */ ASSERT( m_BPMSegments.size() > 0 ); - m_BPMSegments[0].m_iStartIndex = 0; + m_BPMSegments[0].m_iStartRow = 0; } } @@ -344,11 +344,11 @@ void TimingData::DeleteRows( int iStartRow, int iRowsToDelete ) BPMSegment &bpm = m_BPMSegments[i]; /* Before deleted region: */ - if( bpm.m_iStartIndex < iStartRow ) + if( bpm.m_iStartRow < iStartRow ) continue; /* Inside deleted region: */ - if( bpm.m_iStartIndex < iStartRow+iRowsToDelete ) + if( bpm.m_iStartRow < iStartRow+iRowsToDelete ) { m_BPMSegments.erase( m_BPMSegments.begin()+i, m_BPMSegments.begin()+i+1 ); --i; @@ -356,7 +356,7 @@ void TimingData::DeleteRows( int iStartRow, int iRowsToDelete ) } /* After deleted region: */ - bpm.m_iStartIndex -= iRowsToDelete; + bpm.m_iStartRow -= iRowsToDelete; } for( unsigned i = 0; i < m_StopSegments.size(); i++ ) diff --git a/stepmania/src/TimingData.h b/stepmania/src/TimingData.h index d9577710e2..fd2bd8d474 100644 --- a/stepmania/src/TimingData.h +++ b/stepmania/src/TimingData.h @@ -9,9 +9,9 @@ struct BPMSegment { - BPMSegment() : m_iStartIndex(-1), m_fBPS(-1.0f) { } - BPMSegment( int s, float b ) { m_iStartIndex = max( 0, s ); SetBPM( b ); } - int m_iStartIndex; + BPMSegment() : m_iStartRow(-1), m_fBPS(-1.0f) { } + BPMSegment( int s, float b ) { m_iStartRow = max( 0, s ); SetBPM( b ); } + int m_iStartRow; float m_fBPS; void SetBPM( float f ) { m_fBPS = f / 60.0f; } @@ -19,12 +19,12 @@ struct BPMSegment bool operator==( const BPMSegment &other ) const { - COMPARE( m_iStartIndex ); + COMPARE( m_iStartRow ); COMPARE( m_fBPS ); return true; } bool operator!=( const BPMSegment &other ) const { return !operator==(other); } - bool operator<( const BPMSegment &other ) const { return m_iStartIndex < other.m_iStartIndex; } + bool operator<( const BPMSegment &other ) const { return m_iStartRow < other.m_iStartRow; } }; struct StopSegment