Scroll Segments Satisfied.
Just the Stops and Delays...in one segment. Yeah, maybe those should be split up at some point.
This commit is contained in:
+3
-3
@@ -999,11 +999,11 @@ void NoteField::DrawPrimitives()
|
|||||||
{
|
{
|
||||||
FOREACH_CONST( ScrollSegment, timing.m_ScrollSegments, seg )
|
FOREACH_CONST( ScrollSegment, timing.m_ScrollSegments, 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) )
|
if( IS_ON_SCREEN(fBeat) )
|
||||||
DrawScrollText( fBeat, seg->m_fPercent );
|
DrawScrollText( fBeat, seg->GetRatio() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ static void GetTimingTags( vector<RString> &lines, TimingData timing, bool bIsSo
|
|||||||
|
|
||||||
w.Init( "SCROLLS" );
|
w.Init( "SCROLLS" );
|
||||||
FOREACH_CONST( ScrollSegment, timing.m_ScrollSegments, ss )
|
FOREACH_CONST( ScrollSegment, timing.m_ScrollSegments, ss )
|
||||||
w.Write( ss->m_iStartRow, ss->m_fPercent );
|
w.Write( ss->GetRow(), ss->GetRatio() );
|
||||||
w.Finish();
|
w.Finish();
|
||||||
|
|
||||||
if( !bIsSong )
|
if( !bIsSong )
|
||||||
|
|||||||
+1
-1
@@ -4023,7 +4023,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
|
|||||||
ScreenTextEntry::TextEntry(
|
ScreenTextEntry::TextEntry(
|
||||||
SM_BackFromScrollChange,
|
SM_BackFromScrollChange,
|
||||||
ENTER_SCROLL_VALUE,
|
ENTER_SCROLL_VALUE,
|
||||||
ssprintf( "%.5f", GetAppropriateTiming().GetScrollSegmentAtBeat( GetBeat() ).m_fPercent ),
|
ssprintf( "%.5f", GetAppropriateTiming().GetScrollSegmentAtBeat( GetBeat() ).GetRatio() ),
|
||||||
10
|
10
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|||||||
+22
-19
@@ -299,25 +299,25 @@ void TimingData::SetScrollAtRow( int iRow, float fPercent )
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
for( i = 0; i < m_ScrollSegments.size(); i++ )
|
for( i = 0; i < m_ScrollSegments.size(); i++ )
|
||||||
{
|
{
|
||||||
if( m_ScrollSegments[i].m_iStartRow >= iRow)
|
if( m_ScrollSegments[i].GetRow() >= iRow)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( i == m_ScrollSegments.size() || m_ScrollSegments[i].m_iStartRow != iRow )
|
if ( i == m_ScrollSegments.size() || m_ScrollSegments[i].GetRow() != iRow )
|
||||||
{
|
{
|
||||||
// the core mod itself matters the most for comparisons.
|
// the core mod itself matters the most for comparisons.
|
||||||
if( i == 0 || m_ScrollSegments[i-1].m_fPercent != fPercent )
|
if( i == 0 || m_ScrollSegments[i-1].GetRatio() != fPercent )
|
||||||
AddScrollSegment( ScrollSegment(iRow, fPercent) );
|
AddScrollSegment( ScrollSegment(iRow, fPercent) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// The others aren't compared: only the mod itself matters.
|
// The others aren't compared: only the mod itself matters.
|
||||||
if( i > 0 && m_ScrollSegments[i-1].m_fPercent == fPercent )
|
if( i > 0 && m_ScrollSegments[i-1].GetRatio() == fPercent )
|
||||||
m_ScrollSegments.erase( m_ScrollSegments.begin()+i,
|
m_ScrollSegments.erase( m_ScrollSegments.begin()+i,
|
||||||
m_ScrollSegments.begin()+i+1 );
|
m_ScrollSegments.begin()+i+1 );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ScrollSegments[i].m_fPercent = fPercent;
|
m_ScrollSegments[i].SetRatio(fPercent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -434,7 +434,7 @@ unsigned short TimingData::GetSpeedModeAtRow( int iRow )
|
|||||||
|
|
||||||
float TimingData::GetScrollAtRow( int iRow )
|
float TimingData::GetScrollAtRow( int iRow )
|
||||||
{
|
{
|
||||||
return GetScrollSegmentAtRow( iRow ).m_fPercent;
|
return GetScrollSegmentAtRow( iRow ).GetRatio();
|
||||||
}
|
}
|
||||||
|
|
||||||
float TimingData::GetFakeAtRow( int iFakeRow ) const
|
float TimingData::GetFakeAtRow( int iFakeRow ) const
|
||||||
@@ -628,7 +628,7 @@ int TimingData::GetScrollSegmentIndexAtRow( int iRow ) const
|
|||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for (i=0; i < m_ScrollSegments.size() - 1; i++ )
|
for (i=0; i < m_ScrollSegments.size() - 1; i++ )
|
||||||
if( m_ScrollSegments[i+1].m_iStartRow > iRow )
|
if( m_ScrollSegments[i+1].GetRow() > iRow )
|
||||||
break;
|
break;
|
||||||
return static_cast<int>(i);
|
return static_cast<int>(i);
|
||||||
}
|
}
|
||||||
@@ -665,7 +665,7 @@ ScrollSegment& TimingData::GetScrollSegmentAtRow( int iRow )
|
|||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for( i=0; i<m_ScrollSegments.size()-1; i++ )
|
for( i=0; i<m_ScrollSegments.size()-1; i++ )
|
||||||
if( m_ScrollSegments[i+1].m_iStartRow > iRow )
|
if( m_ScrollSegments[i+1].GetRow() > iRow )
|
||||||
break;
|
break;
|
||||||
return m_ScrollSegments[i];
|
return m_ScrollSegments[i];
|
||||||
}
|
}
|
||||||
@@ -1003,10 +1003,13 @@ float TimingData::GetElapsedTimeFromBeatNoOffset( float fBeat ) const
|
|||||||
float TimingData::GetDisplayedBeat( float fBeat ) const
|
float TimingData::GetDisplayedBeat( float fBeat ) const
|
||||||
{
|
{
|
||||||
unsigned index = GetScrollSegmentIndexAtBeat(fBeat);
|
unsigned index = GetScrollSegmentIndexAtBeat(fBeat);
|
||||||
float fOutBeat = ( fBeat - NoteRowToBeat(m_ScrollSegments[index].m_iStartRow) ) * m_ScrollSegments[index].m_fPercent;
|
const ScrollSegment &s = m_ScrollSegments[index];
|
||||||
|
float fOutBeat = ( fBeat - s.GetBeat() ) * s.GetRatio();
|
||||||
for( unsigned i = 0; i < index; i ++ )
|
for( unsigned i = 0; i < index; i ++ )
|
||||||
{
|
{
|
||||||
fOutBeat += ( NoteRowToBeat(m_ScrollSegments[i + 1].m_iStartRow) - NoteRowToBeat(m_ScrollSegments[i].m_iStartRow) ) * m_ScrollSegments[i].m_fPercent;
|
const ScrollSegment &future = m_ScrollSegments[i+1];
|
||||||
|
const ScrollSegment ¤t = m_ScrollSegments[i];
|
||||||
|
fOutBeat += ( future.GetBeat() - current.GetBeat() ) * current.GetRatio();
|
||||||
}
|
}
|
||||||
return fOutBeat;
|
return fOutBeat;
|
||||||
}
|
}
|
||||||
@@ -1147,13 +1150,13 @@ void TimingData::ScaleRegion( float fScale, int iStartIndex, int iEndIndex, bool
|
|||||||
for( unsigned i = 0; i < m_ScrollSegments.size(); i++ )
|
for( unsigned i = 0; i < m_ScrollSegments.size(); i++ )
|
||||||
{
|
{
|
||||||
ScrollSegment &s = m_ScrollSegments[i];
|
ScrollSegment &s = m_ScrollSegments[i];
|
||||||
const int iSegStartRow = s.m_iStartRow;
|
const int iSegStartRow = s.GetRow();
|
||||||
if( iSegStartRow < iStartIndex )
|
if( iSegStartRow < iStartIndex )
|
||||||
continue;
|
continue;
|
||||||
else if( iSegStartRow > iEndIndex )
|
else if( iSegStartRow > iEndIndex )
|
||||||
s.m_iStartRow += lrintf((iEndIndex - iStartIndex) * (fScale - 1));
|
s.SetRow(s.GetRow() + lrintf((iEndIndex - iStartIndex) * (fScale - 1)));
|
||||||
else
|
else
|
||||||
s.m_iStartRow = lrintf((iSegStartRow - iStartIndex) * fScale) + iStartIndex;
|
s.SetRow(lrintf((iSegStartRow - iStartIndex) * fScale) + iStartIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust BPM changes to preserve timing
|
// adjust BPM changes to preserve timing
|
||||||
@@ -1258,9 +1261,9 @@ void TimingData::InsertRows( int iStartRow, int iRowsToAdd )
|
|||||||
for( unsigned i = 0; i < m_ScrollSegments.size(); i++ )
|
for( unsigned i = 0; i < m_ScrollSegments.size(); i++ )
|
||||||
{
|
{
|
||||||
ScrollSegment &scrl = m_ScrollSegments[i];
|
ScrollSegment &scrl = m_ScrollSegments[i];
|
||||||
if( scrl.m_iStartRow < iStartRow )
|
if( scrl.GetRow() < iStartRow )
|
||||||
continue;
|
continue;
|
||||||
scrl.m_iStartRow += iRowsToAdd;
|
scrl.SetRow(scrl.GetRow() + iRowsToAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( iStartRow == 0 )
|
if( iStartRow == 0 )
|
||||||
@@ -1453,17 +1456,17 @@ void TimingData::DeleteRows( int iStartRow, int iRowsToDelete )
|
|||||||
for( unsigned i = 0; i < m_ScrollSegments.size(); i++ )
|
for( unsigned i = 0; i < m_ScrollSegments.size(); i++ )
|
||||||
{
|
{
|
||||||
ScrollSegment &scrl = m_ScrollSegments[i];
|
ScrollSegment &scrl = m_ScrollSegments[i];
|
||||||
|
int keyRow = scrl.GetRow();
|
||||||
if( scrl.m_iStartRow < iStartRow )
|
if( keyRow < iStartRow )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( scrl.m_iStartRow < iStartRow+iRowsToDelete )
|
if( keyRow < iStartRow+iRowsToDelete )
|
||||||
{
|
{
|
||||||
m_ScrollSegments.erase( m_ScrollSegments.begin()+i, m_ScrollSegments.begin()+i+1 );
|
m_ScrollSegments.erase( m_ScrollSegments.begin()+i, m_ScrollSegments.begin()+i+1 );
|
||||||
--i;
|
--i;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
scrl.m_iStartRow -= iRowsToDelete;
|
scrl.SetRow(keyRow - iRowsToDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->SetBPMAtRow( iStartRow, fNewBPM );
|
this->SetBPMAtRow( iStartRow, fNewBPM );
|
||||||
|
|||||||
@@ -119,82 +119,6 @@ struct StopSegment
|
|||||||
bool operator>=( const StopSegment &other ) const { return !operator<(other); }
|
bool operator>=( const StopSegment &other ) const { return !operator<(other); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Identifies when the chart scroll changes.
|
|
||||||
*
|
|
||||||
* ScrollSegments adjusts the scrolling speed of the note field.
|
|
||||||
* Unlike forced attacks, these cannot be turned off at a set time:
|
|
||||||
* reset it by setting the precentage back to 1.
|
|
||||||
*
|
|
||||||
* These were inspired by the Pump It Up series. */
|
|
||||||
struct ScrollSegment
|
|
||||||
{
|
|
||||||
/** @brief Sets up the ScrollSegment with default values. */
|
|
||||||
ScrollSegment(): m_iStartRow(0), m_fPercent(1) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sets up the ScrollSegment with specified values.
|
|
||||||
* @param i The row this activates.
|
|
||||||
* @param p The percentage to use. */
|
|
||||||
ScrollSegment(int i, float p): m_iStartRow(i), m_fPercent(p) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Sets up the ScrollSegment with specified values.
|
|
||||||
* @param r The beat this activates.
|
|
||||||
* @param p The percentage to use. */
|
|
||||||
ScrollSegment(float r, float p): m_iStartRow(BeatToNoteRow(r)), m_fPercent(p) {}
|
|
||||||
|
|
||||||
/** @brief The row in which the ScrollSegment activates. */
|
|
||||||
int m_iStartRow;
|
|
||||||
/** @brief The percentage to use when multiplying the chart's scroll rate. */
|
|
||||||
float m_fPercent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Compares two ScrollSegment to see if they are equal to each other.
|
|
||||||
* @param other the other ScrollSegment to compare to.
|
|
||||||
* @return the equality of the two segments.
|
|
||||||
*/
|
|
||||||
bool operator==( const ScrollSegment &other ) const
|
|
||||||
{
|
|
||||||
COMPARE( m_iStartRow );
|
|
||||||
COMPARE( m_fPercent );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Compares two ScrollSegment to see if they are not equal to each other.
|
|
||||||
* @param other the other ScrollSegment to compare to.
|
|
||||||
* @return the inequality of the two segments.
|
|
||||||
*/
|
|
||||||
bool operator!=( const ScrollSegment &other ) const { return !operator==(other); }
|
|
||||||
/**
|
|
||||||
* @brief Compares two ScrollSegment to see if one is less than the other.
|
|
||||||
* @param other the other ScrollSegment to compare to.
|
|
||||||
* @return the truth/falsehood of if the first is less than the second.
|
|
||||||
*/
|
|
||||||
bool operator<( const ScrollSegment &other ) const { return m_iStartRow < other.m_iStartRow; }
|
|
||||||
/**
|
|
||||||
* @brief Compares two ScrollSegment to see if one is less than or equal to the other.
|
|
||||||
* @param other the other ScrollSegment to compare to.
|
|
||||||
* @return the truth/falsehood of if the first is less or equal to than the second.
|
|
||||||
*/
|
|
||||||
bool operator<=( const ScrollSegment &other ) const
|
|
||||||
{
|
|
||||||
return ( operator<(other) || operator==(other) );
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @brief Compares two ScrollSegment to see if one is greater than the other.
|
|
||||||
* @param other the other ScrollSegment to compare to.
|
|
||||||
* @return the truth/falsehood of if the first is greater than the second.
|
|
||||||
*/
|
|
||||||
bool operator>( const ScrollSegment &other ) const { return !operator<=(other); }
|
|
||||||
/**
|
|
||||||
* @brief Compares two ScrollSegment to see if one is greater than or equal to the other.
|
|
||||||
* @param other the other ScrollSegment to compare to.
|
|
||||||
* @return the truth/falsehood of if the first is greater than or equal to the second.
|
|
||||||
*/
|
|
||||||
bool operator>=( const ScrollSegment &other ) const { return !operator<(other); }
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Holds data for translating beats<->seconds.
|
* @brief Holds data for translating beats<->seconds.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -234,6 +234,22 @@ bool SpeedSegment::operator<( const SpeedSegment &other ) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float ScrollSegment::GetRatio() const
|
||||||
|
{
|
||||||
|
return this->ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScrollSegment::SetRatio(const float i)
|
||||||
|
{
|
||||||
|
this->ratio = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ScrollSegment::operator<( const ScrollSegment &other ) const
|
||||||
|
{
|
||||||
|
LTCOMPARE(GetRow());
|
||||||
|
LTCOMPARE(GetRatio());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
|
|||||||
+49
-1
@@ -688,12 +688,60 @@ private:
|
|||||||
*
|
*
|
||||||
* 0: beats
|
* 0: beats
|
||||||
* 1: seconds
|
* 1: seconds
|
||||||
* other
|
* other values are undetermined at this time, but we're prepared this way.
|
||||||
*/
|
*/
|
||||||
unsigned short unit;
|
unsigned short unit;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Identifies when the chart scroll changes.
|
||||||
|
*
|
||||||
|
* ScrollSegments adjusts the scrolling speed of the note field.
|
||||||
|
* Unlike forced attacks, these cannot be turned off at a set time:
|
||||||
|
* reset it by setting the precentage back to 1.
|
||||||
|
*
|
||||||
|
* These were inspired by the Pump It Up series. */
|
||||||
|
struct ScrollSegment : public TimingSegment<ScrollSegment>
|
||||||
|
{
|
||||||
|
/** @brief Sets up the ScrollSegment with default values. */
|
||||||
|
ScrollSegment(): TimingSegment<ScrollSegment>(0),
|
||||||
|
ratio(1) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets up the ScrollSegment with specified values.
|
||||||
|
* @param s The row / beat this activates.
|
||||||
|
* @param p The percentage to use. */
|
||||||
|
template <typename StartType>
|
||||||
|
ScrollSegment( StartType s, float p):
|
||||||
|
TimingSegment<ScrollSegment>(max((StartType)0, s)),
|
||||||
|
ratio(p) {}
|
||||||
|
|
||||||
|
ScrollSegment(const ScrollSegment &other) :
|
||||||
|
TimingSegment<ScrollSegment>(other),
|
||||||
|
ratio(other.GetRatio()) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the ratio in this SpeedSegment.
|
||||||
|
* @return the ratio. */
|
||||||
|
float GetRatio() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the ratio in this SpeedSegment.
|
||||||
|
* @param i the ratio. */
|
||||||
|
void SetRatio(const float i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Compares two ScrollSegment to see if one is less than the other.
|
||||||
|
* @param other the other ScrollSegment to compare to.
|
||||||
|
* @return the truth/falsehood of if the first is less than the second.
|
||||||
|
*/
|
||||||
|
bool operator<( const ScrollSegment &other ) const;
|
||||||
|
private:
|
||||||
|
/** @brief The ratio / percentage to use when multiplying the chart's scroll rate. */
|
||||||
|
float ratio;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user