add distinct coin input debounce preference

This commit adds a preference, DebounceCoinInputTime (defaults is 0), which allows coin input to be debounced via a float value separate from other input.
This commit is contained in:
Dan Guzek
2014-09-11 16:02:45 -04:00
parent 17ccc0cef5
commit fd1de8b080
3 changed files with 23 additions and 5 deletions
+21 -5
View File
@@ -7,6 +7,8 @@
#include "RageThreads.h"
#include "Preference.h"
#include "Foreach.h"
#include "GameInput.h"
#include "InputMapper.h"
// for mouse stuff: -aj
#include "PrefsManager.h"
#include "ScreenDimensions.h"
@@ -229,12 +231,26 @@ void InputFilter::CheckButtonChange( ButtonState &bs, DeviceInput di, const Rage
{
if( bs.m_BeingHeld == bs.m_bLastReportedHeld )
return;
GameInput gi;
/* If the last IET_FIRST_PRESS or IET_RELEASE event was sent too recently,
* wait a while before sending it. */
if( now - bs.m_LastReportTime < g_fInputDebounceTime )
return;
/* Possibly apply debounce,
* If the input was coin, possibly apply distinct coin debounce in the else below. */
if (! INPUTMAPPER->DeviceToGame(di, gi) || gi.button != GAME_BUTTON_COIN )
{
/* If the last IET_FIRST_PRESS or IET_RELEASE event was sent too recently,
* wait a while before sending it. */
if( now - bs.m_LastReportTime < g_fInputDebounceTime )
{
return;
}
} else {
if( now - bs.m_LastReportTime < PREFSMAN->m_fDebounceCoinInputTime )
{
return;
}
}
bs.m_LastReportTime = now;
bs.m_bLastReportedHeld = bs.m_BeingHeld;
bs.m_fSecsHeld = 0;
+1
View File
@@ -254,6 +254,7 @@ PrefsManager::PrefsManager() :
m_bAllowMultipleHighScoreWithSameName ( "AllowMultipleHighScoreWithSameName", true ),
m_bCelShadeModels ( "CelShadeModels", false ), // Work-In-Progress.. disable by default.
m_bPreferredSortUsesGroups ( "PreferredSortUsesGroups", true ),
m_fDebounceCoinInputTime ( "DebounceCoinInputTime", 0 ),
m_fPadStickSeconds ( "PadStickSeconds", 0 ),
m_bForceMipMaps ( "ForceMipMaps", false ),
+1
View File
@@ -245,6 +245,7 @@ public:
Preference<bool> m_bAllowMultipleHighScoreWithSameName;
Preference<bool> m_bCelShadeModels;
Preference<bool> m_bPreferredSortUsesGroups;
Preference<float> m_fDebounceCoinInputTime; // allow users to apply a distinct debounce to coin input
// Number of seconds it takes for a button on the controller to release
// after pressed.