InputMapper::IsButtonDown -> IsBeingPressed, to match InputFilter::IsBeingPressed

This commit is contained in:
Glenn Maynard
2006-09-08 02:12:30 +00:00
parent 18b047fd94
commit ec3b9382d2
10 changed files with 33 additions and 30 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ bool CodeItem::EnteredCode( GameController controller ) const
for( unsigned i=0; i<buttons.size()-1; i++ )
{
GameInput gi( controller, buttons[i] );
if( !INPUTMAPPER->IsButtonDown(gi) )
if( !INPUTMAPPER->IsBeingPressed(gi) )
return false;
}
// just pressed the last button
+5 -5
View File
@@ -802,7 +802,7 @@ void InputMapper::MenuToGame( const MenuInput &MenuI, GameInput GameIout[4] )
}
bool InputMapper::IsButtonDown( const GameInput &GameI, MultiPlayer mp )
bool InputMapper::IsBeingPressed( const GameInput &GameI, MultiPlayer mp )
{
for( int i=0; i<NUM_GAME_TO_DEVICE_SLOTS; i++ )
{
@@ -820,22 +820,22 @@ bool InputMapper::IsButtonDown( const GameInput &GameI, MultiPlayer mp )
return false;
}
bool InputMapper::IsButtonDown( const MenuInput &MenuI )
bool InputMapper::IsBeingPressed( const MenuInput &MenuI )
{
GameInput GameI[4];
MenuToGame( MenuI, GameI );
for( int i=0; i<4; i++ )
if( GameI[i].IsValid() && IsButtonDown(GameI[i]) )
if( GameI[i].IsValid() && IsBeingPressed(GameI[i]) )
return true;
return false;
}
bool InputMapper::IsButtonDown( const StyleInput &StyleI, MultiPlayer mp )
bool InputMapper::IsBeingPressed( const StyleInput &StyleI, MultiPlayer mp )
{
GameInput GameI;
StyleToGame( StyleI, GameI );
return IsButtonDown( GameI, mp );
return IsBeingPressed( GameI, mp );
}
+6 -3
View File
@@ -13,6 +13,9 @@ const int NUM_GAME_TO_DEVICE_SLOTS = 5; // five device inputs may map to one gam
const int NUM_SHOWN_GAME_TO_DEVICE_SLOTS = 3;
const int NUM_USER_GAME_TO_DEVICE_SLOTS = 2;
// transition:
#define IsButtonDown IsBeingPressed
class InputMapper
{
public:
@@ -48,9 +51,9 @@ public:
float GetSecsHeld( const MenuInput &MenuI );
float GetSecsHeld( const StyleInput &StyleI, MultiPlayer mp = MultiPlayer_INVALID );
bool IsButtonDown( const GameInput &GameI, MultiPlayer mp = MultiPlayer_INVALID );
bool IsButtonDown( const MenuInput &MenuI );
bool IsButtonDown( const StyleInput &StyleI, MultiPlayer mp = MultiPlayer_INVALID );
bool IsBeingPressed( const GameInput &GameI, MultiPlayer mp = MultiPlayer_INVALID );
bool IsBeingPressed( const MenuInput &MenuI );
bool IsBeingPressed( const StyleInput &StyleI, MultiPlayer mp = MultiPlayer_INVALID );
void ResetKeyRepeat( const GameInput &GameI );
void ResetKeyRepeat( const MenuInput &MenuI );
+1 -1
View File
@@ -356,7 +356,7 @@ void LightsManager::Update( float fDeltaTime )
FOREACH_GameButton( gb )
{
bool bOn = INPUTMAPPER->IsButtonDown( GameInput(gc,gb) );
bool bOn = INPUTMAPPER->IsBeingPressed( GameInput(gc,gb) );
m_LightsState.m_bGameButtonLights[gc][gb] = bOn;
}
}
+3 -3
View File
@@ -544,7 +544,7 @@ void Player::Update( float fDeltaTime )
PlayerNumber pn = m_pPlayerState->m_PlayerNumber;
const StyleInput StyleI( pn, col );
bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( StyleI );
bool bIsHoldingButton = INPUTMAPPER->IsBeingPressed( StyleI );
// TODO: Make this work for non-human-controlled players
if( bIsHoldingButton && !GAMESTATE->m_bDemonstrationOrJukebox && m_pPlayerState->m_PlayerController==PC_HUMAN )
if( m_pNoteField )
@@ -622,7 +622,7 @@ void Player::Update( float fDeltaTime )
else
{
const StyleInput StyleI( pn, iTrack );
bIsHoldingButton = INPUTMAPPER->IsButtonDown( StyleI, m_pPlayerState->m_mp );
bIsHoldingButton = INPUTMAPPER->IsBeingPressed( StyleI, m_pPlayerState->m_mp );
}
int iEndRow = iRow + tn.iDuration;
@@ -1501,7 +1501,7 @@ void Player::CrossedMineRow( int iNoteRow, const RageTimer &now )
}
else
{
bool bIsDown = INPUTMAPPER->IsButtonDown( StyleI, m_pPlayerState->m_mp );
bool bIsDown = INPUTMAPPER->IsBeingPressed( StyleI, m_pPlayerState->m_mp );
if( bIsDown )
Step( t, iNoteRow, now, true, false );
}
+1 -1
View File
@@ -935,7 +935,7 @@ void ScreenEdit::Update( float fDeltaTime )
for( int t=0; t<GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer; t++ ) // for each track
{
StyleInput StyleI( PLAYER_1, t );
if( INPUTMAPPER->IsButtonDown(StyleI) )
if( INPUTMAPPER->IsBeingPressed(StyleI) )
bButtonIsBeingPressed = true;
}
+4 -4
View File
@@ -321,8 +321,8 @@ done:
void ScreenNetSelectMusic::MenuLeft( PlayerNumber pn )
{
bool bLeftPressed = INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_LEFT) );
bool bRightPressed = INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_RIGHT) );
bool bLeftPressed = INPUTMAPPER->IsBeingPressed( MenuInput(pn, MENU_BUTTON_LEFT) );
bool bRightPressed = INPUTMAPPER->IsBeingPressed( MenuInput(pn, MENU_BUTTON_RIGHT) );
bool bLeftAndRightPressed = bLeftPressed && bRightPressed;
if ( bLeftAndRightPressed )
@@ -333,8 +333,8 @@ void ScreenNetSelectMusic::MenuLeft( PlayerNumber pn )
void ScreenNetSelectMusic::MenuRight( PlayerNumber pn )
{
bool bLeftPressed = INPUTMAPPER->IsButtonDown( MenuInput (pn, MENU_BUTTON_LEFT) );
bool bRightPressed = INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_RIGHT) ) ;
bool bLeftPressed = INPUTMAPPER->IsBeingPressed( MenuInput (pn, MENU_BUTTON_LEFT) );
bool bRightPressed = INPUTMAPPER->IsBeingPressed( MenuInput(pn, MENU_BUTTON_RIGHT) ) ;
bool bLeftAndRightPressed = bLeftPressed && bRightPressed;
if ( bLeftAndRightPressed )
+6 -6
View File
@@ -794,8 +794,8 @@ void ScreenOptions::MenuStart( const InputEventPlus &input )
case NAV_TOGGLE_THREE_KEY:
{
bool bHoldingLeftAndRight =
INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_RIGHT) ) &&
INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_LEFT) );
INPUTMAPPER->IsBeingPressed( MenuInput(pn, MENU_BUTTON_RIGHT) ) &&
INPUTMAPPER->IsBeingPressed( MenuInput(pn, MENU_BUTTON_LEFT) );
if( bHoldingLeftAndRight )
{
if( MoveRowRelative(pn, -1, input.type != IET_FIRST_PRESS) )
@@ -1223,14 +1223,14 @@ void ScreenOptions::MenuUpDown( const InputEventPlus &input, int iDir )
* holding both up and down from toggling repeatedly in-place. */
if( iDir == +1 )
{
if( INPUTMAPPER->IsButtonDown(MenuInput(pn, MENU_BUTTON_UP)) ||
INPUTMAPPER->IsButtonDown(MenuInput(pn, MENU_BUTTON_SELECT)) )
if( INPUTMAPPER->IsBeingPressed(MenuInput(pn, MENU_BUTTON_UP)) ||
INPUTMAPPER->IsBeingPressed(MenuInput(pn, MENU_BUTTON_SELECT)) )
return;
}
else
{
if( INPUTMAPPER->IsButtonDown(MenuInput(pn, MENU_BUTTON_DOWN)) ||
INPUTMAPPER->IsButtonDown(MenuInput(pn, MENU_BUTTON_START)) )
if( INPUTMAPPER->IsBeingPressed(MenuInput(pn, MENU_BUTTON_DOWN)) ||
INPUTMAPPER->IsBeingPressed(MenuInput(pn, MENU_BUTTON_START)) )
return;
}
}
+4 -4
View File
@@ -339,7 +339,7 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
return;
}
if( SELECT_MENU_AVAILABLE && INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_SELECT) ) )
if( SELECT_MENU_AVAILABLE && INPUTMAPPER->IsBeingPressed( MenuInput(pn, MENU_BUTTON_SELECT) ) )
{
if( input.type == IET_FIRST_PRESS )
{
@@ -375,8 +375,8 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
bool bRightIsDown = false;
FOREACH_EnabledPlayer( p )
{
bLeftIsDown |= INPUTMAPPER->IsButtonDown( MenuInput(p, MENU_BUTTON_LEFT) );
bRightIsDown |= INPUTMAPPER->IsButtonDown( MenuInput(p, MENU_BUTTON_RIGHT) );
bLeftIsDown |= INPUTMAPPER->IsBeingPressed( MenuInput(p, MENU_BUTTON_LEFT) );
bRightIsDown |= INPUTMAPPER->IsBeingPressed( MenuInput(p, MENU_BUTTON_RIGHT) );
}
bool bBothDown = bLeftIsDown && bRightIsDown;
@@ -512,7 +512,7 @@ void ScreenSelectMusic::UpdateSelectButton()
{
bool bSelectIsDown = false;
FOREACH_EnabledPlayer( p )
bSelectIsDown |= INPUTMAPPER->IsButtonDown( MenuInput(p, MENU_BUTTON_SELECT) );
bSelectIsDown |= INPUTMAPPER->IsBeingPressed( MenuInput(p, MENU_BUTTON_SELECT) );
if( !SELECT_MENU_AVAILABLE )
bSelectIsDown = false;
+2 -2
View File
@@ -184,8 +184,8 @@ void ScreenSetTime::MenuRight( PlayerNumber pn )
void ScreenSetTime::MenuStart( PlayerNumber pn )
{
bool bHoldingLeftAndRight =
INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_RIGHT) ) &&
INPUTMAPPER->IsButtonDown( MenuInput(pn, MENU_BUTTON_LEFT) );
INPUTMAPPER->IsBeingPressed( MenuInput(pn, MENU_BUTTON_RIGHT) ) &&
INPUTMAPPER->IsBeingPressed( MenuInput(pn, MENU_BUTTON_LEFT) );
if( bHoldingLeftAndRight )
ChangeSelection( -1 );