remove MenuInput.IsValid(); if invalid, the button is simply MenuButton_INVALID

This commit is contained in:
Glenn Maynard
2006-09-14 20:31:46 +00:00
parent c559ff69b6
commit f1cd95828e
10 changed files with 51 additions and 69 deletions
+1 -1
View File
@@ -40,7 +40,7 @@ MenuButton Game::GameInputToMenuButton( GameInput GameI ) const
void Game::MenuInputToGameInput( MenuInput MenuI, PlayerNumber pn, GameInput GameIout[4] ) const void Game::MenuInputToGameInput( MenuInput MenuI, PlayerNumber pn, GameInput GameIout[4] ) const
{ {
ASSERT( MenuI.IsValid() ); ASSERT( MenuI != MenuButton_INVALID );
GameIout[0].MakeInvalid(); // initialize GameIout[0].MakeInvalid(); // initialize
GameIout[1].MakeInvalid(); GameIout[1].MakeInvalid();
-3
View File
@@ -191,9 +191,6 @@ void Screen::Input( const InputEventPlus &input )
} }
// default input handler used by most menus // default input handler used by most menus
if( !input.MenuI.IsValid() )
return;
switch( input.MenuI.button ) switch( input.MenuI.button )
{ {
case MENU_BUTTON_UP: this->MenuUp ( input ); return; case MENU_BUTTON_UP: this->MenuUp ( input ); return;
-6
View File
@@ -49,8 +49,6 @@ void ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuEle
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; // don't care return; // don't care
if( input.MenuI.IsValid() )
{
switch( input.MenuI.button ) switch( input.MenuI.button )
{ {
case MENU_BUTTON_BACK: case MENU_BUTTON_BACK:
@@ -85,13 +83,10 @@ void ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuEle
} }
break; break;
} }
}
if( pScreen->IsTransitioning() ) if( pScreen->IsTransitioning() )
return; return;
if( input.MenuI.IsValid() )
{
switch( input.MenuI.button ) switch( input.MenuI.button )
{ {
case MENU_BUTTON_LEFT: case MENU_BUTTON_LEFT:
@@ -99,7 +94,6 @@ void ScreenAttract::AttractInput( const InputEventPlus &input, ScreenWithMenuEle
SCREENMAN->PostMessageToTopScreen( SM_BeginFadingOut, 0 ); SCREENMAN->PostMessageToTopScreen( SM_BeginFadingOut, 0 );
break; break;
} }
}
// Screen::Input( input ); // Screen::Input( input );
} }
-3
View File
@@ -356,8 +356,6 @@ bool ScreenEdit::DeviceToEdit( const DeviceInput &DeviceI, EditButton &button )
/* Given a DeviceInput that was just depressed, return an active edit function. */ /* Given a DeviceInput that was just depressed, return an active edit function. */
bool ScreenEdit::MenuInputToEditButton( const MenuInput &MenuI, EditButton &button ) const bool ScreenEdit::MenuInputToEditButton( const MenuInput &MenuI, EditButton &button ) const
{ {
ASSERT( MenuI.IsValid() );
const MapEditButtonToMenuButton *pCurrentMap = GetCurrentMenuButtonMap(); const MapEditButtonToMenuButton *pCurrentMap = GetCurrentMenuButtonMap();
FOREACH_EditButton(e) FOREACH_EditButton(e)
@@ -1088,7 +1086,6 @@ void ScreenEdit::Input( const InputEventPlus &input )
EditButton EditB; EditButton EditB;
if( !DeviceToEdit( input.DeviceI, EditB ) ) if( !DeviceToEdit( input.DeviceI, EditB ) )
if( input.MenuI.IsValid() )
MenuInputToEditButton( input.MenuI, EditB ); MenuInputToEditButton( input.MenuI, EditB );
+1 -1
View File
@@ -119,7 +119,7 @@ void ScreenEnding::Init()
void ScreenEnding::Input( const InputEventPlus &input ) void ScreenEnding::Input( const InputEventPlus &input )
{ {
if( input.MenuI.IsValid() && !IsTransitioning() ) if( !IsTransitioning() )
{ {
switch( input.MenuI.button ) switch( input.MenuI.button )
{ {
+1 -1
View File
@@ -244,7 +244,7 @@ void ScreenEz2SelectMusic::Input( const InputEventPlus &input )
if( !input.GameI.IsValid() ) return; // don't care 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(); SCREENMAN->PlayStartSound();
m_bGoToOptions = true; m_bGoToOptions = true;
+5 -6
View File
@@ -2064,7 +2064,7 @@ void ScreenGameplay::Input( const InputEventPlus &input )
if( m_bPaused ) if( m_bPaused )
{ {
/* If we're paused, only accept MENU_BUTTON_START to unpause. */ /* 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 ) if( m_PauseController == GAME_CONTROLLER_INVALID || m_PauseController == input.GameI.controller )
this->PauseGame( false ); this->PauseGame( false );
@@ -2072,8 +2072,7 @@ void ScreenGameplay::Input( const InputEventPlus &input )
return; return;
} }
if( input.MenuI.IsValid() && if( m_DancingState != STATE_OUTRO &&
m_DancingState != STATE_OUTRO &&
GAMESTATE->IsHumanPlayer(input.pn) && GAMESTATE->IsHumanPlayer(input.pn) &&
(!GAMESTATE->m_bMultiplayer || input.mp == MultiPlayer_1) && (!GAMESTATE->m_bMultiplayer || input.mp == MultiPlayer_1) &&
!m_Cancel.IsTransitioning() ) !m_Cancel.IsTransitioning() )
@@ -2088,8 +2087,8 @@ void ScreenGameplay::Input( const InputEventPlus &input )
bool bHoldingGiveUp = false; bool bHoldingGiveUp = false;
if( GAMESTATE->m_pCurStyle->GameInputToColumn(input.GameI) == Column_INVALID ) if( GAMESTATE->m_pCurStyle->GameInputToColumn(input.GameI) == Column_INVALID )
{ {
bHoldingGiveUp |= ( START_GIVES_UP && input.MenuI.button == MENU_BUTTON_START ); bHoldingGiveUp |= ( START_GIVES_UP && input.MenuI == MENU_BUTTON_START );
bHoldingGiveUp |= ( BACK_GIVES_UP && input.MenuI.button == MENU_BUTTON_BACK ); bHoldingGiveUp |= ( BACK_GIVES_UP && input.MenuI == MENU_BUTTON_BACK );
} }
if( bHoldingGiveUp ) 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 /* Only handle MENU_BUTTON_BACK as a regular BACK button if BACK_GIVES_UP is
* disabled. */ * 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) || if( ((!PREFSMAN->m_bDelayedBack && input.type==IET_FIRST_PRESS) ||
(input.DeviceI.device==DEVICE_KEYBOARD && input.type==IET_REPEAT) || (input.DeviceI.device==DEVICE_KEYBOARD && input.type==IET_REPEAT) ||
-3
View File
@@ -255,8 +255,6 @@ void ScreenJukebox::Input( const InputEventPlus &input )
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; /* ignore */ return; /* ignore */
if( input.MenuI.IsValid() )
{
switch( input.MenuI.button ) switch( input.MenuI.button )
{ {
case MENU_BUTTON_LEFT: case MENU_BUTTON_LEFT:
@@ -264,7 +262,6 @@ void ScreenJukebox::Input( const InputEventPlus &input )
SCREENMAN->PostMessageToTopScreen( SM_NotesEnded, 0 ); SCREENMAN->PostMessageToTopScreen( SM_NotesEnded, 0 );
return; return;
} }
}
ScreenAttract::AttractInput( input, this ); ScreenAttract::AttractInput( input, this );
} }
+1 -2
View File
@@ -83,7 +83,6 @@ void ScreenPlayerOptions::Input( const InputEventPlus &input )
if( m_bAskOptionsMessage && if( m_bAskOptionsMessage &&
input.type == IET_FIRST_PRESS && input.type == IET_FIRST_PRESS &&
!m_In.IsTransitioning() && !m_In.IsTransitioning() &&
input.MenuI.IsValid() &&
input.MenuI == MENU_BUTTON_START ) input.MenuI == MENU_BUTTON_START )
{ {
if( m_bAcceptedChoices && !m_bGoToOptions ) if( m_bAcceptedChoices && !m_bGoToOptions )
@@ -119,7 +118,7 @@ void ScreenPlayerOptions::Input( const InputEventPlus &input )
ScreenOptionsMaster::Input( input ); ScreenOptionsMaster::Input( input );
// UGLY: Update m_Disqualified whenever Start is pressed // 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]; int row = m_iCurrentRow[pn];
UpdateDisqualified( row, pn ); UpdateDisqualified( row, pn );
-1
View File
@@ -291,7 +291,6 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
// Check for "Press START again for options" button press // Check for "Press START again for options" button press
if( m_bMadeChoice && if( m_bMadeChoice &&
input.MenuI.IsValid() &&
input.MenuI.button == MENU_BUTTON_START && input.MenuI.button == MENU_BUTTON_START &&
input.type != IET_RELEASE && input.type != IET_RELEASE &&
OPTIONS_MENU_AVAILABLE.GetValue() ) OPTIONS_MENU_AVAILABLE.GetValue() )