Replacing use of CalculateRadarValues with CalculateStepStats, and ReCalculateRadarValuesAndLastSecond with ReCalculateStepStatsAndLastSecond

This commit is contained in:
Michael Votaw
2025-02-11 19:39:03 -08:00
committed by teejusb
parent afa44ee4df
commit bd897b676a
3 changed files with 12 additions and 11 deletions
+2 -2
View File
@@ -3438,7 +3438,7 @@ void ScreenEdit::TransitionEditState( EditState em )
Steps* pSteps = GAMESTATE->m_pCurSteps[main_player_]; Steps* pSteps = GAMESTATE->m_pCurSteps[main_player_];
ASSERT(pSteps != nullptr); ASSERT(pSteps != nullptr);
pSteps->SetNoteData(m_NoteDataEdit); pSteps->SetNoteData(m_NoteDataEdit);
m_pSong->ReCalculateRadarValuesAndLastSecond(); m_pSong->ReCalculateStepStatsAndLastSecond();
// TODO: Background videos don't support seeking, when they do, make sure // TODO: Background videos don't support seeking, when they do, make sure
// to load the appropriate part of the video. // to load the appropriate part of the video.
@@ -4472,7 +4472,7 @@ void ScreenEdit::PerformSave(bool autosave)
ASSERT( m_pSteps->IsAnEdit() ); ASSERT( m_pSteps->IsAnEdit() );
RString sError; RString sError;
m_pSteps->CalculateRadarValues( m_pSong->m_fMusicLengthSeconds ); m_pSteps->CalculateStepStats( m_pSong->m_fMusicLengthSeconds );
if( !NotesWriterSM::WriteEditFileToMachine(m_pSong, m_pSteps, sError) ) if( !NotesWriterSM::WriteEditFileToMachine(m_pSong, m_pSteps, sError) )
{ {
ScreenPrompt::Prompt( SM_None, sError ); ScreenPrompt::Prompt( SM_None, sError );
+7 -6
View File
@@ -1110,7 +1110,7 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
/* Generate these before we autogen notes, so the new notes can inherit /* Generate these before we autogen notes, so the new notes can inherit
* their source's values. */ * their source's values. */
ReCalculateRadarValuesAndLastSecond(from_cache, true); ReCalculateStepStatsAndLastSecond(from_cache, true);
// If the music length is suspiciously shorter than the last second, adjust // 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 // the length. This prevents the ogg patch from setting a false length. -Kyz
if(m_fMusicLengthSeconds < lastSecond - 10.0f) if(m_fMusicLengthSeconds < lastSecond - 10.0f)
@@ -1131,13 +1131,15 @@ void Song::TranslateTitles()
m_sMainTitleTranslit, m_sSubTitleTranslit, m_sArtistTranslit ); 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 ) if( fromCache && this->GetFirstSecond() >= 0 && this->GetLastSecond() > 0 )
{ {
// this is loaded from cache, then we just have to calculate the radar values. // this is loaded from cache, then we just have to calculate the radar values.
for( unsigned i=0; i<m_vpSteps.size(); i++ ) for( unsigned i=0; i<m_vpSteps.size(); i++ )
m_vpSteps[i]->CalculateRadarValues( m_fMusicLengthSeconds ); {
m_vpSteps[i]->CalculateStepStats( m_fMusicLengthSeconds );
}
return; return;
} }
@@ -1148,8 +1150,7 @@ void Song::ReCalculateRadarValuesAndLastSecond(bool fromCache, bool duringCache)
for( unsigned i=0; i<m_vpSteps.size(); i++ ) for( unsigned i=0; i<m_vpSteps.size(); i++ )
{ {
Steps* pSteps = m_vpSteps[i]; Steps* pSteps = m_vpSteps[i];
pSteps->CalculateStepStats(m_fMusicLengthSeconds);
pSteps->CalculateRadarValues( m_fMusicLengthSeconds );
// Must initialize before the gotos. // Must initialize before the gotos.
NoteData tempNoteData; NoteData tempNoteData;
@@ -1214,7 +1215,7 @@ void Song::Save(bool autosave)
{ {
LOG->Trace( "Song::SaveToSongFile()" ); LOG->Trace( "Song::SaveToSongFile()" );
ReCalculateRadarValuesAndLastSecond(); ReCalculateStepStatsAndLastSecond();
TranslateTitles(); TranslateTitles();
// Save the new files. These calls make backups on their own. // Save the new files. These calls make backups on their own.
+2 -2
View File
@@ -108,11 +108,11 @@ public:
void TidyUpData( bool fromCache = false, bool duringCache = false ); 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. * This is called by TidyUpData, after saving the Song.
* @param fromCache was this data loaded from the cache file? * @param fromCache was this data loaded from the cache file?
* @param duringCache was this data loaded during the cache process? */ * @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. * @brief Translate any titles that aren't in english.
* This is called by TidyUpData. */ * This is called by TidyUpData. */