Stop using Input.StyleI. Just convert it when needed; the vast majority

of screens don't.
This commit is contained in:
Glenn Maynard
2006-09-13 01:29:33 +00:00
parent 9139883e64
commit e4d0b41da1
3 changed files with 21 additions and 14 deletions
+6 -4
View File
@@ -1921,7 +1921,7 @@ void ScreenEdit::InputRecord( const InputEventPlus &input, EditButton EditB )
if( input.MenuI.player != PLAYER_1 ) if( input.MenuI.player != PLAYER_1 )
return; // ignore return; // ignore
const int iCol = input.StyleI; const int iCol = GAMESTATE->m_pCurStyle->GameInputToStyleInput( input.GameI );
switch( input.type ) switch( input.type )
{ {
@@ -2077,17 +2077,19 @@ void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
return; 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; return;
switch( input.MenuI.player ) switch( input.MenuI.player )
{ {
case PLAYER_1: 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; break;
case PLAYER_2: case PLAYER_2:
if( GAMESTATE->GetCurrentStyle()->m_StyleType == TWO_PLAYERS_SHARED_SIDES ) 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 );
} }
} }
+10 -6
View File
@@ -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) * However, if this is also a style button, don't do this. (pump center = start)
*/ */
bool bHoldingGiveUp = false; bool bHoldingGiveUp = false;
bHoldingGiveUp |= ( START_GIVES_UP && input.MenuI.button == MENU_BUTTON_START && input.StyleI == StyleInput_INVALID ); if( GAMESTATE->m_pCurStyle->GameInputToStyleInput(input.GameI) == StyleInput_INVALID )
bHoldingGiveUp |= ( BACK_GIVES_UP && input.MenuI.button == MENU_BUTTON_BACK && input.StyleI == StyleInput_INVALID ); {
bHoldingGiveUp |= ( START_GIVES_UP && input.MenuI.button == MENU_BUTTON_START );
bHoldingGiveUp |= ( BACK_GIVES_UP && input.MenuI.button == MENU_BUTTON_BACK );
}
if( bHoldingGiveUp ) if( bHoldingGiveUp )
{ {
@@ -2142,15 +2145,16 @@ void ScreenGameplay::Input( const InputEventPlus &input )
} }
bool bRelease = input.type == IET_RELEASE; bool bRelease = input.type == IET_RELEASE;
const int iCol = GAMESTATE->m_pCurStyle->GameInputToStyleInput( input.GameI );
if( GAMESTATE->m_bMultiplayer ) if( GAMESTATE->m_bMultiplayer )
{ {
if( input.mp != MultiPlayer_INVALID && if( input.mp != MultiPlayer_INVALID &&
input.type==IET_FIRST_PRESS && input.type==IET_FIRST_PRESS &&
input.StyleI != StyleInput_INVALID && iCol != StyleInput_INVALID &&
GAMESTATE->IsMultiPlayerEnabled(input.mp) ) 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 else
@@ -2159,7 +2163,7 @@ void ScreenGameplay::Input( const InputEventPlus &input )
// handle a step or battle item activate // handle a step or battle item activate
// //
if( input.type==IET_FIRST_PRESS && if( input.type==IET_FIRST_PRESS &&
input.StyleI != StyleInput_INVALID && iCol != StyleInput_INVALID &&
GAMESTATE->IsHumanPlayer( input.MenuI.player ) ) GAMESTATE->IsHumanPlayer( input.MenuI.player ) )
{ {
AbortGiveUp( true ); AbortGiveUp( true );
@@ -2167,7 +2171,7 @@ void ScreenGameplay::Input( const InputEventPlus &input )
if( PREFSMAN->m_AutoPlay == PC_HUMAN ) if( PREFSMAN->m_AutoPlay == PC_HUMAN )
{ {
PlayerInfo& pi = GetPlayerInfoForInput( input ); 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 );
} }
} }
} }
+5 -4
View File
@@ -345,15 +345,16 @@ void ScreenNameEntry::Input( const InputEventPlus &input )
if( input.type != IET_FIRST_PRESS ) if( input.type != IET_FIRST_PRESS )
return; // ignore 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 ) 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(); m_soundStep.Play();
char c = NAME_CHARS[GetClosestCharIndex(m_fFakeBeat)]; 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; m_sSelectedName[input.MenuI.player][iStringIndex] = c;
} }
} }