Attempt to fix Editor bug with Delays.

This commit is contained in:
Jason Felds
2011-02-12 17:57:27 -05:00
parent 33e714c6a0
commit 60b5be592c
4 changed files with 11 additions and 29 deletions
+2 -4
View File
@@ -529,16 +529,14 @@ static bool LoadGlobalData( const RString &sPath, Song &out, bool &bKIUCompliant
else if (BeginsWith(NoteRowString, "|E")) else if (BeginsWith(NoteRowString, "|E"))
{ {
// Finally! the |E| tag is working as it should. I can die happy now -DaisuMaster // Finally! the |E| tag is working as it should. I can die happy now -DaisuMaster
bool bDelay = true;
float fCurDelay = 60 / out.m_Timing.GetBPMAtBeat(fCurBeat) * (float)numTemp / iTickCount; float fCurDelay = 60 / out.m_Timing.GetBPMAtBeat(fCurBeat) * (float)numTemp / iTickCount;
fCurDelay += out.m_Timing.GetStopAtRow(BeatToNoteRow(fCurBeat), bDelay); fCurDelay += out.m_Timing.GetStopAtRow(BeatToNoteRow(fCurBeat) );
out.m_Timing.SetStopAtBeat( fCurBeat, fCurDelay, true ); out.m_Timing.SetStopAtBeat( fCurBeat, fCurDelay, true );
continue; continue;
} }
else if (BeginsWith(NoteRowString, "|D")) else if (BeginsWith(NoteRowString, "|D"))
{ {
bool bDelay = true; float fCurDelay = out.m_Timing.GetStopAtRow(BeatToNoteRow(fCurBeat) );
float fCurDelay = out.m_Timing.GetStopAtRow(BeatToNoteRow(fCurBeat), bDelay);
fCurDelay += (float)numTemp / 1000; fCurDelay += (float)numTemp / 1000;
out.m_Timing.SetStopAtBeat( fCurBeat, fCurDelay, true ); out.m_Timing.SetStopAtBeat( fCurBeat, fCurDelay, true );
continue; continue;
+4 -5
View File
@@ -3454,8 +3454,8 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, const vector<int> &iAns
} }
case convert_pause_to_beat: case convert_pause_to_beat:
{ {
bool bThrowaway; // is it? // TODO: Convert both Delays and Stops at once.
float fStopSeconds = m_pSong->m_Timing.GetStopAtRow( BeatToNoteRow(GAMESTATE->m_fSongBeat), bThrowaway ); float fStopSeconds = m_pSong->m_Timing.GetStopAtRow( BeatToNoteRow(GAMESTATE->m_fSongBeat) );
m_pSong->m_Timing.SetStopAtBeat( GAMESTATE->m_fSongBeat, 0 ); m_pSong->m_Timing.SetStopAtBeat( GAMESTATE->m_fSongBeat, 0 );
float fStopBeats = fStopSeconds * m_pSong->GetBPMAtBeat(GAMESTATE->m_fSongBeat) / 60; float fStopBeats = fStopSeconds * m_pSong->GetBPMAtBeat(GAMESTATE->m_fSongBeat) / 60;
@@ -3581,11 +3581,10 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
break; break;
case stop: case stop:
// todo: Call a screen with class ScreenTextEntry instead. -aj // todo: Call a screen with class ScreenTextEntry instead. -aj
bool bThrowaway; // is it?
ScreenTextEntry::TextEntry( ScreenTextEntry::TextEntry(
SM_BackFromStopChange, SM_BackFromStopChange,
ENTER_STOP_VALUE, ENTER_STOP_VALUE,
ssprintf( "%.4f", m_pSong->m_Timing.GetStopAtRow( BeatToNoteRow(GAMESTATE->m_fSongBeat), bThrowaway ) ), ssprintf( "%.4f", m_pSong->m_Timing.GetStopAtRow( BeatToNoteRow(GAMESTATE->m_fSongBeat) ) ),
10 10
); );
break; break;
@@ -3594,7 +3593,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry( ScreenTextEntry::TextEntry(
SM_BackFromDelayChange, SM_BackFromDelayChange,
ENTER_DELAY_VALUE, ENTER_DELAY_VALUE,
ssprintf( "%.4f", m_pSong->m_Timing.GetStopAtRow( BeatToNoteRow(GAMESTATE->m_fSongBeat), bThrowaway ) ), ssprintf( "%.4f", m_pSong->m_Timing.GetDelayAtRow( BeatToNoteRow(GAMESTATE->m_fSongBeat) ) ),
10 10
); );
break; break;
+4 -17
View File
@@ -176,40 +176,27 @@ void TimingData::SetTickcountAtRow( int iRow, int iTicks )
} }
} }
float TimingData::GetStopAtRow( int iNoteRow, bool &bDelayOut ) const float TimingData::GetStopAtRow( int iNoteRow, bool bDelay ) const
{ {
bDelayOut = false; // not a delay by default
for( unsigned i=0; i<m_StopSegments.size(); i++ ) for( unsigned i=0; i<m_StopSegments.size(); i++ )
{ {
if( m_StopSegments[i].m_iStartRow == iNoteRow ) if( m_StopSegments[i].m_bDelay == bDelay && m_StopSegments[i].m_iStartRow == iNoteRow )
{ {
bDelayOut = m_StopSegments[i].m_bDelay;
return m_StopSegments[i].m_fStopSeconds; return m_StopSegments[i].m_fStopSeconds;
} }
} }
return 0; return 0;
} }
float TimingData::GetStopAtRow( int iRow ) const float TimingData::GetStopAtRow( int iRow ) const
{ {
for( unsigned i = 0; i < m_StopSegments.size(); i++ ) return GetStopAtRow( iRow, false );
{
if ( !m_StopSegments[i].m_bDelay && m_StopSegments[i].m_iStartRow == iRow )
return m_StopSegments[i].m_fStopSeconds;
}
return 0;
} }
float TimingData::GetDelayAtRow( int iRow ) const float TimingData::GetDelayAtRow( int iRow ) const
{ {
for( unsigned i = 0; i < m_StopSegments.size(); i++ ) return GetStopAtRow( iRow, true );
{
if ( m_StopSegments[i].m_bDelay && m_StopSegments[i].m_iStartRow == iRow )
return m_StopSegments[i].m_fStopSeconds;
}
return 0;
} }
int TimingData::GetWarpToRow( int iWarpBeginRow ) const int TimingData::GetWarpToRow( int iWarpBeginRow ) const
+1 -3
View File
@@ -550,13 +550,11 @@ public:
/** /**
* @brief Retrieve the Stop/Delay at the given row. * @brief Retrieve the Stop/Delay at the given row.
*
* Note: This function may need to be fixed: some parts of it are not working.
* @param iNoteRow the row in question. * @param iNoteRow the row in question.
* @param bDelayOut A flag to determine if we are getting a delay or not. * @param bDelayOut A flag to determine if we are getting a delay or not.
* @return the time we stop at this row. * @return the time we stop at this row.
*/ */
float GetStopAtRow( int iNoteRow, bool &bDelayOut ) const; float GetStopAtRow( int iNoteRow, bool bDelayOut ) const;
/** /**
* @brief Retrieve the Stop/Delay at the given row. * @brief Retrieve the Stop/Delay at the given row.
* @param fBeat the beat in question. * @param fBeat the beat in question.