1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-29 22:36:43 +00:00

Merge branch 'restore-gamepad-zoom' into 'master'

Restore Gamepad Zooming

See merge request OpenMW/openmw!276
This commit is contained in:
psi29a 2020-08-04 06:04:59 +00:00
commit a753dc74b1
6 changed files with 15 additions and 3 deletions

View file

@ -416,6 +416,7 @@ namespace MWBase
virtual void togglePOV(bool force = false) = 0; virtual void togglePOV(bool force = false) = 0;
virtual bool isFirstPerson() const = 0; virtual bool isFirstPerson() const = 0;
virtual bool isPreviewModeEnabled() const = 0;
virtual void togglePreviewMode(bool enable) = 0; virtual void togglePreviewMode(bool enable) = 0;
virtual bool toggleVanityMode(bool enable) = 0; virtual bool toggleVanityMode(bool enable) = 0;
virtual void allowVanityMode(bool allow) = 0; virtual void allowVanityMode(bool allow) = 0;

View file

@ -167,6 +167,11 @@ namespace MWInput
mAttemptJump = false; mAttemptJump = false;
} }
bool ActionManager::isPreviewModeEnabled()
{
return MWBase::Environment::get().getWorld()->isPreviewModeEnabled();
}
void ActionManager::resetIdleTime() void ActionManager::resetIdleTime()
{ {

View file

@ -54,7 +54,7 @@ namespace MWInput
void setAttemptJump(bool enabled) { mAttemptJump = enabled; } void setAttemptJump(bool enabled) { mAttemptJump = enabled; }
float getPreviewDelay() const { return mPreviewPOVDelay; }; bool isPreviewModeEnabled();
private: private:
void handleGuiArrowKey(int action); void handleGuiArrowKey(int action);

View file

@ -89,7 +89,7 @@ namespace MWInput
bool ControllerManager::update(float dt) bool ControllerManager::update(float dt)
{ {
mGamepadPreviewMode = mActionManager->getPreviewDelay() == 1.f; mGamepadPreviewMode = mActionManager->isPreviewModeEnabled();
if (mGuiCursorEnabled && !(mJoystickLastUsed && !mGamepadGuiCursorEnabled)) if (mGuiCursorEnabled && !(mJoystickLastUsed && !mGamepadGuiCursorEnabled))
{ {
@ -287,7 +287,7 @@ namespace MWInput
} }
else else
{ {
if (mGamepadPreviewMode && arg.value) // Preview Mode Gamepad Zooming if (mGamepadPreviewMode) // Preview Mode Gamepad Zooming
{ {
if (arg.axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) if (arg.axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT)
{ {

View file

@ -2394,6 +2394,11 @@ namespace MWWorld
{ {
return mRendering->getCamera()->isFirstPerson(); return mRendering->getCamera()->isFirstPerson();
} }
bool World::isPreviewModeEnabled() const
{
return mRendering->getCamera()->getMode() == MWRender::Camera::Mode::Preview;
}
void World::togglePreviewMode(bool enable) void World::togglePreviewMode(bool enable)
{ {

View file

@ -524,6 +524,7 @@ namespace MWWorld
void togglePOV(bool force = false) override; void togglePOV(bool force = false) override;
bool isFirstPerson() const override; bool isFirstPerson() const override;
bool isPreviewModeEnabled() const override;
void togglePreviewMode(bool enable) override; void togglePreviewMode(bool enable) override;