Bring TickcountSegments to refactored level.
I wonder how many of the 8 will be claimed upon wakeup.
This commit is contained in:
+3
-3
@@ -946,11 +946,11 @@ void NoteField::DrawPrimitives()
|
||||
// Tickcount text
|
||||
FOREACH_CONST( TickcountSegment, timing.m_TickcountSegments, seg )
|
||||
{
|
||||
if( seg->m_iStartRow >= iFirstRowToDraw && seg->m_iStartRow <= iLastRowToDraw )
|
||||
if( seg->GetRow() >= iFirstRowToDraw && seg->GetRow() <= iLastRowToDraw )
|
||||
{
|
||||
float fBeat = NoteRowToBeat(seg->m_iStartRow);
|
||||
float fBeat = seg->GetBeat();
|
||||
if( IS_ON_SCREEN(fBeat) )
|
||||
DrawTickcountText( fBeat, seg->m_iTicks );
|
||||
DrawTickcountText( fBeat, seg->GetTicks() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,13 +541,12 @@ static bool LoadGlobalData( const RString &sPath, Song &out, bool &bKIUCompliant
|
||||
* and stops. It will be called again in LoadFromKSFFile for the
|
||||
* actual steps. */
|
||||
iTickCount = StringToInt( sParams[1] );
|
||||
iTickCount = iTickCount > 0 ? iTickCount : 2; // again, Direct Move uses 4 as a default.
|
||||
iTickCount = iTickCount > 0 ? iTickCount : 4;
|
||||
// add a tickcount for those using the [Player]
|
||||
// CheckpointsUseTimeSignatures metric. -aj
|
||||
// It's not with timesigs now -DaisuMaster
|
||||
TickcountSegment tcs;
|
||||
tcs.m_iStartRow = BeatToNoteRow(0.0f);
|
||||
tcs.m_iTicks = iTickCount > ROWS_PER_BEAT ? ROWS_PER_BEAT : iTickCount;
|
||||
TickcountSegment tcs(0);
|
||||
tcs.SetTicks(iTickCount > ROWS_PER_BEAT ? ROWS_PER_BEAT : iTickCount);
|
||||
out.m_SongTiming.AddTickcountSegment( tcs );
|
||||
}
|
||||
else if ( sValueName=="STEP" )
|
||||
|
||||
@@ -122,7 +122,7 @@ static void GetTimingTags( vector<RString> &lines, TimingData timing, bool bIsSo
|
||||
ASSERT( !timing.m_TickcountSegments.empty() );
|
||||
w.Init( "TICKCOUNTS" );
|
||||
FOREACH_CONST( TickcountSegment, timing.m_TickcountSegments, ts )
|
||||
w.Write( ts->m_iStartRow, ts->m_iTicks );
|
||||
w.Write( ts->GetRow(), ts->GetTicks() );
|
||||
w.Finish();
|
||||
|
||||
ASSERT( !timing.m_ComboSegments.empty() );
|
||||
|
||||
+17
-16
@@ -205,21 +205,21 @@ void TimingData::SetTickcountAtRow( int iRow, int iTicks )
|
||||
{
|
||||
unsigned i;
|
||||
for( i=0; i<m_TickcountSegments.size(); i++ )
|
||||
if( m_TickcountSegments[i].m_iStartRow >= iRow )
|
||||
if( m_TickcountSegments[i].GetRow() >= iRow )
|
||||
break;
|
||||
|
||||
if( i == m_TickcountSegments.size() || m_TickcountSegments[i].m_iStartRow != iRow )
|
||||
if( i == m_TickcountSegments.size() || m_TickcountSegments[i].GetRow() != iRow )
|
||||
{
|
||||
// No TickcountSegment here. Make a new segment if required.
|
||||
if( i == 0 || m_TickcountSegments[i-1].m_iTicks != iTicks )
|
||||
if( i == 0 || m_TickcountSegments[i-1].GetTicks() != iTicks )
|
||||
AddTickcountSegment( TickcountSegment(iRow, iTicks ) );
|
||||
}
|
||||
else // TickcountSegment being modified is m_TickcountSegments[i]
|
||||
{
|
||||
if( i > 0 && m_TickcountSegments[i-1].m_iTicks == iTicks )
|
||||
if( i > 0 && m_TickcountSegments[i-1].GetTicks() == iTicks )
|
||||
m_TickcountSegments.erase( m_TickcountSegments.begin()+i, m_TickcountSegments.begin()+i+1 );
|
||||
else
|
||||
m_TickcountSegments[i].m_iTicks = iTicks;
|
||||
m_TickcountSegments[i].SetTicks(iTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ int TimingData::GetTickcountSegmentIndexAtRow( int iRow ) const
|
||||
{
|
||||
unsigned i;
|
||||
for (i=0; i < m_TickcountSegments.size() - 1; i++ )
|
||||
if( m_TickcountSegments[i+1].m_iStartRow > iRow )
|
||||
if( m_TickcountSegments[i+1].GetRow() > iRow )
|
||||
break;
|
||||
return static_cast<int>(i);
|
||||
}
|
||||
@@ -749,7 +749,7 @@ TickcountSegment& TimingData::GetTickcountSegmentAtRow( int iRow )
|
||||
|
||||
int TimingData::GetTickcountAtRow( int iRow ) const
|
||||
{
|
||||
return m_TickcountSegments[GetTickcountSegmentIndexAtRow( iRow )].m_iTicks;
|
||||
return m_TickcountSegments[GetTickcountSegmentIndexAtRow( iRow )].GetTicks();
|
||||
}
|
||||
|
||||
float TimingData::GetPreviousLabelSegmentBeatAtRow( int iRow ) const
|
||||
@@ -1071,13 +1071,14 @@ void TimingData::ScaleRegion( float fScale, int iStartIndex, int iEndIndex, bool
|
||||
|
||||
for ( unsigned i = 0; i < m_TickcountSegments.size(); i++ )
|
||||
{
|
||||
const int iSegStart = m_TickcountSegments[i].m_iStartRow;
|
||||
TickcountSegment &t = m_TickcountSegments[i];
|
||||
const int iSegStart = t.GetRow();
|
||||
if( iSegStart < iStartIndex )
|
||||
continue;
|
||||
else if( iSegStart > iEndIndex )
|
||||
m_TickcountSegments[i].m_iStartRow += lrintf( (iEndIndex - iStartIndex) * (fScale - 1) );
|
||||
t.SetRow(t.GetRow() + lrintf( (iEndIndex - iStartIndex) * (fScale - 1) ));
|
||||
else
|
||||
m_TickcountSegments[i].m_iStartRow = lrintf( (iSegStart - iStartIndex) * fScale ) + iStartIndex;
|
||||
t.SetRow(lrintf( (iSegStart - iStartIndex) * fScale ) + iStartIndex);
|
||||
}
|
||||
|
||||
for ( unsigned i = 0; i < m_ComboSegments.size(); i++ )
|
||||
@@ -1209,9 +1210,9 @@ void TimingData::InsertRows( int iStartRow, int iRowsToAdd )
|
||||
for( unsigned i = 0; i < m_TickcountSegments.size(); i++ )
|
||||
{
|
||||
TickcountSegment &tick = m_TickcountSegments[i];
|
||||
if( tick.m_iStartRow < iStartRow )
|
||||
if( tick.GetRow() < iStartRow )
|
||||
continue;
|
||||
tick.m_iStartRow += iRowsToAdd;
|
||||
tick.SetRow(tick.GetRow() + iRowsToAdd);
|
||||
}
|
||||
|
||||
for( unsigned i = 0; i < m_ComboSegments.size(); i++ )
|
||||
@@ -1354,13 +1355,13 @@ void TimingData::DeleteRows( int iStartRow, int iRowsToDelete )
|
||||
for( unsigned i = 0; i < m_TickcountSegments.size(); i++ )
|
||||
{
|
||||
TickcountSegment &tick = m_TickcountSegments[i];
|
||||
|
||||
int keyRow = tick.GetRow();
|
||||
// Before deleted region:
|
||||
if( tick.m_iStartRow < iStartRow )
|
||||
if( keyRow < iStartRow )
|
||||
continue;
|
||||
|
||||
// Inside deleted region:
|
||||
if( tick.m_iStartRow < iStartRow+iRowsToDelete )
|
||||
if( keyRow < iStartRow+iRowsToDelete )
|
||||
{
|
||||
m_TickcountSegments.erase( m_TickcountSegments.begin()+i, m_TickcountSegments.begin()+i+1 );
|
||||
--i;
|
||||
@@ -1368,7 +1369,7 @@ void TimingData::DeleteRows( int iStartRow, int iRowsToDelete )
|
||||
}
|
||||
|
||||
// After deleted region:
|
||||
tick.m_iStartRow -= iRowsToDelete;
|
||||
tick.SetRow(keyRow - iRowsToDelete);
|
||||
}
|
||||
|
||||
for( unsigned i = 0; i < m_ComboSegments.size(); i++ )
|
||||
|
||||
@@ -412,83 +412,6 @@ struct WarpSegment
|
||||
bool operator>=( const WarpSegment &other ) const { return !operator<(other); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Identifies when a chart is to have a different tickcount value for hold notes.
|
||||
*
|
||||
* A tickcount segment is used to better replicate the checkpoint hold
|
||||
* system used by various based video games. The number is used to
|
||||
* represent how many ticks can be counted in one beat.
|
||||
*/
|
||||
struct TickcountSegment
|
||||
{
|
||||
/**
|
||||
* @brief Creates a simple Tickcount Segment with default values.
|
||||
*
|
||||
* It is best to override the values as soon as possible.
|
||||
*/
|
||||
TickcountSegment() : m_iStartRow(-1), m_iTicks(2) { }
|
||||
/**
|
||||
* @brief Creates a Tickcount Segment with the specified starting row and beats per second.
|
||||
* @param s the starting row of this segment.
|
||||
* @param t the amount of ticks counted per beat.
|
||||
*/
|
||||
TickcountSegment( int s, int t ): m_iStartRow(max(0, s)),
|
||||
m_iTicks(max(0, t)) {}
|
||||
/**
|
||||
* @brief The row in which the TickcountSegment activates.
|
||||
*/
|
||||
int m_iStartRow;
|
||||
/**
|
||||
* @brief The amount of ticks counted per beat.
|
||||
*/
|
||||
int m_iTicks;
|
||||
|
||||
/**
|
||||
* @brief Compares two TickcountSegments to see if they are equal to each other.
|
||||
* @param other the other TickcountSegment to compare to.
|
||||
* @return the equality of the two segments.
|
||||
*/
|
||||
bool operator==( const TickcountSegment &other ) const
|
||||
{
|
||||
COMPARE( m_iStartRow );
|
||||
COMPARE( m_iTicks );
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* @brief Compares two TickcountSegments to see if they are not equal to each other.
|
||||
* @param other the other TickcountSegment to compare to.
|
||||
* @return the inequality of the two segments.
|
||||
*/
|
||||
bool operator!=( const TickcountSegment &other ) const { return !operator==(other); }
|
||||
/**
|
||||
* @brief Compares two TickcountSegments to see if one is less than the other.
|
||||
* @param other the other TickcountSegment to compare to.
|
||||
* @return the truth/falsehood of if the first is less than the second.
|
||||
*/
|
||||
bool operator<( const TickcountSegment &other ) const { return m_iStartRow < other.m_iStartRow; }
|
||||
/**
|
||||
* @brief Compares two TickcountSegments to see if one is less than or equal to the other.
|
||||
* @param other the other TickcountSegment to compare to.
|
||||
* @return the truth/falsehood of if the first is less or equal to than the second.
|
||||
*/
|
||||
bool operator<=( const TickcountSegment &other ) const
|
||||
{
|
||||
return ( operator<(other) || operator==(other) );
|
||||
}
|
||||
/**
|
||||
* @brief Compares two TickcountSegments to see if one is greater than the other.
|
||||
* @param other the other TickcountSegment to compare to.
|
||||
* @return the truth/falsehood of if the first is greater than the second.
|
||||
*/
|
||||
bool operator>( const TickcountSegment &other ) const { return !operator<=(other); }
|
||||
/**
|
||||
* @brief Compares two TickcountSegments to see if one is greater than or equal to the other.
|
||||
* @param other the other TickcountSegment to compare to.
|
||||
* @return the truth/falsehood of if the first is greater than or equal to the second.
|
||||
*/
|
||||
bool operator>=( const TickcountSegment &other ) const { return !operator<(other); }
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Identifies when a chart is to have a different combo multiplier value.
|
||||
*
|
||||
|
||||
+60
-1
@@ -31,7 +31,7 @@ float TimingSegment::GetBeat() const
|
||||
}
|
||||
|
||||
FakeSegment::FakeSegment():
|
||||
TimingSegment(-1), lengthBeats(-1) {}
|
||||
TimingSegment(), lengthBeats(-1) {}
|
||||
|
||||
FakeSegment::FakeSegment( int s, int r ):
|
||||
TimingSegment(max(0, s)), lengthBeats(NoteRowToBeat(max(0, r))) {}
|
||||
@@ -89,6 +89,65 @@ bool FakeSegment::operator>=( const FakeSegment &other ) const
|
||||
return !this->operator<(other);
|
||||
}
|
||||
|
||||
TickcountSegment::TickcountSegment() :
|
||||
TimingSegment(), ticks(4) {}
|
||||
|
||||
TickcountSegment::TickcountSegment(int s) :
|
||||
TimingSegment(s), ticks(4) {}
|
||||
|
||||
TickcountSegment::TickcountSegment(float s) :
|
||||
TimingSegment(s), ticks(4) {}
|
||||
|
||||
TickcountSegment::TickcountSegment( int s, int t ):
|
||||
TimingSegment(max(0, s)), ticks(max(0, t)) {}
|
||||
|
||||
TickcountSegment::TickcountSegment( float s, int t ):
|
||||
TimingSegment(max(0, s)), ticks(max(0, t)) {}
|
||||
|
||||
int TickcountSegment::GetTicks() const
|
||||
{
|
||||
return this->ticks;
|
||||
}
|
||||
|
||||
void TickcountSegment::SetTicks(const int i)
|
||||
{
|
||||
this->ticks = i;
|
||||
}
|
||||
|
||||
bool TickcountSegment::operator==( const TickcountSegment &other ) const
|
||||
{
|
||||
if (this->GetRow() != other.GetRow()) return false;
|
||||
if (this->GetTicks() != other.GetTicks()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TickcountSegment::operator!=( const TickcountSegment &other ) const
|
||||
{
|
||||
return !this->operator==(other);
|
||||
}
|
||||
|
||||
bool TickcountSegment::operator<( const TickcountSegment &other ) const
|
||||
{
|
||||
if (this->GetRow() < other.GetRow()) return true;
|
||||
if (this->GetRow() > other.GetRow()) return false;
|
||||
return this->GetTicks() < other.GetTicks();
|
||||
}
|
||||
|
||||
bool TickcountSegment::operator<=( const TickcountSegment &other ) const
|
||||
{
|
||||
return ( this->operator<(other) || this->operator==(other) );
|
||||
}
|
||||
|
||||
bool TickcountSegment::operator>( const TickcountSegment &other ) const
|
||||
{
|
||||
return !this->operator<=(other);
|
||||
}
|
||||
|
||||
bool TickcountSegment::operator>=( const TickcountSegment &other ) const
|
||||
{
|
||||
return !this->operator<(other);
|
||||
}
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @author Jason Felds (c) 2011
|
||||
|
||||
@@ -153,6 +153,98 @@ private:
|
||||
float lengthBeats;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Identifies when a chart is to have a different tickcount value
|
||||
* for hold notes.
|
||||
*
|
||||
* A tickcount segment is used to better replicate the checkpoint hold
|
||||
* system used by various based video games. The number is used to
|
||||
* represent how many ticks can be counted in one beat.
|
||||
*/
|
||||
struct TickcountSegment : public TimingSegment
|
||||
{
|
||||
/**
|
||||
* @brief Creates a simple Tickcount Segment with default values.
|
||||
*
|
||||
* It is best to override the values as soon as possible.
|
||||
*/
|
||||
TickcountSegment();
|
||||
/**
|
||||
* @brief Creates a TickcountSegment with specified values.
|
||||
* @param s the starting row. */
|
||||
TickcountSegment(int s);
|
||||
/**
|
||||
* @brief Creates a TickcountSegment with specified values.
|
||||
* @param s the starting beat. */
|
||||
TickcountSegment(float s);
|
||||
/**
|
||||
* @brief Creates a Tickcount Segment with the specified values.
|
||||
* @param s the starting row.
|
||||
* @param t the amount of ticks counted per beat.
|
||||
*/
|
||||
TickcountSegment( int s, int t );
|
||||
/**
|
||||
* @brief Creates a Tickcount Segment with the specified values.
|
||||
* @param s the starting beat.
|
||||
* @param t the amount of ticks counted per beat.
|
||||
*/
|
||||
TickcountSegment( float s, int t );
|
||||
|
||||
/**
|
||||
* @brief Get the number of ticks in this TickcountSegment.
|
||||
* @return the tickcount. */
|
||||
int GetTicks() const;
|
||||
|
||||
/**
|
||||
* @brief Set the number of ticks in this TickcountSegment.
|
||||
* @param i the tickcount. */
|
||||
void SetTicks(const int i);
|
||||
|
||||
/**
|
||||
* @brief Compares two TickcountSegments to see if they are equal to each other.
|
||||
* @param other the other TickcountSegment to compare to.
|
||||
* @return the equality of the two segments.
|
||||
*/
|
||||
bool operator==( const TickcountSegment &other ) const;
|
||||
/**
|
||||
* @brief Compares two TickcountSegments to see if they are not equal to each other.
|
||||
* @param other the other TickcountSegment to compare to.
|
||||
* @return the inequality of the two segments.
|
||||
*/
|
||||
bool operator!=( const TickcountSegment &other ) const;
|
||||
/**
|
||||
* @brief Compares two TickcountSegments to see if one is less than the other.
|
||||
* @param other the other TickcountSegment to compare to.
|
||||
* @return the truth/falsehood of if the first is less than the second.
|
||||
*/
|
||||
bool operator<( const TickcountSegment &other ) const;
|
||||
/**
|
||||
* @brief Compares two TickcountSegments to see if one is less than or equal to the other.
|
||||
* @param other the other TickcountSegment to compare to.
|
||||
* @return the truth/falsehood of if the first is less or equal to than the second.
|
||||
*/
|
||||
bool operator<=( const TickcountSegment &other ) const;
|
||||
/**
|
||||
* @brief Compares two TickcountSegments to see if one is greater than the other.
|
||||
* @param other the other TickcountSegment to compare to.
|
||||
* @return the truth/falsehood of if the first is greater than the second.
|
||||
*/
|
||||
bool operator>( const TickcountSegment &other ) const;
|
||||
/**
|
||||
* @brief Compares two TickcountSegments to see if one is greater than or equal to the other.
|
||||
* @param other the other TickcountSegment to compare to.
|
||||
* @return the truth/falsehood of if the first is greater than or equal to the second.
|
||||
*/
|
||||
bool operator>=( const TickcountSegment &other ) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief The amount of ticks counted per beat.
|
||||
*/
|
||||
int ticks;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#undef COMPARE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user