remove MenuInput.IsValid(); if invalid, the button is simply MenuButton_INVALID
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -119,7 +119,7 @@ void ScreenEnding::Init()
|
||||
|
||||
void ScreenEnding::Input( const InputEventPlus &input )
|
||||
{
|
||||
if( input.MenuI.IsValid() && !IsTransitioning() )
|
||||
if( !IsTransitioning() )
|
||||
{
|
||||
switch( input.MenuI.button )
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) ||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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() )
|
||||
|
||||
Reference in New Issue
Block a user