support MultiPlayer inputs

This commit is contained in:
Glenn Maynard
2006-07-01 02:16:38 +00:00
parent 6280cf2356
commit 94780b3fad
2 changed files with 18 additions and 11 deletions
+14 -7
View File
@@ -784,15 +784,19 @@ void InputMapper::MenuToGame( const MenuInput &MenuI, GameInput GameIout[4] )
} }
bool InputMapper::IsButtonDown( const GameInput &GameI ) bool InputMapper::IsButtonDown( const GameInput &GameI, MultiPlayer mp )
{ {
for( int i=0; i<NUM_GAME_TO_DEVICE_SLOTS; i++ ) for( int i=0; i<NUM_GAME_TO_DEVICE_SLOTS; i++ )
{ {
DeviceInput DeviceI; DeviceInput DeviceI;
if( GameToDevice( GameI, i, DeviceI ) ) if( GameToDevice( GameI, i, DeviceI ) )
{
if( mp != MultiPlayer_INVALID )
DeviceI.device = MultiPlayerToInputDevice(mp);
if( INPUTFILTER->IsBeingPressed( DeviceI ) ) if( INPUTFILTER->IsBeingPressed( DeviceI ) )
return true; return true;
}
} }
return false; return false;
@@ -809,24 +813,27 @@ bool InputMapper::IsButtonDown( const MenuInput &MenuI )
return false; return false;
} }
bool InputMapper::IsButtonDown( const StyleInput &StyleI ) bool InputMapper::IsButtonDown( const StyleInput &StyleI, MultiPlayer mp )
{ {
GameInput GameI; GameInput GameI;
StyleToGame( StyleI, GameI ); StyleToGame( StyleI, GameI );
return IsButtonDown( GameI ); return IsButtonDown( GameI, mp );
} }
float InputMapper::GetSecsHeld( const GameInput &GameI ) float InputMapper::GetSecsHeld( const GameInput &GameI, MultiPlayer mp )
{ {
float fMaxSecsHeld = 0; float fMaxSecsHeld = 0;
for( int i=0; i<NUM_GAME_TO_DEVICE_SLOTS; i++ ) for( int i=0; i<NUM_GAME_TO_DEVICE_SLOTS; i++ )
{ {
DeviceInput DeviceI; DeviceInput DeviceI;
if( GameToDevice( GameI, i, DeviceI ) ) if( GameToDevice( GameI, i, DeviceI ) )
{
if( mp != MultiPlayer_INVALID )
DeviceI.device = MultiPlayerToInputDevice(mp);
fMaxSecsHeld = max( fMaxSecsHeld, INPUTFILTER->GetSecsHeld(DeviceI) ); fMaxSecsHeld = max( fMaxSecsHeld, INPUTFILTER->GetSecsHeld(DeviceI) );
}
} }
return fMaxSecsHeld; return fMaxSecsHeld;
@@ -845,11 +852,11 @@ float InputMapper::GetSecsHeld( const MenuInput &MenuI )
return fMaxSecsHeld; return fMaxSecsHeld;
} }
float InputMapper::GetSecsHeld( const StyleInput &StyleI ) float InputMapper::GetSecsHeld( const StyleInput &StyleI, MultiPlayer mp )
{ {
GameInput GameI; GameInput GameI;
StyleToGame( StyleI, GameI ); StyleToGame( StyleI, GameI );
return GetSecsHeld( GameI ); return GetSecsHeld( GameI, mp );
} }
void InputMapper::ResetKeyRepeat( const GameInput &GameI ) void InputMapper::ResetKeyRepeat( const GameInput &GameI )
+4 -4
View File
@@ -44,13 +44,13 @@ public:
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, GameInput GameIout[4] );
float GetSecsHeld( const GameInput &GameI ); float GetSecsHeld( const GameInput &GameI, MultiPlayer mp = MultiPlayer_INVALID );
float GetSecsHeld( const MenuInput &MenuI ); float GetSecsHeld( const MenuInput &MenuI );
float GetSecsHeld( const StyleInput &StyleI ); float GetSecsHeld( const StyleInput &StyleI, MultiPlayer mp = MultiPlayer_INVALID );
bool IsButtonDown( const GameInput &GameI ); bool IsButtonDown( const GameInput &GameI, MultiPlayer mp = MultiPlayer_INVALID );
bool IsButtonDown( const MenuInput &MenuI ); bool IsButtonDown( const MenuInput &MenuI );
bool IsButtonDown( const StyleInput &StyleI ); bool IsButtonDown( const StyleInput &StyleI, MultiPlayer mp = MultiPlayer_INVALID );
void ResetKeyRepeat( const GameInput &GameI ); void ResetKeyRepeat( const GameInput &GameI );
void ResetKeyRepeat( const MenuInput &MenuI ); void ResetKeyRepeat( const MenuInput &MenuI );