mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 12:51:42 +00:00
Change options menu sliders' fastIncrement logic to use a persistent holdTime variable, rather than the current frame's deltaTime
This commit is contained in:
parent
dbe8ef1fb7
commit
890b557cb0
1 changed files with 22 additions and 15 deletions
|
|
@ -80,6 +80,7 @@ static double g_lockedOnTime;
|
||||||
static double g_lastTappedTime;
|
static double g_lastTappedTime;
|
||||||
static double g_lastIncrementTime;
|
static double g_lastIncrementTime;
|
||||||
static double g_lastIncrementSoundTime;
|
static double g_lastIncrementSoundTime;
|
||||||
|
static double g_fastIncrementHoldTime;
|
||||||
|
|
||||||
static constexpr size_t GRID_SIZE = 9;
|
static constexpr size_t GRID_SIZE = 9;
|
||||||
|
|
||||||
|
|
@ -1057,11 +1058,16 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
||||||
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;
|
constexpr double INCREMENT_SOUND_TIME = 1.0 / 7.5;
|
||||||
|
|
||||||
|
if (fastIncrement)
|
||||||
|
g_fastIncrementHoldTime += deltaTime;
|
||||||
|
else
|
||||||
|
g_fastIncrementHoldTime = 0;
|
||||||
|
|
||||||
if (fastIncrement)
|
if (fastIncrement)
|
||||||
{
|
{
|
||||||
isPlayIncrementSound = (time - g_lastIncrementSoundTime) > INCREMENT_SOUND_TIME;
|
isPlayIncrementSound = (time - g_lastIncrementSoundTime) > INCREMENT_SOUND_TIME;
|
||||||
|
|
||||||
if ((time - g_lastIncrementTime) < INCREMENT_TIME)
|
if (g_fastIncrementHoldTime < INCREMENT_TIME)
|
||||||
fastIncrement = false;
|
fastIncrement = false;
|
||||||
else
|
else
|
||||||
g_lastIncrementTime = time;
|
g_lastIncrementTime = time;
|
||||||
|
|
@ -1090,9 +1096,10 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
||||||
config->Value += 0.01f;
|
config->Value += 0.01f;
|
||||||
}
|
}
|
||||||
|
|
||||||
deltaTime -= INCREMENT_TIME;
|
if (fastIncrement)
|
||||||
|
g_fastIncrementHoldTime -= INCREMENT_TIME;
|
||||||
}
|
}
|
||||||
while (fastIncrement && deltaTime > 0.0f);
|
while (fastIncrement && g_fastIncrementHoldTime >= INCREMENT_TIME);
|
||||||
|
|
||||||
bool isConfigValueInBounds = config->Value >= valueMin && config->Value <= valueMax;
|
bool isConfigValueInBounds = config->Value >= valueMin && config->Value <= valueMax;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue