From b939bdec8edd406f7804589f1ec45fe3910046a9 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Sat, 2 Sep 2006 22:22:57 +0000 Subject: [PATCH] Add a last beat hint. The real last beat will be at least as long as the hint. --- stepmania/src/NotesLoaderSM.cpp | 3 +++ stepmania/src/NotesWriterSM.cpp | 2 ++ stepmania/src/Song.cpp | 5 +++-- stepmania/src/song.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/stepmania/src/NotesLoaderSM.cpp b/stepmania/src/NotesLoaderSM.cpp index b7ae48d0d8..3a814eda4b 100644 --- a/stepmania/src/NotesLoaderSM.cpp +++ b/stepmania/src/NotesLoaderSM.cpp @@ -293,6 +293,9 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out ) continue; out.m_fMusicLengthSeconds = StringToFloat( sParams[1] ); } + + else if( sValueName=="LASTBEATHINT" ) + out.m_fSpecifiedLastBeat = StringToFloat( sParams[1] ); else if( sValueName=="MUSICBYTES" ) ; /* ignore */ diff --git a/stepmania/src/NotesWriterSM.cpp b/stepmania/src/NotesWriterSM.cpp index aa85036e56..f76c227d14 100644 --- a/stepmania/src/NotesWriterSM.cpp +++ b/stepmania/src/NotesWriterSM.cpp @@ -54,6 +54,8 @@ void NotesWriterSM::WriteGlobalTags( RageFile &f, const Song &out ) f.PutLine( ssprintf( "#OFFSET:%.3f;", out.m_Timing.m_fBeat0OffsetInSeconds ) ); f.PutLine( ssprintf( "#SAMPLESTART:%.3f;", out.m_fMusicSampleStartSeconds ) ); f.PutLine( ssprintf( "#SAMPLELENGTH:%.3f;", out.m_fMusicSampleLengthSeconds ) ); + if( out.m_fSpecifiedLastBeat > 0 ) + f.PutLine( ssprintf("#LASTBEATHINT:%.3f;", out.m_fSpecifiedLastBeat) ); f.Write( "#SELECTABLE:" ); switch(out.m_SelectionDisplay) { diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index f80044a976..72618cc5d6 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -33,7 +33,7 @@ #include #include -const int FILE_CACHE_VERSION = 150; // increment this to invalidate cache +const int FILE_CACHE_VERSION = 151; // increment this to invalidate cache const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f; @@ -53,6 +53,7 @@ Song::Song() m_fMusicLengthSeconds = 0; m_fFirstBeat = -1; m_fLastBeat = -1; + m_fSpecifiedLastBeat = -1; m_SelectionDisplay = SHOW_ALWAYS; m_DisplayBPMType = DISPLAY_ACTUAL; m_fSpecifiedBPMMin = 0; @@ -657,7 +658,7 @@ void Song::TranslateTitles() void Song::ReCalculateRadarValuesAndLastBeat() { float fFirstBeat = FLT_MAX; /* inf */ - float fLastBeat = 0; + float fLastBeat = m_fSpecifiedLastBeat; // Make sure we're at least as long as the specified amount. for( unsigned i=0; i