diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 95bc91abc7..2d15387af2 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -635,6 +635,7 @@ PrevScreen=SongSelectionScreen() NextScreen=GetGameplayNextScreen() LightsMode="LightsMode_Gameplay" TimerSeconds=-1 +UseAlternativeInput=false PlayerType="Player" PlayerInitCommand=y,SCREEN_CENTER_Y StartGivesUp=true diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index c3efb5b8d4..024eba8c8f 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -59,6 +59,8 @@ #include "Song.h" #include "XmlFileUtil.h" +#include "arch/Dialog/Dialog.h" + // // Defines // @@ -353,6 +355,8 @@ void ScreenGameplay::Init() FAIL_ON_MISS_COMBO.Load( m_sName, "FailOnMissCombo" ); ALLOW_CENTER_1_PLAYER.Load( m_sName, "AllowCenter1Player" ); + USE_ALTERNATIVE_INPUT.Load( m_sName,"UseAlternativeInput"); + if( UseSongBackgroundAndForeground() ) { m_pSongBackground = new Background; @@ -754,6 +758,37 @@ void ScreenGameplay::Init() LoadNextSong(); m_GiveUpTimer.SetZero(); + + // friez + + if(USE_ALTERNATIVE_INPUT) // using alternative input + { + int iNumCols = GAMESTATE->GetCurrentStyle()->m_iColsPerPlayer; + FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi ) + { + for( int col=0; col < iNumCols; ++col ) + { + + // TODO: Remove use of PlayerNumber. + GameInput GameI = GAMESTATE->GetCurrentStyle()->StyleInputToGameInput( col, pi->m_pn ); + // Dialog::OK(GameI.ToString(INPUTMAPPER->GetInputScheme()),"DEBUG"); + + ThemeMetric tmpMetric; + tmpMetric.Load(m_sName,ssprintf("AltInp%s%s",GAMESTATE->GetCurrentStyle()->m_szName,GameI.ToString( INPUTMAPPER->GetInputScheme() ).c_str() ) ); + + if(tmpMetric.GetValue() != "") + { + GameInput GameIAlt; + GameIAlt.FromString(INPUTMAPPER->GetInputScheme(),tmpMetric.GetValue()); + + AlternateMapping tmpMap; + tmpMap.inpMain = GameI; + tmpMap.inpAlt = GameIAlt; + m_vAlterMap.push_back(tmpMap); + } + } + } + } } bool ScreenGameplay::Center1Player() const @@ -2211,7 +2246,19 @@ void ScreenGameplay::Input( const InputEventPlus &input ) if( !input.GameI.IsValid() ) return; - const int iCol = GAMESTATE->GetCurrentStyle()->GameInputToColumn( input.GameI ); + int iCol = GAMESTATE->GetCurrentStyle()->GameInputToColumn( input.GameI ); + + if(USE_ALTERNATIVE_INPUT) // using alternative input + { + for( unsigned int i=0; i < m_vAlterMap.size(); ++i ) + { + if(m_vAlterMap[i].inpAlt == input.GameI) + { + iCol = GAMESTATE->GetCurrentStyle()->GameInputToColumn( m_vAlterMap[i].inpMain ); + } + } + } + // Don't pass on any inputs to Player that aren't a press or a release. switch( input.type ) diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index 1acd4fa726..8e67061acc 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -153,6 +153,18 @@ protected: ThemeMetric FAIL_ON_MISS_COMBO; ThemeMetric ALLOW_CENTER_1_PLAYER; + + ThemeMetric USE_ALTERNATIVE_INPUT; + + struct AlternateMapping + { + GameInput inpMain; + GameInput inpAlt; + }; + + vector m_vAlterMap; + + bool IsLastSong(); void SetupSong( int iSongIndex ); void ReloadCurrentSong();