fix up tweens

This commit is contained in:
Glenn Maynard
2003-06-16 20:01:18 +00:00
parent ad580a760d
commit 4074327d40
+56 -41
View File
@@ -287,20 +287,24 @@ void ScreenOptions::PositionUnderlines()
{ {
OptionsCursor &underline = m_Underline[p][i]; OptionsCursor &underline = m_Underline[p][i];
underline.StopTweening(); /* Don't tween X movement and color changes. */
/* Don't tween X movement. */
int iWidth, iX, iY; int iWidth, iX, iY;
GetWidthXY( (PlayerNumber)p, i, iWidth, iX, iY ); GetWidthXY( (PlayerNumber)p, i, iWidth, iX, iY );
underline.SetX( (float)iX ); underline.SetGlobalX( (float)iX );
underline.SetGlobalDiffuseColor( RageColor(1,1,1, 1.0f) );
// If there's only one choice (ScreenOptionsMenu), don't show underlines. // If there's only one choice (ScreenOptionsMenu), don't show underlines.
// It looks silly. // It looks silly.
bool bOnlyOneChoice = m_OptionRow[i].choices.size() == 1; bool bOnlyOneChoice = m_OptionRow[i].choices.size() == 1;
bool hidden = bOnlyOneChoice || m_bRowIsHidden[i]; bool hidden = bOnlyOneChoice || m_bRowIsHidden[i];
/* XXX: this doesn't work since underline is an ActorFrame */ if( underline.GetDestY() != m_fRowY[i] )
{
underline.StopTweening();
underline.BeginTweening( 0.3f ); underline.BeginTweening( 0.3f );
}
/* XXX: diffuse doesn't work since underline is an ActorFrame */
underline.SetDiffuse( RageColor(1,1,1,hidden? 0.0f:1.0f) ); underline.SetDiffuse( RageColor(1,1,1,hidden? 0.0f:1.0f) );
underline.SetBarWidth( iWidth ); underline.SetBarWidth( iWidth );
underline.SetY( (float)iY ); underline.SetY( (float)iY );
@@ -319,10 +323,15 @@ void ScreenOptions::PositionIcons()
int iWidth, iX, iY; // We only use iY int iWidth, iX, iY; // We only use iY
GetWidthXY( (PlayerNumber)p, i, iWidth, iX, iY ); GetWidthXY( (PlayerNumber)p, i, iWidth, iX, iY );
icon.SetX( ICONS_X(p) ); icon.SetX( ICONS_X(p) );
if( icon.GetDestY() != m_fRowY[i] )
{
icon.StopTweening(); icon.StopTweening();
/* XXX: this doesn't work since icon is an ActorFrame */
icon.BeginTweening( 0.3f ); icon.BeginTweening( 0.3f );
}
icon.SetY( (float)iY ); icon.SetY( (float)iY );
/* XXX: this doesn't work since icon is an ActorFrame */
icon.SetDiffuse( RageColor(1,1,1, m_bRowIsHidden[i]? 0.0f:1.0f) ); icon.SetDiffuse( RageColor(1,1,1, m_bRowIsHidden[i]? 0.0f:1.0f) );
} }
} }
@@ -406,59 +415,76 @@ void ScreenOptions::UpdateEnabledDisabled()
if( GAMESTATE->IsHumanPlayer(p) && m_iCurrentRow[p] == i ) if( GAMESTATE->IsHumanPlayer(p) && m_iCurrentRow[p] == i )
bThisRowIsSelected = true; bThisRowIsSelected = true;
/* Don't tween selection colors at all. */
RageColor color = bThisRowIsSelected ? colorSelected : colorNotSelected;
m_sprBullets[i].SetGlobalDiffuseColor( color );
m_textTitles[i].SetGlobalDiffuseColor( color );
if( m_bRowIsLong[i] )
for( unsigned j=0; j<NUM_PLAYERS; j++ )
m_textItems[i][j].SetGlobalDiffuseColor( color );
else
for( unsigned j=0; j<m_OptionRow[i].choices.size(); j++ )
m_textItems[i][j].SetGlobalDiffuseColor( color );
if( m_sprBullets[i].GetDestY() != m_fRowY[i] )
{
m_sprBullets[i].StopTweening(); m_sprBullets[i].StopTweening();
m_textTitles[i].StopTweening(); m_textTitles[i].StopTweening();
m_sprBullets[i].BeginTweening( 0.3f ); m_sprBullets[i].BeginTweening( 0.3f );
m_textTitles[i].BeginTweening( 0.3f ); m_textTitles[i].BeginTweening( 0.3f );
for( unsigned j=0; j<m_OptionRow[i].choices.size(); j++ )
{
m_textItems[i][j].StopTweening();
m_textItems[i][j].BeginTweening( 0.3f );
}
RageColor color = bThisRowIsSelected ? colorSelected : colorNotSelected; m_sprBullets[i].SetDiffuseAlpha( m_bRowIsHidden[i]? 0.0f:1.0f );
if( m_bRowIsHidden[i] ) m_textTitles[i].SetDiffuseAlpha( m_bRowIsHidden[i]? 0.0f:1.0f );
color.a = 0.0f;
m_sprBullets[i].SetDiffuse( color );
m_textTitles[i].SetDiffuse( color );
m_sprBullets[i].SetY( m_fRowY[i] ); m_sprBullets[i].SetY( m_fRowY[i] );
m_textTitles[i].SetY( m_fRowY[i] ); m_textTitles[i].SetY( m_fRowY[i] );
if( m_bRowIsLong[i] ) if( m_bRowIsLong[i] )
for( unsigned j=0; j<NUM_PLAYERS; j++ ) for( unsigned j=0; j<NUM_PLAYERS; j++ )
{
m_textItems[i][j].SetDiffuse( color );
m_textItems[i][j].SetY( m_fRowY[i] );
/* Hide the text of all but the first player, so we don't overdraw. */
if( m_InputMode == INPUTMODE_BOTH && j != 0 )
{ {
m_textItems[i][j].StopTweening(); m_textItems[i][j].StopTweening();
m_textItems[i][j].SetDiffuse( RageColor(1,1,1,0) ); m_textItems[i][j].BeginTweening( 0.3f );
} m_textItems[i][j].SetDiffuseAlpha( m_bRowIsHidden[i]? 0.0f:1.0f );
m_textItems[i][j].SetY( m_fRowY[i] );
} }
else else
for( unsigned j=0; j<m_OptionRow[i].choices.size(); j++ ) for( unsigned j=0; j<m_OptionRow[i].choices.size(); j++ )
{ {
m_textItems[i][j].SetDiffuse( color ); m_textItems[i][j].StopTweening();
m_textItems[i][j].BeginTweening( 0.3f );
m_textItems[i][j].SetDiffuseAlpha( m_bRowIsHidden[i]? 0.0f:1.0f );
m_textItems[i][j].SetY( m_fRowY[i] ); m_textItems[i][j].SetY( m_fRowY[i] );
} }
} }
/* Hide the text of all but the first player, so we don't overdraw. */
if( m_InputMode == INPUTMODE_BOTH && m_bRowIsLong[i] )
{
for( unsigned j=1; j<NUM_PLAYERS; j++ )
{
m_textItems[i][j].StopTweening();
m_textItems[i][j].SetDiffuse( RageColor(1,1,1,0) );
}
}
}
bool bExitRowIsSelectedByBoth = true; bool bExitRowIsSelectedByBoth = true;
for( int p=0; p<NUM_PLAYERS; p++ ) for( int p=0; p<NUM_PLAYERS; p++ )
if( GAMESTATE->IsHumanPlayer(p) && m_iCurrentRow[p] != m_iNumOptionRows ) if( GAMESTATE->IsHumanPlayer(p) && m_iCurrentRow[p] != m_iNumOptionRows )
bExitRowIsSelectedByBoth = false; bExitRowIsSelectedByBoth = false;
RageColor color = bExitRowIsSelectedByBoth ? colorSelected : colorNotSelected;
m_textItems[m_iNumOptionRows][0].SetGlobalDiffuseColor( color );
if( m_textItems[m_iNumOptionRows][0].GetDestY() != m_fRowY[m_iNumOptionRows] )
{
m_textItems[m_iNumOptionRows][0].StopTweening(); m_textItems[m_iNumOptionRows][0].StopTweening();
m_textItems[m_iNumOptionRows][0].BeginTweening( 0.3f ); m_textItems[m_iNumOptionRows][0].BeginTweening( 0.3f );
m_textItems[m_iNumOptionRows][0].SetDiffuseAlpha( m_bRowIsHidden[i]? 0.0f:1.0f );
RageColor color = bExitRowIsSelectedByBoth ? colorSelected : colorNotSelected;
if( m_bRowIsHidden[i] )
color.a = 0.0f;
m_textItems[m_iNumOptionRows][0].SetDiffuse( color );
m_textItems[m_iNumOptionRows][0].SetY( m_fRowY[m_iNumOptionRows] ); m_textItems[m_iNumOptionRows][0].SetY( m_fRowY[m_iNumOptionRows] );
}
if( bExitRowIsSelectedByBoth ) if( bExitRowIsSelectedByBoth )
m_textItems[m_iNumOptionRows][0].SetEffectDiffuseShift( 1.0f, colorSelected, colorNotSelected ); m_textItems[m_iNumOptionRows][0].SetEffectDiffuseShift( 1.0f, colorSelected, colorNotSelected );
else else
@@ -587,17 +613,6 @@ void ScreenOptions::OnChange()
PositionIcons(); PositionIcons();
UpdateEnabledDisabled(); UpdateEnabledDisabled();
for( int i=0; i<m_iNumOptionRows; i++ ) // foreach line
{
m_sprBullets[i].StopTweening();
m_sprBullets[i].BeginTweening( 0.3f );
m_sprBullets[i].SetY( m_fRowY[i] );
RageColor color = m_sprBullets[i].GetDiffuse();
color.a = m_bRowIsHidden[i]? 0.0f:1.0f;
m_sprBullets[i].SetDiffuse( color );
}
for( int pn=0; pn<NUM_PLAYERS; pn++ ) for( int pn=0; pn<NUM_PLAYERS; pn++ )
TweenCursor( (PlayerNumber)pn ); TweenCursor( (PlayerNumber)pn );