mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-25 12:41:01 +00:00
Enable toggling sneak via gamepad.
This commit is contained in:
parent
3ce261ddd4
commit
3ac5481ab4
@ -71,6 +71,8 @@ namespace MWInput
|
|||||||
, mUserFileExists(userFileExists)
|
, mUserFileExists(userFileExists)
|
||||||
, mAlwaysRunActive(Settings::Manager::getBool("always run", "Input"))
|
, mAlwaysRunActive(Settings::Manager::getBool("always run", "Input"))
|
||||||
, mSneakToggles(Settings::Manager::getBool("toggle sneak", "Input"))
|
, mSneakToggles(Settings::Manager::getBool("toggle sneak", "Input"))
|
||||||
|
, mSneakToggleShortcutTimer(0.f)
|
||||||
|
, mSneakGamepadShortcut(false)
|
||||||
, mSneaking(false)
|
, mSneaking(false)
|
||||||
, mAttemptJump(false)
|
, mAttemptJump(false)
|
||||||
, mInvUiScalingFactor(1.f)
|
, mInvUiScalingFactor(1.f)
|
||||||
@ -579,7 +581,35 @@ namespace MWInput
|
|||||||
|
|
||||||
if (!mSneakToggles)
|
if (!mSneakToggles)
|
||||||
{
|
{
|
||||||
mPlayer->setSneak(actionIsActive(A_Sneak));
|
if(mJoystickLastUsed)
|
||||||
|
{
|
||||||
|
if(actionIsActive(A_Sneak))
|
||||||
|
{
|
||||||
|
if(mSneakToggleShortcutTimer) // New Sneak Button Press
|
||||||
|
{
|
||||||
|
if(mSneakToggleShortcutTimer <= 0.3f)
|
||||||
|
{
|
||||||
|
mSneakGamepadShortcut = true;
|
||||||
|
toggleSneaking();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mSneakGamepadShortcut = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!mSneaking)
|
||||||
|
toggleSneaking();
|
||||||
|
mSneakToggleShortcutTimer = 0.f;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!mSneakGamepadShortcut && mSneaking)
|
||||||
|
toggleSneaking();
|
||||||
|
if(mSneakToggleShortcutTimer <= 0.3f)
|
||||||
|
mSneakToggleShortcutTimer += dt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mPlayer->setSneak(actionIsActive(A_Sneak));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mAttemptJump && mControlSwitch["playerjumping"])
|
if (mAttemptJump && mControlSwitch["playerjumping"])
|
||||||
|
@ -200,6 +200,8 @@ namespace MWInput
|
|||||||
bool mUserFileExists;
|
bool mUserFileExists;
|
||||||
bool mAlwaysRunActive;
|
bool mAlwaysRunActive;
|
||||||
bool mSneakToggles;
|
bool mSneakToggles;
|
||||||
|
float mSneakToggleShortcutTimer;
|
||||||
|
bool mSneakGamepadShortcut;
|
||||||
bool mSneaking;
|
bool mSneaking;
|
||||||
bool mAttemptJump;
|
bool mAttemptJump;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user