From 618d0ced9595695d1b633bb1d3a1c98167360477 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 8 Sep 2006 01:39:32 +0000 Subject: [PATCH] m_BeingHeldTime is the timestamp of the last input change, not the time corresponding to the current input state. (If debouncing delays reporting an input, m_BeingHeldTime refers to the time of the delayed input.) Add m_LastInputTime, which remembers the timestamp of the last reported input. --- stepmania/src/InputFilter.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stepmania/src/InputFilter.cpp b/stepmania/src/InputFilter.cpp index a68dd4c944..66026ec2a1 100644 --- a/stepmania/src/InputFilter.cpp +++ b/stepmania/src/InputFilter.cpp @@ -22,6 +22,11 @@ struct ButtonState // The time that we actually reported the last event (used for debouncing). RageTimer m_LastReportTime; + + // The timestamp of the last reported change. Unlike m_BeingHeldTime, this + // value is debounced along with the input state. (This is the same as + // m_fSecsHeld, except this isn't affected by Update scaling.) + RageTimer m_LastInputTime; }; namespace @@ -173,6 +178,7 @@ void InputFilter::CheckButtonChange( ButtonState &bs, DeviceInput di, const Rage bs.m_LastReportTime = now; bs.m_bLastReportedHeld = bs.m_BeingHeld; bs.m_fSecsHeld = 0; + bs.m_LastInputTime = bs.m_BeingHeldTime; di.ts = bs.m_BeingHeldTime; ReportButtonChange( di, bs.m_bLastReportedHeld? IET_FIRST_PRESS:IET_RELEASE ); @@ -263,7 +269,7 @@ void InputFilter::Update( float fDeltaTime ) /* Set the timestamp to the exact time of the repeat. This way, * as long as tab/` aren't being used, the timestamp will always * increase steadily during repeats. */ - di.ts = bs.m_BeingHeldTime + fRepeatTime; + di.ts = bs.m_LastInputTime + fRepeatTime; ReportButtonChange( di, iet ); }