diff --git a/stepmania/src/Game.cpp b/stepmania/src/Game.cpp index 4051b12edf..71594a4653 100644 --- a/stepmania/src/Game.cpp +++ b/stepmania/src/Game.cpp @@ -40,7 +40,7 @@ MenuButton Game::GameInputToMenuButton( GameInput GameI ) const void Game::MenuInputToGameInput( MenuInput MenuI, PlayerNumber pn, GameInput GameIout[4] ) const { - ASSERT( MenuI.IsValid() ); + ASSERT( MenuI != MenuButton_INVALID ); GameIout[0].MakeInvalid(); // initialize GameIout[1].MakeInvalid(); diff --git a/stepmania/src/Screen.cpp b/stepmania/src/Screen.cpp index b27839c813..5f090da467 100644 --- a/stepmania/src/Screen.cpp +++ b/stepmania/src/Screen.cpp @@ -191,9 +191,6 @@ void Screen::Input( const InputEventPlus &input ) } // default input handler used by most menus - if( !input.MenuI.IsValid() ) - return; - switch( input.MenuI.button ) { case MENU_BUTTON_UP: this->MenuUp ( input ); return; diff --git a/stepmania/src/ScreenAttract.cpp b/stepmania/src/ScreenAttract.cpp index d3e09e260d..20e37b63e0 100644 --- a/stepmania/src/ScreenAttract.cpp +++ b/stepmania/src/ScreenAttract.cpp @@ -49,57 +49,51 @@ void ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuEle if( input.type != IET_FIRST_PRESS ) return; // don't care - if( input.MenuI.IsValid() ) + switch( input.MenuI.button ) { - switch( input.MenuI.button ) - { - case MENU_BUTTON_BACK: - if( !(bool)BACK_GOES_TO_START_SCREEN ) - break; - // fall through - case MENU_BUTTON_START: - case MENU_BUTTON_COIN: - switch( GAMESTATE->GetCoinMode() ) - { - case COIN_MODE_PAY: - LOG->Trace("ScreenAttract::AttractInput: COIN_PAY (%i/%i)", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit.Get() ); - if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit ) - break; // don't fall through - // fall through - case COIN_MODE_HOME: - case COIN_MODE_FREE: - if( pScreen->IsTransitioning() ) - return; - - LOG->Trace("ScreenAttract::AttractInput: begin fading to START_SCREEN" ); - - /* HandleGlobalInputs() already played the coin sound. Don't play it again. */ - if( input.MenuI != MENU_BUTTON_COIN ) - SCREENMAN->PlayCoinSound(); - - SOUNDMAN->SetPlayOnlyCriticalSounds( false ); // unmute attract sounds - pScreen->Cancel( SM_GoToStartScreen ); - break; - default: - ASSERT(0); - } + case MENU_BUTTON_BACK: + if( !(bool)BACK_GOES_TO_START_SCREEN ) break; + // fall through + case MENU_BUTTON_START: + case MENU_BUTTON_COIN: + switch( GAMESTATE->GetCoinMode() ) + { + case COIN_MODE_PAY: + LOG->Trace("ScreenAttract::AttractInput: COIN_PAY (%i/%i)", GAMESTATE->m_iCoins, PREFSMAN->m_iCoinsPerCredit.Get() ); + if( GAMESTATE->m_iCoins < PREFSMAN->m_iCoinsPerCredit ) + break; // don't fall through + // fall through + case COIN_MODE_HOME: + case COIN_MODE_FREE: + if( pScreen->IsTransitioning() ) + return; + + LOG->Trace("ScreenAttract::AttractInput: begin fading to START_SCREEN" ); + + /* HandleGlobalInputs() already played the coin sound. Don't play it again. */ + if( input.MenuI != MENU_BUTTON_COIN ) + SCREENMAN->PlayCoinSound(); + + SOUNDMAN->SetPlayOnlyCriticalSounds( false ); // unmute attract sounds + pScreen->Cancel( SM_GoToStartScreen ); + break; + default: + ASSERT(0); } + break; } if( pScreen->IsTransitioning() ) return; - if( input.MenuI.IsValid() ) + switch( input.MenuI.button ) { - switch( input.MenuI.button ) - { - case MENU_BUTTON_LEFT: - case MENU_BUTTON_RIGHT: - SCREENMAN->PostMessageToTopScreen( SM_BeginFadingOut, 0 ); - break; - } - } + case MENU_BUTTON_LEFT: + case MENU_BUTTON_RIGHT: + SCREENMAN->PostMessageToTopScreen( SM_BeginFadingOut, 0 ); + break; + } // Screen::Input( input ); } diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index e01e2cf661..68467e146a 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -356,8 +356,6 @@ bool ScreenEdit::DeviceToEdit( const DeviceInput &DeviceI, EditButton &button ) /* Given a DeviceInput that was just depressed, return an active edit function. */ bool ScreenEdit::MenuInputToEditButton( const MenuInput &MenuI, EditButton &button ) const { - ASSERT( MenuI.IsValid() ); - const MapEditButtonToMenuButton *pCurrentMap = GetCurrentMenuButtonMap(); FOREACH_EditButton(e) @@ -1088,8 +1086,7 @@ void ScreenEdit::Input( const InputEventPlus &input ) EditButton EditB; if( !DeviceToEdit( input.DeviceI, EditB ) ) - if( input.MenuI.IsValid() ) - MenuInputToEditButton( input.MenuI, EditB ); + MenuInputToEditButton( input.MenuI, EditB ); if( EditB == EDIT_BUTTON_REMOVE_NOTE ) diff --git a/stepmania/src/ScreenEnding.cpp b/stepmania/src/ScreenEnding.cpp index 20483373d0..80f2a42cfb 100644 --- a/stepmania/src/ScreenEnding.cpp +++ b/stepmania/src/ScreenEnding.cpp @@ -119,7 +119,7 @@ void ScreenEnding::Init() void ScreenEnding::Input( const InputEventPlus &input ) { - if( input.MenuI.IsValid() && !IsTransitioning() ) + if( !IsTransitioning() ) { switch( input.MenuI.button ) { diff --git a/stepmania/src/ScreenEz2SelectMusic.cpp b/stepmania/src/ScreenEz2SelectMusic.cpp index 71055a4b9f..4acdd13c39 100644 --- a/stepmania/src/ScreenEz2SelectMusic.cpp +++ b/stepmania/src/ScreenEz2SelectMusic.cpp @@ -244,7 +244,7 @@ void ScreenEz2SelectMusic::Input( const InputEventPlus &input ) if( !input.GameI.IsValid() ) return; // don't care - if( m_bMadeChoice && !m_bGoToOptions && input.MenuI.IsValid() && input.MenuI.button == MENU_BUTTON_START ) + if( m_bMadeChoice && !m_bGoToOptions && input.MenuI.button == MENU_BUTTON_START ) { SCREENMAN->PlayStartSound(); m_bGoToOptions = true; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 8d27ec25d4..bc26132ef2 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -2064,7 +2064,7 @@ void ScreenGameplay::Input( const InputEventPlus &input ) if( m_bPaused ) { /* If we're paused, only accept MENU_BUTTON_START to unpause. */ - if( input.MenuI.IsValid() && GAMESTATE->IsHumanPlayer(input.pn) && input.MenuI.button == MENU_BUTTON_START && input.type == IET_FIRST_PRESS ) + if( GAMESTATE->IsHumanPlayer(input.pn) && input.MenuI == MENU_BUTTON_START && input.type == IET_FIRST_PRESS ) { if( m_PauseController == GAME_CONTROLLER_INVALID || m_PauseController == input.GameI.controller ) this->PauseGame( false ); @@ -2072,8 +2072,7 @@ void ScreenGameplay::Input( const InputEventPlus &input ) return; } - if( input.MenuI.IsValid() && - m_DancingState != STATE_OUTRO && + if( m_DancingState != STATE_OUTRO && GAMESTATE->IsHumanPlayer(input.pn) && (!GAMESTATE->m_bMultiplayer || input.mp == MultiPlayer_1) && !m_Cancel.IsTransitioning() ) @@ -2088,8 +2087,8 @@ void ScreenGameplay::Input( const InputEventPlus &input ) bool bHoldingGiveUp = false; if( GAMESTATE->m_pCurStyle->GameInputToColumn(input.GameI) == Column_INVALID ) { - bHoldingGiveUp |= ( START_GIVES_UP && input.MenuI.button == MENU_BUTTON_START ); - bHoldingGiveUp |= ( BACK_GIVES_UP && input.MenuI.button == MENU_BUTTON_BACK ); + bHoldingGiveUp |= ( START_GIVES_UP && input.MenuI == MENU_BUTTON_START ); + bHoldingGiveUp |= ( BACK_GIVES_UP && input.MenuI == MENU_BUTTON_BACK ); } if( bHoldingGiveUp ) @@ -2115,7 +2114,7 @@ void ScreenGameplay::Input( const InputEventPlus &input ) /* Only handle MENU_BUTTON_BACK as a regular BACK button if BACK_GIVES_UP is * disabled. */ - if( input.MenuI.button == MENU_BUTTON_BACK && !BACK_GIVES_UP ) + if( input.MenuI == MENU_BUTTON_BACK && !BACK_GIVES_UP ) { if( ((!PREFSMAN->m_bDelayedBack && input.type==IET_FIRST_PRESS) || (input.DeviceI.device==DEVICE_KEYBOARD && input.type==IET_REPEAT) || diff --git a/stepmania/src/ScreenJukebox.cpp b/stepmania/src/ScreenJukebox.cpp index 44972b7193..25bec5ceeb 100644 --- a/stepmania/src/ScreenJukebox.cpp +++ b/stepmania/src/ScreenJukebox.cpp @@ -255,15 +255,12 @@ void ScreenJukebox::Input( const InputEventPlus &input ) if( input.type != IET_FIRST_PRESS ) return; /* ignore */ - if( input.MenuI.IsValid() ) + switch( input.MenuI.button ) { - switch( input.MenuI.button ) - { - case MENU_BUTTON_LEFT: - case MENU_BUTTON_RIGHT: - SCREENMAN->PostMessageToTopScreen( SM_NotesEnded, 0 ); - return; - } + case MENU_BUTTON_LEFT: + case MENU_BUTTON_RIGHT: + SCREENMAN->PostMessageToTopScreen( SM_NotesEnded, 0 ); + return; } ScreenAttract::AttractInput( input, this ); diff --git a/stepmania/src/ScreenPlayerOptions.cpp b/stepmania/src/ScreenPlayerOptions.cpp index ee31e23fc4..e044f39b8e 100644 --- a/stepmania/src/ScreenPlayerOptions.cpp +++ b/stepmania/src/ScreenPlayerOptions.cpp @@ -83,7 +83,6 @@ void ScreenPlayerOptions::Input( const InputEventPlus &input ) if( m_bAskOptionsMessage && input.type == IET_FIRST_PRESS && !m_In.IsTransitioning() && - input.MenuI.IsValid() && input.MenuI == MENU_BUTTON_START ) { if( m_bAcceptedChoices && !m_bGoToOptions ) @@ -119,7 +118,7 @@ void ScreenPlayerOptions::Input( const InputEventPlus &input ) ScreenOptionsMaster::Input( input ); // UGLY: Update m_Disqualified whenever Start is pressed - if( GAMESTATE->IsHumanPlayer(pn) && input.MenuI.IsValid() && input.MenuI == MENU_BUTTON_START ) + if( GAMESTATE->IsHumanPlayer(pn) && input.MenuI == MENU_BUTTON_START ) { int row = m_iCurrentRow[pn]; UpdateDisqualified( row, pn ); diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index 7d52bb1cbe..6a8fbe6787 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -291,7 +291,6 @@ void ScreenSelectMusic::Input( const InputEventPlus &input ) // Check for "Press START again for options" button press if( m_bMadeChoice && - input.MenuI.IsValid() && input.MenuI.button == MENU_BUTTON_START && input.type != IET_RELEASE && OPTIONS_MENU_AVAILABLE.GetValue() )