fix radar values don't get recalculated after changing steps in editor
fix radar values shown for edits if copied from official steps
This commit is contained in:
@@ -1812,10 +1812,12 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
|
||||
m_CurrentAction = c;
|
||||
|
||||
// copy edit into current Steps
|
||||
Song* pSong = GAMESTATE->m_pCurSong;
|
||||
Steps* pSteps = GAMESTATE->m_pCurSteps[PLAYER_1];
|
||||
ASSERT( pSteps );
|
||||
|
||||
pSteps->SetNoteData( m_NoteDataEdit );
|
||||
pSteps->CalculateRadarValues( pSong->m_fMusicLengthSeconds );
|
||||
|
||||
if( HOME_EDIT_MODE )
|
||||
{
|
||||
|
||||
+11
-14
@@ -786,7 +786,13 @@ void Song::ReCalculateRadarValuesAndLastBeat()
|
||||
{
|
||||
Steps* pSteps = m_vpSteps[i];
|
||||
|
||||
/* If it's autogen, radar vals and first/last beat will come from the parent. */
|
||||
pSteps->CalculateRadarValues( m_fMusicLengthSeconds );
|
||||
|
||||
//
|
||||
// calculate lastBeat
|
||||
//
|
||||
|
||||
/* If it's autogen, then first/last beat will come from the parent. */
|
||||
if( pSteps->IsAutogen() )
|
||||
continue;
|
||||
|
||||
@@ -795,28 +801,19 @@ void Song::ReCalculateRadarValuesAndLastBeat()
|
||||
if( pSteps->IsAnEdit() )
|
||||
continue;
|
||||
|
||||
// Don't set first/last beat based on lights. They often start very
|
||||
// early and end very late.
|
||||
if( pSteps->m_StepsType == STEPS_TYPE_LIGHTS_CABINET )
|
||||
continue;
|
||||
|
||||
//
|
||||
// calculate radar values
|
||||
//
|
||||
NoteData tempNoteData;
|
||||
pSteps->GetNoteData( tempNoteData );
|
||||
|
||||
RadarValues v;
|
||||
NoteDataUtil::GetRadarValues( tempNoteData, m_fMusicLengthSeconds, v );
|
||||
pSteps->SetRadarValues( v );
|
||||
|
||||
|
||||
/* Many songs have stray, empty song patterns. Ignore them, so
|
||||
* they don't force the first beat of the whole song to 0. */
|
||||
if( tempNoteData.GetLastRow() == 0 )
|
||||
continue;
|
||||
|
||||
// Don't set first/last beat based on lights. They often start very
|
||||
// early and end very late.
|
||||
if( pSteps->m_StepsType == STEPS_TYPE_LIGHTS_CABINET )
|
||||
continue;
|
||||
|
||||
fFirstBeat = min( fFirstBeat, tempNoteData.GetFirstBeat() );
|
||||
fLastBeat = max( fLastBeat, tempNoteData.GetLastBeat() );
|
||||
}
|
||||
|
||||
+19
-2
@@ -151,6 +151,23 @@ void Steps::TidyUpData()
|
||||
SetMeter( int(PredictMeter()) );
|
||||
}
|
||||
|
||||
void Steps::CalculateRadarValues( float fMusicLengthSeconds )
|
||||
{
|
||||
m_RadarValues = RadarValues();
|
||||
|
||||
// If we're autogen, don't calculate values. GetRadarValues will take from our parent.
|
||||
if( parent != NULL )
|
||||
return;
|
||||
|
||||
// If we're an edit, leave the RadarValues invalid.
|
||||
if( IsAnEdit() )
|
||||
return;
|
||||
|
||||
NoteData tempNoteData;
|
||||
this->GetNoteData( tempNoteData );
|
||||
NoteDataUtil::GetRadarValues( tempNoteData, fMusicLengthSeconds, m_RadarValues );
|
||||
}
|
||||
|
||||
void Steps::Decompress() const
|
||||
{
|
||||
if( m_bNoteDataIsFilled )
|
||||
@@ -266,7 +283,7 @@ void Steps::AutogenFrom( const Steps *parent_, StepsType ntTo )
|
||||
m_StepsType = ntTo;
|
||||
}
|
||||
|
||||
void Steps::CopyFrom( Steps* pSource, StepsType ntTo ) // pSource does not have to be of the same StepsType!
|
||||
void Steps::CopyFrom( Steps* pSource, StepsType ntTo, float fMusicLengthSeconds ) // pSource does not have to be of the same StepsType
|
||||
{
|
||||
m_StepsType = ntTo;
|
||||
NoteData noteData;
|
||||
@@ -276,7 +293,7 @@ void Steps::CopyFrom( Steps* pSource, StepsType ntTo ) // pSource does not have
|
||||
this->SetDescription( pSource->GetDescription() );
|
||||
this->SetDifficulty( pSource->GetDifficulty() );
|
||||
this->SetMeter( pSource->GetMeter() );
|
||||
this->SetRadarValues( pSource->GetRadarValues() );
|
||||
this->CalculateRadarValues( fMusicLengthSeconds );
|
||||
}
|
||||
|
||||
void Steps::CreateBlank( StepsType ntTo )
|
||||
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
|
||||
// initializers
|
||||
void AutogenFrom( const Steps *parent, StepsType ntTo );
|
||||
void CopyFrom( Steps* pSource, StepsType ntTo );
|
||||
void CopyFrom( Steps* pSource, StepsType ntTo, float fMusicLengthSeconds );
|
||||
void CreateBlank( StepsType ntTo );
|
||||
|
||||
void Compress() const;
|
||||
@@ -61,7 +61,8 @@ public:
|
||||
void GetSMNoteData( CString ¬es_comp_out ) const;
|
||||
|
||||
void TidyUpData();
|
||||
|
||||
void CalculateRadarValues( float fMusicLengthSeconds );
|
||||
|
||||
// Lua
|
||||
void PushSelf( lua_State *L );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user