From e4d0b41da19c5f41520934fc19c8808c94d0ddb1 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 13 Sep 2006 01:29:33 +0000 Subject: [PATCH] Stop using Input.StyleI. Just convert it when needed; the vast majority of screens don't. --- stepmania/src/ScreenEdit.cpp | 10 ++++++---- stepmania/src/ScreenGameplay.cpp | 16 ++++++++++------ stepmania/src/ScreenNameEntry.cpp | 9 +++++---- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 45169ade5e..da6a8c8f7f 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -1921,7 +1921,7 @@ void ScreenEdit::InputRecord( const InputEventPlus &input, EditButton EditB ) if( input.MenuI.player != PLAYER_1 ) return; // ignore - const int iCol = input.StyleI; + const int iCol = GAMESTATE->m_pCurStyle->GameInputToStyleInput( input.GameI ); switch( input.type ) { @@ -2077,17 +2077,19 @@ void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB ) return; } - if( PREFSMAN->m_AutoPlay != PC_HUMAN || input.StyleI == -1 ) + const int iCol = GAMESTATE->m_pCurStyle->GameInputToStyleInput( input.GameI ); + + if( PREFSMAN->m_AutoPlay != PC_HUMAN || iCol == -1 ) return; switch( input.MenuI.player ) { case PLAYER_1: - m_Player->Step( input.StyleI, -1, input.DeviceI.ts, false, input.type == IET_RELEASE ); + m_Player->Step( iCol, -1, input.DeviceI.ts, false, input.type == IET_RELEASE ); break; case PLAYER_2: if( GAMESTATE->GetCurrentStyle()->m_StyleType == TWO_PLAYERS_SHARED_SIDES ) - m_Player->Step( input.StyleI, -1, input.DeviceI.ts, false, input.type == IET_RELEASE ); + m_Player->Step( iCol, -1, input.DeviceI.ts, false, input.type == IET_RELEASE ); } } diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 0ca2638d5f..34eae1827a 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -2086,8 +2086,11 @@ void ScreenGameplay::Input( const InputEventPlus &input ) * However, if this is also a style button, don't do this. (pump center = start) */ bool bHoldingGiveUp = false; - bHoldingGiveUp |= ( START_GIVES_UP && input.MenuI.button == MENU_BUTTON_START && input.StyleI == StyleInput_INVALID ); - bHoldingGiveUp |= ( BACK_GIVES_UP && input.MenuI.button == MENU_BUTTON_BACK && input.StyleI == StyleInput_INVALID ); + if( GAMESTATE->m_pCurStyle->GameInputToStyleInput(input.GameI) == StyleInput_INVALID ) + { + bHoldingGiveUp |= ( START_GIVES_UP && input.MenuI.button == MENU_BUTTON_START ); + bHoldingGiveUp |= ( BACK_GIVES_UP && input.MenuI.button == MENU_BUTTON_BACK ); + } if( bHoldingGiveUp ) { @@ -2142,15 +2145,16 @@ void ScreenGameplay::Input( const InputEventPlus &input ) } bool bRelease = input.type == IET_RELEASE; + const int iCol = GAMESTATE->m_pCurStyle->GameInputToStyleInput( input.GameI ); if( GAMESTATE->m_bMultiplayer ) { if( input.mp != MultiPlayer_INVALID && input.type==IET_FIRST_PRESS && - input.StyleI != StyleInput_INVALID && + iCol != StyleInput_INVALID && GAMESTATE->IsMultiPlayerEnabled(input.mp) ) { - m_vPlayerInfo[input.mp].m_pPlayer->Step( input.StyleI, -1, input.DeviceI.ts, false, bRelease ); + m_vPlayerInfo[input.mp].m_pPlayer->Step( iCol, -1, input.DeviceI.ts, false, bRelease ); } } else @@ -2159,7 +2163,7 @@ void ScreenGameplay::Input( const InputEventPlus &input ) // handle a step or battle item activate // if( input.type==IET_FIRST_PRESS && - input.StyleI != StyleInput_INVALID && + iCol != StyleInput_INVALID && GAMESTATE->IsHumanPlayer( input.MenuI.player ) ) { AbortGiveUp( true ); @@ -2167,7 +2171,7 @@ void ScreenGameplay::Input( const InputEventPlus &input ) if( PREFSMAN->m_AutoPlay == PC_HUMAN ) { PlayerInfo& pi = GetPlayerInfoForInput( input ); - pi.m_pPlayer->Step( input.StyleI, -1, input.DeviceI.ts, false, bRelease ); + pi.m_pPlayer->Step( iCol, -1, input.DeviceI.ts, false, bRelease ); } } } diff --git a/stepmania/src/ScreenNameEntry.cpp b/stepmania/src/ScreenNameEntry.cpp index c5b5e60065..75c27c4422 100644 --- a/stepmania/src/ScreenNameEntry.cpp +++ b/stepmania/src/ScreenNameEntry.cpp @@ -345,15 +345,16 @@ void ScreenNameEntry::Input( const InputEventPlus &input ) if( input.type != IET_FIRST_PRESS ) return; // ignore - if( input.StyleI != StyleInput_INVALID && m_bStillEnteringName[input.MenuI.player]) + const int iCol = GAMESTATE->m_pCurStyle->GameInputToStyleInput( input.GameI ); + if( iCol != StyleInput_INVALID && m_bStillEnteringName[input.MenuI.player]) { - int iStringIndex = m_ColToStringIndex[input.MenuI.player][input.StyleI]; + int iStringIndex = m_ColToStringIndex[input.MenuI.player][iCol]; if( iStringIndex != -1 ) { - m_ReceptorArrowRow[input.MenuI.player].Step( input.StyleI, TNS_W1 ); + m_ReceptorArrowRow[input.MenuI.player].Step( iCol, TNS_W1 ); m_soundStep.Play(); char c = NAME_CHARS[GetClosestCharIndex(m_fFakeBeat)]; - m_textSelectedChars[input.MenuI.player][input.StyleI].SetText( ssprintf("%c",c) ); + m_textSelectedChars[input.MenuI.player][iCol].SetText( ssprintf("%c",c) ); m_sSelectedName[input.MenuI.player][iStringIndex] = c; } }