From c0384d6529344f3a845ebfd0686371db6e1ccbe1 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 22 Aug 2002 07:35:58 +0000 Subject: [PATCH] Add dimming support. --- stepmania/src/ScreenOptions.cpp | 32 ++++++++++++++++++++++++++++---- stepmania/src/ScreenOptions.h | 4 +++- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index 1f515df01c..37562d4d28 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -79,6 +79,7 @@ ScreenOptions::ScreenOptions( CString sBackgroundPath, CString sPagePath, CStrin m_framePage.SetX( SCREEN_LEFT-SCREEN_WIDTH ); m_framePage.BeginTweening( 0.3f, Actor::TWEEN_BIAS_BEGIN ); m_framePage.SetTweenX( 0 ); + ZeroMemory(&m_OptionDim, sizeof(m_OptionDim)); } void ScreenOptions::Init( InputMode im, OptionLineData optionLineData[], int iNumOptionLines ) @@ -193,6 +194,17 @@ void ScreenOptions::InitOptionsText() } } +void ScreenOptions::DimOption(int line, int option, bool dim) +{ + m_OptionDim[line][option] = dim; + m_textOptions[line][option].BeginTweening(.250); + if(m_OptionDim[line][option]) + m_textOptions[line][option].SetTweenDiffuseColor( D3DXCOLOR(.5,.5,.5,1) ); + else + m_textOptions[line][option].SetTweenDiffuseColor( D3DXCOLOR(1,1,1,1) ); +} + + void ScreenOptions::PositionUnderlines() { // Set the position of the underscores showing the current choice for each option line. @@ -322,10 +334,16 @@ void ScreenOptions::MenuLeft( const PlayerNumber pn ) continue; // skip int iCurRow = m_iCurrentRow[p]; - if( m_iSelectedOption[p][iCurRow] == 0 ) // can't go left any more + + int new_opt = m_iSelectedOption[p][iCurRow]; + do { + new_opt--; + } while(new_opt >= 0 && m_OptionDim[iCurRow][new_opt]); + + if( new_opt < 0 ) // can't go left any more return; - m_iSelectedOption[p][iCurRow]--; + m_iSelectedOption[p][iCurRow] = new_opt; TweenHighlight( (PlayerNumber)p ); } @@ -341,10 +359,16 @@ void ScreenOptions::MenuRight( const PlayerNumber pn ) continue; // skip int iCurRow = m_iCurrentRow[p]; - if( m_iSelectedOption[p][iCurRow] == m_OptionLineData[iCurRow].iNumOptions-1 ) // can't go right any more + int new_opt = m_iSelectedOption[p][iCurRow]; + do { + new_opt++; + } while(new_opt < m_OptionLineData[iCurRow].iNumOptions && + m_OptionDim[iCurRow][new_opt]); + + if( new_opt == m_OptionLineData[iCurRow].iNumOptions ) // can't go right any more return; - m_iSelectedOption[p][iCurRow]++; + m_iSelectedOption[p][iCurRow] = new_opt; TweenHighlight( (PlayerNumber)p ); } diff --git a/stepmania/src/ScreenOptions.h b/stepmania/src/ScreenOptions.h index a52888652c..a329584541 100644 --- a/stepmania/src/ScreenOptions.h +++ b/stepmania/src/ScreenOptions.h @@ -58,7 +58,7 @@ protected: void PositionUnderlines(); void PositionHighlights(); void TweenHighlight( PlayerNumber player_no ); - void OnChange(); + virtual void OnChange(); void MenuBack( const PlayerNumber p ); void MenuStart( const PlayerNumber p ); @@ -82,6 +82,8 @@ protected: Sprite m_sprPage; BitmapText m_textOptionLineTitles[MAX_OPTION_LINES]; BitmapText m_textOptions[MAX_OPTION_LINES][MAX_OPTIONS_PER_LINE]; // this array has to be big enough to hold all of the options + bool m_OptionDim[MAX_OPTION_LINES][MAX_OPTIONS_PER_LINE]; + void DimOption(int line, int option, bool dim); int m_iSelectedOption[NUM_PLAYERS][MAX_OPTION_LINES]; int m_iCurrentRow[NUM_PLAYERS];