Added lookup table system to TimingData so that GetBeatAndBPS and GetElapsedTime don't have to walk through the entire list of timing segments several times every frame during gameplay.

This commit is contained in:
Kyzentun
2015-03-14 23:17:35 -06:00
parent 0d309e633d
commit 2b7ebb3729
7 changed files with 410 additions and 237 deletions
+14
View File
@@ -1486,6 +1486,13 @@ void ScreenGameplay::StartPlayingSong( float fMinTimeToNotes, float fMinTimeToMu
UpdateSongPosition(0);
ASSERT( GAMESTATE->m_Position.m_fMusicSeconds > -4000 ); /* make sure the "fake timer" code doesn't trigger */
FOREACH_EnabledPlayer(pn)
{
if(GAMESTATE->m_pCurSteps[pn])
{
GAMESTATE->m_pCurSteps[pn]->GetTimingData()->PrepareLookup();
}
}
}
@@ -2548,6 +2555,13 @@ void ScreenGameplay::SaveStats()
void ScreenGameplay::SongFinished()
{
FOREACH_EnabledPlayer(pn)
{
if(GAMESTATE->m_pCurSteps[pn])
{
GAMESTATE->m_pCurSteps[pn]->GetTimingData()->ReleaseLookup();
}
}
AdjustSync::HandleSongEnd();
SaveStats(); // Let subclasses save the stats.
/* Extremely important: if we don't remove attacks before moving on to the next