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:
@@ -7,6 +7,8 @@
|
|||||||
#include "RageThreads.h"
|
#include "RageThreads.h"
|
||||||
#include "Preference.h"
|
#include "Preference.h"
|
||||||
#include "Foreach.h"
|
#include "Foreach.h"
|
||||||
|
#include "GameInput.h"
|
||||||
|
#include "InputMapper.h"
|
||||||
// for mouse stuff: -aj
|
// for mouse stuff: -aj
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
@@ -230,10 +232,24 @@ void InputFilter::CheckButtonChange( ButtonState &bs, DeviceInput di, const Rage
|
|||||||
if( bs.m_BeingHeld == bs.m_bLastReportedHeld )
|
if( bs.m_BeingHeld == bs.m_bLastReportedHeld )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
GameInput gi;
|
||||||
|
|
||||||
|
/* 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,
|
/* If the last IET_FIRST_PRESS or IET_RELEASE event was sent too recently,
|
||||||
* wait a while before sending it. */
|
* wait a while before sending it. */
|
||||||
if( now - bs.m_LastReportTime < g_fInputDebounceTime )
|
if( now - bs.m_LastReportTime < g_fInputDebounceTime )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if( now - bs.m_LastReportTime < PREFSMAN->m_fDebounceCoinInputTime )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bs.m_LastReportTime = now;
|
bs.m_LastReportTime = now;
|
||||||
bs.m_bLastReportedHeld = bs.m_BeingHeld;
|
bs.m_bLastReportedHeld = bs.m_BeingHeld;
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ PrefsManager::PrefsManager() :
|
|||||||
m_bAllowMultipleHighScoreWithSameName ( "AllowMultipleHighScoreWithSameName", true ),
|
m_bAllowMultipleHighScoreWithSameName ( "AllowMultipleHighScoreWithSameName", true ),
|
||||||
m_bCelShadeModels ( "CelShadeModels", false ), // Work-In-Progress.. disable by default.
|
m_bCelShadeModels ( "CelShadeModels", false ), // Work-In-Progress.. disable by default.
|
||||||
m_bPreferredSortUsesGroups ( "PreferredSortUsesGroups", true ),
|
m_bPreferredSortUsesGroups ( "PreferredSortUsesGroups", true ),
|
||||||
|
m_fDebounceCoinInputTime ( "DebounceCoinInputTime", 0 ),
|
||||||
|
|
||||||
m_fPadStickSeconds ( "PadStickSeconds", 0 ),
|
m_fPadStickSeconds ( "PadStickSeconds", 0 ),
|
||||||
m_bForceMipMaps ( "ForceMipMaps", false ),
|
m_bForceMipMaps ( "ForceMipMaps", false ),
|
||||||
|
|||||||
@@ -245,6 +245,7 @@ public:
|
|||||||
Preference<bool> m_bAllowMultipleHighScoreWithSameName;
|
Preference<bool> m_bAllowMultipleHighScoreWithSameName;
|
||||||
Preference<bool> m_bCelShadeModels;
|
Preference<bool> m_bCelShadeModels;
|
||||||
Preference<bool> m_bPreferredSortUsesGroups;
|
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
|
// Number of seconds it takes for a button on the controller to release
|
||||||
// after pressed.
|
// after pressed.
|
||||||
|
|||||||
Reference in New Issue
Block a user