move "merged input" test into InputMapper; this moves the GAMESTATE

dependency out of Game (doesn't belong in InputMapper either, working on
it ...)
This commit is contained in:
Glenn Maynard
2006-09-30 03:08:18 +00:00
parent 5e99a1c9e9
commit 261849d895
2 changed files with 16 additions and 24 deletions
+10 -24
View File
@@ -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<GameController> 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; i<iNumSidesUsing; i++ )
for( size_t i=0; i<controller.size(); i++ )
{
for( int j=0; j<iNumButtonsUsing; j++ )
{
+6
View File
@@ -777,6 +777,12 @@ MenuButton InputMapper::GameToMenu( const GameInput &GameI )
void InputMapper::MenuToGame( MenuButton MenuI, PlayerNumber pn, GameInput GameIout[4] )
{
if( GAMESTATE->GetCurrentStyle() )
{
if( GAMESTATE->GetCurrentStyle()->m_StyleType == ONE_PLAYER_TWO_SIDES )
pn = PLAYER_INVALID;
}
const Game* pGame = GAMESTATE->GetCurrentGame();
pGame->MenuButtonToGameInputs( MenuI, pn, GameIout );
}