From d5857acb3ae517708d3524ac2687a1d8fbbb25b7 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 13 Sep 2006 09:57:07 +0000 Subject: [PATCH] A problem with removing StyleI.player: an obscure difference between StyleI.player and MenuI.player is that StyleI is set even if there's no attached MenuButton, and MenuI.player is set even if there's no attached column. That's an odd distinction, anyway. Move input.MenuI.player to input.pn. This also puts it in the same place as input.mp. --- stepmania/src/InputEventPlus.h | 1 + stepmania/src/InputMapper.cpp | 8 ++++++++ stepmania/src/InputMapper.h | 1 + stepmania/src/StepMania.cpp | 3 +++ 4 files changed, 13 insertions(+) diff --git a/stepmania/src/InputEventPlus.h b/stepmania/src/InputEventPlus.h index b33c3949d0..8c2d89ad9b 100644 --- a/stepmania/src/InputEventPlus.h +++ b/stepmania/src/InputEventPlus.h @@ -15,6 +15,7 @@ public: InputEventType type; GameInput GameI; MenuInput MenuI; + PlayerNumber pn; MultiPlayer mp; DeviceInputList InputList; }; diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index 447f740f3b..46b1cd9e66 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -761,6 +761,14 @@ bool InputMapper::GameToDevice( const GameInput &GameI, int iSlotNum, DeviceInpu return DeviceI.device != DEVICE_NONE; } +PlayerNumber InputMapper::ControllerToPlayerNumber( GameController controller ) +{ + if( GAMESTATE->GetCurrentStyle() ) + return GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber(controller); + else + return (PlayerNumber) controller; +} + void InputMapper::GameToMenu( const GameInput &GameI, MenuInput &MenuI ) { const Game* pGame = GAMESTATE->GetCurrentGame(); diff --git a/stepmania/src/InputMapper.h b/stepmania/src/InputMapper.h index d7b0bd8b3d..fe4275707e 100644 --- a/stepmania/src/InputMapper.h +++ b/stepmania/src/InputMapper.h @@ -38,6 +38,7 @@ public: void GameToMenu( const GameInput &GameI, MenuInput &MenuI ); void MenuToGame( const MenuInput &MenuI, GameInput GameIout[4] ); + PlayerNumber ControllerToPlayerNumber( GameController controller ); float GetSecsHeld( const GameInput &GameI, MultiPlayer mp = MultiPlayer_INVALID ); float GetSecsHeld( const MenuInput &MenuI ); diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 00e1def6ed..2c9ef25510 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -1433,7 +1433,10 @@ void HandleInputEvents(float fDeltaTime) } if( input.GameI.IsValid() ) + { INPUTMAPPER->GameToMenu( input.GameI, input.MenuI ); + input.pn = INPUTMAPPER->ControllerToPlayerNumber( input.GameI.controller ); + } if( HandleGlobalInputs(input) ) continue; // skip