Merge branch 'gamepad-sneak-shortcut' into 'master'

Gamepad - Toggle Sneak Shortcut

See merge request OpenMW/openmw!73
pull/541/head
Bret Curtis 6 years ago
commit cf20682d0c

@ -71,6 +71,8 @@ namespace MWInput
, mUserFileExists(userFileExists)
, mAlwaysRunActive(Settings::Manager::getBool("always run", "Input"))
, mSneakToggles(Settings::Manager::getBool("toggle sneak", "Input"))
, mSneakToggleShortcutTimer(0.f)
, mSneakGamepadShortcut(false)
, mSneaking(false)
, mAttemptJump(false)
, mInvUiScalingFactor(1.f)
@ -579,7 +581,35 @@ namespace MWInput
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"])

@ -200,6 +200,8 @@ namespace MWInput
bool mUserFileExists;
bool mAlwaysRunActive;
bool mSneakToggles;
float mSneakToggleShortcutTimer;
bool mSneakGamepadShortcut;
bool mSneaking;
bool mAttemptJump;

Loading…
Cancel
Save