From 261849d895e81210bbc53413e5453f3045cad84d Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 30 Sep 2006 03:08:18 +0000 Subject: [PATCH] move "merged input" test into InputMapper; this moves the GAMESTATE dependency out of Game (doesn't belong in InputMapper either, working on it ...) --- stepmania/src/Game.cpp | 34 ++++++++++------------------------ stepmania/src/InputMapper.cpp | 6 ++++++ 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/stepmania/src/Game.cpp b/stepmania/src/Game.cpp index 9dc1f95d86..51ce8e59aa 100644 --- a/stepmania/src/Game.cpp +++ b/stepmania/src/Game.cpp @@ -2,8 +2,6 @@ #include "Game.h" #include "RageLog.h" #include "RageUtil.h" -#include "Style.h" -#include "GameState.h" #include "PrefsManager.h" int Game::GetNumGameplayButtons() const @@ -47,33 +45,21 @@ void Game::MenuButtonToGameInputs( MenuButton MenuI, PlayerNumber pn, GameInput GameIout[2].MakeInvalid(); GameIout[3].MakeInvalid(); - GameController controller[2]; - StyleType type = TWO_PLAYERS_TWO_SIDES; - if( GAMESTATE->GetCurrentStyle() ) - type = GAMESTATE->GetCurrentStyle()->m_StyleType; - - int iNumSidesUsing = 1; - switch( type ) + vector controller; + if( pn == PLAYER_INVALID ) { - case ONE_PLAYER_ONE_SIDE: - case TWO_PLAYERS_TWO_SIDES: - case TWO_PLAYERS_SHARED_SIDES: - controller[0] = (GameController)pn; - iNumSidesUsing = 1; - break; - case ONE_PLAYER_TWO_SIDES: - controller[0] = GAME_CONTROLLER_1; - controller[1] = GAME_CONTROLLER_2; - iNumSidesUsing = 2; - break; - default: - ASSERT(0); // invalid m_StyleType - }; + controller.push_back( GAME_CONTROLLER_1 ); + controller.push_back( GAME_CONTROLLER_2 ); + } + else + { + controller.push_back( (GameController)pn ); + } GameButton button[2] = { m_DedicatedMenuButton[MenuI], m_SecondaryMenuButton[MenuI] }; int iNumButtonsUsing = PREFSMAN->m_bOnlyDedicatedMenuButtons ? 1 : 2; - for( int i=0; iGetCurrentStyle() ) + { + if( GAMESTATE->GetCurrentStyle()->m_StyleType == ONE_PLAYER_TWO_SIDES ) + pn = PLAYER_INVALID; + } + const Game* pGame = GAMESTATE->GetCurrentGame(); pGame->MenuButtonToGameInputs( MenuI, pn, GameIout ); }