From bd897b676a25fb834b115bc7a7b2399fcce69f39 Mon Sep 17 00:00:00 2001 From: Michael Votaw Date: Tue, 23 Jul 2024 19:36:11 -0500 Subject: [PATCH] Replacing use of CalculateRadarValues with CalculateStepStats, and ReCalculateRadarValuesAndLastSecond with ReCalculateStepStatsAndLastSecond --- src/ScreenEdit.cpp | 4 ++-- src/Song.cpp | 15 ++++++++------- src/Song.h | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index ac6fbf9a49..99a2b9505d 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -3438,7 +3438,7 @@ void ScreenEdit::TransitionEditState( EditState em ) Steps* pSteps = GAMESTATE->m_pCurSteps[main_player_]; ASSERT(pSteps != nullptr); pSteps->SetNoteData(m_NoteDataEdit); - m_pSong->ReCalculateRadarValuesAndLastSecond(); + m_pSong->ReCalculateStepStatsAndLastSecond(); // TODO: Background videos don't support seeking, when they do, make sure // to load the appropriate part of the video. @@ -4472,7 +4472,7 @@ void ScreenEdit::PerformSave(bool autosave) ASSERT( m_pSteps->IsAnEdit() ); RString sError; - m_pSteps->CalculateRadarValues( m_pSong->m_fMusicLengthSeconds ); + m_pSteps->CalculateStepStats( m_pSong->m_fMusicLengthSeconds ); if( !NotesWriterSM::WriteEditFileToMachine(m_pSong, m_pSteps, sError) ) { ScreenPrompt::Prompt( SM_None, sError ); diff --git a/src/Song.cpp b/src/Song.cpp index fc040da6be..9a29fd2e3e 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -1110,7 +1110,7 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ ) /* Generate these before we autogen notes, so the new notes can inherit * their source's values. */ - ReCalculateRadarValuesAndLastSecond(from_cache, true); + ReCalculateStepStatsAndLastSecond(from_cache, true); // If the music length is suspiciously shorter than the last second, adjust // the length. This prevents the ogg patch from setting a false length. -Kyz if(m_fMusicLengthSeconds < lastSecond - 10.0f) @@ -1131,13 +1131,15 @@ void Song::TranslateTitles() m_sMainTitleTranslit, m_sSubTitleTranslit, m_sArtistTranslit ); } -void Song::ReCalculateRadarValuesAndLastSecond(bool fromCache, bool duringCache) +void Song::ReCalculateStepStatsAndLastSecond(bool fromCache, bool duringCache) { if( fromCache && this->GetFirstSecond() >= 0 && this->GetLastSecond() > 0 ) { // this is loaded from cache, then we just have to calculate the radar values. for( unsigned i=0; iCalculateRadarValues( m_fMusicLengthSeconds ); + { + m_vpSteps[i]->CalculateStepStats( m_fMusicLengthSeconds ); + } return; } @@ -1148,9 +1150,8 @@ void Song::ReCalculateRadarValuesAndLastSecond(bool fromCache, bool duringCache) for( unsigned i=0; iCalculateRadarValues( m_fMusicLengthSeconds ); - + pSteps->CalculateStepStats(m_fMusicLengthSeconds); + // Must initialize before the gotos. NoteData tempNoteData; pSteps->GetNoteData( tempNoteData ); @@ -1214,7 +1215,7 @@ void Song::Save(bool autosave) { LOG->Trace( "Song::SaveToSongFile()" ); - ReCalculateRadarValuesAndLastSecond(); + ReCalculateStepStatsAndLastSecond(); TranslateTitles(); // Save the new files. These calls make backups on their own. diff --git a/src/Song.h b/src/Song.h index dd143f7b34..0196dae14c 100644 --- a/src/Song.h +++ b/src/Song.h @@ -108,11 +108,11 @@ public: void TidyUpData( bool fromCache = false, bool duringCache = false ); /** - * @brief Get the new radar values, and determine the last second at the same time. + * @brief Get the new step stats, and determine the last second at the same time. * This is called by TidyUpData, after saving the Song. * @param fromCache was this data loaded from the cache file? * @param duringCache was this data loaded during the cache process? */ - void ReCalculateRadarValuesAndLastSecond(bool fromCache = false, bool duringCache = false); + void ReCalculateStepStatsAndLastSecond(bool fromCache = false, bool duringCache = false); /** * @brief Translate any titles that aren't in english. * This is called by TidyUpData. */