cache Trail RadarValues. There needs to be more coordination with Course's Trail cache though.
This commit is contained in:
+33
-25
@@ -51,34 +51,42 @@ bool TrailEntry::ContainsTransformOrTurn() const
|
|||||||
|
|
||||||
RadarValues Trail::GetRadarValues() const
|
RadarValues Trail::GetRadarValues() const
|
||||||
{
|
{
|
||||||
RadarValues rv;
|
if( m_bRadarValuesCached )
|
||||||
|
|
||||||
FOREACH_CONST( TrailEntry, m_vEntries, e )
|
|
||||||
{
|
{
|
||||||
const Steps *pSteps = e->pSteps;
|
return m_CachedRadarValues;
|
||||||
ASSERT( pSteps );
|
|
||||||
if( e->ContainsTransformOrTurn() )
|
|
||||||
{
|
|
||||||
NoteData nd;
|
|
||||||
pSteps->GetNoteData( &nd );
|
|
||||||
RadarValues rv_orig;
|
|
||||||
NoteDataUtil::GetRadarValues( nd, e->pSong->m_fMusicLengthSeconds, rv_orig );
|
|
||||||
PlayerOptions po;
|
|
||||||
po.FromString( e->Modifiers );
|
|
||||||
if( po.ContainsTransformOrTurn() )
|
|
||||||
NoteDataUtil::TransformNoteData( nd, po, pSteps->m_StepsType );
|
|
||||||
NoteDataUtil::TransformNoteData( nd, e->Attacks, pSteps->m_StepsType, e->pSong );
|
|
||||||
RadarValues rv2;
|
|
||||||
NoteDataUtil::GetRadarValues( nd, e->pSong->m_fMusicLengthSeconds, rv2 );
|
|
||||||
rv += rv2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rv += pSteps->GetRadarValues();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_bRadarValuesCached = true;
|
||||||
|
m_CachedRadarValues.Init();
|
||||||
|
|
||||||
return rv;
|
FOREACH_CONST( TrailEntry, m_vEntries, e )
|
||||||
|
{
|
||||||
|
const Steps *pSteps = e->pSteps;
|
||||||
|
ASSERT( pSteps );
|
||||||
|
if( e->ContainsTransformOrTurn() )
|
||||||
|
{
|
||||||
|
NoteData nd;
|
||||||
|
pSteps->GetNoteData( &nd );
|
||||||
|
RadarValues rv_orig;
|
||||||
|
NoteDataUtil::GetRadarValues( nd, e->pSong->m_fMusicLengthSeconds, rv_orig );
|
||||||
|
PlayerOptions po;
|
||||||
|
po.FromString( e->Modifiers );
|
||||||
|
if( po.ContainsTransformOrTurn() )
|
||||||
|
NoteDataUtil::TransformNoteData( nd, po, pSteps->m_StepsType );
|
||||||
|
NoteDataUtil::TransformNoteData( nd, e->Attacks, pSteps->m_StepsType, e->pSong );
|
||||||
|
RadarValues rv;
|
||||||
|
NoteDataUtil::GetRadarValues( nd, e->pSong->m_fMusicLengthSeconds, rv );
|
||||||
|
m_CachedRadarValues += rv;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_CachedRadarValues += pSteps->GetRadarValues();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_CachedRadarValues;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Trail::GetMeter() const
|
int Trail::GetMeter() const
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ public:
|
|||||||
CourseDifficulty m_CourseDifficulty;
|
CourseDifficulty m_CourseDifficulty;
|
||||||
vector<TrailEntry> m_vEntries;
|
vector<TrailEntry> m_vEntries;
|
||||||
int m_iSpecifiedMeter; // == -1 if no meter specified
|
int m_iSpecifiedMeter; // == -1 if no meter specified
|
||||||
|
mutable bool m_bRadarValuesCached;
|
||||||
|
mutable RadarValues m_CachedRadarValues;
|
||||||
|
|
||||||
Trail()
|
Trail()
|
||||||
{
|
{
|
||||||
@@ -56,6 +58,7 @@ public:
|
|||||||
m_CourseDifficulty = DIFFICULTY_INVALID;
|
m_CourseDifficulty = DIFFICULTY_INVALID;
|
||||||
m_iSpecifiedMeter = -1;
|
m_iSpecifiedMeter = -1;
|
||||||
m_vEntries.clear();
|
m_vEntries.clear();
|
||||||
|
m_bRadarValuesCached = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RadarValues GetRadarValues() const;
|
RadarValues GetRadarValues() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user