diff --git a/Docs/Changelog_sm-ssc.txt b/Docs/Changelog_sm-ssc.txt index ad4251afe3..fa37556d03 100644 --- a/Docs/Changelog_sm-ssc.txt +++ b/Docs/Changelog_sm-ssc.txt @@ -16,6 +16,11 @@ It depends on who you ask. It could be v1.2.5, it could be v1.3.0, it could even be StepMania 5. We will wait and see. +20110405 +-------- +* [ScreenEdit] Allow modifying the #DISPLAYBPM traits in the editor. Look in + Edit Song Info to find it. [Wolfman2000] + 20110402 -------- * Fix a crash (issue 247) when exiting Practice mode from dance-solo, diff --git a/Themes/_fallback/Languages/en.ini b/Themes/_fallback/Languages/en.ini index 2b44eee848..ff7db0434f 100644 --- a/Themes/_fallback/Languages/en.ini +++ b/Themes/_fallback/Languages/en.ini @@ -534,6 +534,7 @@ x2.5=2.5x 8=8 8th=8th 9=9 +Actual=Actual Add=Additive All Music=All Music AllDifficulties=All Difficulties @@ -706,6 +707,7 @@ Song BGAnimation=Song BGAnimation Song Bitmap=Song Bitmap Song Movie=Song Movie Space=Space +Specified=Specified Split=Split Standard=Standard Start=Start @@ -822,6 +824,7 @@ Delete=Delete Delete beat and shift up=Delete beat and shift up Description=Description Difficulty=Difficulty +Display BPM=Display BPM DisplayAspectRatio=Aspect Ratio DisplayColorDepth=Display Color DisplayResolution=Display Resolution @@ -901,9 +904,11 @@ Low Meter=Low Meter Advanced Options=Advanced Options Main title=Main title Main title transliteration=Main title transliteration +Max BPM=Max Specified BPM MaxTextureResolution=Texture Resolution MenuTimer=Menu Timer Meter=Meter +Min BPM=Min Specified BPM Mines=Mines MoveRandomToEnd=Random At End More Options=More Options @@ -1223,6 +1228,8 @@ Enter a new main title transliteration.=Enter a new main title transliteration. Enter a new main title.=Enter a new main title. Enter a new sub title transliteration.=Enter a new sub title transliteration. Enter a new sub title.=Enter a new sub title. +Enter a new min BPM.=Enter the minimum displayed BPM. +Enter a new max BPM.=Enter the maximum displayed BPM. More than %d notes per measure is not allowed. This change has been reverted.=More than %d notes per measure is not allowed. This change has been reverted. No backgrounds available=No backgrounds available EditHelpText=Up/Down:\n change beat\nLeft/Right:\n change snap\nNumber keys:\n add/remove\n tap note\nCreate hold note:\n Hold a number\n while moving\n Up or Down\nCreate roll note:\n Hold Shift,\n then create a\n hold note.\nSpace bar:\n Set area\n marker\nEnter:\n Area Menu\nEscape:\n Main Menu\nF1:\n Show help\n diff --git a/src/BPMDisplay.cpp b/src/BPMDisplay.cpp index 80ce23a145..bd26e2c099 100644 --- a/src/BPMDisplay.cpp +++ b/src/BPMDisplay.cpp @@ -180,8 +180,8 @@ void BPMDisplay::SetBpmFromSong( const Song* pSong ) ASSERT( pSong ); switch( pSong->m_DisplayBPMType ) { - case Song::DISPLAY_ACTUAL: - case Song::DISPLAY_SPECIFIED: + case DISPLAY_BPM_ACTUAL: + case DISPLAY_BPM_SPECIFIED: { DisplayBpms bpms; pSong->GetDisplayBpms( bpms ); @@ -189,7 +189,7 @@ void BPMDisplay::SetBpmFromSong( const Song* pSong ) m_fCycleTime = 1.0f; } break; - case Song::DISPLAY_RANDOM: + case DISPLAY_BPM_RANDOM: CycleRandomly(); break; default: diff --git a/src/NotesLoaderDWI.cpp b/src/NotesLoaderDWI.cpp index 30386f0f8c..b15c74252f 100644 --- a/src/NotesLoaderDWI.cpp +++ b/src/NotesLoaderDWI.cpp @@ -500,18 +500,18 @@ bool DWILoader::LoadFromDir( const RString &sPath_, Song &out, set &Bla * worth bothering with since we don't display fractional BPM anyway.) */ if( sscanf( sParams[1], "%i..%i", &iMin, &iMax ) == 2 ) { - out.m_DisplayBPMType = Song::DISPLAY_SPECIFIED; + out.m_DisplayBPMType = DISPLAY_BPM_SPECIFIED; out.m_fSpecifiedBPMMin = (float) iMin; out.m_fSpecifiedBPMMax = (float) iMax; } else if( sscanf( sParams[1], "%i", &iMin ) == 1 ) { - out.m_DisplayBPMType = Song::DISPLAY_SPECIFIED; + out.m_DisplayBPMType = DISPLAY_BPM_SPECIFIED; out.m_fSpecifiedBPMMin = out.m_fSpecifiedBPMMax = (float) iMin; } else { - out.m_DisplayBPMType = Song::DISPLAY_RANDOM; + out.m_DisplayBPMType = DISPLAY_BPM_RANDOM; } } diff --git a/src/NotesLoaderSM.cpp b/src/NotesLoaderSM.cpp index 4937e37b52..7fa211df32 100644 --- a/src/NotesLoaderSM.cpp +++ b/src/NotesLoaderSM.cpp @@ -581,10 +581,10 @@ bool SMLoader::LoadFromSMFile( const RString &sPath, Song &out, bool bFromCache { // #DISPLAYBPM:[xxx][xxx:xxx]|[*]; if( sParams[1] == "*" ) - out.m_DisplayBPMType = Song::DISPLAY_RANDOM; + out.m_DisplayBPMType = DISPLAY_BPM_RANDOM; else { - out.m_DisplayBPMType = Song::DISPLAY_SPECIFIED; + out.m_DisplayBPMType = DISPLAY_BPM_SPECIFIED; out.m_fSpecifiedBPMMin = StringToFloat( sParams[1] ); if( sParams[2].empty() ) out.m_fSpecifiedBPMMax = out.m_fSpecifiedBPMMin; diff --git a/src/NotesLoaderSMA.cpp b/src/NotesLoaderSMA.cpp index 2d60122764..dd6ce2c60f 100644 --- a/src/NotesLoaderSMA.cpp +++ b/src/NotesLoaderSMA.cpp @@ -230,10 +230,10 @@ bool SMALoader::LoadFromSMAFile( const RString &sPath, Song &out ) { // #DISPLAYBPM:[xxx][xxx:xxx]|[*]; if( sParams[1] == "*" ) - out.m_DisplayBPMType = Song::DISPLAY_RANDOM; + out.m_DisplayBPMType = DISPLAY_BPM_RANDOM; else { - out.m_DisplayBPMType = Song::DISPLAY_SPECIFIED; + out.m_DisplayBPMType = DISPLAY_BPM_SPECIFIED; out.m_fSpecifiedBPMMin = StringToFloat( sParams[1] ); if( sParams[2].empty() ) out.m_fSpecifiedBPMMax = out.m_fSpecifiedBPMMin; diff --git a/src/NotesLoaderSSC.cpp b/src/NotesLoaderSSC.cpp index 1868dfd19d..409999960d 100644 --- a/src/NotesLoaderSSC.cpp +++ b/src/NotesLoaderSSC.cpp @@ -256,10 +256,10 @@ bool SSCLoader::LoadFromSSCFile( const RString &sPath, Song &out, bool bFromCach { // #DISPLAYBPM:[xxx][xxx:xxx]|[*]; if( sParams[1] == "*" ) - out.m_DisplayBPMType = Song::DISPLAY_RANDOM; + out.m_DisplayBPMType = DISPLAY_BPM_RANDOM; else { - out.m_DisplayBPMType = Song::DISPLAY_SPECIFIED; + out.m_DisplayBPMType = DISPLAY_BPM_SPECIFIED; out.m_fSpecifiedBPMMin = StringToFloat( sParams[1] ); if( sParams[2].empty() ) out.m_fSpecifiedBPMMax = out.m_fSpecifiedBPMMin; diff --git a/src/NotesWriterDWI.cpp b/src/NotesWriterDWI.cpp index 2398b708e7..ce8ba00231 100644 --- a/src/NotesWriterDWI.cpp +++ b/src/NotesWriterDWI.cpp @@ -360,16 +360,16 @@ bool NotesWriterDWI::Write( RString sPath, const Song &out ) f.PutLine( ssprintf("#CDTITLE:%s;", DwiEscape(out.m_sCDTitleFile).c_str()) ); switch( out.m_DisplayBPMType ) { - case Song::DISPLAY_ACTUAL: + case DISPLAY_BPM_ACTUAL: // write nothing break; - case Song::DISPLAY_SPECIFIED: + case DISPLAY_BPM_SPECIFIED: if( out.m_fSpecifiedBPMMin == out.m_fSpecifiedBPMMax ) f.PutLine( ssprintf("#DISPLAYBPM:%i;\n", (int) out.m_fSpecifiedBPMMin) ); else f.PutLine( ssprintf("#DISPLAYBPM:%i..%i;\n", (int) out.m_fSpecifiedBPMMin, (int) out.m_fSpecifiedBPMMax) ); break; - case Song::DISPLAY_RANDOM: + case DISPLAY_BPM_RANDOM: f.PutLine( "#DISPLAYBPM:*" ); break; } diff --git a/src/NotesWriterSM.cpp b/src/NotesWriterSM.cpp index 13d3e21a3b..920081509a 100644 --- a/src/NotesWriterSM.cpp +++ b/src/NotesWriterSM.cpp @@ -94,17 +94,17 @@ static void WriteGlobalTags( RageFile &f, const Song &out ) switch( out.m_DisplayBPMType ) { - case Song::DISPLAY_ACTUAL: + case DISPLAY_BPM_ACTUAL: // write nothing break; - case Song::DISPLAY_SPECIFIED: + case DISPLAY_BPM_SPECIFIED: if( out.m_fSpecifiedBPMMin == out.m_fSpecifiedBPMMax ) f.PutLine( ssprintf( "#DISPLAYBPM:%.3f;", out.m_fSpecifiedBPMMin ) ); else f.PutLine( ssprintf( "#DISPLAYBPM:%.3f:%.3f;", out.m_fSpecifiedBPMMin, out.m_fSpecifiedBPMMax ) ); break; - case Song::DISPLAY_RANDOM: + case DISPLAY_BPM_RANDOM: f.PutLine( ssprintf( "#DISPLAYBPM:*;" ) ); break; } diff --git a/src/NotesWriterSSC.cpp b/src/NotesWriterSSC.cpp index 36c170b475..ca681fe307 100644 --- a/src/NotesWriterSSC.cpp +++ b/src/NotesWriterSSC.cpp @@ -91,16 +91,16 @@ static void WriteGlobalTags( RageFile &f, const Song &out ) switch( out.m_DisplayBPMType ) { - case Song::DISPLAY_ACTUAL: + case DISPLAY_BPM_ACTUAL: // write nothing break; - case Song::DISPLAY_SPECIFIED: + case DISPLAY_BPM_SPECIFIED: if( out.m_fSpecifiedBPMMin == out.m_fSpecifiedBPMMax ) f.PutLine( ssprintf( "#DISPLAYBPM:%.6f;", out.m_fSpecifiedBPMMin ) ); else f.PutLine( ssprintf( "#DISPLAYBPM:%.6f:%.6f;", out.m_fSpecifiedBPMMin, out.m_fSpecifiedBPMMax ) ); break; - case Song::DISPLAY_RANDOM: + case DISPLAY_BPM_RANDOM: f.PutLine( ssprintf( "#DISPLAYBPM:*;" ) ); break; } diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index b315b74098..801f4aa467 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -539,7 +539,10 @@ static MenuDef g_SongInformation( MenuRowDef( ScreenEdit::main_title_transliteration, "Main title transliteration", true, EditMode_Practice, true, true, 0, NULL ), MenuRowDef( ScreenEdit::sub_title_transliteration, "Sub title transliteration", true, EditMode_Practice, true, true, 0, NULL ), MenuRowDef( ScreenEdit::artist_transliteration, "Artist transliteration", true, EditMode_Practice, true, true, 0, NULL ), - MenuRowDef( ScreenEdit::last_beat_hint, "Last beat hint", true, EditMode_Full, true, true, 0, NULL ) + MenuRowDef( ScreenEdit::last_beat_hint, "Last beat hint", true, EditMode_Full, true, true, 0, NULL ), + MenuRowDef( ScreenEdit::display_bpm, "Display BPM", true, EditMode_Full, true, true, 0, "Actual", "Specified", "Random" ), + MenuRowDef( ScreenEdit::min_bpm, "Min BPM", true, EditMode_Full, true, true, 0, NULL ), + MenuRowDef( ScreenEdit::min_bpm, "Max BPM", true, EditMode_Full, true, true, 0, NULL ) ); static MenuDef g_TimingDataInformation( @@ -2980,6 +2983,16 @@ static void ChangeLastBeatHint( const RString &sNew ) GAMESTATE->m_pCurSong->m_fSpecifiedLastBeat = StringToFloat( sNew ); } +static void ChangeMinBPM( const RString &sNew ) +{ + GAMESTATE->m_pCurSong->m_fSpecifiedBPMMin = StringToFloat( sNew ); +} + +static void ChangeMaxBPM( const RString &sNew ) +{ + GAMESTATE->m_pCurSong->m_fSpecifiedBPMMax = StringToFloat( sNew ); +} + // End helper functions static LocalizedString REVERT_LAST_SAVE ( "ScreenEdit", "Do you want to revert to your last save?" ); @@ -3171,6 +3184,9 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector &iAns g_SongInformation.rows[sub_title_transliteration].SetOneUnthemedChoice( pSong->m_sSubTitleTranslit ); g_SongInformation.rows[artist_transliteration].SetOneUnthemedChoice( pSong->m_sArtistTranslit ); g_SongInformation.rows[last_beat_hint].SetOneUnthemedChoice( ssprintf("%.5f", pSong->m_fSpecifiedLastBeat) ); + g_SongInformation.rows[display_bpm].iDefaultChoice = pSong->m_DisplayBPMType; + g_SongInformation.rows[min_bpm].SetOneUnthemedChoice( ssprintf("%.5f", pSong->m_fSpecifiedBPMMin) ); + g_SongInformation.rows[max_bpm].SetOneUnthemedChoice( ssprintf("%.5f", pSong->m_fSpecifiedBPMMax) ); EditMiniMenu( &g_SongInformation, SM_BackFromSongInformation ); } @@ -3575,13 +3591,15 @@ static LocalizedString ENTER_MAIN_TITLE_TRANSLIT ("ScreenEdit","Enter a new main static LocalizedString ENTER_SUB_TITLE_TRANSLIT ("ScreenEdit","Enter a new sub title transliteration."); static LocalizedString ENTER_ARTIST_TRANSLIT ("ScreenEdit","Enter a new artist transliteration."); static LocalizedString ENTER_LAST_BEAT_HINT ("ScreenEdit","Enter a new last beat hint."); +static LocalizedString ENTER_MIN_BPM ("ScreenEdit","Enter a new min BPM."); +static LocalizedString ENTER_MAX_BPM ("ScreenEdit","Enter a new max BPM."); void ScreenEdit::HandleSongInformationChoice( SongInformationChoice c, const vector &iAnswers ) { Song* pSong = GAMESTATE->m_pCurSong; + pSong->m_DisplayBPMType = static_cast(iAnswers[display_bpm]); switch( c ) { - DEFAULT_FAIL(c); case main_title: ScreenTextEntry::TextEntry( SM_None, ENTER_MAIN_TITLE, pSong->m_sMainTitle, 100, NULL, ChangeMainTitle, NULL ); break; @@ -3607,7 +3625,20 @@ void ScreenEdit::HandleSongInformationChoice( SongInformationChoice c, const vec ScreenTextEntry::TextEntry( SM_None, ENTER_ARTIST_TRANSLIT, pSong->m_sArtistTranslit, 100, NULL, ChangeArtistTranslit, NULL ); break; case last_beat_hint: - ScreenTextEntry::TextEntry( SM_None, ENTER_LAST_BEAT_HINT, ssprintf("%.5f", pSong->m_fSpecifiedLastBeat), 20, ScreenTextEntry::FloatValidate, ChangeLastBeatHint, NULL ); + ScreenTextEntry::TextEntry( SM_None, ENTER_LAST_BEAT_HINT, + ssprintf("%.5f", pSong->m_fSpecifiedLastBeat), 20, + ScreenTextEntry::FloatValidate, ChangeLastBeatHint, NULL ); + break; + case min_bpm: + ScreenTextEntry::TextEntry( SM_None, ENTER_MIN_BPM, + ssprintf("%.5f", pSong->m_fSpecifiedBPMMin), 20, + ScreenTextEntry::FloatValidate, ChangeMinBPM, NULL ); + break; + case max_bpm: + ScreenTextEntry::TextEntry( SM_None, ENTER_MAX_BPM, + ssprintf("%.5f", pSong->m_fSpecifiedBPMMax), 20, + ScreenTextEntry::FloatValidate, ChangeMaxBPM, NULL ); + break; }; } diff --git a/src/ScreenEdit.h b/src/ScreenEdit.h index 1f79b78528..1af4734fc1 100644 --- a/src/ScreenEdit.h +++ b/src/ScreenEdit.h @@ -442,6 +442,9 @@ public: sub_title_transliteration, artist_transliteration, last_beat_hint, + display_bpm, + min_bpm, + max_bpm, NUM_SONG_INFORMATION_CHOICES }; void HandleSongInformationChoice( SongInformationChoice c, const vector &iAnswers ); diff --git a/src/Song.cpp b/src/Song.cpp index 50537a8b97..224fa855bd 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -74,7 +74,7 @@ Song::Song() m_fSpecifiedLastBeat = -1; m_SelectionDisplay = SHOW_ALWAYS; m_bEnabled = true; - m_DisplayBPMType = DISPLAY_ACTUAL; + m_DisplayBPMType = DISPLAY_BPM_ACTUAL; m_fSpecifiedBPMMin = 0; m_fSpecifiedBPMMax = 0; m_bIsSymLink = false; @@ -147,7 +147,7 @@ void Song::AddLyricSegment( LyricSegment seg ) void Song::GetDisplayBpms( DisplayBpms &AddTo ) const { - if( m_DisplayBPMType == DISPLAY_SPECIFIED ) + if( m_DisplayBPMType == DISPLAY_BPM_SPECIFIED ) { AddTo.Add( m_fSpecifiedBPMMin ); AddTo.Add( m_fSpecifiedBPMMax ); @@ -1458,7 +1458,7 @@ bool Song::HasSignificantBpmChangesOrStops() const // Don't consider BPM changes that only are only for maintaining sync as // a real BpmChange. - if( m_DisplayBPMType == DISPLAY_SPECIFIED ) + if( m_DisplayBPMType == DISPLAY_BPM_SPECIFIED ) { if( m_fSpecifiedBPMMin != m_fSpecifiedBPMMax ) return true; @@ -1612,7 +1612,7 @@ public: } static int IsDisplayBpmRandom( T* p, lua_State *L ) { - lua_pushboolean( L, p->m_DisplayBPMType == Song::DISPLAY_RANDOM ); + lua_pushboolean( L, p->m_DisplayBPMType == DISPLAY_BPM_RANDOM ); return 1; } diff --git a/src/Song.h b/src/Song.h index d9b1d18c1f..d8dd4a20ee 100644 --- a/src/Song.h +++ b/src/Song.h @@ -35,6 +35,15 @@ enum BackgroundLayer NUM_BackgroundLayer, BACKGROUND_LAYER_Invalid }; + +/** @brief The different ways of displaying the BPM. */ +enum DisplayBPM +{ + DISPLAY_BPM_ACTUAL, /**< Display the song's actual BPM. */ + DISPLAY_BPM_SPECIFIED, /**< Display a specified value or values. */ + DISPLAY_BPM_RANDOM /**< Display a random selection of BPMs. */ +}; + /** @brief A custom foreach loop for the different background layers. */ #define FOREACH_BackgroundLayer( bl ) FOREACH_ENUM( BackgroundLayer, bl ) @@ -222,7 +231,7 @@ public: float m_fSpecifiedLastBeat; // specified last beat of the song float m_fMusicSampleStartSeconds; float m_fMusicSampleLengthSeconds; - enum { DISPLAY_ACTUAL, DISPLAY_SPECIFIED, DISPLAY_RANDOM } m_DisplayBPMType; + DisplayBPM m_DisplayBPMType; float m_fSpecifiedBPMMin; float m_fSpecifiedBPMMax; // if a range, then Min != Max diff --git a/src/Trail.cpp b/src/Trail.cpp index bbd54bf4bc..073d266c93 100644 --- a/src/Trail.cpp +++ b/src/Trail.cpp @@ -189,11 +189,11 @@ void Trail::GetDisplayBpms( DisplayBpms &AddTo ) const ASSERT( pSong ); switch( pSong->m_DisplayBPMType ) { - case Song::DISPLAY_ACTUAL: - case Song::DISPLAY_SPECIFIED: + case DISPLAY_BPM_ACTUAL: + case DISPLAY_BPM_SPECIFIED: pSong->GetDisplayBpms( AddTo ); break; - case Song::DISPLAY_RANDOM: + case DISPLAY_BPM_RANDOM: AddTo.Add( -1 ); break; DEFAULT_FAIL( pSong->m_DisplayBPMType );