cleanup
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "LyricDisplay.h"
|
#include "LyricDisplay.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
|
|
||||||
#include "GameState.h"
|
#include "GameState.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
|
||||||
@@ -9,7 +8,7 @@ static ThemeMetric<apActorCommands> IN_COMMAND ("LyricDisplay","InCommand");
|
|||||||
static ThemeMetric<apActorCommands> OUT_COMMAND ("LyricDisplay","OutCommand");
|
static ThemeMetric<apActorCommands> OUT_COMMAND ("LyricDisplay","OutCommand");
|
||||||
static ThemeMetric<RageColor> WIPE_DIM_FACTOR ("LyricDisplay","WipeDimFactor");
|
static ThemeMetric<RageColor> WIPE_DIM_FACTOR ("LyricDisplay","WipeDimFactor");
|
||||||
|
|
||||||
static float g_TweenInTime, g_TweenOutTime;
|
static float g_fTweenInTime, g_fTweenOutTime;
|
||||||
|
|
||||||
LyricDisplay::LyricDisplay()
|
LyricDisplay::LyricDisplay()
|
||||||
{
|
{
|
||||||
@@ -17,7 +16,7 @@ LyricDisplay::LyricDisplay()
|
|||||||
{
|
{
|
||||||
m_textLyrics[i].LoadFromFont( THEME->GetPathF("LyricDisplay","text") );
|
m_textLyrics[i].LoadFromFont( THEME->GetPathF("LyricDisplay","text") );
|
||||||
m_textLyrics[i].SetDiffuse( RageColor(1,1,1,1) );
|
m_textLyrics[i].SetDiffuse( RageColor(1,1,1,1) );
|
||||||
this->AddChild(&m_textLyrics[i]);
|
this->AddChild( &m_textLyrics[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
Init();
|
Init();
|
||||||
@@ -30,8 +29,8 @@ void LyricDisplay::Init()
|
|||||||
m_iCurLyricNumber = 0;
|
m_iCurLyricNumber = 0;
|
||||||
|
|
||||||
/* Update global cache: */
|
/* Update global cache: */
|
||||||
g_TweenInTime = Actor::GetCommandsLengthSeconds(IN_COMMAND);
|
g_fTweenInTime = Actor::GetCommandsLengthSeconds( IN_COMMAND );
|
||||||
g_TweenOutTime = Actor::GetCommandsLengthSeconds(OUT_COMMAND);
|
g_fTweenOutTime = Actor::GetCommandsLengthSeconds( OUT_COMMAND );
|
||||||
m_fLastSecond = -500;
|
m_fLastSecond = -500;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,14 +46,13 @@ void LyricDisplay::Update( float fDeltaTime )
|
|||||||
Init();
|
Init();
|
||||||
m_fLastSecond = GAMESTATE->m_fMusicSeconds;
|
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() )
|
if( m_iCurLyricNumber >= GAMESTATE->m_pCurSong->m_LyricSegments.size() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const Song *song = GAMESTATE->m_pCurSong;
|
const Song *pSong = GAMESTATE->m_pCurSong;
|
||||||
const float fStartTime = (song->m_LyricSegments[m_iCurLyricNumber].m_fStartTime) - g_TweenInTime;
|
const float fStartTime = (pSong->m_LyricSegments[m_iCurLyricNumber].m_fStartTime) - g_fTweenInTime;
|
||||||
|
|
||||||
if(GAMESTATE->m_fMusicSeconds < fStartTime)
|
if( GAMESTATE->m_fMusicSeconds < fStartTime )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const float MaxDisplayTime = 10;
|
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,
|
/* Clamp this lyric to the beginning of the next, the end of the music,
|
||||||
* or 5 seconds. */
|
* or 5 seconds. */
|
||||||
float EndTime;
|
float fEndTime;
|
||||||
if(m_iCurLyricNumber+1 < GAMESTATE->m_pCurSong->m_LyricSegments.size())
|
if( m_iCurLyricNumber+1 < GAMESTATE->m_pCurSong->m_LyricSegments.size() )
|
||||||
EndTime = song->m_LyricSegments[m_iCurLyricNumber+1].m_fStartTime;
|
fEndTime = pSong->m_LyricSegments[m_iCurLyricNumber+1].m_fStartTime;
|
||||||
else
|
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 fDistance = fEndTime - pSong->m_LyricSegments[m_iCurLyricNumber].m_fStartTime;
|
||||||
const float TweenBufferTime = g_TweenInTime + g_TweenOutTime;
|
const float fTweenBufferTime = g_fTweenInTime + g_fTweenOutTime;
|
||||||
|
|
||||||
fShowLength = min(fShowLength, Distance - TweenBufferTime);
|
fShowLength = min( fShowLength, fDistance - fTweenBufferTime );
|
||||||
fShowLength = min(fShowLength, 3);
|
fShowLength = min( fShowLength, 3 );
|
||||||
|
|
||||||
/* If it's negative, two lyrics are so close together that there's no time
|
/* 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
|
* to tween properly. Lyrics should never be this brief, anyway, so just
|
||||||
* skip it. */
|
* skip it. */
|
||||||
fShowLength = max(fShowLength, 0);
|
fShowLength = max( fShowLength, 0 );
|
||||||
|
|
||||||
// make lyrics show faster a larger song rates.
|
// make lyrics show faster a larger song rates.
|
||||||
fShowLength /= GAMESTATE->m_SongOptions.m_fMusicRate;
|
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) );
|
const float fZoom = min( 1.0f, float(SCREEN_WIDTH)/(m_textLyrics[i].GetZoomedWidth()+1) );
|
||||||
|
|
||||||
m_textLyrics[i].StopTweening();
|
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;
|
RageColor color = GAMESTATE->m_pCurSong->m_LyricSegments[m_iCurLyricNumber].m_Color;
|
||||||
|
|
||||||
if( i==0 )
|
if( i==0 )
|
||||||
color *= WIPE_DIM_FACTOR;
|
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
|
/* Crop the bottom layer of text away as we crop the top layer on. That
|
||||||
* prevents overdraw, which reduces AA quality. */
|
* prevents overdraw, which reduces AA quality. */
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class LyricDisplay: public ActorFrame
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LyricDisplay();
|
LyricDisplay();
|
||||||
void Update(float fDeltaTime);
|
void Update( float fDeltaTime );
|
||||||
|
|
||||||
/* Call when song changes: */
|
/* Call when song changes: */
|
||||||
void Init();
|
void Init();
|
||||||
|
|||||||
Reference in New Issue
Block a user