mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 06:39:42 +00:00
Derive sneaking state from character data
This commit is contained in:
parent
de83a41de6
commit
60491cc896
2 changed files with 8 additions and 5 deletions
|
@ -37,7 +37,6 @@ namespace MWInput
|
|||
, mScreenCaptureHandler(screenCaptureHandler)
|
||||
, mScreenCaptureOperation(screenCaptureOperation)
|
||||
, mAlwaysRunActive(Settings::Manager::getBool("always run", "Input"))
|
||||
, mSneaking(false)
|
||||
, mAttemptJump(false)
|
||||
, mTimeIdle(0.f)
|
||||
{
|
||||
|
@ -535,15 +534,20 @@ namespace MWInput
|
|||
Settings::Manager::setBool("always run", "Input", mAlwaysRunActive);
|
||||
}
|
||||
|
||||
bool ActionManager::isSneaking() const
|
||||
{
|
||||
const MWBase::Environment& env = MWBase::Environment::get();
|
||||
return env.getMechanicsManager()->isSneaking(env.getWorld()->getPlayer().getPlayer());
|
||||
}
|
||||
|
||||
void ActionManager::toggleSneaking()
|
||||
{
|
||||
if (MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||
return;
|
||||
if (!MWBase::Environment::get().getInputManager()->getControlSwitch("playercontrols"))
|
||||
return;
|
||||
mSneaking = !mSneaking;
|
||||
MWWorld::Player& player = MWBase::Environment::get().getWorld()->getPlayer();
|
||||
player.setSneak(mSneaking);
|
||||
player.setSneak(!isSneaking());
|
||||
}
|
||||
|
||||
void ActionManager::handleGuiArrowKey(int action)
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace MWInput
|
|||
float getIdleTime() const { return mTimeIdle; }
|
||||
|
||||
bool isAlwaysRunActive() const { return mAlwaysRunActive; }
|
||||
bool isSneaking() const { return mSneaking; }
|
||||
bool isSneaking() const;
|
||||
|
||||
void setAttemptJump(bool enabled) { mAttemptJump = enabled; }
|
||||
|
||||
|
@ -62,7 +62,6 @@ namespace MWInput
|
|||
osgViewer::ScreenCaptureHandler::CaptureOperation* mScreenCaptureOperation;
|
||||
|
||||
bool mAlwaysRunActive;
|
||||
bool mSneaking;
|
||||
bool mAttemptJump;
|
||||
|
||||
float mTimeIdle;
|
||||
|
|
Loading…
Reference in a new issue