diff --git a/stepmania/src/ScreenSelectDifficultyEX.cpp b/stepmania/src/ScreenSelectDifficultyEX.cpp index 4358f790d1..33fa2e4cba 100644 --- a/stepmania/src/ScreenSelectDifficultyEX.cpp +++ b/stepmania/src/ScreenSelectDifficultyEX.cpp @@ -6,7 +6,6 @@ Desc: See header. Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved. - Chris Danford Kevin Slaughter ----------------------------------------------------------------------------- */ @@ -22,17 +21,27 @@ #include "ThemeManager.h" -#define CURSOR_OFFSET_X_FROM_PICTURE( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("CursorP%dOffsetXFromPicture",p+1)) -#define CURSOR_OFFSET_Y_FROM_PICTURE( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("CursorP%dOffsetYFromPicture",p+1)) -#define DISABLED_COLOR THEME->GetMetricC("ScreenSelectDifficultyEX","DisabledColor") -#define INFO_X( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("InfoXP%d",p+1)) -#define INFO_Y( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("InfoYP%d",p+1)) -#define LOCK_INPUT_SECONDS THEME->GetMetricF("ScreenSelectDifficultyEX","LockInputSeconds") -#define PICTURE_X( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("PictureXP%d",p+1)) -#define PICTURE_Y( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("PictureYP%d",p+1)) -#define SLEEP_AFTER_CHOICE_SECONDS THEME->GetMetricF("ScreenSelectDifficultyEX","SleepAfterChoiceSeconds") -#define SLEEP_AFTER_TWEEN_OFF_SECONDS THEME->GetMetricF("ScreenSelectDifficultyEX","SleepAfterTweenOffSeconds") - +#define ANIMATE_MODE_SWITCH THEME->GetMetricB("ScreenSelectDifficultyEX","AnimateModeSwitch") +#define ANIMATE_MODE_SWITCH_LOCK_TIME THEME->GetMetricF("ScreenSelectDifficultyEX","AnimateModeSwitchLockTime") +#define ANIMATE_MODE_SWITCH_INFO_OFF_COMMAND THEME->GetMetric("ScreenSelectDifficultyEX","AnimateModeSwitchInfoOFFCommand") +#define ANIMATE_MODE_SWITCH_INFO_ON_COMMAND THEME->GetMetric("ScreenSelectDifficultyEX","AnimateModeSwitchInfoONCommand") +#define ANIMATE_MODE_SWITCH_PICTURE_OFF_COMMAND THEME->GetMetric("ScreenSelectDifficultyEX","AnimateModeSwitchPictureOFFCommand") +#define ANIMATE_MODE_SWITCH_PICTURE_ON_COMMAND THEME->GetMetric("ScreenSelectDifficultyEX","AnimateModeSwitchPictureONCommand") +#define CURSOR_OFFSET_X_FROM_PICTURE( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("CursorP%dOffsetXFromPicture",p+1)) +#define CURSOR_OFFSET_Y_FROM_PICTURE( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("CursorP%dOffsetYFromPicture",p+1)) +#define DIFFICULTYICON_X( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("DifficultyIcon%dX",p+1)) +#define DIFFICULTYICON_Y( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("DifficultyIcon%dY",p+1)) +#define DIFFICULTYICON_COLOR( p ) THEME->GetMetricC("ScreenSelectDifficultyEX",ssprintf("DifficultyIcon%dCOLOR",p+1)) +#define DISABLED_COLOR THEME->GetMetricC("ScreenSelectDifficultyEX","DisabledColor") +#define ICONBAR_X THEME->GetMetricF("ScreenSelectDifficultyEX","IconBarX") +#define ICONBAR_Y THEME->GetMetricF("ScreenSelectDifficultyEX","IconBarY") +#define INFO_X( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("InfoXP%d",p+1)) +#define INFO_Y( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("InfoYP%d",p+1)) +#define LOCK_INPUT_SECONDS THEME->GetMetricF("ScreenSelectDifficultyEX","LockInputSeconds") +#define PICTURE_X( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("PictureXP%d",p+1)) +#define PICTURE_Y( p ) THEME->GetMetricF("ScreenSelectDifficultyEX",ssprintf("PictureYP%d",p+1)) +#define SLEEP_AFTER_CHOICE_SECONDS THEME->GetMetricF("ScreenSelectDifficultyEX","SleepAfterChoiceSeconds") +#define SLEEP_AFTER_TWEEN_OFF_SECONDS THEME->GetMetricF("ScreenSelectDifficultyEX","SleepAfterTweenOffSeconds") ScreenSelectDifficultyEX::ScreenSelectDifficultyEX() : ScreenSelect( "ScreenSelectDifficultyEX" ) @@ -44,31 +53,54 @@ ScreenSelectDifficultyEX::ScreenSelectDifficultyEX() : ScreenSelect( "ScreenSele m_iChoice[p] = 0; m_bChosen[p] = false; } - + + NUM_MODES = 0; for( unsigned c=0; cGetPathToG( "ScreenSelectDifficultyEX more page1") ); - //m_framePages.AddChild( &m_sprMore ); + m_sprIconBar.Load( THEME->GetPathToG("ScreenSelectDifficultyEX icon bar.png") ); + m_sprIconBar.SetXY( ICONBAR_X, ICONBAR_Y ); + this->AddChild( &m_sprIconBar ); - //m_sprExplanation.Load( THEME->GetPathToG( "ScreenSelectDifficultyEX explanation") ); - //m_sprExplanation.StopAnimating(); - //m_sprExplanation.SetState( 1 ); - //m_framePages.AddChild( &m_sprExplanation ); + for( unsigned k=0; k < NUM_MODES || k <= 7 ; k++ ) + { + CString MOO = m_aModeChoices[k].name; + if( IsValidModeName(MOO) ) + { + // We cannot show more than 8 icons at a time, BTW + m_sprDifficultyIcon[k].Load( THEME->GetPathToG("ScreenSelectDifficultyEX icons 1x10") ); + m_sprDifficultyIcon[k].SetX( DIFFICULTYICON_X(k) ); + m_sprDifficultyIcon[k].SetY( DIFFICULTYICON_Y(k) ); + m_sprDifficultyIcon[k].SetZoom( 1 ); + this->AddChild( &m_sprDifficultyIcon[k] ); + + m_textDifficultyText[k].SetHorizAlign( Actor::align_left ); + m_textDifficultyText[k].LoadFromFont( THEME->GetPathToF("Common normal") ); + m_textDifficultyText[k].SetX( DIFFICULTYICON_X(k) + 20 ); + m_textDifficultyText[k].SetY( DIFFICULTYICON_Y(k) ); + m_textDifficultyText[k].SetZoom( .5 ); + m_textDifficultyText[k].SetShadowLength( 1 ); + m_textDifficultyText[k].SetDiffuse( DIFFICULTYICON_COLOR(k) ); + this->AddChild( &m_textDifficultyText[k] ); + } + } + SetDifficultyIconText( false ); // Make sure we show the names! for( p=0; pGetPathToG("ScreenSelectMusic difficulty icons 1x10") ); - - m_sprDifficultyIcon[p].SetX( 200 ); - m_sprDifficultyIcon[p].SetY( 200 ); - m_sprDifficultyIcon[p].SetZoom( 10 ); - - m_sprDifficultyIcon[p].SetState( 6 ); - // 0=BEGINNER, 1=LIGHT, 2=STANDARD, 3=HEAVY, 4=NONSTOP/ONI, 5=ENDLESS, 6=RAVE - //this->AddChild( &m_sprDifficultyIcon[p] ); + if( GAMESTATE->IsPlayerEnabled(p) ) // Only show their cursor, if they're enabled + { + m_sprHighlight[p].SetHorizAlign( Actor::align_left ); + m_sprHighlight[p].Load( (PlayerNumber)p, false ); + m_sprHighlight[p].SetX( DIFFICULTYICON_X(0) ); + m_sprHighlight[p].SetY( DIFFICULTYICON_Y(0) ); + m_sprHighlight[p].SetBarWidth( m_sprDifficultyIcon[0].GetZoomedWidth() + 20 + m_textDifficultyText[0].GetZoomedWidth() * 3 ); + this->AddChild( &m_sprHighlight[p] ); + this->MoveToHead( &m_sprHighlight[p] ); + } CLAMP( m_iChoice[p], 0, (int)m_ModeChoices.size()-1 ); m_bChosen[p] = false; @@ -82,6 +114,7 @@ ScreenSelectDifficultyEX::ScreenSelectDifficultyEX() : ScreenSelect( "ScreenSele m_sprPicture[p].Load( THEME->GetPathToG(sPictureFile) ); m_sprPicture[p].SetX( PICTURE_X(p) ); + m_sprPicture[p].SetY( PICTURE_Y(p) ); m_framePages.AddChild( &m_sprPicture[p] ); @@ -194,15 +227,10 @@ void ScreenSelectDifficultyEX::MenuRight( PlayerNumber pn ) if( m_iChoice[pn] < (int)m_ModeChoices.size()-1 ) { Change( pn, m_iChoice[pn]+1 ); } } -bool ScreenSelectDifficultyEX::PlayerIsOnCourse( PlayerNumber pn ) -{ - if( m_iChoice[pn] > 3 ) { return true; } - else { return false; } -} - bool ScreenSelectDifficultyEX::IsACourse( int mIndex ) { - if( mIndex > 3 ) { return true; } + CString MODECHOICENAME = m_ModeChoices[mIndex].name; + if( MODECHOICENAME.Left(7) != "arcade-" ) { return true; } else { return false; } } @@ -211,36 +239,34 @@ void ScreenSelectDifficultyEX::SetAllPlayersSelection( int iChoice, bool bSwitch for( int p=0; pGetPathToG(sInfoFile) ); m_sprPicture[p].Load( THEME->GetPathToG(sPictureFile) ); + m_sprHighlight[p].SetXY( DIFFICULTYICON_X( iChoice ), DIFFICULTYICON_Y( iChoice ) ); } m_soundChange.Play(); } -bool ScreenSelectDifficultyEX::AllPlayersAreOnCourse() -{ - bool OC = false; - for( int p=0; pGetPathToG(sInfoFile) ); m_sprPicture[p].Load( THEME->GetPathToG(sPictureFile) ); + m_sprHighlight[p].SetXY( DIFFICULTYICON_X(m_iChoice[p]), DIFFICULTYICON_Y(m_iChoice[p]) ); + } m_soundChange.Play(); } +bool ScreenSelectDifficultyEX::IsValidModeName( CString ModeName ) +{ + if( ModeName == "arcade-beginner" || ModeName == "beginner" || ModeName == "arcade-easy" || ModeName == "easy" || ModeName == "arcade-medium" || ModeName == "medium" || ModeName == "arcade-hard" || ModeName == "hard" || ModeName == "nonstop" || ModeName == "oni" || ModeName == "endless" || ModeName == "rave" || ModeName == "battle" ) + { + return true; + } + else { return false; }; +} + +int ScreenSelectDifficultyEX::GetIconIndex( CString DiffName ) +{ + if( DiffName == "arcade-beginner" || DiffName == "beginner" ) { return 0; } + else if( DiffName == "arcade-easy" || DiffName == "easy" ) { return 1; } + else if( DiffName == "arcade-medium" || DiffName == "medium" ) { return 2; } + else if( DiffName == "arcade-hard" || DiffName == "hard" ) { return 3; } + else if( DiffName == "nonstop" ) { return 4; } + else if( DiffName == "oni" || DiffName == "challenge" ) { return 5; } + else if( DiffName == "endless" ) { return 6; } + else if( DiffName == "rave" || DiffName == "battle" ) { return 7; } + else { return 10; }; +} + +void ScreenSelectDifficultyEX::SetDifficultyIconText( bool bDisplayCourseItems ) +{ + for( unsigned k=0; k < m_aModeChoices.size(); k++ ) + { + CString MMNAME = m_ModeChoices[k].name; + MMNAME.Replace( "arcade-", "" ); + m_sprDifficultyIcon[k].SetState( GetIconIndex(MMNAME.c_str()) ); + m_textDifficultyText[k].SetDiffuse( RageColor(1,1,1,1) ); + + /* Grammatically correct names. There has to be a better way to + do this.. Anyone? -- Miryo */ + MMNAME.Replace( "beginner", "Beginner"); + MMNAME.Replace( "easy", "Light" ); + MMNAME.Replace( "medium", "Standard" ); + MMNAME.Replace( "hard", "Heavy" ); + MMNAME.Replace( "nonstop", "Nonstop"); + MMNAME.Replace( "oni", "Oni"); + MMNAME.Replace( "endless", "Endless"); + MMNAME.Replace( "rave", "Rave"); + + m_textDifficultyText[k].SetText( MMNAME.c_str() ); + m_textDifficultyText[k].SetDiffuse( DIFFICULTYICON_COLOR(k) ); + } +} + void ScreenSelectDifficultyEX::MenuStart( PlayerNumber pn ) { if( m_fLockInputTime > 0 ) { return; } @@ -298,6 +370,15 @@ void ScreenSelectDifficultyEX::MenuStart( PlayerNumber pn ) if( !IsACourse( m_iChoice[pn] ) || !AnotherPlayerSelected) { + // Disable the courses + for( unsigned e=0; e < NUM_MODES || e <= 7; e++ ) + { + if( IsACourse(e) ) + { + m_textDifficultyText[e].SetDiffuse( RageColor(.5,.5,.5,1) ); + m_sprDifficultyIcon[e].SetDiffuse( RageColor(.5,.5,.5,1) ); + } + } SOUNDMAN->PlayOnceFromDir( ANNOUNCER->GetPathTo(ssprintf("ScreenSelectDifficulty comment %s",mc.name)) ); m_soundSelect.Play(); } @@ -337,13 +418,6 @@ void ScreenSelectDifficultyEX::TweenOnScreen() { unsigned p; - for( int page=0; pageIsPlayerEnabled((PlayerNumber)p) ) { continue; } @@ -357,11 +431,6 @@ void ScreenSelectDifficultyEX::TweenOnScreen() void ScreenSelectDifficultyEX::TweenOffScreen() { -// const int page = m_CurrentPage; - - //m_sprExplanation.Command( "linear,0.5;bounceend,0.5" ); - //m_sprMore.Command( "linear,0.5;bounceend,0.5" ); - for( int p=0; pIsPlayerEnabled((PlayerNumber)p) ) { continue; } @@ -377,10 +446,10 @@ void ScreenSelectDifficultyEX::TweenOffScreen() float ScreenSelectDifficultyEX::GetCursorX( PlayerNumber pn ) { - return m_sprPicture[pn].GetX();// + CURSOR_OFFSET_X_FROM_PICTURE(pn); + return m_sprPicture[pn].GetX(); } float ScreenSelectDifficultyEX::GetCursorY( PlayerNumber pn ) { - return m_sprPicture[pn].GetY();// + CURSOR_OFFSET_Y_FROM_PICTURE(pn); + return m_sprPicture[pn].GetY(); } diff --git a/stepmania/src/ScreenSelectDifficultyEX.h b/stepmania/src/ScreenSelectDifficultyEX.h index a1089352d9..27ff29c372 100644 --- a/stepmania/src/ScreenSelectDifficultyEX.h +++ b/stepmania/src/ScreenSelectDifficultyEX.h @@ -7,7 +7,6 @@ Desc: DDR Extreme Difficulty Select Copyright (c) 2001-2003 by the person(s) listed below. All rights reserved. - Chris Danford Kevin Slaughter ----------------------------------------------------------------------------- */ @@ -19,6 +18,7 @@ #include "ScreenSelect.h" #include "Sprite.h" #include "DifficultyIcon.h" +#include "OptionsCursor.h" class ScreenSelectDifficultyEX : public ScreenSelect { @@ -41,20 +41,30 @@ protected: virtual int GetSelectionIndex( PlayerNumber pn ); virtual void UpdateSelectableChoices(); - bool AllPlayersAreOnCourse(); void Change( PlayerNumber pn, int iNewChoice ); float GetCursorX( PlayerNumber pn ); float GetCursorY( PlayerNumber pn ); bool IsACourse( int mIndex ); - bool PlayerIsOnCourse( PlayerNumber pn ); + bool IsValidModeName( CString ModeName ); void SetAllPlayersSelection( int iChoice, bool bSwitchingModes ); ActorFrame m_framePages; Sprite m_sprCursor[NUM_PLAYERS]; -// Sprite m_sprExplanation; Will implement properly soon -- Miryokuteki Sprite m_sprInfo[NUM_PLAYERS]; -// Sprite m_sprMore; Will implement properly soon -- Miryokuteki - DifficultyIcon m_sprDifficultyIcon[NUM_PLAYERS]; + + +/* Icon Bar stuff */ + int NUM_MODES; + DifficultyIcon m_sprDifficultyIcon[8]; + Sprite m_sprIconBar; + BitmapText m_textDifficultyText[8]; + OptionsCursor m_sprHighlight[NUM_PLAYERS]; + + int GetIconIndex( CString DiffName ); + void SetDifficultyIconText( bool bDisplayCourseItems ); +/* -------------- */ + + Sprite m_sprOK[NUM_PLAYERS]; Sprite m_sprPicture[NUM_PLAYERS];