mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 12:51:42 +00:00
Add an interval between consecutive playbacks of the slider sound effect in fastIncrement mode
This commit is contained in:
parent
611136873e
commit
165ab0823c
1 changed files with 12 additions and 1 deletions
|
|
@ -316,6 +316,7 @@ static bool g_downWasHeld;
|
||||||
static bool g_lockedOnOption;
|
static bool g_lockedOnOption;
|
||||||
static double g_lastTappedTime;
|
static double g_lastTappedTime;
|
||||||
static double g_lastIncrementTime;
|
static double g_lastIncrementTime;
|
||||||
|
static double g_lastIncrementSoundTime;
|
||||||
|
|
||||||
static void ResetSelection()
|
static void ResetSelection()
|
||||||
{
|
{
|
||||||
|
|
@ -682,8 +683,13 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
||||||
bool fastIncrement = (time - g_lastTappedTime) > 0.5;
|
bool fastIncrement = (time - g_lastTappedTime) > 0.5;
|
||||||
constexpr double INCREMENT_TIME = 1.0 / 120.0;
|
constexpr double INCREMENT_TIME = 1.0 / 120.0;
|
||||||
|
|
||||||
|
constexpr double INCREMENT_SOUND_TIME = 1.0 / 7.5;
|
||||||
|
bool isPlayIncrementSound = true;
|
||||||
|
|
||||||
if (fastIncrement)
|
if (fastIncrement)
|
||||||
{
|
{
|
||||||
|
isPlayIncrementSound = (time - g_lastIncrementSoundTime) > INCREMENT_SOUND_TIME;
|
||||||
|
|
||||||
if ((time - g_lastIncrementTime) < INCREMENT_TIME)
|
if ((time - g_lastIncrementTime) < INCREMENT_TIME)
|
||||||
fastIncrement = false;
|
fastIncrement = false;
|
||||||
else
|
else
|
||||||
|
|
@ -747,8 +753,13 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
||||||
deltaTime -= INCREMENT_TIME;
|
deltaTime -= INCREMENT_TIME;
|
||||||
} while (fastIncrement && deltaTime > 0.0f);
|
} while (fastIncrement && deltaTime > 0.0f);
|
||||||
|
|
||||||
if ((increment || decrement) && (config->Value >= valueMin && config->Value <= valueMax))
|
bool isConfigValueInBounds = config->Value >= valueMin && config->Value <= valueMax;
|
||||||
|
|
||||||
|
if ((increment || decrement) && isConfigValueInBounds && isPlayIncrementSound)
|
||||||
|
{
|
||||||
|
g_lastIncrementSoundTime = time;
|
||||||
Game_PlaySound("sys_actstg_twn_speechbutton");
|
Game_PlaySound("sys_actstg_twn_speechbutton");
|
||||||
|
}
|
||||||
|
|
||||||
config->Value = std::clamp(config->Value, valueMin, valueMax);
|
config->Value = std::clamp(config->Value, valueMin, valueMax);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue