diff --git a/stepmania/src/InputEventPlus.h b/stepmania/src/InputEventPlus.h index c38af19109..6efd7b5422 100644 --- a/stepmania/src/InputEventPlus.h +++ b/stepmania/src/InputEventPlus.h @@ -23,7 +23,12 @@ public: MultiPlayer mp; DeviceInputList InputList; }; - + +struct AlternateMapping +{ + GameInput inpMain; + GameInput inpAlt; +}; #endif /* diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index bfdc7f8d6e..4a77b5126d 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -733,10 +733,25 @@ void Player::Update( float fDeltaTime ) GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( col, m_pPlayerState->m_PlayerNumber ); bool bIsHoldingButton = INPUTMAPPER->IsBeingPressed( GameI ); + + if( m_vAlterMap.size() > 0 ) // alternate input is being used + { + for( unsigned int i=0; i < m_vAlterMap.size(); ++i ) + { + if( m_vAlterMap[i].inpMain == GameI ) + { + bIsHoldingButton = bIsHoldingButton | INPUTMAPPER->IsBeingPressed( m_vAlterMap[i].inpAlt ); + } + } + } + // TODO: Make this work for non-human-controlled players if( bIsHoldingButton && !GAMESTATE->m_bDemonstrationOrJukebox && m_pPlayerState->m_PlayerController==PC_HUMAN ) if( m_pNoteField ) m_pNoteField->SetPressed( col ); + + + } @@ -959,7 +974,23 @@ void Player::UpdateHoldNotes( int iSongRow, float fDeltaTime, vectorGetCurrentStyle()->StyleInputToGameInput( iTrack, pn ); - bIsHoldingButton &= INPUTMAPPER->IsBeingPressed( GameI, m_pPlayerState->m_mp ); + + // this previously read as bIsHoldingButton &= + // was there a specific reason for this? - Friez + bIsHoldingButton = INPUTMAPPER->IsBeingPressed( GameI, m_pPlayerState->m_mp ); + + if( m_vAlterMap.size() > 0 ) // alternate input is being used + { + for( unsigned int i=0; i < m_vAlterMap.size(); ++i ) + { + if( m_vAlterMap[i].inpMain == GameI ) + { + bIsHoldingButton = bIsHoldingButton | INPUTMAPPER->IsBeingPressed( m_vAlterMap[i].inpAlt ); + } + } + } + + } } } @@ -2440,16 +2471,47 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now ) { PlayerNumber pn = m_pPlayerState->m_PlayerNumber; GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( iTrack, pn ); + if( PREFSMAN->m_fPadStickSeconds > 0.f ) { float fSecsHeld = INPUTMAPPER->GetSecsHeld( GameI, m_pPlayerState->m_mp ); if( fSecsHeld >= PREFSMAN->m_fPadStickSeconds ) Step( iTrack, -1, now - PREFSMAN->m_fPadStickSeconds, true, false ); + + if( m_vAlterMap.size() > 0 ) // alternate input is being used + { + for( unsigned int i=0; i < m_vAlterMap.size(); ++i ) + { + if( m_vAlterMap[i].inpMain == GameI ) + { + GameInput GameIB = m_vAlterMap[i].inpAlt; + float fSecsHeld = INPUTMAPPER->GetSecsHeld( GameIB, m_pPlayerState->m_mp ); + if( fSecsHeld >= PREFSMAN->m_fPadStickSeconds ) + Step( iTrack, -1, now - PREFSMAN->m_fPadStickSeconds, true, false ); + } + } + } + + } else if( INPUTMAPPER->IsBeingPressed(GameI, m_pPlayerState->m_mp) ) { Step( iTrack, -1, now, true, false ); } + else if( m_vAlterMap.size() > 0 ) // alternate input being used + { + for( unsigned int i=0; i < m_vAlterMap.size(); ++i ) + { + if( m_vAlterMap[i].inpMain == GameI ) + { + GameInput GameIB = m_vAlterMap[i].inpAlt; + if( INPUTMAPPER->IsBeingPressed(GameIB, m_pPlayerState->m_mp) ) + { + Step( iTrack, -1, now, true, false ); + } + } + } + } } break; case TapNote::mine: diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index 2f18ca7d57..c0435679e0 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -11,6 +11,7 @@ #include "NoteData.h" #include "ScreenMessage.h" #include "ThemeMetric.h" +#include "InputEventPlus.h" class ScoreDisplay; class LifeMeter; @@ -106,6 +107,7 @@ public: // virtual void PushSelf( lua_State *L ); + vector m_vAlterMap; protected: void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ); void UpdateJudgedRows(); diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 6238796d0c..de5a2266e9 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -783,6 +783,11 @@ void ScreenGameplay::Init() tmpMap.inpMain = GameI; tmpMap.inpAlt = GameIAlt; m_vAlterMap.push_back( tmpMap ); + + FOREACH( PlayerInfo, m_vPlayerInfo, pi ) + { + pi->m_pPlayer->m_vAlterMap.push_back( tmpMap ); + } } } } diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index 8e67061acc..61195bfabd 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -156,12 +156,6 @@ protected: ThemeMetric USE_ALTERNATIVE_INPUT; - struct AlternateMapping - { - GameInput inpMain; - GameInput inpAlt; - }; - vector m_vAlterMap;