From 0b074f22111bfbf41e09cc85fa43b35b0547c57e Mon Sep 17 00:00:00 2001 From: Capostrophic Date: Sun, 30 Jun 2019 01:50:17 +0300 Subject: [PATCH] Rewrite messed up playerlooking switch handling (bug #5078) --- CHANGELOG.md | 1 + apps/openmw/mwbase/world.hpp | 1 - apps/openmw/mwinput/inputmanagerimp.cpp | 11 ++++------- apps/openmw/mwrender/camera.cpp | 6 ------ apps/openmw/mwrender/camera.hpp | 3 --- apps/openmw/mwrender/renderingmanager.cpp | 5 ----- apps/openmw/mwrender/renderingmanager.hpp | 1 - apps/openmw/mwworld/worldimp.cpp | 5 ----- apps/openmw/mwworld/worldimp.hpp | 2 -- 9 files changed, 5 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf1f80705..3f818b706 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -111,6 +111,7 @@ Bug #5069: Blocking creatures' attacks doesn't degrade shields Bug #5074: Paralyzed actors greet the player Bug #5075: Enchanting cast style can be changed if there's no object + Bug #5078: DisablePlayerLooking is broken Bug #5082: Scrolling with controller in GUI mode is broken Bug #5092: NPCs with enchanted weapons play sound when out of charges Bug #5093: Hand to hand sound plays on knocked out enemies diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 256c8b1d5..63f69ab65 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -407,7 +407,6 @@ namespace MWBase virtual void togglePreviewMode(bool enable) = 0; virtual bool toggleVanityMode(bool enable) = 0; virtual void allowVanityMode(bool allow) = 0; - virtual void togglePlayerLooking(bool enable) = 0; virtual void changeVanityModeScale(float factor) = 0; virtual bool vanityRotateCamera(float * rot) = 0; virtual void setCameraDistance(float dist, bool adjust = false, bool override = true)=0; diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 581a96e7b..d3b79806c 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -589,7 +589,7 @@ namespace MWInput rot[2] = xAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f) * (mInvertX ? -1 : 1); // Only actually turn player when we're not in vanity mode - if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot)) + if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot) && mControlSwitch["playerlooking"]) { mPlayer->yaw(rot[2]); mPlayer->pitch(rot[0]); @@ -827,9 +827,6 @@ namespace MWInput void InputManager::toggleControlSwitch (const std::string& sw, bool value) { - if (mControlSwitch[sw] == value) { - return; - } /// \note 7 switches at all, if-else is relevant if (sw == "playercontrols" && !value) { mPlayer->setLeftRight(0); @@ -841,8 +838,8 @@ namespace MWInput mPlayer->setUpDown(0); } else if (sw == "vanitymode") { MWBase::Environment::get().getWorld()->allowVanityMode(value); - } else if (sw == "playerlooking") { - MWBase::Environment::get().getWorld()->togglePlayerLooking(value); + } else if (sw == "playerlooking" && !value) { + MWBase::Environment::get().getWorld()->rotateObject(mPlayer->getPlayer(), 0.f, 0.f, 0.f); } mControlSwitch[sw] = value; } @@ -976,7 +973,7 @@ namespace MWInput rot[2] = -x; // Only actually turn player when we're not in vanity mode - if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot)) + if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot) && mControlSwitch["playerlooking"]) { mPlayer->yaw(x); mPlayer->pitch(y); diff --git a/apps/openmw/mwrender/camera.cpp b/apps/openmw/mwrender/camera.cpp index 74f2ba911..e0818101d 100644 --- a/apps/openmw/mwrender/camera.cpp +++ b/apps/openmw/mwrender/camera.cpp @@ -48,7 +48,6 @@ namespace MWRender mAnimation(nullptr), mFirstPersonView(true), mPreviewMode(false), - mFreeLook(true), mNearest(30.f), mFurthest(800.f), mIsNearest(false), @@ -393,11 +392,6 @@ namespace MWRender camera = focal + offset; } - void Camera::togglePlayerLooking(bool enable) - { - mFreeLook = enable; - } - bool Camera::isVanityOrPreviewModeEnabled() { return mPreviewMode || mVanity.enabled; diff --git a/apps/openmw/mwrender/camera.hpp b/apps/openmw/mwrender/camera.hpp index db5ad25f0..573cf936f 100644 --- a/apps/openmw/mwrender/camera.hpp +++ b/apps/openmw/mwrender/camera.hpp @@ -37,7 +37,6 @@ namespace MWRender bool mFirstPersonView; bool mPreviewMode; - bool mFreeLook; float mNearest; float mFurthest; bool mIsNearest; @@ -119,8 +118,6 @@ namespace MWRender /// Stores focal and camera world positions in passed arguments void getPosition(osg::Vec3f &focal, osg::Vec3f &camera); - void togglePlayerLooking(bool enable); - bool isVanityOrPreviewModeEnabled(); bool isNearest(); diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 0d9cbd9b0..c361ddf03 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -1353,11 +1353,6 @@ namespace MWRender mCamera->allowVanityMode(allow); } - void RenderingManager::togglePlayerLooking(bool enable) - { - mCamera->togglePlayerLooking(enable); - } - void RenderingManager::changeVanityModeScale(float factor) { if(mCamera->isVanityOrPreviewModeEnabled()) diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index 7fb436863..49da50be3 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -208,7 +208,6 @@ namespace MWRender void togglePreviewMode(bool enable); bool toggleVanityMode(bool enable); void allowVanityMode(bool allow); - void togglePlayerLooking(bool enable); void changeVanityModeScale(float factor); /// temporarily override the field of view with given value. diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 3426e9115..73962c8f2 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -2389,11 +2389,6 @@ namespace MWWorld mRendering->allowVanityMode(allow); } - void World::togglePlayerLooking(bool enable) - { - mRendering->togglePlayerLooking(enable); - } - void World::changeVanityModeScale(float factor) { mRendering->changeVanityModeScale(factor); diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index dd915c8bd..a8963a909 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -526,8 +526,6 @@ namespace MWWorld void allowVanityMode(bool allow) override; - void togglePlayerLooking(bool enable) override; - void changeVanityModeScale(float factor) override; bool vanityRotateCamera(float * rot) override;