Actor::GetCommandsLengthSeconds is evil; don't use it. (Commands

can have side-effects.)
This commit is contained in:
Glenn Maynard
2006-08-01 20:25:13 +00:00
parent ffb1993c51
commit cea07f5e2c
+4 -7
View File
@@ -6,10 +6,10 @@
static ThemeMetric<apActorCommands> IN_COMMAND ("LyricDisplay","InCommand");
static ThemeMetric<apActorCommands> OUT_COMMAND ("LyricDisplay","OutCommand");
static ThemeMetric<float> IN_LENGTH ("LyricDisplay","InLength");
static ThemeMetric<float> OUT_LENGTH ("LyricDisplay","OutLength");
static ThemeMetric<RageColor> WIPE_DIM_FACTOR ("LyricDisplay","WipeDimFactor");
static float g_fTweenInTime, g_fTweenOutTime;
LyricDisplay::LyricDisplay()
{
for( int i=0; i<2; i++ )
@@ -28,9 +28,6 @@ void LyricDisplay::Init()
m_textLyrics[i].SetText("");
m_iCurLyricNumber = 0;
/* Update global cache: */
g_fTweenInTime = Actor::GetCommandsLengthSeconds( IN_COMMAND );
g_fTweenOutTime = Actor::GetCommandsLengthSeconds( OUT_COMMAND );
m_fLastSecond = -500;
}
@@ -50,7 +47,7 @@ void LyricDisplay::Update( float fDeltaTime )
return;
const Song *pSong = GAMESTATE->m_pCurSong;
const float fStartTime = (pSong->m_LyricSegments[m_iCurLyricNumber].m_fStartTime) - g_fTweenInTime;
const float fStartTime = (pSong->m_LyricSegments[m_iCurLyricNumber].m_fStartTime) - IN_LENGTH.GetValue();
if( GAMESTATE->m_fMusicSeconds < fStartTime )
return;
@@ -63,7 +60,7 @@ void LyricDisplay::Update( float fDeltaTime )
fEndTime = pSong->GetElapsedTimeFromBeat( pSong->m_fLastBeat );
const float fDistance = fEndTime - pSong->m_LyricSegments[m_iCurLyricNumber].m_fStartTime;
const float fTweenBufferTime = g_fTweenInTime + g_fTweenOutTime;
const float fTweenBufferTime = IN_LENGTH.GetValue() + OUT_LENGTH.GetValue();
/* If it's negative, two lyrics are so close together that there's no time
* to tween properly. Lyrics should never be this brief, anyway, so just