fix crash if a button is held while recording and still in the lead-in

This commit is contained in:
Glenn Maynard
2004-06-11 05:08:25 +00:00
parent a89083d9f4
commit cafede40f3
+3 -3
View File
@@ -443,13 +443,13 @@ void ScreenEdit::Update( float fDeltaTime )
StyleInput StyleI( PLAYER_1, t );
float fSecsHeld = INPUTMAPPER->GetSecsHeld( StyleI );
if( fSecsHeld > RECORD_HOLD_SECONDS )
if( fSecsHeld > RECORD_HOLD_SECONDS && GAMESTATE->m_fSongBeat > 0 )
{
// add or extend hold
const float fHoldStartSeconds = m_soundMusic.GetPositionSeconds() - fSecsHeld;
float fStartBeat = m_pSong->GetBeatFromElapsedTime( fHoldStartSeconds );
float fEndBeat = GAMESTATE->m_fSongBeat;
float fStartBeat = max( 0, m_pSong->GetBeatFromElapsedTime( fHoldStartSeconds ) );
float fEndBeat = max( fStartBeat, GAMESTATE->m_fSongBeat );
// Round hold start and end to the nearest snap interval
fStartBeat = froundf( fStartBeat, NoteTypeToBeat(m_SnapDisplay.GetNoteType()) );