const cleanup
This commit is contained in:
@@ -74,7 +74,7 @@ InputFilter::ButtonState::ButtonState():
|
||||
m_fSecsHeld = m_Level = m_LastLevel = 0;
|
||||
}
|
||||
|
||||
void InputFilter::ButtonPressed( DeviceInput di, bool Down )
|
||||
void InputFilter::ButtonPressed( const DeviceInput &di, bool Down )
|
||||
{
|
||||
LockMut(*queuemutex);
|
||||
|
||||
@@ -103,7 +103,7 @@ void InputFilter::ButtonPressed( DeviceInput di, bool Down )
|
||||
}
|
||||
}
|
||||
|
||||
void InputFilter::SetButtonComment( DeviceInput di, const CString &sComment )
|
||||
void InputFilter::SetButtonComment( const DeviceInput &di, const CString &sComment )
|
||||
{
|
||||
LockMut(*queuemutex);
|
||||
ButtonState &bs = m_ButtonState[di.device][di.button];
|
||||
@@ -219,23 +219,23 @@ void InputFilter::Update(float fDeltaTime)
|
||||
|
||||
}
|
||||
|
||||
bool InputFilter::IsBeingPressed( DeviceInput di )
|
||||
bool InputFilter::IsBeingPressed( const DeviceInput &di )
|
||||
{
|
||||
return m_ButtonState[di.device][di.button].m_bLastReportedHeld;
|
||||
}
|
||||
|
||||
float InputFilter::GetSecsHeld( DeviceInput di )
|
||||
float InputFilter::GetSecsHeld( const DeviceInput &di )
|
||||
{
|
||||
return m_ButtonState[di.device][di.button].m_fSecsHeld;
|
||||
}
|
||||
|
||||
CString InputFilter::GetButtonComment( DeviceInput di ) const
|
||||
CString InputFilter::GetButtonComment( const DeviceInput &di ) const
|
||||
{
|
||||
LockMut(*queuemutex);
|
||||
return m_ButtonState[di.device][di.button].m_sComment;
|
||||
}
|
||||
|
||||
void InputFilter::ResetKeyRepeat( DeviceInput di )
|
||||
void InputFilter::ResetKeyRepeat( const DeviceInput &di )
|
||||
{
|
||||
m_ButtonState[di.device][di.button].m_fSecsHeld = 0;
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ class RageMutex;
|
||||
class InputFilter
|
||||
{
|
||||
public:
|
||||
void ButtonPressed( DeviceInput di, bool Down );
|
||||
void SetButtonComment( DeviceInput di, const CString &sComment = "" );
|
||||
void ButtonPressed( const DeviceInput &di, bool Down );
|
||||
void SetButtonComment( const DeviceInput &di, const CString &sComment = "" );
|
||||
void ResetDevice( InputDevice dev );
|
||||
|
||||
InputFilter();
|
||||
@@ -52,11 +52,11 @@ public:
|
||||
|
||||
void SetRepeatRate( float fSlowDelay, float fFastDelay, float fRepeatRate );
|
||||
void ResetRepeatRate();
|
||||
void ResetKeyRepeat( DeviceInput di );
|
||||
void ResetKeyRepeat( const DeviceInput &di );
|
||||
|
||||
bool IsBeingPressed( DeviceInput di );
|
||||
float GetSecsHeld( DeviceInput di );
|
||||
CString GetButtonComment( DeviceInput di ) const;
|
||||
bool IsBeingPressed( const DeviceInput &di );
|
||||
float GetSecsHeld( const DeviceInput &di );
|
||||
CString GetButtonComment( const DeviceInput &di ) const;
|
||||
|
||||
void GetInputEvents( InputEventArray &array );
|
||||
|
||||
|
||||
@@ -495,7 +495,7 @@ void InputMapper::SaveMappingsToDisk()
|
||||
}
|
||||
|
||||
|
||||
void InputMapper::SetInputMap( DeviceInput DeviceI, GameInput GameI, int iSlotIndex )
|
||||
void InputMapper::SetInputMap( const DeviceInput &DeviceI, const GameInput &GameI, int iSlotIndex )
|
||||
{
|
||||
// remove the old input
|
||||
ClearFromInputMap( DeviceI );
|
||||
@@ -507,7 +507,7 @@ void InputMapper::SetInputMap( DeviceInput DeviceI, GameInput GameI, int iSlotIn
|
||||
UpdateTempDItoGI();
|
||||
}
|
||||
|
||||
void InputMapper::ClearFromInputMap( DeviceInput DeviceI )
|
||||
void InputMapper::ClearFromInputMap( const DeviceInput &DeviceI )
|
||||
{
|
||||
// search for where this DeviceI maps to
|
||||
|
||||
@@ -526,7 +526,7 @@ void InputMapper::ClearFromInputMap( DeviceInput DeviceI )
|
||||
UpdateTempDItoGI();
|
||||
}
|
||||
|
||||
void InputMapper::ClearFromInputMap( GameInput GameI, int iSlotIndex )
|
||||
void InputMapper::ClearFromInputMap( const GameInput &GameI, int iSlotIndex )
|
||||
{
|
||||
if( !GameI.IsValid() )
|
||||
return;
|
||||
@@ -536,12 +536,12 @@ void InputMapper::ClearFromInputMap( GameInput GameI, int iSlotIndex )
|
||||
UpdateTempDItoGI();
|
||||
}
|
||||
|
||||
bool InputMapper::IsMapped( DeviceInput DeviceI )
|
||||
bool InputMapper::IsMapped( const DeviceInput &DeviceI )
|
||||
{
|
||||
return m_tempDItoGI[DeviceI.device][DeviceI.button].IsValid();
|
||||
}
|
||||
|
||||
bool InputMapper::IsMapped( GameInput GameI )
|
||||
bool InputMapper::IsMapped( const GameInput &GameI )
|
||||
{
|
||||
for( int i=0; i<NUM_GAME_TO_DEVICE_SLOTS; i++ )
|
||||
if( m_GItoDI[GameI.controller][GameI.button][i].IsValid() )
|
||||
@@ -580,19 +580,19 @@ void InputMapper::UpdateTempDItoGI()
|
||||
}
|
||||
}
|
||||
|
||||
bool InputMapper::DeviceToGame( DeviceInput DeviceI, GameInput& GameI ) // return true if there is a mapping from device to pad
|
||||
bool InputMapper::DeviceToGame( const DeviceInput &DeviceI, GameInput& GameI ) // return true if there is a mapping from device to pad
|
||||
{
|
||||
GameI = m_tempDItoGI[DeviceI.device][DeviceI.button];
|
||||
return GameI.controller != GAME_CONTROLLER_INVALID;
|
||||
}
|
||||
|
||||
bool InputMapper::GameToDevice( GameInput GameI, int iSoltNum, DeviceInput& DeviceI ) // return true if there is a mapping from pad to device
|
||||
bool InputMapper::GameToDevice( const GameInput &GameI, int iSoltNum, DeviceInput& DeviceI ) // return true if there is a mapping from pad to device
|
||||
{
|
||||
DeviceI = m_GItoDI[GameI.controller][GameI.button][iSoltNum];
|
||||
return DeviceI.device != DEVICE_NONE;
|
||||
}
|
||||
|
||||
void InputMapper::GameToStyle( GameInput GameI, StyleInput &StyleI )
|
||||
void InputMapper::GameToStyle( const GameInput &GameI, StyleInput &StyleI )
|
||||
{
|
||||
if( GAMESTATE->m_pCurStyle == NULL )
|
||||
{
|
||||
@@ -603,27 +603,27 @@ void InputMapper::GameToStyle( GameInput GameI, StyleInput &StyleI )
|
||||
StyleI = GAMESTATE->m_pCurStyle->GameInputToStyleInput( GameI );
|
||||
}
|
||||
|
||||
void InputMapper::GameToMenu( GameInput GameI, MenuInput &MenuI )
|
||||
void InputMapper::GameToMenu( const GameInput &GameI, MenuInput &MenuI )
|
||||
{
|
||||
const Game* pGame = GAMESTATE->GetCurrentGame();
|
||||
MenuI = pGame->GameInputToMenuInput( GameI );
|
||||
}
|
||||
|
||||
void InputMapper::StyleToGame( StyleInput StyleI, GameInput &GameI )
|
||||
void InputMapper::StyleToGame( const StyleInput &StyleI, GameInput &GameI )
|
||||
{
|
||||
const Style* pStyle = GAMESTATE->GetCurrentStyle();
|
||||
GameI = pStyle->StyleInputToGameInput( StyleI );
|
||||
}
|
||||
|
||||
|
||||
void InputMapper::MenuToGame( MenuInput MenuI, GameInput GameIout[4] )
|
||||
void InputMapper::MenuToGame( const MenuInput &MenuI, GameInput GameIout[4] )
|
||||
{
|
||||
const Game* pGame = GAMESTATE->GetCurrentGame();
|
||||
pGame->MenuInputToGameInput( MenuI, GameIout );
|
||||
}
|
||||
|
||||
|
||||
bool InputMapper::IsButtonDown( GameInput GameI )
|
||||
bool InputMapper::IsButtonDown( const GameInput &GameI )
|
||||
{
|
||||
for( int i=0; i<NUM_GAME_TO_DEVICE_SLOTS; i++ )
|
||||
{
|
||||
@@ -637,7 +637,7 @@ bool InputMapper::IsButtonDown( GameInput GameI )
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InputMapper::IsButtonDown( MenuInput MenuI )
|
||||
bool InputMapper::IsButtonDown( const MenuInput &MenuI )
|
||||
{
|
||||
GameInput GameI[4];
|
||||
MenuToGame( MenuI, GameI );
|
||||
@@ -648,7 +648,7 @@ bool InputMapper::IsButtonDown( MenuInput MenuI )
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InputMapper::IsButtonDown( StyleInput StyleI )
|
||||
bool InputMapper::IsButtonDown( const StyleInput &StyleI )
|
||||
{
|
||||
GameInput GameI;
|
||||
StyleToGame( StyleI, GameI );
|
||||
@@ -656,7 +656,7 @@ bool InputMapper::IsButtonDown( StyleInput StyleI )
|
||||
}
|
||||
|
||||
|
||||
float InputMapper::GetSecsHeld( GameInput GameI )
|
||||
float InputMapper::GetSecsHeld( const GameInput &GameI )
|
||||
{
|
||||
float fMaxSecsHeld = 0;
|
||||
|
||||
@@ -671,7 +671,7 @@ float InputMapper::GetSecsHeld( GameInput GameI )
|
||||
return fMaxSecsHeld;
|
||||
}
|
||||
|
||||
float InputMapper::GetSecsHeld( MenuInput MenuI )
|
||||
float InputMapper::GetSecsHeld( const MenuInput &MenuI )
|
||||
{
|
||||
float fMaxSecsHeld = 0;
|
||||
|
||||
@@ -684,14 +684,14 @@ float InputMapper::GetSecsHeld( MenuInput MenuI )
|
||||
return fMaxSecsHeld;
|
||||
}
|
||||
|
||||
float InputMapper::GetSecsHeld( StyleInput StyleI )
|
||||
float InputMapper::GetSecsHeld( const StyleInput &StyleI )
|
||||
{
|
||||
GameInput GameI;
|
||||
StyleToGame( StyleI, GameI );
|
||||
return GetSecsHeld( GameI );
|
||||
}
|
||||
|
||||
void InputMapper::ResetKeyRepeat( GameInput GameI )
|
||||
void InputMapper::ResetKeyRepeat( const GameInput &GameI )
|
||||
{
|
||||
for( int i=0; i<NUM_GAME_TO_DEVICE_SLOTS; i++ )
|
||||
{
|
||||
@@ -701,7 +701,7 @@ void InputMapper::ResetKeyRepeat( GameInput GameI )
|
||||
}
|
||||
}
|
||||
|
||||
void InputMapper::ResetKeyRepeat( MenuInput MenuI )
|
||||
void InputMapper::ResetKeyRepeat( const MenuInput &MenuI )
|
||||
{
|
||||
GameInput GameI[4];
|
||||
MenuToGame( MenuI, GameI );
|
||||
@@ -710,7 +710,7 @@ void InputMapper::ResetKeyRepeat( MenuInput MenuI )
|
||||
ResetKeyRepeat( GameI[i] );
|
||||
}
|
||||
|
||||
void InputMapper::ResetKeyRepeat( StyleInput StyleI )
|
||||
void InputMapper::ResetKeyRepeat( const StyleInput &StyleI )
|
||||
{
|
||||
GameInput GameI;
|
||||
StyleToGame( StyleI, GameI );
|
||||
|
||||
+20
-20
@@ -25,36 +25,36 @@ public:
|
||||
|
||||
void ClearAllMappings();
|
||||
|
||||
void SetInputMap( DeviceInput DeviceI, GameInput GameI, int iSlotIndex );
|
||||
void ClearFromInputMap( DeviceInput DeviceI );
|
||||
void ClearFromInputMap( GameInput GameI, int iSlotIndex );
|
||||
void SetInputMap( const DeviceInput &DeviceI, const GameInput &GameI, int iSlotIndex );
|
||||
void ClearFromInputMap( const DeviceInput &DeviceI );
|
||||
void ClearFromInputMap( const GameInput &GameI, int iSlotIndex );
|
||||
|
||||
void AddDefaultMappingsForCurrentGameIfUnmapped();
|
||||
void AutoMapJoysticksForCurrentGame();
|
||||
|
||||
bool IsMapped( DeviceInput DeviceI );
|
||||
bool IsMapped( GameInput GameI );
|
||||
bool IsMapped( const DeviceInput &DeviceI );
|
||||
bool IsMapped( const GameInput &GameI );
|
||||
|
||||
bool DeviceToGame( DeviceInput DeviceI, GameInput& GameI ); // return true if there is a mapping from device to pad
|
||||
bool GameToDevice( GameInput GameI, int iSoltNum, DeviceInput& DeviceI ); // return true if there is a mapping from pad to device
|
||||
bool DeviceToGame( const DeviceInput &DeviceI, GameInput& GameI ); // return true if there is a mapping from device to pad
|
||||
bool GameToDevice( const GameInput &GameI, int iSoltNum, DeviceInput& DeviceI ); // return true if there is a mapping from pad to device
|
||||
|
||||
void GameToStyle( GameInput GameI, StyleInput &StyleI );
|
||||
void StyleToGame( StyleInput StyleI, GameInput &GameI );
|
||||
void GameToStyle( const GameInput &GameI, StyleInput &StyleI );
|
||||
void StyleToGame( const StyleInput &StyleI, GameInput &GameI );
|
||||
|
||||
void GameToMenu( GameInput GameI, MenuInput &MenuI );
|
||||
void MenuToGame( MenuInput MenuI, GameInput GameIout[4] );
|
||||
void GameToMenu( const GameInput &GameI, MenuInput &MenuI );
|
||||
void MenuToGame( const MenuInput &MenuI, GameInput GameIout[4] );
|
||||
|
||||
float GetSecsHeld( GameInput GameI );
|
||||
float GetSecsHeld( MenuInput MenuI );
|
||||
float GetSecsHeld( StyleInput StyleI );
|
||||
float GetSecsHeld( const GameInput &GameI );
|
||||
float GetSecsHeld( const MenuInput &MenuI );
|
||||
float GetSecsHeld( const StyleInput &StyleI );
|
||||
|
||||
bool IsButtonDown( GameInput GameI );
|
||||
bool IsButtonDown( MenuInput MenuI );
|
||||
bool IsButtonDown( StyleInput StyleI );
|
||||
bool IsButtonDown( const GameInput &GameI );
|
||||
bool IsButtonDown( const MenuInput &MenuI );
|
||||
bool IsButtonDown( const StyleInput &StyleI );
|
||||
|
||||
void ResetKeyRepeat( GameInput GameI );
|
||||
void ResetKeyRepeat( MenuInput MenuI );
|
||||
void ResetKeyRepeat( StyleInput StyleI );
|
||||
void ResetKeyRepeat( const GameInput &GameI );
|
||||
void ResetKeyRepeat( const MenuInput &MenuI );
|
||||
void ResetKeyRepeat( const StyleInput &StyleI );
|
||||
|
||||
struct Mapping {
|
||||
bool IsEndMarker() const { return iSlotIndex==-1; }
|
||||
|
||||
Reference in New Issue
Block a user