From 0422d2b1c5be4300a35c38870c8763b8170a3b08 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 8 Jun 2005 21:50:55 +0000 Subject: [PATCH] cleanup --- stepmania/src/LyricDisplay.cpp | 38 ++++++++++++++++------------------ stepmania/src/LyricDisplay.h | 2 +- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/stepmania/src/LyricDisplay.cpp b/stepmania/src/LyricDisplay.cpp index 32d35e41e4..62e4e90381 100644 --- a/stepmania/src/LyricDisplay.cpp +++ b/stepmania/src/LyricDisplay.cpp @@ -1,7 +1,6 @@ #include "global.h" #include "LyricDisplay.h" #include "ScreenDimensions.h" - #include "GameState.h" #include "ThemeMetric.h" @@ -9,7 +8,7 @@ static ThemeMetric IN_COMMAND ("LyricDisplay","InCommand"); static ThemeMetric OUT_COMMAND ("LyricDisplay","OutCommand"); static ThemeMetric WIPE_DIM_FACTOR ("LyricDisplay","WipeDimFactor"); -static float g_TweenInTime, g_TweenOutTime; +static float g_fTweenInTime, g_fTweenOutTime; LyricDisplay::LyricDisplay() { @@ -17,7 +16,7 @@ LyricDisplay::LyricDisplay() { m_textLyrics[i].LoadFromFont( THEME->GetPathF("LyricDisplay","text") ); m_textLyrics[i].SetDiffuse( RageColor(1,1,1,1) ); - this->AddChild(&m_textLyrics[i]); + this->AddChild( &m_textLyrics[i] ); } Init(); @@ -30,8 +29,8 @@ void LyricDisplay::Init() m_iCurLyricNumber = 0; /* Update global cache: */ - g_TweenInTime = Actor::GetCommandsLengthSeconds(IN_COMMAND); - g_TweenOutTime = Actor::GetCommandsLengthSeconds(OUT_COMMAND); + g_fTweenInTime = Actor::GetCommandsLengthSeconds( IN_COMMAND ); + g_fTweenOutTime = Actor::GetCommandsLengthSeconds( OUT_COMMAND ); m_fLastSecond = -500; } @@ -47,14 +46,13 @@ void LyricDisplay::Update( float fDeltaTime ) Init(); m_fLastSecond = GAMESTATE->m_fMusicSeconds; - // Make sure we don't go over the array's boundry if( m_iCurLyricNumber >= GAMESTATE->m_pCurSong->m_LyricSegments.size() ) return; - const Song *song = GAMESTATE->m_pCurSong; - const float fStartTime = (song->m_LyricSegments[m_iCurLyricNumber].m_fStartTime) - g_TweenInTime; + const Song *pSong = GAMESTATE->m_pCurSong; + const float fStartTime = (pSong->m_LyricSegments[m_iCurLyricNumber].m_fStartTime) - g_fTweenInTime; - if(GAMESTATE->m_fMusicSeconds < fStartTime) + if( GAMESTATE->m_fMusicSeconds < fStartTime ) return; const float MaxDisplayTime = 10; @@ -63,22 +61,22 @@ void LyricDisplay::Update( float fDeltaTime ) /* Clamp this lyric to the beginning of the next, the end of the music, * or 5 seconds. */ - float EndTime; - if(m_iCurLyricNumber+1 < GAMESTATE->m_pCurSong->m_LyricSegments.size()) - EndTime = song->m_LyricSegments[m_iCurLyricNumber+1].m_fStartTime; + float fEndTime; + if( m_iCurLyricNumber+1 < GAMESTATE->m_pCurSong->m_LyricSegments.size() ) + fEndTime = pSong->m_LyricSegments[m_iCurLyricNumber+1].m_fStartTime; else - EndTime = song->GetElapsedTimeFromBeat( song->m_fLastBeat ); + fEndTime = pSong->GetElapsedTimeFromBeat( pSong->m_fLastBeat ); - const float Distance = EndTime - song->m_LyricSegments[m_iCurLyricNumber].m_fStartTime; - const float TweenBufferTime = g_TweenInTime + g_TweenOutTime; + const float fDistance = fEndTime - pSong->m_LyricSegments[m_iCurLyricNumber].m_fStartTime; + const float fTweenBufferTime = g_fTweenInTime + g_fTweenOutTime; - fShowLength = min(fShowLength, Distance - TweenBufferTime); - fShowLength = min(fShowLength, 3); + fShowLength = min( fShowLength, fDistance - fTweenBufferTime ); + fShowLength = min( fShowLength, 3 ); /* 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 * skip it. */ - fShowLength = max(fShowLength, 0); + fShowLength = max( fShowLength, 0 ); // make lyrics show faster a larger song rates. fShowLength /= GAMESTATE->m_SongOptions.m_fMusicRate; @@ -97,14 +95,14 @@ void LyricDisplay::Update( float fDeltaTime ) const float fZoom = min( 1.0f, float(SCREEN_WIDTH)/(m_textLyrics[i].GetZoomedWidth()+1) ); m_textLyrics[i].StopTweening(); - m_textLyrics[i].SetZoomX(fZoom); + m_textLyrics[i].SetZoomX( fZoom ); RageColor color = GAMESTATE->m_pCurSong->m_LyricSegments[m_iCurLyricNumber].m_Color; if( i==0 ) color *= WIPE_DIM_FACTOR; - m_textLyrics[i].SetDiffuse(color); + m_textLyrics[i].SetDiffuse( color ); /* Crop the bottom layer of text away as we crop the top layer on. That * prevents overdraw, which reduces AA quality. */ diff --git a/stepmania/src/LyricDisplay.h b/stepmania/src/LyricDisplay.h index d0f0c96766..6b45d64378 100644 --- a/stepmania/src/LyricDisplay.h +++ b/stepmania/src/LyricDisplay.h @@ -9,7 +9,7 @@ class LyricDisplay: public ActorFrame { public: LyricDisplay(); - void Update(float fDeltaTime); + void Update( float fDeltaTime ); /* Call when song changes: */ void Init();