forked from teamnwah/openmw-tes3coop
Add toggle sneak option; fix bug #2119
To enable toggle sneak mode, set "toggle sneak = true" in the [Input] section of settings.cfg. Outstanding issues: - In toggle sneak mode, holding the Sneak button causes rapid, repeated toggling. - The button in the settings menu doesn't do anything.
This commit is contained in:
parent
36141b0c53
commit
ba7fc8609c
4 changed files with 37 additions and 5 deletions
|
@ -124,6 +124,8 @@ namespace MWInput
|
|||
, mTimeIdle(0.f)
|
||||
, mOverencumberedMessageDelay(0.f)
|
||||
, mAlwaysRunActive(Settings::Manager::getBool("always run", "Input"))
|
||||
, mSneakToggles(Settings::Manager::getBool("toggle sneak", "Input"))
|
||||
, mSneaking(false)
|
||||
, mAttemptJump(false)
|
||||
, mControlsDisabled(false)
|
||||
, mJoystickLastUsed(false)
|
||||
|
@ -522,7 +524,16 @@ namespace MWInput
|
|||
}
|
||||
}
|
||||
|
||||
mPlayer->setSneak(actionIsActive(A_Sneak));
|
||||
if (mSneakToggles)
|
||||
{
|
||||
if (actionIsActive(A_Sneak))
|
||||
{
|
||||
toggleSneaking();
|
||||
mPlayer->setSneak(mSneaking);
|
||||
}
|
||||
}
|
||||
else
|
||||
mPlayer->setSneak(actionIsActive(A_Sneak));
|
||||
|
||||
if (mAttemptJump && mControlSwitch["playerjumping"])
|
||||
{
|
||||
|
@ -1089,6 +1100,12 @@ namespace MWInput
|
|||
Settings::Manager::setBool("always run", "Input", mAlwaysRunActive);
|
||||
}
|
||||
|
||||
void InputManager::toggleSneaking()
|
||||
{
|
||||
if (MWBase::Environment::get().getWindowManager()->isGuiMode()) return;
|
||||
mSneaking = !mSneaking;
|
||||
}
|
||||
|
||||
void InputManager::resetIdleTime()
|
||||
{
|
||||
if (mTimeIdle < 0)
|
||||
|
|
|
@ -180,6 +180,8 @@ namespace MWInput
|
|||
int mMouseWheel;
|
||||
bool mUserFileExists;
|
||||
bool mAlwaysRunActive;
|
||||
bool mSneakToggles;
|
||||
bool mSneaking;
|
||||
bool mAttemptJump;
|
||||
|
||||
std::map<std::string, bool> mControlSwitch;
|
||||
|
@ -208,6 +210,7 @@ namespace MWInput
|
|||
void toggleJournal();
|
||||
void activate();
|
||||
void toggleWalking();
|
||||
void toggleSneaking();
|
||||
void toggleAutoMove();
|
||||
void rest();
|
||||
void quickLoad();
|
||||
|
|
|
@ -196,10 +196,20 @@
|
|||
<Property key="Caption" value="#{sMouseFlip}"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
<Widget type="TextBox" skin="NormalText" position="4 254 336 18" align="Left Bottom">
|
||||
<Widget type="HBox" skin="" position="4 254 300 24" align="Left Bottom">
|
||||
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 24 24" align="Left Bottom" name="ToggleSneak">
|
||||
<UserString key="SettingCategory" value="Input"/>
|
||||
<UserString key="SettingName" value="toggle sneak"/>
|
||||
<UserString key="SettingType" value="CheckButton"/>
|
||||
</Widget>
|
||||
<Widget type="AutoSizedTextBox" skin="SandText" position="28 4 78 16" align="Left Bottom">
|
||||
<Property key="Caption" value="Toggle Sneak"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
<Widget type="TextBox" skin="NormalText" position="4 278 336 18" align="Left Bottom">
|
||||
<Property key="Caption" value="Camera sensitivity"/>
|
||||
</Widget>
|
||||
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 278 336 18" align="HStretch Bottom" name="CameraSensitivitySlider">
|
||||
<Widget type="MWScrollBar" skin="MW_HScroll" position="4 302 336 18" align="HStretch Bottom" name="CameraSensitivitySlider">
|
||||
<Property key="Range" value="10000"/>
|
||||
<Property key="Page" value="300"/>
|
||||
<UserString key="SettingType" value="Slider"/>
|
||||
|
@ -209,11 +219,11 @@
|
|||
<UserString key="SettingMin" value="0.2"/>
|
||||
<UserString key="SettingMax" value="5.0"/>
|
||||
</Widget>
|
||||
<Widget type="TextBox" skin="SandText" position="4 302 336 18" align="Left Bottom">
|
||||
<Widget type="TextBox" skin="SandText" position="4 326 336 18" align="Left Bottom">
|
||||
<Property key="Caption" value="#{sLow}"/>
|
||||
<Property key="TextAlign" value="Left"/>
|
||||
</Widget>
|
||||
<Widget type="TextBox" skin="SandText" position="4 302 336 18" align="Right Bottom">
|
||||
<Widget type="TextBox" skin="SandText" position="4 326 336 18" align="Right Bottom">
|
||||
<Property key="Caption" value="#{sHigh}"/>
|
||||
<Property key="TextAlign" value="Right"/>
|
||||
</Widget>
|
||||
|
|
|
@ -194,6 +194,8 @@ always run = false
|
|||
|
||||
allow third person zoom = false
|
||||
|
||||
toggle sneak = false
|
||||
|
||||
[Game]
|
||||
# Always use the most powerful attack when striking with a weapon (chop, slash or thrust)
|
||||
best attack = false
|
||||
|
|
Loading…
Reference in a new issue