GameInputToMenuInput -> GameInputToMenuButton; one less place Game.cpp

depends on GameState
This commit is contained in:
Glenn Maynard
2006-09-14 03:48:35 +00:00
parent 2c3ea735a8
commit a07987de8d
2 changed files with 8 additions and 12 deletions
+6 -10
View File
@@ -22,27 +22,23 @@ GameButton Game::ButtonNameToIndex( const RString &sButtonName ) const
return GAME_BUTTON_INVALID; return GAME_BUTTON_INVALID;
} }
MenuInput Game::GameInputToMenuInput( GameInput GameI ) const MenuButton Game::GameInputToMenuButton( GameInput GameI ) const
{ {
PlayerNumber pn = (PlayerNumber) GameI.controller;
if( GAMESTATE->GetCurrentStyle() )
pn = GAMESTATE->GetCurrentStyle()->ControllerToPlayerNumber(GameI.controller);
FOREACH_MenuButton(i) FOREACH_MenuButton(i)
if( m_DedicatedMenuButton[i] == GameI.button ) if( m_DedicatedMenuButton[i] == GameI.button )
return MenuInput( pn, i ); return i;
if( !PREFSMAN->m_bOnlyDedicatedMenuButtons ) if( !PREFSMAN->m_bOnlyDedicatedMenuButtons )
{ {
FOREACH_MenuButton(i) FOREACH_MenuButton(i)
if( m_SecondaryMenuButton[i] == GameI.button ) if( m_SecondaryMenuButton[i] == GameI.button )
return MenuInput( pn, i ); return i;
} }
return MenuInput(); // invalid GameInput return MenuButton_INVALID; // invalid GameInput
} }
void Game::MenuInputToGameInput( MenuInput MenuI, GameInput GameIout[4] ) const void Game::MenuInputToGameInput( MenuInput MenuI, PlayerNumber pn, GameInput GameIout[4] ) const
{ {
ASSERT( MenuI.IsValid() ); ASSERT( MenuI.IsValid() );
@@ -61,7 +57,7 @@ void Game::MenuInputToGameInput( MenuInput MenuI, GameInput GameIout[4] ) const
{ {
case ONE_PLAYER_ONE_SIDE: case ONE_PLAYER_ONE_SIDE:
case TWO_PLAYERS_TWO_SIDES: case TWO_PLAYERS_TWO_SIDES:
controller[0] = (GameController)MenuI.player; controller[0] = (GameController)pn;
iNumSidesUsing = 1; iNumSidesUsing = 1;
break; break;
case ONE_PLAYER_TWO_SIDES: case ONE_PLAYER_TWO_SIDES:
+2 -2
View File
@@ -51,8 +51,8 @@ public:
DeviceButton m_iDefaultKeyboardKey[MAX_GAME_CONTROLLERS][MAX_GAME_BUTTONS]; // default keyboard keys only have an effect the current game is this game DeviceButton m_iDefaultKeyboardKey[MAX_GAME_CONTROLLERS][MAX_GAME_BUTTONS]; // default keyboard keys only have an effect the current game is this game
GameButton ButtonNameToIndex( const RString &sButtonName ) const; GameButton ButtonNameToIndex( const RString &sButtonName ) const;
MenuInput GameInputToMenuInput( GameInput GameI ) const; // looks up current style in GAMESTATE. Yuck. MenuButton GameInputToMenuButton( GameInput GameI ) const;
void MenuInputToGameInput( MenuInput MenuI, GameInput GameIout[4] ) const; // looks up current style in GAMESTATE. Yuck. void MenuInputToGameInput( MenuInput MenuI, PlayerNumber pn, GameInput GameIout[4] ) const; // looks up current style in GAMESTATE. Yuck.
RString ColToButtonName( int col ) const; // looks up current style. Yuck. RString ColToButtonName( int col ) const; // looks up current style. Yuck.
TapNoteScore MapTapNoteScore( TapNoteScore tns ) const; TapNoteScore MapTapNoteScore( TapNoteScore tns ) const;