From 87bb92451b7f5f06a4d70375736b6ee931fc96c3 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 13 Sep 2006 00:02:23 +0000 Subject: [PATCH] StyleI.player duplicates MenuI.player when the style is set. It's essentially being used as a hack to see if the style is set, and as a shortcut for converting from StyleInput back to GameInput, complicating InputEventPlus in the process. Remove it, and just pass along the PlayerNumber when it's actually needed. (incremental commit) --- stepmania/src/InputMapper.cpp | 4 ++-- stepmania/src/InputMapper.h | 4 ++-- stepmania/src/Player.cpp | 8 ++++---- stepmania/src/ScreenEdit.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index 1d66a58b2c..f1a0fcb615 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -831,7 +831,7 @@ bool InputMapper::IsBeingPressed( const MenuInput &MenuI ) return false; } -bool InputMapper::IsBeingPressed( const StyleInput &StyleI, MultiPlayer mp ) +bool InputMapper::IsBeingPressed( const StyleInput &StyleI, PlayerNumber pn, MultiPlayer mp ) { GameInput GameI; StyleToGame( StyleI, GameI ); @@ -870,7 +870,7 @@ float InputMapper::GetSecsHeld( const MenuInput &MenuI ) return fMaxSecsHeld; } -float InputMapper::GetSecsHeld( const StyleInput &StyleI, MultiPlayer mp ) +float InputMapper::GetSecsHeld( const StyleInput &StyleI, PlayerNumber pn, MultiPlayer mp ) { GameInput GameI; StyleToGame( StyleI, GameI ); diff --git a/stepmania/src/InputMapper.h b/stepmania/src/InputMapper.h index 044a68fe43..0a0a532a52 100644 --- a/stepmania/src/InputMapper.h +++ b/stepmania/src/InputMapper.h @@ -46,11 +46,11 @@ public: float GetSecsHeld( const GameInput &GameI, MultiPlayer mp = MultiPlayer_INVALID ); float GetSecsHeld( const MenuInput &MenuI ); - float GetSecsHeld( const StyleInput &StyleI, MultiPlayer mp = MultiPlayer_INVALID ); + float GetSecsHeld( const StyleInput &StyleI, PlayerNumber pn, MultiPlayer mp = MultiPlayer_INVALID ); bool IsBeingPressed( const GameInput &GameI, MultiPlayer mp = MultiPlayer_INVALID, const DeviceInputList *pButtonState = NULL ); bool IsBeingPressed( const MenuInput &MenuI ); - bool IsBeingPressed( const StyleInput &StyleI, MultiPlayer mp = MultiPlayer_INVALID ); + bool IsBeingPressed( const StyleInput &StyleI, PlayerNumber pn, MultiPlayer mp = MultiPlayer_INVALID ); void ResetKeyRepeat( const GameInput &GameI ); void ResetKeyRepeat( const MenuInput &MenuI ); diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index f12fbfdabb..8fe0bec2e0 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -544,7 +544,7 @@ void Player::Update( float fDeltaTime ) PlayerNumber pn = m_pPlayerState->m_PlayerNumber; const StyleInput StyleI( pn, col ); - bool bIsHoldingButton = INPUTMAPPER->IsBeingPressed( StyleI ); + bool bIsHoldingButton = INPUTMAPPER->IsBeingPressed( StyleI, pn ); // TODO: Make this work for non-human-controlled players if( bIsHoldingButton && !GAMESTATE->m_bDemonstrationOrJukebox && m_pPlayerState->m_PlayerController==PC_HUMAN ) if( m_pNoteField ) @@ -622,7 +622,7 @@ void Player::Update( float fDeltaTime ) else { const StyleInput StyleI( pn, iTrack ); - bIsHoldingButton = INPUTMAPPER->IsBeingPressed( StyleI, m_pPlayerState->m_mp ); + bIsHoldingButton = INPUTMAPPER->IsBeingPressed( StyleI, pn, m_pPlayerState->m_mp ); } int iEndRow = iRow + tn.iDuration; @@ -1492,13 +1492,13 @@ void Player::CrossedMineRow( int iNoteRow, const RageTimer &now ) const StyleInput StyleI( pn, t ); if( PREFSMAN->m_fPadStickSeconds > 0 ) { - float fSecsHeld = INPUTMAPPER->GetSecsHeld( StyleI, m_pPlayerState->m_mp ); + float fSecsHeld = INPUTMAPPER->GetSecsHeld( StyleI, pn, m_pPlayerState->m_mp ); if( fSecsHeld >= PREFSMAN->m_fPadStickSeconds ) Step( t, -1, now+(-PREFSMAN->m_fPadStickSeconds), true, false ); } else { - bool bIsDown = INPUTMAPPER->IsBeingPressed( StyleI, m_pPlayerState->m_mp ); + bool bIsDown = INPUTMAPPER->IsBeingPressed( StyleI, pn, m_pPlayerState->m_mp ); if( bIsDown ) Step( t, iNoteRow, now, true, false ); } diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 1ee802da6e..be8f45d688 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -887,7 +887,7 @@ void ScreenEdit::Update( float fDeltaTime ) for( int t=0; tGetCurrentStyle()->m_iColsPerPlayer; t++ ) // for each track { StyleInput StyleI( PLAYER_1, t ); - float fSecsHeld = INPUTMAPPER->GetSecsHeld( StyleI ); + float fSecsHeld = INPUTMAPPER->GetSecsHeld( StyleI, PLAYER_1 ); fSecsHeld = min( fSecsHeld, m_RemoveNoteButtonLastChanged.Ago() ); if( fSecsHeld == 0 ) continue; @@ -935,7 +935,7 @@ void ScreenEdit::Update( float fDeltaTime ) for( int t=0; tGetCurrentStyle()->m_iColsPerPlayer; t++ ) // for each track { StyleInput StyleI( PLAYER_1, t ); - if( INPUTMAPPER->IsBeingPressed(StyleI) ) + if( INPUTMAPPER->IsBeingPressed(StyleI, PLAYER_1) ) bButtonIsBeingPressed = true; }