segment renovation stage 2: redefine TimingSegments as simple structs, standardize names and functions, use only rows for constructors (we'll limit allocation through TimingData::AddSegment in the near future)
This commit is contained in:
+3
-3
@@ -618,7 +618,7 @@ void NoteField::DrawLabelText( const float fBeat, RString sLabel )
|
||||
m_textMeasureNumber.Draw();
|
||||
}
|
||||
|
||||
void NoteField::DrawSpeedText( const float fBeat, float fPercent, float fWait, unsigned short usMode )
|
||||
void NoteField::DrawSpeedText( const float fBeat, float fPercent, float fWait, int iMode )
|
||||
{
|
||||
const float fYOffset = ArrowEffects::GetYOffset( m_pPlayerState, 0, fBeat );
|
||||
const float fYPos = ArrowEffects::GetYPos( m_pPlayerState, 0, fYOffset, m_fYReverseOffsetPixels );
|
||||
@@ -630,7 +630,7 @@ void NoteField::DrawSpeedText( const float fBeat, float fPercent, float fWait, u
|
||||
m_textMeasureNumber.SetHorizAlign( SPEED_IS_LEFT_SIDE ? align_right : align_left );
|
||||
m_textMeasureNumber.SetDiffuse( SPEED_COLOR );
|
||||
m_textMeasureNumber.SetGlow( RageColor(1,1,1,RageFastCos(RageTimer::GetTimeSinceStartFast()*2)/2+0.5f) );
|
||||
m_textMeasureNumber.SetText( ssprintf("%.3f\n%s\n%.3f", fPercent, (usMode == 1 ? "S" : "B"), fWait) );
|
||||
m_textMeasureNumber.SetText( ssprintf("%.3f\n%s\n%.3f", fPercent, (iMode == 1 ? "S" : "B"), fWait) );
|
||||
m_textMeasureNumber.SetXY( (SPEED_IS_LEFT_SIDE ? -xBase - xOffset : xBase + xOffset), fYPos );
|
||||
m_textMeasureNumber.Draw();
|
||||
}
|
||||
@@ -1033,7 +1033,7 @@ void NoteField::DrawPrimitives()
|
||||
float fBeat = seg->GetBeat();
|
||||
if( IS_ON_SCREEN(fBeat) )
|
||||
DrawSpeedText(fBeat, seg->GetRatio(),
|
||||
seg->GetLength(), seg->GetUnit() );
|
||||
seg->GetDelay(), seg->GetUnit() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ protected:
|
||||
void DrawTickcountText( const float fBeat, int iTicks );
|
||||
void DrawComboText( const float fBeat, int iCombo, int iMiss );
|
||||
void DrawLabelText( const float fBeat, RString sLabel );
|
||||
void DrawSpeedText( const float fBeat, float fPercent, float fWait, unsigned short usMode );
|
||||
void DrawSpeedText( const float fBeat, float fPercent, float fWait, int iMode );
|
||||
void DrawScrollText( const float fBeat, float fPercent );
|
||||
void DrawFakeText( const float fBeat, const float fNewBeat );
|
||||
void DrawAttackText( const float fBeat, const Attack &attack );
|
||||
|
||||
@@ -17,7 +17,7 @@ static void HandleBunki( TimingData &timing, const float fEarlyBPM,
|
||||
const float beat = (fPos + fGap) * BeatsPerSecond;
|
||||
LOG->Trace( "BPM %f, BPS %f, BPMPos %f, beat %f",
|
||||
fEarlyBPM, BeatsPerSecond, fPos, beat );
|
||||
timing.AddSegment( SEGMENT_BPM, new BPMSegment(beat, fCurBPM) );
|
||||
timing.AddSegment( SEGMENT_BPM, new BPMSegment(BeatToNoteRow(beat), fCurBPM) );
|
||||
}
|
||||
|
||||
static bool LoadFromKSFFile( const RString &sPath, Steps &out, Song &song, bool bKIUCompliant )
|
||||
|
||||
@@ -695,7 +695,7 @@ static void ReadGlobalTags( const RString &sPath, const NameToData_t &mapNameToD
|
||||
|
||||
if( fBPM > 0.0f )
|
||||
{
|
||||
BPMSegment * newSeg = new BPMSegment( fBeat, fBPM );
|
||||
BPMSegment * newSeg = new BPMSegment( BeatToNoteRow(fBeat), fBPM );
|
||||
out.m_SongTiming.AddSegment( SEGMENT_BPM, newSeg );
|
||||
LOG->Trace( "Inserting new BPM change at beat %f, BPM %f", fBeat, newSeg->GetBPM() );
|
||||
}
|
||||
@@ -722,7 +722,7 @@ static void ReadGlobalTags( const RString &sPath, const NameToData_t &mapNameToD
|
||||
float fBeats = StringToFloat( sBeats ) / 48.0f;
|
||||
float fFreezeSecs = fBeats / fBPS;
|
||||
|
||||
StopSegment * newSeg = new StopSegment( fBeat, fFreezeSecs );
|
||||
StopSegment * newSeg = new StopSegment( BeatToNoteRow(fBeat), fFreezeSecs );
|
||||
out.m_SongTiming.AddSegment( SEGMENT_STOP, newSeg );
|
||||
LOG->Trace( "Inserting new Freeze at beat %f, secs %f", fBeat, newSeg->GetPause() );
|
||||
}
|
||||
|
||||
+31
-25
@@ -245,7 +245,7 @@ bool SMLoader::ProcessBPMs( TimingData &out, const RString line, const int rowsP
|
||||
{
|
||||
float endBeat = fBeat + (fNewBPM / -negBPM) * (fBeat - negBeat);
|
||||
out.AddSegment(SEGMENT_WARP,
|
||||
new WarpSegment(negBeat, endBeat - negBeat));
|
||||
new WarpSegment(BeatToNoteRow(negBeat), endBeat - negBeat));
|
||||
|
||||
negBeat = -1;
|
||||
negBPM = 1;
|
||||
@@ -261,12 +261,12 @@ bool SMLoader::ProcessBPMs( TimingData &out, const RString line, const int rowsP
|
||||
if( highspeedBeat > 0 )
|
||||
{
|
||||
out.AddSegment(SEGMENT_WARP,
|
||||
new WarpSegment(highspeedBeat, fBeat - highspeedBeat) );
|
||||
new WarpSegment(BeatToNoteRow(highspeedBeat), fBeat - highspeedBeat) );
|
||||
highspeedBeat = -1;
|
||||
}
|
||||
{
|
||||
out.AddSegment(SEGMENT_BPM,
|
||||
new BPMSegment(fBeat, fNewBPM));
|
||||
new BPMSegment(BeatToNoteRow(fBeat), fNewBPM));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -310,7 +310,7 @@ void SMLoader::ProcessStops( TimingData &out, const RString line, const int rows
|
||||
if( negBeat + fSkipBeats > fFreezeBeat )
|
||||
fSkipBeats = fFreezeBeat - negBeat;
|
||||
|
||||
out.AddSegment(SEGMENT_WARP, new WarpSegment(negBeat, fSkipBeats));
|
||||
out.AddSegment(SEGMENT_WARP, new WarpSegment(BeatToNoteRow(negBeat), fSkipBeats));
|
||||
|
||||
negBeat = -1;
|
||||
negPause = 0;
|
||||
@@ -324,7 +324,7 @@ void SMLoader::ProcessStops( TimingData &out, const RString line, const int rows
|
||||
else if( fFreezeSeconds > 0.0f )
|
||||
{
|
||||
out.AddSegment(SEGMENT_STOP,
|
||||
new StopSegment(fFreezeBeat, fFreezeSeconds));
|
||||
new StopSegment(BeatToNoteRow(fFreezeBeat), fFreezeSeconds));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -336,7 +336,7 @@ void SMLoader::ProcessStops( TimingData &out, const RString line, const int rows
|
||||
float fSecondsPerBeat = 60 / oldBPM->GetBPM();
|
||||
float fSkipBeats = negPause / fSecondsPerBeat;
|
||||
|
||||
out.AddSegment(SEGMENT_WARP, new WarpSegment(negBeat, fSkipBeats));
|
||||
out.AddSegment(SEGMENT_WARP, new WarpSegment(BeatToNoteRow(negBeat), fSkipBeats));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@ void SMLoader::ProcessDelays( TimingData &out, const RString line, const int row
|
||||
const float fFreezeBeat = RowToBeat( arrayDelayValues[0], rowsPerBeat );
|
||||
const float fFreezeSeconds = StringToFloat( arrayDelayValues[1] );
|
||||
|
||||
DelaySegment * new_seg = new DelaySegment(fFreezeBeat,
|
||||
DelaySegment * new_seg = new DelaySegment(BeatToNoteRow(fFreezeBeat),
|
||||
fFreezeSeconds);
|
||||
|
||||
// LOG->Trace( "Adding a delay segment: beat: %f, seconds = %f", new_seg.m_fStartBeat, new_seg.m_fStopSeconds );
|
||||
@@ -381,28 +381,28 @@ void SMLoader::ProcessTimeSignatures( TimingData &out, const RString line, const
|
||||
{
|
||||
vector<RString> vs1;
|
||||
split( line, ",", vs1 );
|
||||
|
||||
|
||||
FOREACH_CONST( RString, vs1, s1 )
|
||||
{
|
||||
vector<RString> vs2;
|
||||
split( *s1, "=", vs2 );
|
||||
|
||||
|
||||
if( vs2.size() < 3 )
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
this->GetSongTitle(),
|
||||
"has an invalid time signature change with %i values.",
|
||||
static_cast<int>(vs2.size()) );
|
||||
GetSongTitle(),
|
||||
"has an invalid time signature change with %i values.",
|
||||
static_cast<int>(vs2.size()) );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
const float fBeat = RowToBeat( vs2[0], rowsPerBeat );
|
||||
|
||||
|
||||
TimeSignatureSegment * seg =
|
||||
new TimeSignatureSegment(fBeat,
|
||||
new TimeSignatureSegment( BeatToNoteRow(fBeat),
|
||||
StringToInt( vs2[1] ),
|
||||
StringToInt( vs2[2] ));
|
||||
|
||||
|
||||
if( fBeat < 0 )
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
@@ -456,7 +456,7 @@ void SMLoader::ProcessTickcounts( TimingData &out, const RString line, const int
|
||||
int iTicks = clamp(atoi( arrayTickcountValues[1] ), 0, ROWS_PER_BEAT);
|
||||
|
||||
out.AddSegment( SEGMENT_TICKCOUNT,
|
||||
new TickcountSegment(fTickcountBeat, iTicks) );
|
||||
new TickcountSegment(BeatToNoteRow(fTickcountBeat), iTicks) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,11 +491,17 @@ void SMLoader::ProcessSpeeds( TimingData &out, const RString line, const int row
|
||||
|
||||
const float fBeat = RowToBeat( vs2[0], rowsPerBeat );
|
||||
|
||||
SpeedSegment * seg = new SpeedSegment(fBeat,
|
||||
StringToFloat( vs2[1] ),
|
||||
StringToFloat( vs2[2] ));
|
||||
seg->SetUnit(StringToInt(vs2[3]));
|
||||
|
||||
SpeedSegment * seg = new SpeedSegment( BeatToNoteRow(fBeat),
|
||||
StringToFloat( vs2[1] ),
|
||||
StringToFloat( vs2[2] ));
|
||||
|
||||
// XXX: ugly...
|
||||
int iUnit = StringToInt(vs2[3]);
|
||||
SpeedSegment::BaseUnit unit = (iUnit == 0) ?
|
||||
SpeedSegment::UNIT_BEATS : SpeedSegment::UNIT_SECONDS;
|
||||
|
||||
seg->SetUnit( unit );
|
||||
|
||||
if( fBeat < 0 )
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
@@ -505,12 +511,12 @@ void SMLoader::ProcessSpeeds( TimingData &out, const RString line, const int row
|
||||
continue;
|
||||
}
|
||||
|
||||
if( seg->GetLength() < 0 )
|
||||
if( seg->GetDelay() < 0 )
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
this->GetSongTitle(),
|
||||
"has an speed change with beat %f, length %f.",
|
||||
fBeat, seg->GetLength() );
|
||||
fBeat, seg->GetDelay() );
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -540,7 +546,7 @@ void SMLoader::ProcessFakes( TimingData &out, const RString line, const int rows
|
||||
const float fNewBeat = StringToFloat( arrayFakeValues[1] );
|
||||
|
||||
if(fNewBeat > 0)
|
||||
out.AddSegment( SEGMENT_FAKE, new FakeSegment(fBeat, fNewBeat) );
|
||||
out.AddSegment( SEGMENT_FAKE, new FakeSegment(BeatToNoteRow(fBeat), fNewBeat) );
|
||||
else
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
|
||||
+17
-17
@@ -39,7 +39,7 @@ void SMALoader::ProcessMultipliers( TimingData &out, const int iRowsPerBeat, con
|
||||
iCombos :
|
||||
StringToInt(arrayMultiplierValues[2]));
|
||||
out.AddSegment(SEGMENT_COMBO,
|
||||
new ComboSegment( fComboBeat, iCombos, iMisses ));
|
||||
new ComboSegment( BeatToNoteRow(fComboBeat), iCombos, iMisses ));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ void SMALoader::ProcessBeatsPerMeasure( TimingData &out, const RString sParam )
|
||||
{
|
||||
vector<RString> vs2;
|
||||
split( *s1, "=", vs2 );
|
||||
|
||||
|
||||
if( vs2.size() < 2 )
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
@@ -61,13 +61,13 @@ void SMALoader::ProcessBeatsPerMeasure( TimingData &out, const RString sParam )
|
||||
static_cast<int>(vs2.size()) );
|
||||
continue;
|
||||
}
|
||||
|
||||
const float fBeat = StringToFloat( vs2[0] );
|
||||
|
||||
TimeSignatureSegment * seg = new TimeSignatureSegment(fBeat,
|
||||
StringToInt(vs2[1]),
|
||||
4 );
|
||||
|
||||
|
||||
TimeSignatureSegment * seg = new TimeSignatureSegment(
|
||||
BeatToNoteRow(fBeat),
|
||||
StringToInt(vs2[1]),
|
||||
4 );
|
||||
|
||||
if( fBeat < 0 )
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
@@ -122,14 +122,14 @@ void SMALoader::ProcessSpeeds( TimingData &out, const RString line, const int ro
|
||||
RString backup = vs2[2];
|
||||
Trim(vs2[2], "s");
|
||||
Trim(vs2[2], "S");
|
||||
|
||||
|
||||
unsigned short tmp = ((backup != vs2[2]) ? 1 : 0);
|
||||
|
||||
SpeedSegment * seg = new SpeedSegment(fBeat,
|
||||
StringToFloat( vs2[1] ),
|
||||
StringToFloat(vs2[2]),
|
||||
tmp);
|
||||
|
||||
SpeedSegment::BaseUnit unit = ((backup != vs2[2]) ?
|
||||
SpeedSegment::UNIT_SECONDS : SpeedSegment::UNIT_BEATS);
|
||||
|
||||
SpeedSegment * seg = new SpeedSegment( BeatToNoteRow(fBeat),
|
||||
StringToFloat( vs2[1] ), StringToFloat(vs2[2]), unit);
|
||||
|
||||
if( fBeat < 0 )
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
@@ -139,12 +139,12 @@ void SMALoader::ProcessSpeeds( TimingData &out, const RString line, const int ro
|
||||
continue;
|
||||
}
|
||||
|
||||
if( seg->GetLength() < 0 )
|
||||
if( seg->GetDelay() < 0 )
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
this->GetSongTitle(),
|
||||
"has an speed change with beat %f, length %f.",
|
||||
fBeat, seg->GetLength() );
|
||||
fBeat, seg->GetDelay() );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,10 +37,10 @@ void SSCLoader::ProcessWarps( TimingData &out, const RString sParam, const float
|
||||
// Early versions were absolute in beats. They should be relative.
|
||||
if( ( fVersion < VERSION_SPLIT_TIMING && fNewBeat > fBeat ) )
|
||||
{
|
||||
out.AddSegment( SEGMENT_WARP, new WarpSegment(fBeat, fNewBeat - fBeat) );
|
||||
out.AddSegment( SEGMENT_WARP, new WarpSegment(BeatToNoteRow(fBeat), fNewBeat - fBeat) );
|
||||
}
|
||||
else if( fNewBeat > 0 )
|
||||
out.AddSegment( SEGMENT_WARP, new WarpSegment(fBeat, fNewBeat) );
|
||||
out.AddSegment( SEGMENT_WARP, new WarpSegment(BeatToNoteRow(fBeat), fNewBeat) );
|
||||
else
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
@@ -73,7 +73,7 @@ void SSCLoader::ProcessLabels( TimingData &out, const RString sParam )
|
||||
RString sLabel = arrayLabelValues[1];
|
||||
TrimRight(sLabel);
|
||||
if( fBeat >= 0.0f )
|
||||
out.AddSegment( SEGMENT_LABEL, new LabelSegment(fBeat, sLabel) );
|
||||
out.AddSegment( SEGMENT_LABEL, new LabelSegment(BeatToNoteRow(fBeat), sLabel) );
|
||||
else
|
||||
{
|
||||
LOG->UserLog("Song file",
|
||||
@@ -106,7 +106,7 @@ void SSCLoader::ProcessCombos( TimingData &out, const RString line, const int ro
|
||||
const float fComboBeat = StringToFloat( arrayComboValues[0] );
|
||||
const int iCombos = StringToInt( arrayComboValues[1] );
|
||||
const int iMisses = (size == 2 ? iCombos : StringToInt(arrayComboValues[2]));
|
||||
out.AddSegment( SEGMENT_COMBO, new ComboSegment( fComboBeat, iCombos, iMisses ) );
|
||||
out.AddSegment( SEGMENT_COMBO, new ComboSegment( BeatToNoteRow(fComboBeat), iCombos, iMisses ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ void SSCLoader::ProcessScrolls( TimingData &out, const RString sParam )
|
||||
|
||||
const float fBeat = StringToFloat( vs2[0] );
|
||||
|
||||
ScrollSegment * seg = new ScrollSegment(fBeat, StringToFloat( vs2[1] ) );
|
||||
ScrollSegment * seg = new ScrollSegment(BeatToNoteRow(fBeat), StringToFloat( vs2[1] ) );
|
||||
|
||||
if( fBeat < 0 )
|
||||
{
|
||||
|
||||
@@ -142,7 +142,7 @@ static void GetTimingTags( vector<RString> &lines, TimingData timing, bool bIsSo
|
||||
for (i = 0; i < speeds.size(); i++)
|
||||
{
|
||||
SpeedSegment *ss = static_cast<SpeedSegment *>(speeds[i]);
|
||||
w.Write( ss->GetRow(), ss->GetRatio(), ss->GetLength(), ss->GetUnit() );
|
||||
w.Write( ss->GetRow(), ss->GetRatio(), ss->GetDelay(), ss->GetUnit() );
|
||||
}
|
||||
w.Finish();
|
||||
|
||||
|
||||
+8
-11
@@ -3046,23 +3046,20 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
|
||||
{
|
||||
if( ScreenTextEntry::s_sLastAnswer.substr(0, 1) == "b" || ScreenTextEntry::s_sLastAnswer.substr(0, 1) == "B" )
|
||||
{
|
||||
GetAppropriateTiming().SetSpeedModeAtBeat( GetBeat(), 0 );
|
||||
GetAppropriateTiming().SetSpeedModeAtBeat( GetBeat(), SpeedSegment::UNIT_BEATS );
|
||||
}
|
||||
else if( ScreenTextEntry::s_sLastAnswer.substr(0, 1) == "s" || ScreenTextEntry::s_sLastAnswer.substr(0, 1) == "S" )
|
||||
{
|
||||
GetAppropriateTiming().SetSpeedModeAtBeat( GetBeat(), 1 );
|
||||
GetAppropriateTiming().SetSpeedModeAtBeat( GetBeat(), SpeedSegment::UNIT_SECONDS );
|
||||
}
|
||||
else
|
||||
{
|
||||
int tmp = StringToInt(ScreenTextEntry::s_sLastAnswer );
|
||||
if( tmp == 0 )
|
||||
{
|
||||
GetAppropriateTiming().SetSpeedModeAtBeat( GetBeat(), 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
GetAppropriateTiming().SetSpeedModeAtBeat( GetBeat(), 1 );
|
||||
}
|
||||
|
||||
SpeedSegment::BaseUnit unit = (tmp == 0 ) ?
|
||||
SpeedSegment::UNIT_BEATS : SpeedSegment::UNIT_SECONDS;
|
||||
|
||||
GetAppropriateTiming().SetSpeedModeAtBeat( GetBeat(), unit );
|
||||
}
|
||||
SetDirty( true );
|
||||
}
|
||||
@@ -4729,7 +4726,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
|
||||
ScreenTextEntry::TextEntry(
|
||||
SM_BackFromSpeedWaitChange,
|
||||
ENTER_SPEED_WAIT_VALUE,
|
||||
ssprintf( "%.6f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() )->GetLength() ),
|
||||
ssprintf( "%.6f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() )->GetDelay() ),
|
||||
10
|
||||
);
|
||||
break;
|
||||
|
||||
+90
-91
@@ -7,7 +7,6 @@
|
||||
#include "Foreach.h"
|
||||
#include <float.h>
|
||||
|
||||
|
||||
TimingData::TimingData(float fOffset) : m_fBeat0OffsetInSeconds(fOffset)
|
||||
{
|
||||
}
|
||||
@@ -46,57 +45,57 @@ TimingData TimingData::CopyRange(int startRow, int endRow) const
|
||||
{
|
||||
case SEGMENT_BPM:
|
||||
{
|
||||
cpy = new BPMSegment(*(static_cast<BPMSegment *>(org)));
|
||||
cpy = new BPMSegment(*(ToBPM(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_STOP:
|
||||
{
|
||||
cpy = new StopSegment(*(static_cast<StopSegment *>(org)));
|
||||
cpy = new StopSegment(*(ToStop(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_DELAY:
|
||||
{
|
||||
cpy = new DelaySegment(*(static_cast<DelaySegment *>(org)));
|
||||
cpy = new DelaySegment(*(ToDelay(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_TIME_SIG:
|
||||
{
|
||||
cpy = new TimeSignatureSegment(*(static_cast<TimeSignatureSegment *>(org)));
|
||||
cpy = new TimeSignatureSegment(*(ToTimeSignature(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_WARP:
|
||||
{
|
||||
cpy = new WarpSegment(*(static_cast<WarpSegment *>(org)));
|
||||
cpy = new WarpSegment(*(ToWarp(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_LABEL:
|
||||
{
|
||||
cpy = new LabelSegment(*(static_cast<LabelSegment *>(org)));
|
||||
cpy = new LabelSegment(*(ToLabel(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_TICKCOUNT:
|
||||
{
|
||||
cpy = new TickcountSegment(*(static_cast<TickcountSegment *>(org)));
|
||||
cpy = new TickcountSegment(*(ToTickcount(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_COMBO:
|
||||
{
|
||||
cpy = new ComboSegment(*(static_cast<ComboSegment *>(org)));
|
||||
cpy = new ComboSegment(*(ToCombo(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_SPEED:
|
||||
{
|
||||
cpy = new SpeedSegment(*(static_cast<SpeedSegment *>(org)));
|
||||
cpy = new SpeedSegment(*(ToSpeed(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_SCROLL:
|
||||
{
|
||||
cpy = new ScrollSegment(*(static_cast<ScrollSegment *>(org)));
|
||||
cpy = new ScrollSegment(*(ToScroll(org)));
|
||||
break;
|
||||
}
|
||||
case SEGMENT_FAKE:
|
||||
{
|
||||
cpy = new FakeSegment(*(static_cast<FakeSegment *>(org)));
|
||||
cpy = new FakeSegment(*(ToFake(org)));
|
||||
break;
|
||||
}
|
||||
default: FAIL_M(ssprintf("An unknown timing segment type %d can't be copied over!", tst));
|
||||
@@ -119,7 +118,7 @@ void TimingData::GetActualBPM( float &fMinBPMOut, float &fMaxBPMOut, float highe
|
||||
const vector<TimingSegment *> &bpms = m_avpTimingSegments[SEGMENT_BPM];
|
||||
for (unsigned i = 0; i < bpms.size(); i++)
|
||||
{
|
||||
BPMSegment *seg = static_cast<BPMSegment *>(bpms[i]);
|
||||
BPMSegment *seg = ToBPM( bpms[i] );
|
||||
const float fBPM = seg->GetBPM();
|
||||
fMaxBPMOut = clamp(max( fBPM, fMaxBPMOut ), 0, highest);
|
||||
fMinBPMOut = min( fBPM, fMinBPMOut );
|
||||
@@ -199,16 +198,16 @@ void TimingData::SetBPMAtRow( int iNoteRow, float fBPM )
|
||||
// There is no BPMSegment at the specified beat. If the BPM being set differs
|
||||
// from the last BPMSegment's BPM, create a new BPMSegment.
|
||||
if (i == 0 ||
|
||||
fabsf(static_cast<BPMSegment *>(bpms[i-1])->GetBPM() - fBPM) > 1e-5f )
|
||||
fabsf( ToBPM(bpms[i-1])->GetBPM() - fBPM) > 1e-5f )
|
||||
AddSegment( SEGMENT_BPM, new BPMSegment(iNoteRow, fBPM) );
|
||||
}
|
||||
else // BPMSegment being modified is m_BPMSegments[i]
|
||||
{
|
||||
if (i > 0 &&
|
||||
fabsf(static_cast<BPMSegment *>(bpms[i-1])->GetBPM() - fBPM) < 1e-5f )
|
||||
fabsf(ToBPM(bpms[i-1])->GetBPM() - fBPM) < 1e-5f )
|
||||
bpms.erase( bpms.begin()+i, bpms.begin()+i+1 );
|
||||
else
|
||||
static_cast<BPMSegment *>(bpms[i])->SetBPM(fBPM);
|
||||
ToBPM(bpms[i])->SetBPM(fBPM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,7 +229,7 @@ void TimingData::SetStopAtRow( int iRow, float fSeconds )
|
||||
}
|
||||
else // StopSegment being modified is m_StopSegments[i]
|
||||
{
|
||||
StopSegment *ss = static_cast<StopSegment *>(stops[i]);
|
||||
StopSegment *ss = ToStop(stops[i]);
|
||||
if( fSeconds > 0 )
|
||||
{
|
||||
ss->SetPause(fSeconds);
|
||||
@@ -258,7 +257,7 @@ void TimingData::SetDelayAtRow( int iRow, float fSeconds )
|
||||
}
|
||||
else // DelaySegment being modified is present one
|
||||
{
|
||||
DelaySegment *ss = static_cast<DelaySegment *>(stops[i]);
|
||||
DelaySegment *ss = ToDelay(stops[i]);
|
||||
if( fSeconds > 0 )
|
||||
{
|
||||
ss->SetPause(fSeconds);
|
||||
@@ -282,20 +281,20 @@ void TimingData::SetTimeSignatureAtRow( int iRow, int iNumerator, int iDenominat
|
||||
{
|
||||
// No specific segment here: place one if it differs.
|
||||
if (i == 0 ||
|
||||
(static_cast<TimeSignatureSegment *>(tSigs[i-1])->GetNum() != iNumerator ||
|
||||
static_cast<TimeSignatureSegment *>(tSigs[i-1])->GetDen() != iDenominator ) )
|
||||
(ToTimeSignature(tSigs[i-1])->GetNum() != iNumerator ||
|
||||
ToTimeSignature(tSigs[i-1])->GetDen() != iDenominator ) )
|
||||
AddSegment( SEGMENT_TIME_SIG, new TimeSignatureSegment(iRow, iNumerator, iDenominator) );
|
||||
}
|
||||
else // TimeSignatureSegment being modified is m_vTimeSignatureSegments[i]
|
||||
{
|
||||
if (i > 0 &&
|
||||
static_cast<TimeSignatureSegment *>(tSigs[i-1])->GetNum() == iNumerator &&
|
||||
static_cast<TimeSignatureSegment *>(tSigs[i-1])->GetDen() == iDenominator )
|
||||
ToTimeSignature(tSigs[i-1])->GetNum() == iNumerator &&
|
||||
ToTimeSignature(tSigs[i-1])->GetDen() == iDenominator )
|
||||
tSigs.erase( tSigs.begin()+i, tSigs.begin()+i+1 );
|
||||
else
|
||||
{
|
||||
static_cast<TimeSignatureSegment *>(tSigs[i])->SetNum(iNumerator);
|
||||
static_cast<TimeSignatureSegment *>(tSigs[i])->SetDen(iDenominator);
|
||||
ToTimeSignature(tSigs[i])->SetNum(iNumerator);
|
||||
ToTimeSignature(tSigs[i])->SetDen(iDenominator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -331,7 +330,7 @@ void TimingData::SetWarpAtRow( int iRow, float fNew )
|
||||
{
|
||||
if( valid )
|
||||
{
|
||||
static_cast<WarpSegment *>(warps[i])->SetLength(fNew);
|
||||
ToWarp(warps[i])->SetLength(fNew);
|
||||
}
|
||||
else
|
||||
warps.erase( warps.begin()+i, warps.begin()+i+1 );
|
||||
@@ -351,16 +350,16 @@ void TimingData::SetTickcountAtRow( int iRow, int iTicks )
|
||||
{
|
||||
// No TickcountSegment here. Make a new segment if required.
|
||||
if (i == 0 ||
|
||||
static_cast<TickcountSegment *>(ticks[i-1])->GetTicks() != iTicks )
|
||||
ToTickcount(ticks[i-1])->GetTicks() != iTicks )
|
||||
AddSegment( SEGMENT_TICKCOUNT, new TickcountSegment(iRow, iTicks ) );
|
||||
}
|
||||
else // TickcountSegment being modified is m_TickcountSegments[i]
|
||||
{
|
||||
if (i > 0 &&
|
||||
static_cast<TickcountSegment *>(ticks[i-1])->GetTicks() == iTicks )
|
||||
ToTickcount(ticks[i-1])->GetTicks() == iTicks )
|
||||
ticks.erase( ticks.begin()+i, ticks.begin()+i+1 );
|
||||
else
|
||||
static_cast<TickcountSegment *>(ticks[i])->SetTicks(iTicks);
|
||||
ToTickcount(ticks[i])->SetTicks(iTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,20 +374,20 @@ void TimingData::SetComboAtRow( int iRow, int iCombo, int iMiss )
|
||||
if( i == combos.size() || combos[i]->GetRow() != iRow )
|
||||
{
|
||||
if (i == 0 ||
|
||||
static_cast<ComboSegment *>(combos[i-1])->GetCombo() != iCombo ||
|
||||
static_cast<ComboSegment *>(combos[i-1])->GetMissCombo() != iMiss)
|
||||
ToCombo(combos[i-1])->GetCombo() != iCombo ||
|
||||
ToCombo(combos[i-1])->GetMissCombo() != iMiss)
|
||||
AddSegment( SEGMENT_COMBO, new ComboSegment(iRow, iCombo, iMiss ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i > 0 &&
|
||||
static_cast<ComboSegment *>(combos[i-1])->GetCombo() == iCombo &&
|
||||
static_cast<ComboSegment *>(combos[i-1])->GetMissCombo() == iMiss)
|
||||
ToCombo(combos[i-1])->GetCombo() == iCombo &&
|
||||
ToCombo(combos[i-1])->GetMissCombo() == iMiss)
|
||||
combos.erase( combos.begin()+i, combos.begin()+i+1 );
|
||||
else
|
||||
{
|
||||
static_cast<ComboSegment *>(combos[i])->SetCombo(iCombo);
|
||||
static_cast<ComboSegment *>(combos[i])->SetMissCombo(iMiss);
|
||||
ToCombo(combos[i])->SetCombo(iCombo);
|
||||
ToCombo(combos[i])->SetMissCombo(iMiss);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -418,21 +417,21 @@ void TimingData::SetLabelAtRow( int iRow, const RString sLabel )
|
||||
if( i == labels.size() || labels[i]->GetRow() != iRow )
|
||||
{
|
||||
if (i == 0 ||
|
||||
static_cast<LabelSegment *>(labels[i-1])->GetLabel() != sLabel )
|
||||
ToLabel(labels[i-1])->GetLabel() != sLabel )
|
||||
AddSegment( SEGMENT_LABEL, new LabelSegment(iRow, sLabel ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i > 0 &&
|
||||
( static_cast<LabelSegment *>(labels[i-1])->GetLabel() == sLabel ||
|
||||
( ToLabel(labels[i-1])->GetLabel() == sLabel ||
|
||||
sLabel == "" ) )
|
||||
labels.erase( labels.begin()+i, labels.begin()+i+1 );
|
||||
else
|
||||
static_cast<LabelSegment *>(labels[i])->SetLabel(sLabel);
|
||||
ToLabel(labels[i])->SetLabel(sLabel);
|
||||
}
|
||||
}
|
||||
|
||||
void TimingData::SetSpeedAtRow( int iRow, float fPercent, float fWait, unsigned short usMode )
|
||||
void TimingData::SetSpeedAtRow( int iRow, float fPercent, float fWait, SpeedSegment::BaseUnit unit )
|
||||
{
|
||||
unsigned i;
|
||||
vector<TimingSegment *> &speeds = m_avpTimingSegments[SEGMENT_SPEED];
|
||||
@@ -441,25 +440,25 @@ void TimingData::SetSpeedAtRow( int iRow, float fPercent, float fWait, unsigned
|
||||
if( speeds[i]->GetRow() >= iRow)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ( i == speeds.size() || speeds[i]->GetRow() != iRow )
|
||||
{
|
||||
// the core mod itself matters the most for comparisons.
|
||||
if (i == 0 ||
|
||||
static_cast<SpeedSegment *>(speeds[i-1])->GetRatio() != fPercent )
|
||||
AddSegment( SEGMENT_SPEED, new SpeedSegment(iRow, fPercent, fWait, usMode) );
|
||||
ToSpeed(speeds[i-1])->GetRatio() != fPercent )
|
||||
AddSegment( SEGMENT_SPEED, new SpeedSegment(iRow, fPercent, fWait, unit) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// The others aren't compared: only the mod itself matters.
|
||||
if (i > 0 &&
|
||||
static_cast<SpeedSegment *>(speeds[i-1])->GetRatio() == fPercent )
|
||||
ToSpeed(speeds[i-1])->GetRatio() == fPercent )
|
||||
speeds.erase( speeds.begin()+i, speeds.begin()+i+1 );
|
||||
else
|
||||
{
|
||||
static_cast<SpeedSegment *>(speeds[i])->SetRatio(fPercent);
|
||||
static_cast<SpeedSegment *>(speeds[i])->SetLength(fWait);
|
||||
static_cast<SpeedSegment *>(speeds[i])->SetUnit(usMode);
|
||||
ToSpeed(speeds[i])->SetRatio(fPercent);
|
||||
ToSpeed(speeds[i])->SetDelay(fWait);
|
||||
ToSpeed(speeds[i])->SetUnit(unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -478,18 +477,18 @@ void TimingData::SetScrollAtRow( int iRow, float fPercent )
|
||||
{
|
||||
// the core mod itself matters the most for comparisons.
|
||||
if (i == 0 ||
|
||||
static_cast<ScrollSegment *>(scrolls[i-1])->GetRatio() != fPercent )
|
||||
ToScroll(scrolls[i-1])->GetRatio() != fPercent )
|
||||
AddSegment( SEGMENT_SCROLL, new ScrollSegment(iRow, fPercent) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// The others aren't compared: only the mod itself matters.
|
||||
if (i > 0 &&
|
||||
static_cast<ScrollSegment *>(scrolls[i-1])->GetRatio() == fPercent )
|
||||
ToScroll(scrolls[i-1])->GetRatio() == fPercent )
|
||||
scrolls.erase( scrolls.begin()+i, scrolls.begin()+i+1 );
|
||||
else
|
||||
{
|
||||
static_cast<ScrollSegment *>(scrolls[i])->SetRatio(fPercent);
|
||||
ToScroll(scrolls[i])->SetRatio(fPercent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -513,7 +512,7 @@ void TimingData::SetFakeAtRow( int iRow, float fNew )
|
||||
{
|
||||
if( valid )
|
||||
{
|
||||
static_cast<FakeSegment *>(fakes[i])->SetLength(fNew);
|
||||
ToFake(fakes[i])->SetLength(fNew);
|
||||
}
|
||||
else
|
||||
fakes.erase( fakes.begin()+i, fakes.begin()+i+1 );
|
||||
@@ -524,7 +523,7 @@ void TimingData::SetSpeedPercentAtRow( int iRow, float fPercent )
|
||||
{
|
||||
SetSpeedAtRow( iRow,
|
||||
fPercent,
|
||||
GetSpeedSegmentAtRow( iRow )->GetLength(),
|
||||
GetSpeedSegmentAtRow( iRow )->GetDelay(),
|
||||
GetSpeedSegmentAtRow( iRow )->GetUnit());
|
||||
}
|
||||
|
||||
@@ -536,12 +535,12 @@ void TimingData::SetSpeedWaitAtRow( int iRow, float fWait )
|
||||
GetSpeedSegmentAtRow( iRow )->GetUnit());
|
||||
}
|
||||
|
||||
void TimingData::SetSpeedModeAtRow( int iRow, unsigned short usMode )
|
||||
void TimingData::SetSpeedModeAtRow( int iRow, SpeedSegment::BaseUnit unit )
|
||||
{
|
||||
SetSpeedAtRow( iRow,
|
||||
GetSpeedSegmentAtRow( iRow )->GetRatio(),
|
||||
GetSpeedSegmentAtRow( iRow )->GetLength(),
|
||||
usMode );
|
||||
GetSpeedSegmentAtRow( iRow )->GetDelay(),
|
||||
unit );
|
||||
}
|
||||
|
||||
float TimingData::GetStopAtRow( int iRow ) const
|
||||
@@ -549,7 +548,7 @@ float TimingData::GetStopAtRow( int iRow ) const
|
||||
const vector<TimingSegment *> &stops = m_avpTimingSegments[SEGMENT_STOP];
|
||||
for( unsigned i=0; i<stops.size(); i++ )
|
||||
{
|
||||
const StopSegment *s = static_cast<StopSegment *>(stops[i]);
|
||||
const StopSegment *s = ToStop(stops[i]);
|
||||
if( s->GetRow() == iRow )
|
||||
{
|
||||
return s->GetPause();
|
||||
@@ -564,7 +563,7 @@ float TimingData::GetDelayAtRow( int iRow ) const
|
||||
const vector<TimingSegment *> &stops = m_avpTimingSegments[SEGMENT_DELAY];
|
||||
for( unsigned i=0; i<stops.size(); i++ )
|
||||
{
|
||||
const DelaySegment *s = static_cast<DelaySegment *>(stops[i]);
|
||||
const DelaySegment *s = ToDelay(stops[i]);
|
||||
if( s->GetRow() == iRow )
|
||||
{
|
||||
return s->GetPause();
|
||||
@@ -577,21 +576,21 @@ int TimingData::GetComboAtRow( int iNoteRow ) const
|
||||
{
|
||||
const vector<TimingSegment *> &c = m_avpTimingSegments[SEGMENT_COMBO];
|
||||
const int index = GetSegmentIndexAtRow(SEGMENT_COMBO, iNoteRow);
|
||||
return static_cast<ComboSegment *>(c[index])->GetCombo();
|
||||
return ToCombo(c[index])->GetCombo();
|
||||
}
|
||||
|
||||
int TimingData::GetMissComboAtRow(int iNoteRow) const
|
||||
{
|
||||
const vector<TimingSegment *> &c = m_avpTimingSegments[SEGMENT_COMBO];
|
||||
const int index = GetSegmentIndexAtRow(SEGMENT_COMBO, iNoteRow);
|
||||
return static_cast<ComboSegment *>(c[index])->GetMissCombo();
|
||||
return ToCombo(c[index])->GetMissCombo();
|
||||
}
|
||||
|
||||
RString TimingData::GetLabelAtRow( int iRow ) const
|
||||
{
|
||||
const vector<TimingSegment *> &l = m_avpTimingSegments[SEGMENT_LABEL];
|
||||
const int index = GetSegmentIndexAtRow(SEGMENT_LABEL, iRow);
|
||||
return static_cast<LabelSegment *>(l[index])->GetLabel();
|
||||
return ToLabel(l[index])->GetLabel();
|
||||
}
|
||||
|
||||
float TimingData::GetWarpAtRow( int iWarpRow ) const
|
||||
@@ -601,7 +600,7 @@ float TimingData::GetWarpAtRow( int iWarpRow ) const
|
||||
{
|
||||
if( warps[i]->GetRow() == iWarpRow )
|
||||
{
|
||||
return static_cast<WarpSegment *>(warps[i])->GetLength();
|
||||
return ToWarp(warps[i])->GetLength();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -614,10 +613,10 @@ float TimingData::GetSpeedPercentAtRow( int iRow )
|
||||
|
||||
float TimingData::GetSpeedWaitAtRow( int iRow )
|
||||
{
|
||||
return GetSpeedSegmentAtRow( iRow )->GetLength();
|
||||
return GetSpeedSegmentAtRow( iRow )->GetDelay();
|
||||
}
|
||||
|
||||
unsigned short TimingData::GetSpeedModeAtRow( int iRow )
|
||||
SpeedSegment::BaseUnit TimingData::GetSpeedModeAtRow( int iRow )
|
||||
{
|
||||
return GetSpeedSegmentAtRow( iRow )->GetUnit();
|
||||
}
|
||||
@@ -634,7 +633,7 @@ float TimingData::GetFakeAtRow( int iFakeRow ) const
|
||||
{
|
||||
if( fakes[i]->GetRow() == iFakeRow )
|
||||
{
|
||||
return static_cast<FakeSegment *>(fakes[i])->GetLength();
|
||||
return ToFake(fakes[i])->GetLength();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -647,7 +646,7 @@ void TimingData::MultiplyBPMInBeatRange( int iStartIndex, int iEndIndex, float f
|
||||
vector<TimingSegment *> &bpms = m_avpTimingSegments[SEGMENT_BPM];
|
||||
for( unsigned i=0; i<bpms.size(); i++ )
|
||||
{
|
||||
BPMSegment *bs = static_cast<BPMSegment *>(bpms[i]);
|
||||
BPMSegment *bs = ToBPM(bpms[i]);
|
||||
const int iStartIndexThisSegment = bs->GetRow();
|
||||
const bool bIsLastBPMSegment = i == bpms.size()-1;
|
||||
const int iStartIndexNextSegment = bIsLastBPMSegment ? INT_MAX : bpms[i+1]->GetRow();
|
||||
@@ -690,7 +689,7 @@ float TimingData::GetBPMAtRow( int iNoteRow ) const
|
||||
for( i=0; i<bpms.size()-1; i++ )
|
||||
if( bpms[i+1]->GetRow() > iNoteRow )
|
||||
break;
|
||||
return static_cast<BPMSegment *>(bpms[i])->GetBPM();
|
||||
return ToBPM(bpms[i])->GetBPM();
|
||||
}
|
||||
|
||||
bool TimingData::IsWarpAtRow( int iNoteRow ) const
|
||||
@@ -700,7 +699,7 @@ bool TimingData::IsWarpAtRow( int iNoteRow ) const
|
||||
return false;
|
||||
|
||||
int i = GetSegmentIndexAtRow( SEGMENT_WARP, iNoteRow );
|
||||
const WarpSegment *s = static_cast<WarpSegment *>(warps[i]);
|
||||
const WarpSegment *s = ToWarp(warps[i]);
|
||||
float beatRow = NoteRowToBeat(iNoteRow);
|
||||
if( s->GetBeat() <= beatRow && beatRow < (s->GetBeat() + s->GetLength() ) )
|
||||
{
|
||||
@@ -725,7 +724,7 @@ bool TimingData::IsFakeAtRow( int iNoteRow ) const
|
||||
return false;
|
||||
|
||||
int i = GetSegmentIndexAtRow( SEGMENT_FAKE, iNoteRow );
|
||||
const FakeSegment *s = static_cast<FakeSegment *>(fakes[i]);
|
||||
const FakeSegment *s = ToFake(fakes[i]);
|
||||
float beatRow = NoteRowToBeat(iNoteRow);
|
||||
if( s->GetBeat() <= beatRow && beatRow < ( s->GetBeat() + s->GetLength() ) )
|
||||
{
|
||||
@@ -774,7 +773,7 @@ int TimingData::GetTickcountAtRow( int iRow ) const
|
||||
{
|
||||
const vector<TimingSegment *> &ticks = m_avpTimingSegments[SEGMENT_TICKCOUNT];
|
||||
const int index = GetSegmentIndexAtRow( SEGMENT_TICKCOUNT, iRow );
|
||||
return static_cast<TickcountSegment *>(ticks[index])->GetTicks();
|
||||
return ToTickcount(ticks[index])->GetTicks();
|
||||
}
|
||||
|
||||
bool TimingData::DoesLabelExist( RString sLabel ) const
|
||||
@@ -782,7 +781,7 @@ bool TimingData::DoesLabelExist( RString sLabel ) const
|
||||
const vector<TimingSegment *> &labels = m_avpTimingSegments[SEGMENT_LABEL];
|
||||
for (unsigned i = 0; i < labels.size(); i++)
|
||||
{
|
||||
if (static_cast<LabelSegment *>(labels[i])->GetLabel() == sLabel)
|
||||
if (ToLabel(labels[i])->GetLabel() == sLabel)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -878,13 +877,13 @@ void TimingData::GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float
|
||||
bIsWarping = false;
|
||||
break;
|
||||
case FOUND_BPM_CHANGE:
|
||||
fBPS = static_cast<BPMSegment *>(*itBPMS)->GetBPS();
|
||||
fBPS = ToBPM(*itBPMS)->GetBPS();
|
||||
itBPMS ++;
|
||||
break;
|
||||
case FOUND_DELAY:
|
||||
case FOUND_STOP_DELAY:
|
||||
{
|
||||
const DelaySegment *ss = static_cast<DelaySegment *>(*itDS);
|
||||
const DelaySegment *ss = ToDelay(*itDS);
|
||||
fTimeToNextEvent = ss->GetPause();
|
||||
fNextEventTime = fLastTime + fTimeToNextEvent;
|
||||
if ( fElapsedTime < fNextEventTime )
|
||||
@@ -902,7 +901,7 @@ void TimingData::GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float
|
||||
}
|
||||
case FOUND_STOP:
|
||||
{
|
||||
const StopSegment *ss = static_cast<StopSegment *>(*itSS);
|
||||
const StopSegment *ss = ToStop(*itSS);
|
||||
fTimeToNextEvent = ss->GetPause();
|
||||
fNextEventTime = fLastTime + fTimeToNextEvent;
|
||||
if ( fElapsedTime < fNextEventTime )
|
||||
@@ -920,7 +919,7 @@ void TimingData::GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float
|
||||
case FOUND_WARP:
|
||||
{
|
||||
bIsWarping = true;
|
||||
const WarpSegment *ws = static_cast<WarpSegment *>(*itWS);
|
||||
const WarpSegment *ws = ToWarp(*itWS);
|
||||
float fWarpSum = ws->GetLength() + ws->GetBeat();
|
||||
if( fWarpSum > fWarpDestination )
|
||||
{
|
||||
@@ -1007,17 +1006,17 @@ float TimingData::GetElapsedTimeFromBeatNoOffset( float fBeat ) const
|
||||
bIsWarping = false;
|
||||
break;
|
||||
case FOUND_BPM_CHANGE:
|
||||
fBPS = static_cast<BPMSegment *>(*itBPMS)->GetBPS();
|
||||
fBPS = ToBPM(*itBPMS)->GetBPS();
|
||||
itBPMS ++;
|
||||
break;
|
||||
case FOUND_STOP:
|
||||
fTimeToNextEvent = static_cast<StopSegment *>(*itSS)->GetPause();
|
||||
fTimeToNextEvent = ToStop(*itSS)->GetPause();
|
||||
fNextEventTime = fLastTime + fTimeToNextEvent;
|
||||
fLastTime = fNextEventTime;
|
||||
itSS ++;
|
||||
break;
|
||||
case FOUND_DELAY:
|
||||
fTimeToNextEvent = static_cast<DelaySegment *>(*itDS)->GetPause();
|
||||
fTimeToNextEvent = ToDelay(*itDS)->GetPause();
|
||||
fNextEventTime = fLastTime + fTimeToNextEvent;
|
||||
fLastTime = fNextEventTime;
|
||||
itDS ++;
|
||||
@@ -1027,7 +1026,7 @@ float TimingData::GetElapsedTimeFromBeatNoOffset( float fBeat ) const
|
||||
case FOUND_WARP:
|
||||
{
|
||||
bIsWarping = true;
|
||||
WarpSegment *ws = static_cast<WarpSegment *>(*itWS);
|
||||
WarpSegment *ws = ToWarp(*itWS);
|
||||
float fWarpSum = ws->GetLength() + ws->GetBeat();
|
||||
if( fWarpSum > fWarpDestination )
|
||||
{
|
||||
@@ -1053,9 +1052,9 @@ float TimingData::GetDisplayedBeat( float fBeat ) const
|
||||
{
|
||||
if( scrolls[i+1]->GetBeat() > fBeat )
|
||||
break;
|
||||
fOutBeat += (scrolls[i+1]->GetBeat() - scrolls[i]->GetBeat()) * static_cast<ScrollSegment *>(scrolls[i])->GetRatio();
|
||||
fOutBeat += (scrolls[i+1]->GetBeat() - scrolls[i]->GetBeat()) * ToScroll(scrolls[i])->GetRatio();
|
||||
}
|
||||
fOutBeat += (fBeat - scrolls[i]->GetBeat()) * static_cast<ScrollSegment *>(scrolls[i])->GetRatio();
|
||||
fOutBeat += (fBeat - scrolls[i]->GetBeat()) * ToScroll(scrolls[i])->GetRatio();
|
||||
return fOutBeat;
|
||||
}
|
||||
|
||||
@@ -1086,7 +1085,7 @@ void TimingData::ScaleRegion( float fScale, int iStartIndex, int iEndIndex, bool
|
||||
// adjust BPM changes "between" iStartIndex and iNewEndIndex
|
||||
for ( unsigned i = 0; i < bpms.size(); i++ )
|
||||
{
|
||||
BPMSegment *bpm = static_cast<BPMSegment *>(bpms[i]);
|
||||
BPMSegment *bpm = ToBPM(bpms[i]);
|
||||
const int iSegStart = bpm->GetRow();
|
||||
if( iSegStart <= iStartIndex )
|
||||
continue;
|
||||
@@ -1175,7 +1174,7 @@ float TimingData::GetDisplayedSpeedPercent( float fSongBeat, float fMusicSeconds
|
||||
|
||||
const int index = GetSegmentIndexAtBeat( SEGMENT_SPEED, fSongBeat );
|
||||
|
||||
const SpeedSegment *seg = static_cast<SpeedSegment *>(speeds[index]);
|
||||
const SpeedSegment *seg = ToSpeed(speeds[index]);
|
||||
float fStartBeat = seg->GetBeat();
|
||||
float fStartTime = GetElapsedTimeFromBeat( fStartBeat ) - GetDelayAtBeat( fStartBeat );
|
||||
float fEndTime;
|
||||
@@ -1183,25 +1182,25 @@ float TimingData::GetDisplayedSpeedPercent( float fSongBeat, float fMusicSeconds
|
||||
|
||||
if( seg->GetUnit() == 1 ) // seconds
|
||||
{
|
||||
fEndTime = fStartTime + seg->GetLength();
|
||||
fEndTime = fStartTime + seg->GetDelay();
|
||||
}
|
||||
else
|
||||
{
|
||||
fEndTime = GetElapsedTimeFromBeat( fStartBeat + seg->GetLength() )
|
||||
- GetDelayAtBeat( fStartBeat + seg->GetLength() );
|
||||
fEndTime = GetElapsedTimeFromBeat( fStartBeat + seg->GetDelay() )
|
||||
- GetDelayAtBeat( fStartBeat + seg->GetDelay() );
|
||||
}
|
||||
|
||||
SpeedSegment *first = static_cast<SpeedSegment *>(speeds[0]);
|
||||
SpeedSegment *first = ToSpeed(speeds[0]);
|
||||
|
||||
if( ( index == 0 && first->GetLength() > 0.0 ) && fCurTime < fStartTime )
|
||||
if( ( index == 0 && first->GetDelay() > 0.0 ) && fCurTime < fStartTime )
|
||||
{
|
||||
return 1.0f;
|
||||
}
|
||||
else if( fEndTime >= fCurTime && ( index > 0 || first->GetLength() > 0.0 ) )
|
||||
else if( fEndTime >= fCurTime && ( index > 0 || first->GetDelay() > 0.0 ) )
|
||||
{
|
||||
const float fPriorSpeed = (index == 0 ?
|
||||
1 :
|
||||
static_cast<SpeedSegment *>(speeds[index - 1])->GetRatio() );
|
||||
ToSpeed(speeds[index - 1])->GetRatio() );
|
||||
float fTimeUsed = fCurTime - fStartTime;
|
||||
float fDuration = fEndTime - fStartTime;
|
||||
float fRatioUsed = fDuration == 0.0 ? 1 : fTimeUsed / fDuration;
|
||||
@@ -1304,14 +1303,14 @@ bool TimingData::HasSpeedChanges() const
|
||||
{
|
||||
const vector<TimingSegment *> &speeds = m_avpTimingSegments[SEGMENT_SPEED];
|
||||
return (speeds.size()>1 ||
|
||||
static_cast<SpeedSegment *>(speeds[0])->GetRatio() != 1);
|
||||
ToSpeed(speeds[0])->GetRatio() != 1);
|
||||
}
|
||||
|
||||
bool TimingData::HasScrollChanges() const
|
||||
{
|
||||
const vector<TimingSegment *> &scrolls = m_avpTimingSegments[SEGMENT_SCROLL];
|
||||
return (scrolls.size()>1 ||
|
||||
static_cast<ScrollSegment *>(scrolls[0])->GetRatio() != 1);
|
||||
ToScroll(scrolls[0])->GetRatio() != 1);
|
||||
}
|
||||
|
||||
void TimingData::NoteRowToMeasureAndBeat( int iNoteRow, int &iMeasureIndexOut, int &iBeatIndexOut, int &iRowsRemainder ) const
|
||||
@@ -1320,7 +1319,7 @@ void TimingData::NoteRowToMeasureAndBeat( int iNoteRow, int &iMeasureIndexOut, i
|
||||
const vector<TimingSegment *> &tSigs = m_avpTimingSegments[SEGMENT_TIME_SIG];
|
||||
for (unsigned i = 0; i < tSigs.size(); i++)
|
||||
{
|
||||
TimeSignatureSegment *curSig = static_cast<TimeSignatureSegment *>(tSigs[i]);
|
||||
TimeSignatureSegment *curSig = ToTimeSignature(tSigs[i]);
|
||||
int iSegmentEndRow = (i + 1 == tSigs.size()) ? INT_MAX : curSig->GetRow();
|
||||
|
||||
int iRowsPerMeasureThisSegment = curSig->GetNoteRowsPerMeasure();
|
||||
@@ -1426,7 +1425,7 @@ public:
|
||||
vector<TimingSegment *> &bpms = p->m_avpTimingSegments[SEGMENT_BPM];
|
||||
for (unsigned i = 0; i < bpms.size(); i++)
|
||||
{
|
||||
BPMSegment *seg = static_cast<BPMSegment *>(bpms[i]);
|
||||
BPMSegment *seg = ToBPM(bpms[i]);
|
||||
const float fBPM = seg->GetBPM();
|
||||
vBPMs.push_back( fBPM );
|
||||
}
|
||||
|
||||
+64
-22
@@ -10,6 +10,36 @@ struct lua_State;
|
||||
/** @brief Compare a TimingData segment's properties with one another. */
|
||||
#define COMPARE(x) if(this->x!=other.x) return false;
|
||||
|
||||
|
||||
/* convenience functions to handle static casting */
|
||||
template<class T> T* ToDerived( TimingSegment *t, TimingSegmentType tst )
|
||||
{
|
||||
ASSERT( t->GetType() == tst ); // type checking
|
||||
return static_cast<T*>( t );
|
||||
}
|
||||
|
||||
#define TimingSegmentToXWithName(Seg, SegName, SegType) \
|
||||
inline Seg* To##SegName( TimingSegment *t ) { return ToDerived<Seg>(t, SegType); }
|
||||
|
||||
#define TimingSegmentToX(Seg, SegType) \
|
||||
TimingSegmentToXWithName(Seg##Segment, Seg, SEGMENT_##SegType)
|
||||
|
||||
/* ToBPM(TimingSegment*), ToTimeSignature(TimingSegment*), etc. */
|
||||
TimingSegmentToX( BPM, BPM );
|
||||
TimingSegmentToX( Stop, STOP );
|
||||
TimingSegmentToX( Delay, DELAY );
|
||||
TimingSegmentToX( TimeSignature, TIME_SIG );
|
||||
TimingSegmentToX( Warp, WARP );
|
||||
TimingSegmentToX( Label, LABEL );
|
||||
TimingSegmentToX( Tickcount, TICKCOUNT );
|
||||
TimingSegmentToX( Combo, COMBO );
|
||||
TimingSegmentToX( Speed, SPEED );
|
||||
TimingSegmentToX( Scroll, SCROLL );
|
||||
TimingSegmentToX( Fake, FAKE );
|
||||
|
||||
#undef TimingSegmentToXWithName
|
||||
#undef TimingSegmentToX
|
||||
|
||||
/**
|
||||
* @brief Holds data for translating beats<->seconds.
|
||||
*/
|
||||
@@ -87,6 +117,7 @@ public:
|
||||
* @return the segment in question.
|
||||
*/
|
||||
TimingSegment* GetSegmentAtRow( int iNoteRow, TimingSegmentType tst );
|
||||
|
||||
/**
|
||||
* @brief Retrieve the TimingSegment at the given beat.
|
||||
* @param fBeat the beat that has a TimingSegment.
|
||||
@@ -98,34 +129,45 @@ public:
|
||||
return GetSegmentAtRow( BeatToNoteRow(fBeat), tst );
|
||||
}
|
||||
|
||||
void SetTimingSegmentAtRow( TimingSegment *seg, int iNoteRow );
|
||||
|
||||
|
||||
/* XXX: convenience shortcuts. We should get rid of these later. */
|
||||
#define GetSegmentWithName(Seg, SegType) \
|
||||
#define GetAndSetSegmentWithName(Seg, SegName, SegType) \
|
||||
Seg* Get##Seg##AtRow( int iNoteRow ) \
|
||||
{ \
|
||||
TimingSegment *t = GetSegmentAtRow( iNoteRow, SegType ); \
|
||||
return static_cast<Seg*>( t ); \
|
||||
return To##SegName( t ); \
|
||||
} \
|
||||
Seg* Get##Seg##AtBeat( float fBeat ) \
|
||||
{ \
|
||||
TimingSegment *t = GetSegmentAtBeat( fBeat, SegType ); \
|
||||
return static_cast<Seg*>( t ); \
|
||||
return To##SegName( t ); \
|
||||
} \
|
||||
void Set##SegName##AtRow( Seg &seg, int iNoteRow ) \
|
||||
{ \
|
||||
SetTimingSegmentAtRow( &seg, iNoteRow ); \
|
||||
}
|
||||
|
||||
// (TimeSignature,TIME_SIG) -> (TimeSignatureSegment,SEGMENT_TIME_SIG)
|
||||
#define GetSegment(Seg, SegType ) \
|
||||
GetSegmentWithName( Seg##Segment, SEGMENT_##SegType )
|
||||
#define GetAndSetSegment(Seg, SegType ) \
|
||||
GetAndSetSegmentWithName( Seg##Segment, Seg, SEGMENT_##SegType )
|
||||
|
||||
GetAndSetSegment( BPM, BPM );
|
||||
GetAndSetSegment( Stop, STOP );
|
||||
GetAndSetSegment( Delay, DELAY );
|
||||
GetAndSetSegment( Warp, WARP );
|
||||
GetAndSetSegment( Label, LABEL );
|
||||
GetAndSetSegment( Tickcount, TICKCOUNT );
|
||||
GetAndSetSegment( Combo, COMBO );
|
||||
GetAndSetSegment( Speed, SPEED );
|
||||
GetAndSetSegment( Scroll, SCROLL );
|
||||
GetAndSetSegment( Fake, FAKE );
|
||||
GetAndSetSegment( TimeSignature, TIME_SIG );
|
||||
|
||||
#undef GetAndSetSegmentWithName
|
||||
#undef GetAndSetSegment
|
||||
|
||||
GetSegment( BPM, BPM );
|
||||
GetSegment( Stop, STOP );
|
||||
GetSegment( Delay, DELAY );
|
||||
GetSegment( Warp, WARP );
|
||||
GetSegment( Label, LABEL );
|
||||
GetSegment( Tickcount, TICKCOUNT );
|
||||
GetSegment( Combo, COMBO );
|
||||
GetSegment( Speed, SPEED );
|
||||
GetSegment( Scroll, SCROLL );
|
||||
GetSegment( Fake, FAKE );
|
||||
GetSegment( TimeSignature, TIME_SIG );
|
||||
|
||||
/**
|
||||
* @brief Retrieve the stop time at the given row.
|
||||
@@ -443,13 +485,13 @@ public:
|
||||
* @param iNoteRow the row in question.
|
||||
* @return the mode.
|
||||
*/
|
||||
unsigned short GetSpeedModeAtRow( int iNoteRow );
|
||||
SpeedSegment::BaseUnit GetSpeedModeAtRow( int iNoteRow );
|
||||
/**
|
||||
* @brief Retrieve the Speed's mode at the given beat.
|
||||
* @param fBeat the beat in question.
|
||||
* @return the mode.
|
||||
*/
|
||||
unsigned short GetSpeedModeAtBeat( float fBeat ) { return GetSpeedModeAtRow( BeatToNoteRow(fBeat) ); }
|
||||
SpeedSegment::BaseUnit GetSpeedModeAtBeat( float fBeat ) { return GetSpeedModeAtRow( BeatToNoteRow(fBeat) ); }
|
||||
/**
|
||||
* @brief Set the row to have the new Speed.
|
||||
* @param iNoteRow the row to have the new Speed.
|
||||
@@ -457,7 +499,7 @@ public:
|
||||
* @param fWait the wait.
|
||||
* @param usMode the mode.
|
||||
*/
|
||||
void SetSpeedAtRow( int iNoteRow, float fPercent, float fWait, unsigned short usMode );
|
||||
void SetSpeedAtRow( int iNoteRow, float fPercent, float fWait, SpeedSegment::BaseUnit unit );
|
||||
/**
|
||||
* @brief Set the beat to have the new Speed.
|
||||
* @param fBeat the beat to have the new Speed.
|
||||
@@ -465,7 +507,7 @@ public:
|
||||
* @param fWait the wait.
|
||||
* @param usMode the mode.
|
||||
*/
|
||||
void SetSpeedAtBeat( float fBeat, float fPercent, float fWait, unsigned short usMode ) { SetSpeedAtRow( BeatToNoteRow(fBeat), fPercent, fWait, usMode ); }
|
||||
void SetSpeedAtBeat( float fBeat, float fPercent, float fWait, SpeedSegment::BaseUnit unit ) { SetSpeedAtRow( BeatToNoteRow(fBeat), fPercent, fWait, unit ); }
|
||||
/**
|
||||
* @brief Set the row to have the new Speed percent.
|
||||
* @param iNoteRow the row to have the new Speed percent.
|
||||
@@ -495,13 +537,13 @@ public:
|
||||
* @param iNoteRow the row to have the new Speed mode.
|
||||
* @param usMode the mode.
|
||||
*/
|
||||
void SetSpeedModeAtRow( int iNoteRow, unsigned short usMode );
|
||||
void SetSpeedModeAtRow( int iNoteRow, SpeedSegment::BaseUnit unit );
|
||||
/**
|
||||
* @brief Set the beat to have the new Speed mode.
|
||||
* @param fBeat the beat to have the new Speed mode.
|
||||
* @param usMode the mode.
|
||||
*/
|
||||
void SetSpeedModeAtBeat( float fBeat, unsigned short usMode ) { SetSpeedModeAtRow( BeatToNoteRow(fBeat), usMode); }
|
||||
void SetSpeedModeAtBeat( float fBeat, SpeedSegment::BaseUnit unit ) { SetSpeedModeAtRow( BeatToNoteRow(fBeat), unit); }
|
||||
|
||||
float GetDisplayedSpeedPercent( float fBeat, float fMusicSeconds ) const;
|
||||
|
||||
|
||||
+50
-265
@@ -19,45 +19,16 @@ XToString( TimingSegmentType );
|
||||
|
||||
#define LTCOMPARE(x) if(this->x < other.x) return true; if(this->x > other.x) return false;
|
||||
|
||||
TimingSegment::~TimingSegment() {}
|
||||
|
||||
void TimingSegment::SetRow(const int s)
|
||||
{
|
||||
this->startingRow = s;
|
||||
}
|
||||
|
||||
void TimingSegment::SetBeat(const float s)
|
||||
{
|
||||
SetRow(BeatToNoteRow(s));
|
||||
}
|
||||
|
||||
int TimingSegment::GetRow() const
|
||||
{
|
||||
return this->startingRow;
|
||||
}
|
||||
|
||||
float TimingSegment::GetBeat() const
|
||||
{
|
||||
return NoteRowToBeat(GetRow());
|
||||
}
|
||||
|
||||
void TimingSegment::Scale( int start, int length, int newLength )
|
||||
{
|
||||
SetRow( ScalePosition( start, length, newLength, this->GetRow() ) );
|
||||
}
|
||||
|
||||
|
||||
/* ======================================================
|
||||
Here comes the actual timing segments implementation!! */
|
||||
|
||||
float FakeSegment::GetLength() const
|
||||
RString FakeSegment::ToString(int dec) const
|
||||
{
|
||||
return this->lengthBeats;
|
||||
}
|
||||
|
||||
void FakeSegment::SetLength(const float b)
|
||||
{
|
||||
this->lengthBeats = b;
|
||||
RString str = "%.0" + IntToString(dec)
|
||||
+ "f=%.0" + IntToString(dec) + "f";
|
||||
return ssprintf(str.c_str(), GetBeat(), GetLength());
|
||||
}
|
||||
|
||||
void FakeSegment::Scale( int start, int length, int newLength )
|
||||
@@ -70,24 +41,11 @@ void FakeSegment::Scale( int start, int length, int newLength )
|
||||
TimingSegment::Scale( start, length, newLength );
|
||||
}
|
||||
|
||||
bool FakeSegment::operator<( const FakeSegment &other ) const
|
||||
{
|
||||
LTCOMPARE(GetRow());
|
||||
LTCOMPARE(GetLength());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
float WarpSegment::GetLength() const
|
||||
RString WarpSegment::ToString(int dec) const
|
||||
{
|
||||
return this->lengthBeats;
|
||||
}
|
||||
|
||||
void WarpSegment::SetLength(const float b)
|
||||
{
|
||||
this->lengthBeats = b;
|
||||
RString str = "%.0" + IntToString(dec)
|
||||
+ "f=%.0" + IntToString(dec) + "f";
|
||||
return ssprintf(str.c_str(), GetBeat(), GetLength());
|
||||
}
|
||||
|
||||
void WarpSegment::Scale( int start, int length, int newLength )
|
||||
@@ -101,180 +59,48 @@ void WarpSegment::Scale( int start, int length, int newLength )
|
||||
TimingSegment::Scale( start, length, newLength );
|
||||
}
|
||||
|
||||
bool WarpSegment::operator<( const WarpSegment &other ) const
|
||||
RString TickcountSegment::ToString(int dec) const
|
||||
{
|
||||
LTCOMPARE(GetRow());
|
||||
LTCOMPARE(GetLength());
|
||||
return false;
|
||||
const RString str = "%.0" + IntToString(dec) + "f=%i";
|
||||
return ssprintf(str.c_str(), GetBeat(), GetTicks());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int TickcountSegment::GetTicks() const
|
||||
RString ComboSegment::ToString(int dec) const
|
||||
{
|
||||
return this->ticks;
|
||||
RString str = "%.0" + IntToString(dec) + "f=%i";
|
||||
if (GetCombo() == GetMissCombo())
|
||||
{
|
||||
return ssprintf(str.c_str(), GetBeat(), GetCombo());
|
||||
}
|
||||
str += "=%i";
|
||||
return ssprintf(str.c_str(), GetBeat(), GetCombo(), GetMissCombo());
|
||||
}
|
||||
|
||||
void TickcountSegment::SetTicks(const int i)
|
||||
RString LabelSegment::ToString(int dec) const
|
||||
{
|
||||
this->ticks = i;
|
||||
const RString str = "%.0" + IntToString(dec) + "f=%s";
|
||||
return ssprintf(str.c_str(), GetBeat(), GetLabel().c_str());
|
||||
}
|
||||
|
||||
bool TickcountSegment::operator<( const TickcountSegment &other ) const
|
||||
RString BPMSegment::ToString(int dec) const
|
||||
{
|
||||
LTCOMPARE(GetRow());
|
||||
LTCOMPARE(GetTicks());
|
||||
return false;
|
||||
const RString str = "%.0" + IntToString(dec)
|
||||
+ "f=%.0" + IntToString(dec) + "f";
|
||||
return ssprintf(str.c_str(), GetBeat(), GetBPM());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int ComboSegment::GetCombo() const
|
||||
RString TimeSignatureSegment::ToString(int dec) const
|
||||
{
|
||||
return this->combo;
|
||||
const RString str = "%.0" + IntToString(dec) + "f=%i=%i";
|
||||
return ssprintf(str.c_str(), GetBeat(), GetNum(), GetDen());
|
||||
}
|
||||
|
||||
void ComboSegment::SetCombo(const int i)
|
||||
RString SpeedSegment::ToString(int dec) const
|
||||
{
|
||||
this->combo = i;
|
||||
}
|
||||
|
||||
int ComboSegment::GetMissCombo() const
|
||||
{
|
||||
return this->missCombo;
|
||||
}
|
||||
|
||||
void ComboSegment::SetMissCombo(const int i)
|
||||
{
|
||||
this->missCombo = i;
|
||||
}
|
||||
|
||||
bool ComboSegment::operator<( const ComboSegment &other ) const
|
||||
{
|
||||
LTCOMPARE(GetRow());
|
||||
LTCOMPARE(GetCombo());
|
||||
LTCOMPARE(GetMissCombo());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
RString LabelSegment::GetLabel() const
|
||||
{
|
||||
return this->label;
|
||||
}
|
||||
|
||||
void LabelSegment::SetLabel(const RString l)
|
||||
{
|
||||
this->label = l;
|
||||
}
|
||||
|
||||
bool LabelSegment::operator<( const LabelSegment &other ) const
|
||||
{
|
||||
LTCOMPARE(GetRow());
|
||||
LTCOMPARE(GetLabel());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
float BPMSegment::GetBPM() const
|
||||
{
|
||||
return this->bps * 60.0f;
|
||||
}
|
||||
|
||||
void BPMSegment::SetBPM(const float bpm)
|
||||
{
|
||||
this->bps = bpm / 60.0f;
|
||||
}
|
||||
|
||||
float BPMSegment::GetBPS() const
|
||||
{
|
||||
return this->bps;
|
||||
}
|
||||
|
||||
void BPMSegment::SetBPS(const float newBPS)
|
||||
{
|
||||
this->bps = newBPS;
|
||||
}
|
||||
|
||||
bool BPMSegment::operator<( const BPMSegment &other ) const
|
||||
{
|
||||
LTCOMPARE(GetRow());
|
||||
LTCOMPARE(GetBPS());
|
||||
return false;
|
||||
}
|
||||
|
||||
int TimeSignatureSegment::GetNum() const
|
||||
{
|
||||
return this->numerator;
|
||||
}
|
||||
|
||||
void TimeSignatureSegment::SetNum(const int i)
|
||||
{
|
||||
this->numerator = i;
|
||||
}
|
||||
|
||||
int TimeSignatureSegment::GetDen() const
|
||||
{
|
||||
return this->denominator;
|
||||
}
|
||||
|
||||
void TimeSignatureSegment::SetDen(const int i)
|
||||
{
|
||||
this->denominator = i;
|
||||
}
|
||||
|
||||
int TimeSignatureSegment::GetNoteRowsPerMeasure() const
|
||||
{
|
||||
return BeatToNoteRow(1) * 4 * numerator / denominator;
|
||||
}
|
||||
|
||||
bool TimeSignatureSegment::operator<( const TimeSignatureSegment &other ) const
|
||||
{
|
||||
LTCOMPARE(GetRow());
|
||||
LTCOMPARE(GetNum());
|
||||
LTCOMPARE(GetDen());
|
||||
return false;
|
||||
}
|
||||
|
||||
float SpeedSegment::GetRatio() const
|
||||
{
|
||||
return this->ratio;
|
||||
}
|
||||
|
||||
void SpeedSegment::SetRatio(const float i)
|
||||
{
|
||||
this->ratio = i;
|
||||
}
|
||||
|
||||
float SpeedSegment::GetLength() const
|
||||
{
|
||||
return this->length;
|
||||
}
|
||||
|
||||
void SpeedSegment::SetLength(const float i)
|
||||
{
|
||||
this->length = i;
|
||||
}
|
||||
|
||||
|
||||
unsigned short SpeedSegment::GetUnit() const
|
||||
{
|
||||
return this->unit;
|
||||
}
|
||||
|
||||
void SpeedSegment::SetUnit(const unsigned short i)
|
||||
{
|
||||
this->unit = i;
|
||||
}
|
||||
|
||||
void SpeedSegment::SetUnit(const int i)
|
||||
{
|
||||
this->unit = static_cast<unsigned short>(i);
|
||||
const RString str = "%.0" + IntToString(dec)
|
||||
+ "f=%.0" + IntToString(dec) + "f=%.0"
|
||||
+ IntToString(dec) + "f=%u";
|
||||
return ssprintf(str.c_str(), GetBeat(), GetRatio(),
|
||||
GetDelay(), GetUnit());
|
||||
}
|
||||
|
||||
void SpeedSegment::Scale( int start, int oldLength, int newLength )
|
||||
@@ -283,7 +109,7 @@ void SpeedSegment::Scale( int start, int oldLength, int newLength )
|
||||
{
|
||||
// XXX: this function is duplicated, there should be a better way
|
||||
float startBeat = GetBeat();
|
||||
float endBeat = startBeat + GetLength();
|
||||
float endBeat = startBeat + GetDelay();
|
||||
float newStartBeat = ScalePosition(NoteRowToBeat(start),
|
||||
NoteRowToBeat(oldLength),
|
||||
NoteRowToBeat(newLength),
|
||||
@@ -292,76 +118,35 @@ void SpeedSegment::Scale( int start, int oldLength, int newLength )
|
||||
NoteRowToBeat(oldLength),
|
||||
NoteRowToBeat(newLength),
|
||||
endBeat);
|
||||
SetLength( newEndBeat - newStartBeat );
|
||||
SetDelay( newEndBeat - newStartBeat );
|
||||
}
|
||||
TimingSegment::Scale( start, oldLength, newLength );
|
||||
}
|
||||
|
||||
bool SpeedSegment::operator<( const SpeedSegment &other ) const
|
||||
RString ScrollSegment::ToString(int dec) const
|
||||
{
|
||||
LTCOMPARE(GetRow());
|
||||
LTCOMPARE(GetRatio());
|
||||
LTCOMPARE(GetLength());
|
||||
LTCOMPARE(GetUnit());
|
||||
return false;
|
||||
const RString str = "%.0" + IntToString(dec)
|
||||
+ "f=%.0" + IntToString(dec) + "f";
|
||||
return ssprintf(str.c_str(), GetBeat(), GetRatio());
|
||||
}
|
||||
|
||||
float ScrollSegment::GetRatio() const
|
||||
RString StopSegment::ToString(int dec) const
|
||||
{
|
||||
return this->ratio;
|
||||
const RString str = "%.0" + IntToString(dec)
|
||||
+ "f=%.0" + IntToString(dec) + "f";
|
||||
return ssprintf(str.c_str(), GetBeat(), GetPause());
|
||||
}
|
||||
|
||||
void ScrollSegment::SetRatio(const float i)
|
||||
RString DelaySegment::ToString(int dec) const
|
||||
{
|
||||
this->ratio = i;
|
||||
const RString str = "%.0" + IntToString(dec)
|
||||
+ "f=%.0" + IntToString(dec) + "f";
|
||||
return ssprintf(str.c_str(), GetBeat(), GetPause());
|
||||
}
|
||||
|
||||
bool ScrollSegment::operator<( const ScrollSegment &other ) const
|
||||
{
|
||||
LTCOMPARE(GetRow());
|
||||
LTCOMPARE(GetRatio());
|
||||
return false;
|
||||
}
|
||||
|
||||
float StopSegment::GetPause() const
|
||||
{
|
||||
return this->pauseSeconds;
|
||||
}
|
||||
|
||||
void StopSegment::SetPause(const float i)
|
||||
{
|
||||
this->pauseSeconds = i;
|
||||
}
|
||||
|
||||
bool StopSegment::operator<( const StopSegment &other ) const
|
||||
{
|
||||
LTCOMPARE(GetRow());
|
||||
LTCOMPARE(GetPause());
|
||||
return false;
|
||||
}
|
||||
|
||||
float DelaySegment::GetPause() const
|
||||
{
|
||||
return this->pauseSeconds;
|
||||
}
|
||||
|
||||
void DelaySegment::SetPause(const float i)
|
||||
{
|
||||
this->pauseSeconds = i;
|
||||
}
|
||||
|
||||
bool DelaySegment::operator<( const DelaySegment &other ) const
|
||||
{
|
||||
LTCOMPARE(GetRow());
|
||||
LTCOMPARE(GetPause());
|
||||
return false;
|
||||
}
|
||||
|
||||
#undef LTCOMPARE
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @author Jason Felds (c) 2011
|
||||
* @author Jason Felds (c) 2011
|
||||
* @section LICENSE
|
||||
* All rights reserved.
|
||||
*
|
||||
|
||||
+265
-803
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user