From cea07f5e2c4accf1b6859a3733a9e79c82b21c77 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 1 Aug 2006 20:25:13 +0000 Subject: [PATCH] Actor::GetCommandsLengthSeconds is evil; don't use it. (Commands can have side-effects.) --- stepmania/src/LyricDisplay.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/stepmania/src/LyricDisplay.cpp b/stepmania/src/LyricDisplay.cpp index 146fba5dad..a06839caf4 100644 --- a/stepmania/src/LyricDisplay.cpp +++ b/stepmania/src/LyricDisplay.cpp @@ -6,10 +6,10 @@ static ThemeMetric IN_COMMAND ("LyricDisplay","InCommand"); static ThemeMetric OUT_COMMAND ("LyricDisplay","OutCommand"); +static ThemeMetric IN_LENGTH ("LyricDisplay","InLength"); +static ThemeMetric OUT_LENGTH ("LyricDisplay","OutLength"); static ThemeMetric 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