fix InputFilter::ResetDevice
Don't update g_CurrentState in InputFilter::ButtonPressed, but in the caller instead.
This commit is contained in:
@@ -137,6 +137,7 @@ void InputFilter::ButtonPressed( const DeviceInput &di )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Try to report presses immediately. */
|
/* Try to report presses immediately. */
|
||||||
|
MakeButtonStateList( g_CurrentState );
|
||||||
CheckButtonChange( bs, di, now );
|
CheckButtonChange( bs, di, now );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,7 +159,7 @@ void InputFilter::ResetDevice( InputDevice device )
|
|||||||
{
|
{
|
||||||
const DeviceInput &di = b->first;
|
const DeviceInput &di = b->first;
|
||||||
if( di.device == device )
|
if( di.device == device )
|
||||||
ButtonPressed( DeviceInput(device, di.button, 0, now), false );
|
ButtonPressed( DeviceInput(device, di.button, false, now) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,6 +180,7 @@ void InputFilter::CheckButtonChange( ButtonState &bs, DeviceInput di, const Rage
|
|||||||
bs.m_LastInputTime = bs.m_BeingHeldTime;
|
bs.m_LastInputTime = bs.m_BeingHeldTime;
|
||||||
|
|
||||||
di.ts = bs.m_BeingHeldTime;
|
di.ts = bs.m_BeingHeldTime;
|
||||||
|
MakeButtonStateList( g_CurrentState );
|
||||||
ReportButtonChange( di, bs.m_bLastReportedHeld? IET_FIRST_PRESS:IET_RELEASE );
|
ReportButtonChange( di, bs.m_bLastReportedHeld? IET_FIRST_PRESS:IET_RELEASE );
|
||||||
|
|
||||||
if( !bs.m_bLastReportedHeld )
|
if( !bs.m_bLastReportedHeld )
|
||||||
@@ -199,7 +201,6 @@ void InputFilter::ReportButtonChange( const DeviceInput &di, InputEventType t )
|
|||||||
* g_ButtonStates will be in DeviceInput order, so users can binary search this
|
* g_ButtonStates will be in DeviceInput order, so users can binary search this
|
||||||
* list (eg. std::lower_bound).
|
* list (eg. std::lower_bound).
|
||||||
*/
|
*/
|
||||||
MakeButtonStateList( g_CurrentState );
|
|
||||||
ie.m_ButtonState = g_CurrentState;
|
ie.m_ButtonState = g_CurrentState;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,6 +230,8 @@ void InputFilter::Update( float fDeltaTime )
|
|||||||
|
|
||||||
DeviceInput di( InputDevice_Invalid, DeviceButton_Invalid, 1.0f, now );
|
DeviceInput di( InputDevice_Invalid, DeviceButton_Invalid, 1.0f, now );
|
||||||
|
|
||||||
|
MakeButtonStateList( g_CurrentState );
|
||||||
|
|
||||||
vector<ButtonStateMap::iterator> ButtonsToErase;
|
vector<ButtonStateMap::iterator> ButtonsToErase;
|
||||||
|
|
||||||
FOREACHM( DeviceInput, ButtonState, g_ButtonStates, b )
|
FOREACHM( DeviceInput, ButtonState, g_ButtonStates, b )
|
||||||
|
|||||||
Reference in New Issue
Block a user