StartIndex -> StartRow
This commit is contained in:
@@ -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<timing.m_BPMSegments.size(); i++ )
|
||||
{
|
||||
const BPMSegment& bpmseg = timing.m_BPMSegments[i];
|
||||
|
||||
if( bpmseg.m_iStartIndex % BeatToNoteRow((float) BEATS_PER_MEASURE) != 0 )
|
||||
if( bpmseg.m_iStartRow % BeatToNoteRow((float) BEATS_PER_MEASURE) != 0 )
|
||||
continue; // skip
|
||||
|
||||
// start so that we don't create a BGChange right on top of fEndBeat
|
||||
bool bInRange = bpmseg.m_iStartIndex >= 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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,10 +591,10 @@ void NoteField::DrawPrimitives()
|
||||
const vector<BPMSegment> &aBPMSegments = GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments;
|
||||
for( unsigned i=0; i<aBPMSegments.size(); i++ )
|
||||
{
|
||||
if( aBPMSegments[i].m_iStartIndex >= 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() );
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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<out.m_Timing.m_BPMSegments.size(); i++ )
|
||||
{
|
||||
const BPMSegment &bs = out.m_Timing.m_BPMSegments[i];
|
||||
f.Write( ssprintf("%.3f=%.3f", bs.m_iStartIndex * 4.0f / ROWS_PER_BEAT, bs.GetBPM() ) );
|
||||
f.Write( ssprintf("%.3f=%.3f", bs.m_iStartRow * 4.0f / ROWS_PER_BEAT, bs.GetBPM() ) );
|
||||
if( i != out.m_Timing.m_BPMSegments.size()-1 )
|
||||
f.Write( "," );
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
|
||||
{
|
||||
const BPMSegment &bs = out.m_Timing.m_BPMSegments[i];
|
||||
|
||||
f.Write( ssprintf( "%.3f=%.3f", NoteRowToBeat(bs.m_iStartIndex), bs.GetBPM() ) );
|
||||
f.Write( ssprintf( "%.3f=%.3f", NoteRowToBeat(bs.m_iStartRow), bs.GetBPM() ) );
|
||||
if( i != out.m_Timing.m_BPMSegments.size()-1 )
|
||||
f.Write( "," );
|
||||
}
|
||||
|
||||
@@ -456,8 +456,8 @@ void Song::TidyUpData()
|
||||
}
|
||||
|
||||
/* Make sure the first BPM segment starts at beat 0. */
|
||||
if( m_Timing.m_BPMSegments[0].m_iStartIndex != 0 )
|
||||
m_Timing.m_BPMSegments[0].m_iStartIndex = 0;
|
||||
if( m_Timing.m_BPMSegments[0].m_iStartRow != 0 )
|
||||
m_Timing.m_BPMSegments[0].m_iStartRow = 0;
|
||||
|
||||
|
||||
if( m_fMusicSampleStartSeconds == -1 ||
|
||||
|
||||
@@ -41,10 +41,10 @@ void TimingData::SetBPMAtRow( int iNoteRow, float fBPM )
|
||||
float fBPS = fBPM / 60.0f;
|
||||
unsigned i;
|
||||
for( i=0; i<m_BPMSegments.size(); i++ )
|
||||
if( m_BPMSegments[i].m_iStartIndex >= 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<m_BPMSegments.size(); i++ )
|
||||
{
|
||||
const int iStartIndexThisSegment = m_BPMSegments[i].m_iStartIndex;
|
||||
const int iStartIndexThisSegment = m_BPMSegments[i].m_iStartRow;
|
||||
const bool bIsLastBPMSegment = i==m_BPMSegments.size()-1;
|
||||
const int iStartIndexNextSegment = bIsLastBPMSegment ? INT_MAX : m_BPMSegments[i+1].m_iStartIndex;
|
||||
const int iStartIndexNextSegment = bIsLastBPMSegment ? INT_MAX : m_BPMSegments[i+1].m_iStartRow;
|
||||
|
||||
if( iStartIndexThisSegment <= iStartIndex && iStartIndexNextSegment <= iStartIndex )
|
||||
continue;
|
||||
@@ -110,7 +110,7 @@ void TimingData::MultiplyBPMInBeatRange( int iStartIndex, int iEndIndex, float f
|
||||
if( iStartIndexThisSegment < iStartIndex && iStartIndexNextSegment > 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<m_BPMSegments.size()-1; i++ )
|
||||
if( m_BPMSegments[i+1].m_iStartIndex > 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<m_BPMSegments.size(); i++ ) // foreach BPMSegment
|
||||
{
|
||||
const int iStartRowThisSegment = m_BPMSegments[i].m_iStartIndex;
|
||||
const int iStartRowThisSegment = m_BPMSegments[i].m_iStartRow;
|
||||
const float fStartBeatThisSegment = NoteRowToBeat( iStartRowThisSegment );
|
||||
const bool bIsFirstBPMSegment = i==0;
|
||||
const bool bIsLastBPMSegment = i==m_BPMSegments.size()-1;
|
||||
const int iStartRowNextSegment = bIsLastBPMSegment ? MAX_NOTE_ROW : m_BPMSegments[i+1].m_iStartIndex;
|
||||
const int iStartRowNextSegment = bIsLastBPMSegment ? MAX_NOTE_ROW : m_BPMSegments[i+1].m_iStartRow;
|
||||
const float fStartBeatNextSegment = NoteRowToBeat( iStartRowNextSegment );
|
||||
const float fBPS = m_BPMSegments[i].m_fBPS;
|
||||
|
||||
@@ -261,8 +261,8 @@ float TimingData::GetElapsedTimeFromBeatNoOffset( float fBeat ) const
|
||||
}
|
||||
else
|
||||
{
|
||||
const int iStartIndexThisSegment = m_BPMSegments[i].m_iStartIndex;
|
||||
const int iStartIndexNextSegment = m_BPMSegments[i+1].m_iStartIndex;
|
||||
const int iStartIndexThisSegment = m_BPMSegments[i].m_iStartRow;
|
||||
const int iStartIndexNextSegment = m_BPMSegments[i+1].m_iStartRow;
|
||||
const int iRowsInThisSegment = min( iStartIndexNextSegment - iStartIndexThisSegment, iRow );
|
||||
fElapsedTime += NoteRowToBeat( iRowsInThisSegment ) / fBPS;
|
||||
iRow -= iRowsInThisSegment;
|
||||
@@ -283,13 +283,13 @@ void TimingData::ScaleRegion( float fScale, int iStartIndex, int iEndIndex )
|
||||
|
||||
for ( unsigned i = 0; i < m_BPMSegments.size(); i++ )
|
||||
{
|
||||
const int iSegStart = m_BPMSegments[i].m_iStartIndex;
|
||||
const int iSegStart = m_BPMSegments[i].m_iStartRow;
|
||||
if( iSegStart < iStartIndex )
|
||||
continue;
|
||||
else if( iSegStart > 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++ )
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user