From: Frieza <de...@st...> - 2009-05-23 18:13:36
|
Modified: trunk/stepmania/src/InputEventPlus.h trunk/stepmania/src/Player.cpp trunk/stepmania/src/Player.h trunk/stepmania/src/ScreenGameplay.cpp trunk/stepmania/src/ScreenGameplay.h Log: Fix a problem with alternative input that made hold notes 'let go' when held using the alternative button. Modified: trunk/stepmania/src/InputEventPlus.h ============================================================================== --- trunk/stepmania/src/InputEventPlus.h (original) +++ trunk/stepmania/src/InputEventPlus.h Sat May 23 11:13:29 2009 @@ -23,7 +23,12 @@ public: MultiPlayer mp; DeviceInputList InputList; }; - + +struct AlternateMapping +{ + GameInput inpMain; + GameInput inpAlt; +}; #endif /* Modified: trunk/stepmania/src/Player.cpp ============================================================================== --- trunk/stepmania/src/Player.cpp (original) +++ trunk/stepmania/src/Player.cpp Sat May 23 11:13:29 2009 @@ -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 iSongR else { GameInput GameI = GAMESTATE->GetCurrentStyle()->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 iLastRowCr { 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: Modified: trunk/stepmania/src/Player.h ============================================================================== --- trunk/stepmania/src/Player.h (original) +++ trunk/stepmania/src/Player.h Sat May 23 11:13:29 2009 @@ -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<AlternateMapping> m_vAlterMap; protected: void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat ); void UpdateJudgedRows(); Modified: trunk/stepmania/src/ScreenGameplay.cpp ============================================================================== --- trunk/stepmania/src/ScreenGameplay.cpp (original) +++ trunk/stepmania/src/ScreenGameplay.cpp Sat May 23 11:13:29 2009 @@ -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 ); + } } } } Modified: trunk/stepmania/src/ScreenGameplay.h ============================================================================== --- trunk/stepmania/src/ScreenGameplay.h (original) +++ trunk/stepmania/src/ScreenGameplay.h Sat May 23 11:13:29 2009 @@ -156,12 +156,6 @@ protected: ThemeMetric<bool> USE_ALTERNATIVE_INPUT; - struct AlternateMapping - { - GameInput inpMain; - GameInput inpAlt; - }; - vector<AlternateMapping> m_vAlterMap; |