diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 470738e5b7..d06904dda5 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -31,51 +31,137 @@ CurrentModeZoom=1 # Note that we don't use the "name" parameter to Choices here. Name1 is # the displayed text, which might be translated or otherwise changed. The "name,foo" # parameter to ModeChoices is an asset name, which is used in filenames. -Fallback=ScreenWithMenuElements +Class=ScreenTitleMenu +Fallback=ScreenCaution +SharedPreviewAndCursor=1 +AllowDisabledPlayerInput=1 ChoiceNames=1,2,3,4,5,6,7 //,8 -Choice1=screen,ScreenCaution -Name1=GAME START +DefaultChoice=1 +NumChoicesOnPage1=100 +Choice1=ApplyDefaultOptions;screen,ScreenCaution Choice2=screen,ScreenSelectGame -Name2=SELECT GAME Choice3=screen,ScreenOptionsMenu -Name3=OPTIONS Choice4=screen,ScreenEditMenu -Name4=EDIT/SYNC SONGS Choice5=screen,ScreenEditCoursesMenu -Name5=EDIT COURSES Choice6=screen,ScreenJukeboxMenu -Name6=JUKEBOX Choice7=screen,ScreenExit -Name7=EXIT Choice8=screen,ScreenTest -Name8=SANDBOX +NumIconParts=1 + +IconPart1Choice1X=SCREEN_CENTER_X +IconPart1Choice1Y=SCREEN_CENTER_Y-150 +IconPart1Choice1OnCommand= +IconPart1Choice1OffCommand= +IconPart1Choice1OffFocusedCommand= +IconPart1Choice1OffUnfocusedCommand= +IconPart1Choice1EnabledCommand= +IconPart1Choice1DisabledCommand= +IconPart1Choice1GainFocusCommand= +IconPart1Choice1LoseFocusCommand= + +IconPart1Choice2X=SCREEN_CENTER_X +IconPart1Choice2Y=SCREEN_CENTER_Y-100 +IconPart1Choice2OnCommand= +IconPart1Choice2OffCommand= +IconPart1Choice2OffFocusedCommand= +IconPart1Choice2OffUnfocusedCommand= +IconPart1Choice2EnabledCommand= +IconPart1Choice2DisabledCommand= +IconPart1Choice2GainFocusCommand= +IconPart1Choice2LoseFocusCommand= + +IconPart1Choice3X=SCREEN_CENTER_X +IconPart1Choice3Y=SCREEN_CENTER_Y-50 +IconPart1Choice3OnCommand= +IconPart1Choice3OffCommand= +IconPart1Choice3OffFocusedCommand= +IconPart1Choice3OffUnfocusedCommand= +IconPart1Choice3EnabledCommand= +IconPart1Choice3DisabledCommand= +IconPart1Choice3GainFocusCommand= +IconPart1Choice3LoseFocusCommand= + +IconPart1Choice4X=SCREEN_CENTER_X +IconPart1Choice4Y=SCREEN_CENTER_Y+0 +IconPart1Choice4OnCommand= +IconPart1Choice4OffCommand= +IconPart1Choice4OffFocusedCommand= +IconPart1Choice4OffUnfocusedCommand= +IconPart1Choice4EnabledCommand= +IconPart1Choice4DisabledCommand= +IconPart1Choice4GainFocusCommand= +IconPart1Choice4LoseFocusCommand= + +IconPart1Choice5X=SCREEN_CENTER_X +IconPart1Choice5Y=SCREEN_CENTER_Y+50 +IconPart1Choice5OnCommand= +IconPart1Choice5OffCommand= +IconPart1Choice5OffFocusedCommand= +IconPart1Choice5OffUnfocusedCommand= +IconPart1Choice5EnabledCommand= +IconPart1Choice5DisabledCommand= +IconPart1Choice5GainFocusCommand= +IconPart1Choice5LoseFocusCommand= + +IconPart1Choice6X=SCREEN_CENTER_X +IconPart1Choice6Y=SCREEN_CENTER_Y+100 +IconPart1Choice6OnCommand= +IconPart1Choice6OffCommand= +IconPart1Choice6OffFocusedCommand= +IconPart1Choice6OffUnfocusedCommand= +IconPart1Choice6EnabledCommand= +IconPart1Choice6DisabledCommand= +IconPart1Choice6GainFocusCommand= +IconPart1Choice6LoseFocusCommand= + +IconPart1Choice7X=SCREEN_CENTER_X +IconPart1Choice7Y=SCREEN_CENTER_Y+150 +IconPart1Choice7OnCommand= +IconPart1Choice7OffCommand= +IconPart1Choice7OffFocusedCommand= +IconPart1Choice7OffUnfocusedCommand= +IconPart1Choice7EnabledCommand= +IconPart1Choice7DisabledCommand= +IconPart1Choice7GainFocusCommand= +IconPart1Choice7LoseFocusCommand= + +IconPart1Choice8X=SCREEN_CENTER_X +IconPart1Choice8Y=SCREEN_CENTER_Y+200 +IconPart1Choice8OnCommand= +IconPart1Choice8OffCommand= +IconPart1Choice8OffFocusedCommand= +IconPart1Choice8OffUnfocusedCommand= +IconPart1Choice8EnabledCommand= +IconPart1Choice8DisabledCommand= +IconPart1Choice8GainFocusCommand= +IconPart1Choice8LoseFocusCommand= + NumCodes=0 TimerSeconds=-1 // none StyleIcon=0 MemoryCardIcons=0 -LogoHomeOnCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomy,0;sleep,0.5;bounceend,0.5;zoomy,1;glowshift;effectperiod,2.5;effectcolor1,1,1,1,0.1;effectcolor2,1,1,1,0.3 -LogoOnCommand=x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y;zoomy,0;sleep,0.5;bounceend,0.5;zoomy,1;glowshift;effectperiod,2.5;effectcolor1,1,1,1,0.1;effectcolor2,1,1,1,0.3 -VersionOnCommand=horizalign,right;x,SCREEN_RIGHT-20;y,SCREEN_TOP+20;diffuse,0.6,0.6,0.6,1;zoom,0.5;shadowlength,2 -SongsOnCommand=horizalign,left;x,SCREEN_LEFT+20;y,SCREEN_TOP+20;diffuse,0.6,0.6,0.6,1;zoom,0.5;shadowlength,2 +LogoX=SCREEN_CENTER_X +LogoY=SCREEN_CENTER_Y +LogoOnCommand=zoomy,0;sleep,0.5;bounceend,0.5;zoomy,1;glowshift;effectperiod,2.5;effectcolor1,1,1,1,0.1;effectcolor2,1,1,1,0.3 +VersionX=SCREEN_RIGHT-20 +VersionY=SCREEN_TOP+20 +VersionOnCommand=horizalign,right;diffuse,0.6,0.6,0.6,1;zoom,0.5;shadowlength,2 +SongsX=SCREEN_LEFT+20 +SongsY=SCREEN_TOP+20 +SongsOnCommand=horizalign,left;diffuse,0.6,0.6,0.6,1;zoom,0.5;shadowlength,2 +MaxStagesX= +MaxStagesY= MaxStagesOnCommand=hidden,1 MaxStagesText= +LifeDifficultyX= +LifeDifficultyY= LifeDifficultyOnCommand=hidden,1 -ChoicesX=SCREEN_CENTER_X -ChoicesStartY=SCREEN_CENTER_Y-154 -ChoicesSpacingY=48 -ChoicesShadowLength=5 HelpX=SCREEN_CENTER_X HelpY=SCREEN_BOTTOM-40 -ColorNotSelected=1,1,1,1 -ColorSelected=0.5,1,0.5,1 -ZoomNotSelected=1.0 -ZoomSelected=1.3 -MenuTextAlign=1 // 0=left, 1=center, 2=right -MenuCommandOnCreate= -MenuCommandSelectDelay=0.5 -SecondsBetweenComments=12 -SecondsBeforeAttract=30 +IdleCommentSeconds=12 +IdleTimeoutSeconds=30 +IdleTimeoutScreen=ScreenCompany [ScreenCaution] PrevScreen=ScreenTitleMenu @@ -131,6 +217,8 @@ MorePage2Y= MorePage2OnCommand=hidden,1 MorePage2OffCommand= ExtraSleepAfterTweenOffSeconds=0 +IdleCommentSeconds=15 +IdleTimeoutSeconds=0 [ScreenEz2SelectPlayer] JoinFrameP1X=SCREEN_CENTER_X-200 diff --git a/stepmania/src/ScreenSelect.cpp b/stepmania/src/ScreenSelect.cpp index 3babcc89de..df0ed8bdc3 100644 --- a/stepmania/src/ScreenSelect.cpp +++ b/stepmania/src/ScreenSelect.cpp @@ -25,8 +25,13 @@ #define CODE_ACTION( c ) THEME->GetMetricA(m_sName,ssprintf("Code%dAction",c+1)) #define HELP_TEXT THEME->GetMetric (m_sName,"HelpText") #define NEXT_SCREEN( c ) THEME->GetMetric (m_sName,ssprintf("NextScreen%d",c+1)) +#define IDLE_TIMEOUT_SCREEN THEME->GetMetric (m_sName,"IdleTimeoutScreen") +#define ALLOW_DISABLED_PLAYER_INPUT THEME->GetMetricB(m_sName,"AllowDisabledPlayerInput") -ScreenSelect::ScreenSelect( CString sClassName ) : ScreenWithMenuElements(sClassName) +ScreenSelect::ScreenSelect( CString sClassName ) : + ScreenWithMenuElements(sClassName), + IDLE_COMMENT_SECONDS(m_sName,"IdleCommentSeconds"), + IDLE_TIMEOUT_SECONDS(m_sName,"IdleTimeoutSeconds") { LOG->Trace( "ScreenSelect::ScreenSelect()" ); @@ -100,6 +105,26 @@ void ScreenSelect::Update( float fDelta ) SOUND->PlayMusic( THEME->GetPathToS(m_sName+" music") ); } + if( !IsTransitioning() ) + { + if( IDLE_COMMENT_SECONDS > 0 && m_timerIdleComment.PeekDeltaTime() >= IDLE_COMMENT_SECONDS ) + { + SOUND->PlayOnceFromAnnouncer( m_sName+" IdleComment" ); + m_timerIdleComment.GetDeltaTime(); + } + // don't time out on this screen is coin mode is pay. + // If we're here, then there's a credit in the machine. + if( PREFSMAN->GetCoinMode() != COIN_PAY ) + { + if( IDLE_TIMEOUT_SECONDS > 0 && m_timerIdleTimeout.PeekDeltaTime() >= IDLE_TIMEOUT_SECONDS ) + { + SCREENMAN->SetNewScreen( IDLE_TIMEOUT_SCREEN ); + m_timerIdleTimeout.GetDeltaTime(); + return; + } + } + } + Screen::Update( fDelta ); // GAMESTATE->m_MasterPlayerNumber is set to PLAYER_INVALID when going Back to @@ -127,12 +152,20 @@ void ScreenSelect::Input( const DeviceInput& DeviceI, const InputEventType type, { // LOG->Trace( "ScreenSelect::Input()" ); + /* Reset the demonstration timer when a key is pressed. */ + m_timerIdleComment.GetDeltaTime(); + m_timerIdleTimeout.GetDeltaTime(); + if( MenuI.button == MENU_BUTTON_COIN || Screen::JoinInput(DeviceI, type, GameI, MenuI, StyleI) ) { if( type == IET_FIRST_PRESS ) this->UpdateSelectableChoices(); - return; // don't let the screen handle the MENU_START press + + if( ALLOW_DISABLED_PLAYER_INPUT ) + ; + else + return; // don't let the screen handle the MENU_START press } if( IsTransitioning() ) diff --git a/stepmania/src/ScreenSelect.h b/stepmania/src/ScreenSelect.h index f19f27c4b0..a2fdc26a85 100644 --- a/stepmania/src/ScreenSelect.h +++ b/stepmania/src/ScreenSelect.h @@ -7,12 +7,11 @@ #include "BGAnimation.h" #include "GameCommand.h" #include "CodeDetector.h" +#include "ThemeMetric.h" // Derived classes must send this when done const ScreenMessage SM_AllDoneChoosing = (ScreenMessage)(SM_User+123); // unique -#define MAX_CHOICES 30 - class ScreenSelect : public ScreenWithMenuElements { public: @@ -26,7 +25,6 @@ public: virtual void MenuBack( PlayerNumber pn ); - protected: virtual int GetSelectionIndex( PlayerNumber pn ) = 0; virtual void UpdateSelectableChoices() = 0; // derived screens must handle this @@ -37,6 +35,12 @@ protected: vector m_aCodes; vector m_aCodeChoices; + + RageTimer m_timerIdleComment; // count up to time between idle comment announcer sounds + RageTimer m_timerIdleTimeout; // count up to go to the timeout screen + + ThemeMetric IDLE_COMMENT_SECONDS; + ThemeMetric IDLE_TIMEOUT_SECONDS; }; #endif diff --git a/stepmania/src/ScreenTitleMenu.cpp b/stepmania/src/ScreenTitleMenu.cpp index bedaf6f5d0..70732a7966 100644 --- a/stepmania/src/ScreenTitleMenu.cpp +++ b/stepmania/src/ScreenTitleMenu.cpp @@ -25,38 +25,11 @@ #include "ScreenOptionsMasterPrefs.h" #include "PlayerState.h" - -#define LOGO_ON_COMMAND THEME->GetMetricA("ScreenTitleMenu","LogoOnCommand") -#define LOGO_HOME_ON_COMMAND THEME->GetMetricA("ScreenTitleMenu","LogoHomeOnCommand") -#define VERSION_ON_COMMAND THEME->GetMetricA("ScreenTitleMenu","VersionOnCommand") -#define SONGS_ON_COMMAND THEME->GetMetricA("ScreenTitleMenu","SongsOnCommand") -#define MAX_STAGES_ON_COMMAND THEME->GetMetricA("ScreenTitleMenu","MaxStagesOnCommand") -#define MAX_STAGES_TEXT THEME->GetMetric ("ScreenTitleMenu","MaxStagesText") -#define LIFE_DIFFICULTY_ON_COMMAND THEME->GetMetricA("ScreenTitleMenu","LifeDifficultyOnCommand") -#define HELP_X THEME->GetMetricF("ScreenTitleMenu","HelpX") -#define HELP_Y THEME->GetMetricF("ScreenTitleMenu","HelpY") -#define CHOICES_X THEME->GetMetricF("ScreenTitleMenu","ChoicesX") -#define CHOICES_START_Y THEME->GetMetricF("ScreenTitleMenu","ChoicesStartY") -#define CHOICES_SPACING_Y THEME->GetMetricF("ScreenTitleMenu","ChoicesSpacingY") -#define CHOICES_SHADOW_LENGTH THEME->GetMetricF("ScreenTitleMenu","ChoicesShadowLength") -#define COLOR_NOT_SELECTED THEME->GetMetricC("ScreenTitleMenu","ColorNotSelected") -#define COLOR_SELECTED THEME->GetMetricC("ScreenTitleMenu","ColorSelected") -#define ZOOM_NOT_SELECTED THEME->GetMetricF("ScreenTitleMenu","ZoomNotSelected") -#define ZOOM_SELECTED THEME->GetMetricF("ScreenTitleMenu","ZoomSelected") -#define MENU_TEXT_ALIGN THEME->GetMetricI("ScreenTitleMenu","MenuTextAlign") -#define SECONDS_BETWEEN_COMMENTS THEME->GetMetricF("ScreenTitleMenu","SecondsBetweenComments") -#define SECONDS_BEFORE_ATTRACT THEME->GetMetricF("ScreenTitleMenu","SecondsBeforeAttract") -#define HELP_TEXT( coin_mode ) THEME->GetMetric ("ScreenTitleMenu","HelpText"+Capitalize(CoinModeToString(coin_mode))) -#define MENU_ITEM_CREATE THEME->GetMetricA("ScreenTitleMenu","MenuCommandOnCreate") -#define MENU_ITEM_SELECT_DELAY THEME->GetMetricF("ScreenTitleMenu","MenuCommandSelectDelay") - -#define NAME( sChoiceName ) THEME->GetMetric (m_sName,ssprintf("Name%s",sChoiceName.c_str())) - -const ScreenMessage SM_PlayComment = ScreenMessage(SM_User+1); -const ScreenMessage SM_GoToAttractLoop = ScreenMessage(SM_User+13); +#define MAX_STAGES_TEXT THEME->GetMetric (m_sName,"MaxStagesText") REGISTER_SCREEN_CLASS( ScreenTitleMenu ); -ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassName ) +ScreenTitleMenu::ScreenTitleMenu( CString sScreenName ) : + ScreenSelectMaster( sScreenName ) { LOG->Trace( "ScreenTitleMenu::ScreenTitleMenu()" ); @@ -75,152 +48,59 @@ ScreenTitleMenu::ScreenTitleMenu( CString sClassName ) : ScreenSelect( sClassNam * things stinks ... */ GAMESTATE->Reset(); - LIGHTSMAN->SetLightsMode( LIGHTSMODE_JOINING ); // do this after Reset! + // TRICKY: Do this after GameState::Reset. + LIGHTSMAN->SetLightsMode( LIGHTSMODE_JOINING ); - m_sprLogo.Load( THEME->GetPathG("ScreenLogo",GAMESTATE->GetCurrentGame()->m_szName) ); - m_sprLogo.RunCommands( PREFSMAN->GetCoinMode()==COIN_HOME ? LOGO_HOME_ON_COMMAND : LOGO_ON_COMMAND ); - this->AddChild( &m_sprLogo ); - - if( PREFSMAN->GetCoinMode() != COIN_HOME ) - { - switch( PREFSMAN->GetPremium() ) - { - case PrefsManager::DOUBLES_PREMIUM: - m_Premium.LoadFromAniDir( THEME->GetPathToB("ScreenTitleMenu doubles premium") ); - this->AddChild( &m_Premium ); - break; - case PrefsManager::JOINT_PREMIUM: - m_Premium.LoadFromAniDir( THEME->GetPathToB("ScreenTitleMenu joint premium") ); - this->AddChild( &m_Premium ); - break; - } - } + m_sprLogo.Load( THEME->GetPathG(m_sName,GAMESTATE->GetCurrentGame()->m_szName) ); + m_sprLogo->SetName( "Logo" ); + m_sprLogo->SetDrawOrder( -1 ); + this->AddChild( m_sprLogo ); + SET_XY_AND_ON_COMMAND( m_sprLogo ); m_textVersion.LoadFromFont( THEME->GetPathToF("Common normal") ); - m_textVersion.RunCommands( VERSION_ON_COMMAND ); + m_textVersion.SetName( "Version" ); m_textVersion.SetText( PRODUCT_VER ); this->AddChild( &m_textVersion ); - + SET_XY_AND_ON_COMMAND( m_textVersion ); m_textSongs.LoadFromFont( THEME->GetPathToF("Common normal") ); - m_textSongs.RunCommands( SONGS_ON_COMMAND ); + m_textSongs.SetName( "Songs" ); CString text = ssprintf("%d songs in %d groups, %d courses", SONGMAN->GetNumSongs(), SONGMAN->GetNumGroups(), SONGMAN->GetNumCourses() ); if( PREFSMAN->m_bUseUnlockSystem ) text += ssprintf(", %d unlocks", UNLOCKMAN->GetNumUnlocks() ); m_textSongs.SetText( text ); this->AddChild( &m_textSongs ); + SET_XY_AND_ON_COMMAND( m_textSongs ); m_textMaxStages.LoadFromFont( THEME->GetPathF(m_sName,"MaxStages") ); - m_textMaxStages.RunCommands( MAX_STAGES_ON_COMMAND ); + m_textMaxStages.SetName( "MaxStages" ); CString sText = PREFSMAN->m_bEventMode ? CString("event mode") : ssprintf( "%d %s%s max", PREFSMAN->m_iNumArcadeStages, MAX_STAGES_TEXT.c_str(), (PREFSMAN->m_iNumArcadeStages>1)?"s":"" ); m_textMaxStages.SetText( sText ); this->AddChild( &m_textMaxStages ); + SET_XY_AND_ON_COMMAND( m_textMaxStages ); m_textLifeDifficulty.LoadFromFont( THEME->GetPathF(m_sName,"LifeDifficulty") ); - m_textLifeDifficulty.RunCommands( LIFE_DIFFICULTY_ON_COMMAND ); + m_textLifeDifficulty.SetName( "LifeDifficulty" ); + ON_COMMAND( m_textLifeDifficulty ); int iLifeDifficulty; LifeDifficulty( iLifeDifficulty, true, NULL ); iLifeDifficulty++; // LifeDifficulty returns an index m_textLifeDifficulty.SetText( ssprintf( "life difficulty %d", iLifeDifficulty ) ); this->AddChild( &m_textLifeDifficulty ); - - CString sCoinMode = CoinModeToString((CoinMode)PREFSMAN->GetCoinMode()); - m_CoinMode.LoadFromAniDir( THEME->GetPathToB("ScreenTitleMenu "+sCoinMode) ); - this->AddChild( &m_CoinMode ); - - m_textHelp.LoadFromFont( THEME->GetPathToF("ScreenTitleMenu help") ); - m_textHelp.SetText( HELP_TEXT((CoinMode)PREFSMAN->GetCoinMode()) ); - m_textHelp.SetXY( HELP_X, HELP_Y ); - m_textHelp.SetZoom( 0.5f ); - m_textHelp.SetEffectDiffuseBlink(); - m_textHelp.SetShadowLength( 2 ); - this->AddChild( &m_textHelp ); - - switch( PREFSMAN->GetCoinMode() ) - { - case COIN_HOME: - { - for( unsigned i=0; iGetPathToF("ScreenTitleMenu choices") ); - m_textChoice[i].SetHorizAlign( (enum Actor::HorizAlign)MENU_TEXT_ALIGN ); - m_textChoice[i].SetText( NAME(mc.m_sName) ); - m_textChoice[i].SetXY( CHOICES_X, CHOICES_START_Y + i*CHOICES_SPACING_Y ); - m_textChoice[i].SetShadowLength( CHOICES_SHADOW_LENGTH ); - m_textChoice[i].SetShadowLength( 4 ); - this->AddChild( &m_textChoice[i] ); - } - } - break; - case COIN_PAY: - case COIN_FREE: - break; - default: - ASSERT(0); - } - - -// m_AttractOut.Load( THEME->GetPathToB("ScreenTitleMenu out") ); -// this->AddChild( &m_AttractOut ); - -// m_BeginOut.Load( THEME->GetPathToB("ScreenTitleMenu begin out") ); -// this->AddChild( &m_BeginOut ); - - - SOUND->PlayOnceFromAnnouncer( "title menu game name" ); - - - m_soundChange.Load( THEME->GetPathToS("ScreenTitleMenu change"),true ); - - m_Choice = 0; - - for( unsigned i=0; iPlayMusic( THEME->GetPathToS("ScreenTitleMenu music") ); - - this->PostScreenMessage( SM_PlayComment, SECONDS_BETWEEN_COMMENTS); + SET_XY_AND_ON_COMMAND( m_textLifeDifficulty ); this->SortByDrawOrder(); -// this->MoveToTail( &m_AttractOut ); // put it in the back so it covers up the stuff we just added + SOUND->PlayOnceFromAnnouncer( "title menu game name" ); } ScreenTitleMenu::~ScreenTitleMenu() { - LOG->Trace( "ScreenTitleMenu::~ScreenTitleMenu()" ); -} - -void ScreenTitleMenu::UpdateSelectableChoices() -{ - -} - -void ScreenTitleMenu::MoveCursor( bool up ) -{ - if( PREFSMAN->GetCoinMode() != COIN_HOME ) - return; -// if( m_BeginOut.IsTransitioning() ) -// return; - - TimeToDemonstration.GetDeltaTime(); /* Reset the demonstration timer when a key is pressed. */ - LoseFocus( m_Choice ); - m_Choice += (up? -1:+1); - wrap( (int&)m_Choice, m_aGameCommands.size() ); - m_soundChange.Play(); - GainFocus( m_Choice ); + LOG->Trace( ScreenTitleMenu::~ScreenTitleMenu()" ); } void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) @@ -234,59 +114,27 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty * so that the right m_aGameCommands will show */ if( ScreenAttract::ChangeCoinModeInput( DeviceI, type, GameI, MenuI, StyleI ) ) { - SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); + SCREENMAN->SetNewScreen( m_sName ); return; } - if( m_In.IsTransitioning() || m_Back.IsTransitioning() ) /* not m_Out */ return; - if( MenuI.IsValid() ) - { - switch( MenuI.button ) - { - case MENU_BUTTON_UP: - case MENU_BUTTON_LEFT: - MoveCursor( true ); - break; - case MENU_BUTTON_DOWN: - case MENU_BUTTON_RIGHT: - MoveCursor( false ); - break; - case MENU_BUTTON_BACK: - if( m_Out.IsTransitioning() ) - break; - Back( SM_GoToAttractLoop ); - break; - case MENU_BUTTON_START: - /* return if the choice is invalid */ - const GameCommand &mc = m_aGameCommands[m_Choice]; - CString why; - if( !mc.IsPlayable( &why ) ) - { - SCREENMAN->PlayInvalidSound(); - if( why != "" ) - SCREENMAN->SystemMessage( why ); - return; - } - - if( !Screen::JoinInput( DeviceI, type, GameI, MenuI, StyleI ) ) - return; - - if( !m_Out.IsTransitioning() ) - StartTransitioning( SM_GoToNextScreen ); - } - } + if( PREFSMAN->GetCoinMode() != COIN_HOME ) + return; + + // // detect codes + // if( CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_THEME) || CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_THEME2) ) { THEME->NextTheme(); ApplyGraphicOptions(); // update window title and icon SCREENMAN->SystemMessage( "Theme: "+THEME->GetCurThemeName() ); - SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); + SCREENMAN->SetNewScreen( m_sName ); TEXTUREMAN->DoDelayedDelete(); } if( CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_ANNOUNCER) || @@ -296,7 +144,7 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty CString sName = ANNOUNCER->GetCurAnnouncerName(); if( sName=="" ) sName = "(none)"; SCREENMAN->SystemMessage( "Announcer: "+sName ); - SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); + SCREENMAN->SetNewScreen( m_sName ); } if( CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_GAME) || CodeDetector::EnteredCode(GameI.controller,CodeDetector::CODE_NEXT_GAME2) ) @@ -319,80 +167,10 @@ void ScreenTitleMenu::Input( const DeviceInput& DeviceI, const InputEventType ty ResetGame( false ); SCREENMAN->SystemMessage( CString("Game: ") + GAMESTATE->GetCurrentGame()->m_szName ); - SCREENMAN->SetNewScreen( "ScreenTitleMenu" ); + SCREENMAN->SetNewScreen( m_sName ); } - ScreenSelect::Input( DeviceI, type, GameI, MenuI, StyleI ); -} - -void ScreenTitleMenu::Update( float fDelta ) -{ - // time out on this screen and go to the attract sequence - if( !IsTransitioning() && TimeToDemonstration.PeekDeltaTime() >= SECONDS_BEFORE_ATTRACT) - { - // don't time out on this screen is coin mode is pay. - // If we're here, then there's a credit in the machine. - if( PREFSMAN->GetCoinMode() == COIN_PAY ) - ; // do nothing - else - { - this->PostScreenMessage( SM_GoToAttractLoop, 0 ); - TimeToDemonstration.GetDeltaTime(); - } - } - - Screen::Update(fDelta); -} - - -void ScreenTitleMenu::HandleScreenMessage( const ScreenMessage SM ) -{ - switch( SM ) - { - case SM_PlayComment: - SOUND->PlayOnceFromAnnouncer( "title menu attract" ); - this->PostScreenMessage( SM_PlayComment, SECONDS_BETWEEN_COMMENTS ); - break; - case SM_GoToNextScreen: - /* XXX: Bad hack: we only want to set default options if we're actually - * going into the game. We don't want to set it if we're going into the - * editor menu, since that never resets options (so it'll maintain changes - * when entering and exiting the editor), and the editor probably shouldn't - * use default options. */ - if( m_Choice == 0 ) - { - // apply default options - FOREACH_PlayerNumber( p ) - GAMESTATE->m_pPlayerState[p]->m_PlayerOptions.FromString( PREFSMAN->m_sDefaultModifiers ); - GAMESTATE->m_SongOptions.FromString( PREFSMAN->m_sDefaultModifiers ); - } - m_aGameCommands[m_Choice].ApplyToAllPlayers(); - break; - case SM_GoToAttractLoop: - SCREENMAN->SetNewScreen( INITIAL_SCREEN ); - break; - } -} - - -void ScreenTitleMenu::LoseFocus( int iChoiceIndex ) -{ - m_textChoice[iChoiceIndex].SetEffectNone(); - m_textChoice[iChoiceIndex].StopTweening(); - m_textChoice[iChoiceIndex].BeginTweening( 0.3f ); - m_textChoice[iChoiceIndex].SetZoom( ZOOM_NOT_SELECTED ); -} - -void ScreenTitleMenu::GainFocus( int iChoiceIndex ) -{ - m_textChoice[iChoiceIndex].StopTweening(); - m_textChoice[iChoiceIndex].BeginTweening( 0.3f ); - m_textChoice[iChoiceIndex].SetZoom( ZOOM_SELECTED ); - RageColor color1, color2; - color1 = COLOR_SELECTED; - color2 = color1 * 0.5f; - color2.a = 1; - m_textChoice[iChoiceIndex].SetEffectDiffuseShift( 0.5f, color1, color2 ); + ScreenSelectMaster::Input( DeviceI, type, GameI, MenuI, StyleI ); } /* diff --git a/stepmania/src/ScreenTitleMenu.h b/stepmania/src/ScreenTitleMenu.h index 2b5f9997ba..e50c8fdf76 100644 --- a/stepmania/src/ScreenTitleMenu.h +++ b/stepmania/src/ScreenTitleMenu.h @@ -9,46 +9,22 @@ #include "BitmapText.h" #include "RageSound.h" #include "RageTimer.h" -#include "ScreenSelect.h" +#include "ScreenSelectMaster.h" -#define MAX_MODE_CHOICES 30 - -class ScreenTitleMenu : public ScreenSelect +class ScreenTitleMenu : public ScreenSelectMaster { public: ScreenTitleMenu( CString sName ); virtual ~ScreenTitleMenu(); virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); - virtual void Update( float fDelta ); - virtual void HandleScreenMessage( const ScreenMessage SM ); private: - int GetSelectionIndex( PlayerNumber pn ) { return m_Choice; } - void UpdateSelectableChoices(); - - void GainFocus( int iChoiceIndex ); - void LoseFocus( int iChoiceIndex ); - void MoveCursor( bool up ); - - unsigned m_Choice; - - Sprite m_sprLogo; + AutoActor m_sprLogo; BitmapText m_textVersion; BitmapText m_textSongs; BitmapText m_textMaxStages; BitmapText m_textLifeDifficulty; - BitmapText m_textHelp; - BitmapText m_textChoice[MAX_MODE_CHOICES]; - - RageSound m_soundChange; - - RageTimer TimeToDemonstration; - - BGAnimation m_CoinMode; - BGAnimation m_Premium; - - Transition m_AttractOut; }; #endif