More flexible song timing.

Still not finding the bug I'm after though.
This commit is contained in:
Jason Felds
2011-06-01 14:01:35 -04:00
parent c249f0eaf5
commit 63ba56d0be
+7 -7
View File
@@ -1308,7 +1308,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
return;
}
TimingData &sTiming = GAMESTATE->m_pCurSong->m_SongTiming;
float playerBeat = GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat;
float playerBeat = GetAppropriatePosition().m_fSongBeat;
int beatsPerMeasure = sTiming.GetTimeSignatureSegmentAtBeat( playerBeat ).GetNum();
switch( EditB )
@@ -2045,12 +2045,12 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
{
if( g_iDefaultRecordLength.Get() == -1 )
{
m_iStartPlayingAt = BeatToNoteRow(GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat);
m_iStartPlayingAt = BeatToNoteRow(GetAppropriatePosition().m_fSongBeat);
m_iStopPlayingAt = max( m_iStartPlayingAt, m_NoteDataEdit.GetLastRow() + 1 );
}
else
{
m_iStartPlayingAt = BeatToNoteRow( ftruncf(GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat, g_iDefaultRecordLength.Get()) );
m_iStartPlayingAt = BeatToNoteRow( ftruncf(GetAppropriatePosition().m_fSongBeat, g_iDefaultRecordLength.Get()) );
m_iStopPlayingAt = m_iStartPlayingAt + BeatToNoteRow( g_iDefaultRecordLength.Get() );
}
@@ -2067,7 +2067,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
}
break;
case EDIT_BUTTON_RECORD_FROM_CURSOR:
m_iStartPlayingAt = BeatToNoteRow(GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat);
m_iStartPlayingAt = BeatToNoteRow(GetAppropriatePosition().m_fSongBeat);
m_iStopPlayingAt = max( m_iStartPlayingAt, m_NoteDataEdit.GetLastRow() );
TransitionEditState( STATE_RECORDING );
break;
@@ -2278,7 +2278,7 @@ void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
{
case EDIT_BUTTON_RETURN_TO_EDIT:
/* When exiting play mode manually, leave the cursor where it is. */
m_fBeatToReturnTo = GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat;
m_fBeatToReturnTo = GetAppropriatePosition().m_fSongBeat;
TransitionEditState( STATE_EDITING );
break;
case EDIT_BUTTON_OFFSET_UP:
@@ -2349,7 +2349,7 @@ void ScreenEdit::TransitionEditState( EditState em )
{
case STATE_EDITING:
// If exiting EDIT mode, save the cursor position.
m_fBeatToReturnTo = GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat;
m_fBeatToReturnTo = GetAppropriatePosition().m_fSongBeat;
break;
case STATE_PLAYING:
@@ -4277,7 +4277,7 @@ float ScreenEdit::GetMaximumBeatForNewNote() const
* mid-measure, and it's odd to have movement capped to these weird
* beats. */
TimingData &songTiming = GAMESTATE->m_pCurSong->m_SongTiming;
float playerBeat = GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat;
float playerBeat = GetAppropriatePosition().m_fSongBeat;
int beatsPerMeasure = songTiming.GetTimeSignatureSegmentAtBeat( playerBeat ).GetNum();
fEndBeat += beatsPerMeasure;
fEndBeat = ftruncf( fEndBeat, (float)beatsPerMeasure );