mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Merge branch 'gamepad-sneak-shortcut' into 'master'
Gamepad - Toggle Sneak Shortcut See merge request OpenMW/openmw!73
This commit is contained in:
commit
cf20682d0c
2 changed files with 33 additions and 1 deletions
|
@ -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…
Reference in a new issue