transitional: accept pn arg to MenuInput helpers

This commit is contained in:
Glenn Maynard
2006-09-14 03:34:52 +00:00
parent 754f2edb0f
commit 0244e48eca
2 changed files with 14 additions and 12 deletions
+10 -8
View File
@@ -775,10 +775,12 @@ void InputMapper::GameToMenu( const GameInput &GameI, MenuInput &MenuI )
MenuI = pGame->GameInputToMenuInput( GameI ); 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(); 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; return false;
} }
bool InputMapper::IsBeingPressed( const MenuInput &MenuI ) bool InputMapper::IsBeingPressed( const MenuInput &MenuI, PlayerNumber pn )
{ {
GameInput GameI[4]; GameInput GameI[4];
MenuToGame( MenuI, GameI ); MenuToGame( MenuI, pn, GameI );
for( int i=0; i<4; i++ ) for( int i=0; i<4; i++ )
if( GameI[i].IsValid() && IsBeingPressed(GameI[i]) ) if( GameI[i].IsValid() && IsBeingPressed(GameI[i]) )
return true; return true;
@@ -829,12 +831,12 @@ float InputMapper::GetSecsHeld( const GameInput &GameI, MultiPlayer mp )
return fMaxSecsHeld; return fMaxSecsHeld;
} }
float InputMapper::GetSecsHeld( const MenuInput &MenuI ) float InputMapper::GetSecsHeld( const MenuInput &MenuI, PlayerNumber pn )
{ {
float fMaxSecsHeld = 0; float fMaxSecsHeld = 0;
GameInput GameI[4]; GameInput GameI[4];
MenuToGame( MenuI, GameI ); MenuToGame( MenuI, pn, GameI );
for( int i=0; i<4; i++ ) for( int i=0; i<4; i++ )
if( GameI[i].IsValid() ) if( GameI[i].IsValid() )
fMaxSecsHeld = max( fMaxSecsHeld, GetSecsHeld(GameI[i]) ); 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]; GameInput GameI[4];
MenuToGame( MenuI, GameI ); MenuToGame( MenuI, pn, GameI );
for( int i=0; i<4; i++ ) for( int i=0; i<4; i++ )
if( GameI[i].IsValid() ) if( GameI[i].IsValid() )
ResetKeyRepeat( GameI[i] ); ResetKeyRepeat( GameI[i] );
+4 -4
View File
@@ -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 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 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 ); PlayerNumber ControllerToPlayerNumber( GameController controller );
float GetSecsHeld( const GameInput &GameI, MultiPlayer mp = MultiPlayer_INVALID ); 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 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 GameInput &GameI );
void ResetKeyRepeat( const MenuInput &MenuI ); void ResetKeyRepeat( const MenuInput &MenuI, PlayerNumber pn = PLAYER_INVALID );
struct Mapping struct Mapping
{ {