From 534c81976cfeca9755fef872d4a6d1039acb91c4 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jun 2017 12:47:57 +0200 Subject: [PATCH 1/5] Add missing cell update for physics system (Fixes #3917) --- apps/openmw/mwworld/scene.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 2467af646..bec053bc0 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -461,6 +461,8 @@ namespace MWWorld mechMgr->updateCell(old, player); mechMgr->watchActor(player); + mPhysics->updatePtr(old, player); + MWBase::Environment::get().getWorld()->adjustSky(); mLastPlayerPos = pos.asVec3(); From 44e2089098cb520cb292a93515ddafdd8643dd89 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jun 2017 12:52:59 +0200 Subject: [PATCH 2/5] Don't play 'menu click' sound for right clicks (Fixes #3919) --- apps/openmw/mwinput/inputmanagerimp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 19b746d5d..242a2cafc 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -710,7 +710,7 @@ namespace MWInput if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0) { MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType(false); - if (b && b->getEnabled()) + if (b && b->getEnabled() && id == SDL_BUTTON_LEFT) { MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f); } From 903e59f4956f9eb2c49e57a3de17717facde60eb Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jun 2017 13:08:55 +0200 Subject: [PATCH 3/5] Don't reset idle time when there is no camera movement (Fixes #3902) --- apps/openmw/mwinput/inputmanagerimp.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 242a2cafc..73e0c6d30 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -413,18 +413,21 @@ namespace MWInput { float xAxis = mInputBinder->getChannel(A_LookLeftRight)->getValue()*2.0f-1.0f; float yAxis = mInputBinder->getChannel(A_LookUpDown)->getValue()*2.0f-1.0f; - resetIdleTime(); + if (xAxis != 0 || yAxis != 0) + { + resetIdleTime(); - float rot[3]; - rot[0] = yAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f) * (mInvertY ? -1 : 1) * mCameraYMultiplier; - rot[1] = 0.0f; - rot[2] = xAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f); + float rot[3]; + rot[0] = yAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f) * (mInvertY ? -1 : 1) * mCameraYMultiplier; + rot[1] = 0.0f; + rot[2] = xAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f); - // Only actually turn player when we're not in vanity mode - if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot)) - { - mPlayer->yaw(rot[2]); - mPlayer->pitch(rot[0]); + // Only actually turn player when we're not in vanity mode + if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot)) + { + mPlayer->yaw(rot[2]); + mPlayer->pitch(rot[0]); + } } } From ca5b351eef448c52950be08580014380ff5c49de Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jun 2017 14:43:03 +0200 Subject: [PATCH 4/5] Fix saved joystick bindings being discarded when running without joystick connected --- extern/oics/ICSInputControlSystem_joystick.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extern/oics/ICSInputControlSystem_joystick.cpp b/extern/oics/ICSInputControlSystem_joystick.cpp index ab219d074..5beaf27c4 100644 --- a/extern/oics/ICSInputControlSystem_joystick.cpp +++ b/extern/oics/ICSInputControlSystem_joystick.cpp @@ -78,6 +78,9 @@ namespace ICS // add bindings void InputControlSystem::addJoystickAxisBinding(Control* control, int deviceID, int axis, Control::ControlChangingDirection direction) { + if (std::find(mJoystickIDList.begin(), mJoystickIDList.end(), deviceID) == mJoystickIDList.end()) + mJoystickIDList.push_back(deviceID); + ICS_LOG("\tAdding AxisBinder [axis=" + ToString(axis) + ", deviceID=" + ToString(deviceID) + ", direction=" @@ -93,6 +96,9 @@ namespace ICS void InputControlSystem::addJoystickButtonBinding(Control* control, int deviceID, unsigned int button, Control::ControlChangingDirection direction) { + if (std::find(mJoystickIDList.begin(), mJoystickIDList.end(), deviceID) == mJoystickIDList.end()) + mJoystickIDList.push_back(deviceID); // Hack: add the device to the list so bindings are saved in save() even when joystick is not connected + ICS_LOG("\tAdding JoystickButtonBinder [button=" + ToString(button) + ", deviceID=" + ToString(deviceID) + ", direction=" From 8d17565efdacfc6d627b4f4cad2166e20c4f7e9b Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 25 Jun 2017 14:43:56 +0200 Subject: [PATCH 5/5] Fix joystick binding for an action being discarded when default for another action is loaded (Bug #3900) --- apps/openmw/mwinput/inputmanagerimp.cpp | 7 ++++--- extern/oics/ICSInputControlSystem.h | 2 ++ extern/oics/ICSInputControlSystem_joystick.cpp | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 73e0c6d30..283147ca9 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -1243,7 +1243,7 @@ namespace MWInput if (!controlExists) { float initial; - if (defaultButtonBindings.find(i) != defaultButtonBindings.end()) + if (defaultAxisBindings.find(i) == defaultAxisBindings.end()) initial = 0.0f; else initial = 0.5f; control = new ICS::Control(std::to_string(i), false, true, initial, ICS::ICS_MAX, ICS::ICS_MAX); @@ -1259,12 +1259,13 @@ namespace MWInput { clearAllControllerBindings(control); - if (defaultButtonBindings.find(i) != defaultButtonBindings.end()) + if (defaultButtonBindings.find(i) != defaultButtonBindings.end() + && !mInputBinder->isJoystickButtonBound(mFakeDeviceID, defaultButtonBindings[i])) { control->setInitialValue(0.0f); mInputBinder->addJoystickButtonBinding(control, mFakeDeviceID, defaultButtonBindings[i], ICS::Control::INCREASE); } - else if (defaultAxisBindings.find(i) != defaultAxisBindings.end()) + else if (defaultAxisBindings.find(i) != defaultAxisBindings.end() && !mInputBinder->isJoystickAxisBound(mFakeDeviceID, defaultAxisBindings[i])) { control->setValue(0.5f); control->setInitialValue(0.5f); diff --git a/extern/oics/ICSInputControlSystem.h b/extern/oics/ICSInputControlSystem.h index 308b54c3b..0e8e6ecad 100644 --- a/extern/oics/ICSInputControlSystem.h +++ b/extern/oics/ICSInputControlSystem.h @@ -120,6 +120,8 @@ namespace ICS bool isMouseButtonBound(unsigned int button) const; void addJoystickAxisBinding(Control* control, int deviceID, int axis, Control::ControlChangingDirection direction); void addJoystickButtonBinding(Control* control, int deviceID, unsigned int button, Control::ControlChangingDirection direction); + bool isJoystickButtonBound(int deviceID, unsigned int button) const; + bool isJoystickAxisBound(int deviceID, unsigned int axis) const; void removeKeyBinding(SDL_Scancode key); void removeMouseAxisBinding(NamedAxis axis); void removeMouseButtonBinding(unsigned int button); diff --git a/extern/oics/ICSInputControlSystem_joystick.cpp b/extern/oics/ICSInputControlSystem_joystick.cpp index 5beaf27c4..ed6e2f664 100644 --- a/extern/oics/ICSInputControlSystem_joystick.cpp +++ b/extern/oics/ICSInputControlSystem_joystick.cpp @@ -110,6 +110,24 @@ namespace ICS mControlsJoystickButtonBinderMap[deviceID][button] = controlJoystickButtonBinderItem; } + bool InputControlSystem::isJoystickButtonBound(int deviceID, unsigned int button) const + { + JoystickButtonBinderMapType::const_iterator found = mControlsJoystickButtonBinderMap.find(deviceID); + if (found == mControlsJoystickButtonBinderMap.end()) + return false; + + return (found->second.find(button) != found->second.end()); + } + + bool InputControlSystem::isJoystickAxisBound(int deviceID, unsigned int axis) const + { + JoystickAxisBinderMapType::const_iterator found = mControlsJoystickAxisBinderMap.find(deviceID); + if (found == mControlsJoystickAxisBinderMap.end()) + return false; + + return (found->second.find(axis) != found->second.end()); + } + // get bindings int InputControlSystem::getJoystickAxisBinding(Control* control, int deviceID, ICS::Control::ControlChangingDirection direction) {