reduce StyleInput to an int
This commit is contained in:
@@ -2864,7 +2864,7 @@ MenuButton GameManager::GetMenuButtonSecondaryFunction( const Game *pGame, GameB
|
|||||||
FOREACH_GameController(gc)
|
FOREACH_GameController(gc)
|
||||||
{
|
{
|
||||||
const StyleInput si = pStyle->GameInputToStyleInput( GameInput(gc,gb) );
|
const StyleInput si = pStyle->GameInputToStyleInput( GameInput(gc,gb) );
|
||||||
if( si.IsValid() )
|
if( si != StyleInput_INVALID )
|
||||||
bUsedInGameplay = true;
|
bUsedInGameplay = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.col;
|
const int iCol = input.StyleI;
|
||||||
|
|
||||||
switch( input.type )
|
switch( input.type )
|
||||||
{
|
{
|
||||||
@@ -2077,17 +2077,17 @@ void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( PREFSMAN->m_AutoPlay != PC_HUMAN )
|
if( PREFSMAN->m_AutoPlay != PC_HUMAN || input.StyleI == -1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch( input.MenuI.player )
|
switch( input.MenuI.player )
|
||||||
{
|
{
|
||||||
case PLAYER_1:
|
case PLAYER_1:
|
||||||
m_Player->Step( input.StyleI.col, -1, input.DeviceI.ts, false, input.type == IET_RELEASE );
|
m_Player->Step( input.StyleI, -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.col, -1, input.DeviceI.ts, false, input.type == IET_RELEASE );
|
m_Player->Step( input.StyleI, -1, input.DeviceI.ts, false, input.type == IET_RELEASE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3647,9 +3647,9 @@ static RString GetDeviceButtonsLocalized( const vector<EditButton> &veb, const M
|
|||||||
DeviceInput diPress = editmap.button[*eb][s];
|
DeviceInput diPress = editmap.button[*eb][s];
|
||||||
DeviceInput diHold = editmap.hold[*eb][s];
|
DeviceInput diHold = editmap.hold[*eb][s];
|
||||||
if( diPress.IsValid() )
|
if( diPress.IsValid() )
|
||||||
vsPress.push_back( INPUTMAN->GetLocalizedInputString(diPress) );
|
vsPress.push_back( Capitalize(INPUTMAN->GetLocalizedInputString(diPress)) );
|
||||||
if( diHold.IsValid() )
|
if( diHold.IsValid() )
|
||||||
vsHold.push_back( INPUTMAN->GetLocalizedInputString(diHold) );
|
vsHold.push_back( Capitalize(INPUTMAN->GetLocalizedInputString(diHold)) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2086,8 +2086,8 @@ 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.IsValid() );
|
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.IsValid() );
|
bHoldingGiveUp |= ( BACK_GIVES_UP && input.MenuI.button == MENU_BUTTON_BACK && input.StyleI == StyleInput_INVALID );
|
||||||
|
|
||||||
if( bHoldingGiveUp )
|
if( bHoldingGiveUp )
|
||||||
{
|
{
|
||||||
@@ -2147,10 +2147,10 @@ void ScreenGameplay::Input( const InputEventPlus &input )
|
|||||||
{
|
{
|
||||||
if( input.mp != MultiPlayer_INVALID &&
|
if( input.mp != MultiPlayer_INVALID &&
|
||||||
input.type==IET_FIRST_PRESS &&
|
input.type==IET_FIRST_PRESS &&
|
||||||
input.StyleI.IsValid() &&
|
input.StyleI != StyleInput_INVALID &&
|
||||||
GAMESTATE->IsMultiPlayerEnabled(input.mp) )
|
GAMESTATE->IsMultiPlayerEnabled(input.mp) )
|
||||||
{
|
{
|
||||||
m_vPlayerInfo[input.mp].m_pPlayer->Step( input.StyleI.col, -1, input.DeviceI.ts, false, bRelease );
|
m_vPlayerInfo[input.mp].m_pPlayer->Step( input.StyleI, -1, input.DeviceI.ts, false, bRelease );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2159,7 +2159,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.IsValid() &&
|
input.StyleI != StyleInput_INVALID &&
|
||||||
GAMESTATE->IsHumanPlayer( input.MenuI.player ) )
|
GAMESTATE->IsHumanPlayer( input.MenuI.player ) )
|
||||||
{
|
{
|
||||||
AbortGiveUp( true );
|
AbortGiveUp( true );
|
||||||
@@ -2167,7 +2167,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.col, -1, input.DeviceI.ts, false, bRelease );
|
pi.m_pPlayer->Step( input.StyleI, -1, input.DeviceI.ts, false, bRelease );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -345,15 +345,15 @@ 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.IsValid() && m_bStillEnteringName[input.MenuI.player])
|
if( input.StyleI != StyleInput_INVALID && m_bStillEnteringName[input.MenuI.player])
|
||||||
{
|
{
|
||||||
int iStringIndex = m_ColToStringIndex[input.MenuI.player][input.StyleI.col];
|
int iStringIndex = m_ColToStringIndex[input.MenuI.player][input.StyleI];
|
||||||
if( iStringIndex != -1 )
|
if( iStringIndex != -1 )
|
||||||
{
|
{
|
||||||
m_ReceptorArrowRow[input.MenuI.player].Step( input.StyleI.col, TNS_W1 );
|
m_ReceptorArrowRow[input.MenuI.player].Step( input.StyleI, 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.col].SetText( ssprintf("%c",c) );
|
m_textSelectedChars[input.MenuI.player][input.StyleI].SetText( ssprintf("%c",c) );
|
||||||
m_sSelectedName[input.MenuI.player][iStringIndex] = c;
|
m_sSelectedName[input.MenuI.player][iStringIndex] = c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-10
@@ -40,8 +40,8 @@ void Style::GetTransformedNoteDataForStyle( PlayerNumber pn, const NoteData& ori
|
|||||||
|
|
||||||
GameInput Style::StyleInputToGameInput( const StyleInput& StyleI, PlayerNumber pn ) const
|
GameInput Style::StyleInputToGameInput( const StyleInput& StyleI, PlayerNumber pn ) const
|
||||||
{
|
{
|
||||||
ASSERT_M( pn < NUM_PLAYERS && StyleI.col < MAX_COLS_PER_PLAYER,
|
ASSERT_M( pn < NUM_PLAYERS && StyleI < MAX_COLS_PER_PLAYER,
|
||||||
ssprintf("P%i C%i", pn, StyleI.col) );
|
ssprintf("P%i C%i", pn, StyleI) );
|
||||||
bool bUsingOneSide = m_StyleType != ONE_PLAYER_TWO_SIDES && m_StyleType != TWO_PLAYERS_SHARED_SIDES;
|
bool bUsingOneSide = m_StyleType != ONE_PLAYER_TWO_SIDES && m_StyleType != TWO_PLAYERS_SHARED_SIDES;
|
||||||
|
|
||||||
FOREACH_GameController(gc)
|
FOREACH_GameController(gc)
|
||||||
@@ -50,26 +50,23 @@ GameInput Style::StyleInputToGameInput( const StyleInput& StyleI, PlayerNumber p
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
for( int i = 0; i < m_pGame->m_iButtonsPerController && m_iInputColumn[gc][i] != END_MAPPING; ++i )
|
for( int i = 0; i < m_pGame->m_iButtonsPerController && m_iInputColumn[gc][i] != END_MAPPING; ++i )
|
||||||
if( m_iInputColumn[gc][i] == StyleI.col )
|
if( m_iInputColumn[gc][i] == StyleI )
|
||||||
return GameInput( gc, i );
|
return GameInput( gc, i );
|
||||||
}
|
}
|
||||||
|
|
||||||
FAIL_M( ssprintf("Unknown StyleInput %i,%i", pn, StyleI.col) );
|
FAIL_M( ssprintf("Unknown StyleInput %i,%i", pn, StyleI) );
|
||||||
};
|
};
|
||||||
|
|
||||||
StyleInput Style::GameInputToStyleInput( const GameInput &GameI ) const
|
StyleInput Style::GameInputToStyleInput( const GameInput &GameI ) const
|
||||||
{
|
{
|
||||||
StyleInput SI;
|
|
||||||
|
|
||||||
if( m_iInputColumn[GameI.controller][GameI.button] == NO_MAPPING )
|
if( m_iInputColumn[GameI.controller][GameI.button] == NO_MAPPING )
|
||||||
return SI; // Return invalid.
|
return StyleInput_INVALID;
|
||||||
|
|
||||||
for( int i = 0; i <= GameI.button; ++i )
|
for( int i = 0; i <= GameI.button; ++i )
|
||||||
if( m_iInputColumn[GameI.controller][i] == END_MAPPING )
|
if( m_iInputColumn[GameI.controller][i] == END_MAPPING )
|
||||||
return SI; // Return invalid.
|
return StyleInput_INVALID;
|
||||||
|
|
||||||
SI = StyleInput( m_iInputColumn[GameI.controller][GameI.button] );
|
|
||||||
|
|
||||||
|
StyleInput SI = (StyleInput) m_iInputColumn[GameI.controller][GameI.button];
|
||||||
return SI;
|
return SI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,17 +3,8 @@
|
|||||||
#ifndef STYLE_INPUT_H
|
#ifndef STYLE_INPUT_H
|
||||||
#define STYLE_INPUT_H
|
#define STYLE_INPUT_H
|
||||||
|
|
||||||
struct StyleInput
|
typedef int StyleInput;
|
||||||
{
|
static const int StyleInput_INVALID = -1;
|
||||||
int col;
|
|
||||||
|
|
||||||
StyleInput() { MakeInvalid(); };
|
|
||||||
StyleInput( int c ) { col = c; }
|
|
||||||
bool operator==( const StyleInput &other ) { return col == other.col; }
|
|
||||||
|
|
||||||
bool IsValid() const { return col != -1; }
|
|
||||||
void MakeInvalid() { col = -1; }
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user