const cleanup

This commit is contained in:
Chris Danford
2005-10-15 16:47:44 +00:00
parent d6555531f3
commit ae7300b3be
4 changed files with 52 additions and 52 deletions
+6 -6
View File
@@ -74,7 +74,7 @@ InputFilter::ButtonState::ButtonState():
m_fSecsHeld = m_Level = m_LastLevel = 0; m_fSecsHeld = m_Level = m_LastLevel = 0;
} }
void InputFilter::ButtonPressed( DeviceInput di, bool Down ) void InputFilter::ButtonPressed( const DeviceInput &di, bool Down )
{ {
LockMut(*queuemutex); 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); LockMut(*queuemutex);
ButtonState &bs = m_ButtonState[di.device][di.button]; 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; 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; return m_ButtonState[di.device][di.button].m_fSecsHeld;
} }
CString InputFilter::GetButtonComment( DeviceInput di ) const CString InputFilter::GetButtonComment( const DeviceInput &di ) const
{ {
LockMut(*queuemutex); LockMut(*queuemutex);
return m_ButtonState[di.device][di.button].m_sComment; 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; m_ButtonState[di.device][di.button].m_fSecsHeld = 0;
} }
+6 -6
View File
@@ -41,8 +41,8 @@ class RageMutex;
class InputFilter class InputFilter
{ {
public: public:
void ButtonPressed( DeviceInput di, bool Down ); void ButtonPressed( const DeviceInput &di, bool Down );
void SetButtonComment( DeviceInput di, const CString &sComment = "" ); void SetButtonComment( const DeviceInput &di, const CString &sComment = "" );
void ResetDevice( InputDevice dev ); void ResetDevice( InputDevice dev );
InputFilter(); InputFilter();
@@ -52,11 +52,11 @@ public:
void SetRepeatRate( float fSlowDelay, float fFastDelay, float fRepeatRate ); void SetRepeatRate( float fSlowDelay, float fFastDelay, float fRepeatRate );
void ResetRepeatRate(); void ResetRepeatRate();
void ResetKeyRepeat( DeviceInput di ); void ResetKeyRepeat( const DeviceInput &di );
bool IsBeingPressed( DeviceInput di ); bool IsBeingPressed( const DeviceInput &di );
float GetSecsHeld( DeviceInput di ); float GetSecsHeld( const DeviceInput &di );
CString GetButtonComment( DeviceInput di ) const; CString GetButtonComment( const DeviceInput &di ) const;
void GetInputEvents( InputEventArray &array ); void GetInputEvents( InputEventArray &array );
+20 -20
View File
@@ -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 // remove the old input
ClearFromInputMap( DeviceI ); ClearFromInputMap( DeviceI );
@@ -507,7 +507,7 @@ void InputMapper::SetInputMap( DeviceInput DeviceI, GameInput GameI, int iSlotIn
UpdateTempDItoGI(); UpdateTempDItoGI();
} }
void InputMapper::ClearFromInputMap( DeviceInput DeviceI ) void InputMapper::ClearFromInputMap( const DeviceInput &DeviceI )
{ {
// search for where this DeviceI maps to // search for where this DeviceI maps to
@@ -526,7 +526,7 @@ void InputMapper::ClearFromInputMap( DeviceInput DeviceI )
UpdateTempDItoGI(); UpdateTempDItoGI();
} }
void InputMapper::ClearFromInputMap( GameInput GameI, int iSlotIndex ) void InputMapper::ClearFromInputMap( const GameInput &GameI, int iSlotIndex )
{ {
if( !GameI.IsValid() ) if( !GameI.IsValid() )
return; return;
@@ -536,12 +536,12 @@ void InputMapper::ClearFromInputMap( GameInput GameI, int iSlotIndex )
UpdateTempDItoGI(); UpdateTempDItoGI();
} }
bool InputMapper::IsMapped( DeviceInput DeviceI ) bool InputMapper::IsMapped( const DeviceInput &DeviceI )
{ {
return m_tempDItoGI[DeviceI.device][DeviceI.button].IsValid(); 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++ ) for( int i=0; i<NUM_GAME_TO_DEVICE_SLOTS; i++ )
if( m_GItoDI[GameI.controller][GameI.button][i].IsValid() ) 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]; GameI = m_tempDItoGI[DeviceI.device][DeviceI.button];
return GameI.controller != GAME_CONTROLLER_INVALID; 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]; DeviceI = m_GItoDI[GameI.controller][GameI.button][iSoltNum];
return DeviceI.device != DEVICE_NONE; 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 ) if( GAMESTATE->m_pCurStyle == NULL )
{ {
@@ -603,27 +603,27 @@ void InputMapper::GameToStyle( GameInput GameI, StyleInput &StyleI )
StyleI = GAMESTATE->m_pCurStyle->GameInputToStyleInput( GameI ); 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(); const Game* pGame = GAMESTATE->GetCurrentGame();
MenuI = pGame->GameInputToMenuInput( GameI ); MenuI = pGame->GameInputToMenuInput( GameI );
} }
void InputMapper::StyleToGame( StyleInput StyleI, GameInput &GameI ) void InputMapper::StyleToGame( const StyleInput &StyleI, GameInput &GameI )
{ {
const Style* pStyle = GAMESTATE->GetCurrentStyle(); const Style* pStyle = GAMESTATE->GetCurrentStyle();
GameI = pStyle->StyleInputToGameInput( StyleI ); 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(); const Game* pGame = GAMESTATE->GetCurrentGame();
pGame->MenuInputToGameInput( MenuI, GameIout ); 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++ ) for( int i=0; i<NUM_GAME_TO_DEVICE_SLOTS; i++ )
{ {
@@ -637,7 +637,7 @@ bool InputMapper::IsButtonDown( GameInput GameI )
return false; return false;
} }
bool InputMapper::IsButtonDown( MenuInput MenuI ) bool InputMapper::IsButtonDown( const MenuInput &MenuI )
{ {
GameInput GameI[4]; GameInput GameI[4];
MenuToGame( MenuI, GameI ); MenuToGame( MenuI, GameI );
@@ -648,7 +648,7 @@ bool InputMapper::IsButtonDown( MenuInput MenuI )
return false; return false;
} }
bool InputMapper::IsButtonDown( StyleInput StyleI ) bool InputMapper::IsButtonDown( const StyleInput &StyleI )
{ {
GameInput GameI; GameInput GameI;
StyleToGame( StyleI, 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; float fMaxSecsHeld = 0;
@@ -671,7 +671,7 @@ float InputMapper::GetSecsHeld( GameInput GameI )
return fMaxSecsHeld; return fMaxSecsHeld;
} }
float InputMapper::GetSecsHeld( MenuInput MenuI ) float InputMapper::GetSecsHeld( const MenuInput &MenuI )
{ {
float fMaxSecsHeld = 0; float fMaxSecsHeld = 0;
@@ -684,14 +684,14 @@ float InputMapper::GetSecsHeld( MenuInput MenuI )
return fMaxSecsHeld; return fMaxSecsHeld;
} }
float InputMapper::GetSecsHeld( StyleInput StyleI ) float InputMapper::GetSecsHeld( const StyleInput &StyleI )
{ {
GameInput GameI; GameInput GameI;
StyleToGame( StyleI, GameI ); StyleToGame( StyleI, GameI );
return GetSecsHeld( 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++ ) 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]; GameInput GameI[4];
MenuToGame( MenuI, GameI ); MenuToGame( MenuI, GameI );
@@ -710,7 +710,7 @@ void InputMapper::ResetKeyRepeat( MenuInput MenuI )
ResetKeyRepeat( GameI[i] ); ResetKeyRepeat( GameI[i] );
} }
void InputMapper::ResetKeyRepeat( StyleInput StyleI ) void InputMapper::ResetKeyRepeat( const StyleInput &StyleI )
{ {
GameInput GameI; GameInput GameI;
StyleToGame( StyleI, GameI ); StyleToGame( StyleI, GameI );
+20 -20
View File
@@ -25,36 +25,36 @@ public:
void ClearAllMappings(); void ClearAllMappings();
void SetInputMap( DeviceInput DeviceI, GameInput GameI, int iSlotIndex ); void SetInputMap( const DeviceInput &DeviceI, const GameInput &GameI, int iSlotIndex );
void ClearFromInputMap( DeviceInput DeviceI ); void ClearFromInputMap( const DeviceInput &DeviceI );
void ClearFromInputMap( GameInput GameI, int iSlotIndex ); void ClearFromInputMap( const GameInput &GameI, int iSlotIndex );
void AddDefaultMappingsForCurrentGameIfUnmapped(); void AddDefaultMappingsForCurrentGameIfUnmapped();
void AutoMapJoysticksForCurrentGame(); void AutoMapJoysticksForCurrentGame();
bool IsMapped( DeviceInput DeviceI ); bool IsMapped( const DeviceInput &DeviceI );
bool IsMapped( GameInput GameI ); bool IsMapped( const GameInput &GameI );
bool DeviceToGame( DeviceInput DeviceI, GameInput& GameI ); // return true if there is a mapping from device to pad bool DeviceToGame( const 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 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 GameToStyle( const GameInput &GameI, StyleInput &StyleI );
void StyleToGame( StyleInput StyleI, GameInput &GameI ); void StyleToGame( const StyleInput &StyleI, GameInput &GameI );
void GameToMenu( GameInput GameI, MenuInput &MenuI ); void GameToMenu( const GameInput &GameI, MenuInput &MenuI );
void MenuToGame( MenuInput MenuI, GameInput GameIout[4] ); void MenuToGame( const MenuInput &MenuI, GameInput GameIout[4] );
float GetSecsHeld( GameInput GameI ); float GetSecsHeld( const GameInput &GameI );
float GetSecsHeld( MenuInput MenuI ); float GetSecsHeld( const MenuInput &MenuI );
float GetSecsHeld( StyleInput StyleI ); float GetSecsHeld( const StyleInput &StyleI );
bool IsButtonDown( GameInput GameI ); bool IsButtonDown( const GameInput &GameI );
bool IsButtonDown( MenuInput MenuI ); bool IsButtonDown( const MenuInput &MenuI );
bool IsButtonDown( StyleInput StyleI ); bool IsButtonDown( const StyleInput &StyleI );
void ResetKeyRepeat( GameInput GameI ); void ResetKeyRepeat( const GameInput &GameI );
void ResetKeyRepeat( MenuInput MenuI ); void ResetKeyRepeat( const MenuInput &MenuI );
void ResetKeyRepeat( StyleInput StyleI ); void ResetKeyRepeat( const StyleInput &StyleI );
struct Mapping { struct Mapping {
bool IsEndMarker() const { return iSlotIndex==-1; } bool IsEndMarker() const { return iSlotIndex==-1; }