From 0244e48ecac787cd4bcfd7905f0e188f1a1f4565 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 14 Sep 2006 03:34:52 +0000 Subject: [PATCH] transitional: accept pn arg to MenuInput helpers --- stepmania/src/InputMapper.cpp | 18 ++++++++++-------- stepmania/src/InputMapper.h | 8 ++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index 46b1cd9e66..2a7d5b2203 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -775,10 +775,12 @@ void InputMapper::GameToMenu( const GameInput &GameI, MenuInput &MenuI ) MenuI = pGame->GameInputToMenuInput( GameI ); } -void InputMapper::MenuToGame( const MenuInput &MenuI, GameInput GameIout[4] ) +void InputMapper::MenuToGame( const MenuInput &MenuI, PlayerNumber pn, GameInput GameIout[4] ) { const Game* pGame = GAMESTATE->GetCurrentGame(); - pGame->MenuInputToGameInput( MenuI, GameIout ); + if( pn == PLAYER_INVALID ) + pn = MenuI.button; + pGame->MenuInputToGameInput( MenuI, pn, GameIout ); } @@ -800,10 +802,10 @@ bool InputMapper::IsBeingPressed( const GameInput &GameI, MultiPlayer mp, const return false; } -bool InputMapper::IsBeingPressed( const MenuInput &MenuI ) +bool InputMapper::IsBeingPressed( const MenuInput &MenuI, PlayerNumber pn ) { GameInput GameI[4]; - MenuToGame( MenuI, GameI ); + MenuToGame( MenuI, pn, GameI ); for( int i=0; i<4; i++ ) if( GameI[i].IsValid() && IsBeingPressed(GameI[i]) ) return true; @@ -829,12 +831,12 @@ float InputMapper::GetSecsHeld( const GameInput &GameI, MultiPlayer mp ) return fMaxSecsHeld; } -float InputMapper::GetSecsHeld( const MenuInput &MenuI ) +float InputMapper::GetSecsHeld( const MenuInput &MenuI, PlayerNumber pn ) { float fMaxSecsHeld = 0; GameInput GameI[4]; - MenuToGame( MenuI, GameI ); + MenuToGame( MenuI, pn, GameI ); for( int i=0; i<4; i++ ) if( GameI[i].IsValid() ) fMaxSecsHeld = max( fMaxSecsHeld, GetSecsHeld(GameI[i]) ); @@ -852,10 +854,10 @@ void InputMapper::ResetKeyRepeat( const GameInput &GameI ) } } -void InputMapper::ResetKeyRepeat( const MenuInput &MenuI ) +void InputMapper::ResetKeyRepeat( const MenuInput &MenuI, PlayerNumber pn ) { GameInput GameI[4]; - MenuToGame( MenuI, GameI ); + MenuToGame( MenuI, pn, GameI ); for( int i=0; i<4; i++ ) if( GameI[i].IsValid() ) ResetKeyRepeat( GameI[i] ); diff --git a/stepmania/src/InputMapper.h b/stepmania/src/InputMapper.h index fe4275707e..b0fef936fa 100644 --- a/stepmania/src/InputMapper.h +++ b/stepmania/src/InputMapper.h @@ -37,17 +37,17 @@ public: bool GameToDevice( const GameInput &GameI, int iSlotNum, DeviceInput& DeviceI ); // return true if there is a mapping from pad to device void GameToMenu( const GameInput &GameI, MenuInput &MenuI ); - void MenuToGame( const MenuInput &MenuI, GameInput GameIout[4] ); + void MenuToGame( const MenuInput &MenuI, PlayerNumber pn, GameInput GameIout[4] ); PlayerNumber ControllerToPlayerNumber( GameController controller ); float GetSecsHeld( const GameInput &GameI, MultiPlayer mp = MultiPlayer_INVALID ); - float GetSecsHeld( const MenuInput &MenuI ); + float GetSecsHeld( const MenuInput &MenuI, PlayerNumber pn = PLAYER_INVALID ); bool IsBeingPressed( const GameInput &GameI, MultiPlayer mp = MultiPlayer_INVALID, const DeviceInputList *pButtonState = NULL ); - bool IsBeingPressed( const MenuInput &MenuI ); + bool IsBeingPressed( const MenuInput &MenuI, PlayerNumber pn = PLAYER_INVALID ); void ResetKeyRepeat( const GameInput &GameI ); - void ResetKeyRepeat( const MenuInput &MenuI ); + void ResetKeyRepeat( const MenuInput &MenuI, PlayerNumber pn = PLAYER_INVALID ); struct Mapping {