Alternative Column Input Metrics -- Mainly a requirement for Ez2dancer gametype. Allows for a themer to make game inputs that aren't usually used to trigger a column press do so in addition to the usual buttons. (In the case of ez2dancer, the lower hand sensors are used as well as upper hand sensors, except for real mode where they are defined seperately).

This commit is contained in:
Andrew Livy
2009-05-22 18:35:14 +00:00
parent a4736a8802
commit fd5f5d38f4
3 changed files with 61 additions and 1 deletions
+1
View File
@@ -635,6 +635,7 @@ PrevScreen=SongSelectionScreen()
NextScreen=GetGameplayNextScreen()
LightsMode="LightsMode_Gameplay"
TimerSeconds=-1
UseAlternativeInput=false
PlayerType="Player"
PlayerInitCommand=y,SCREEN_CENTER_Y
StartGivesUp=true
+48 -1
View File
@@ -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<RString> 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 )
+12
View File
@@ -153,6 +153,18 @@ protected:
ThemeMetric<int> FAIL_ON_MISS_COMBO;
ThemeMetric<bool> ALLOW_CENTER_1_PLAYER;
ThemeMetric<bool> USE_ALTERNATIVE_INPUT;
struct AlternateMapping
{
GameInput inpMain;
GameInput inpAlt;
};
vector<AlternateMapping> m_vAlterMap;
bool IsLastSong();
void SetupSong( int iSongIndex );
void ReloadCurrentSong();