Merge pull request #230 from OpenMW/master

Add OpenMW commits up to 25 Jun 2017
0.6.1
David Cernat 8 years ago committed by GitHub
commit 77758596a1

@ -416,6 +416,8 @@ namespace MWInput
{ {
float xAxis = mInputBinder->getChannel(A_LookLeftRight)->getValue()*2.0f-1.0f; float xAxis = mInputBinder->getChannel(A_LookLeftRight)->getValue()*2.0f-1.0f;
float yAxis = mInputBinder->getChannel(A_LookUpDown)->getValue()*2.0f-1.0f; float yAxis = mInputBinder->getChannel(A_LookUpDown)->getValue()*2.0f-1.0f;
if (xAxis != 0 || yAxis != 0)
{
resetIdleTime(); resetIdleTime();
float rot[3]; float rot[3];
@ -430,6 +432,7 @@ namespace MWInput
mPlayer->pitch(rot[0]); mPlayer->pitch(rot[0]);
} }
} }
}
// Disable movement in Gui mode // Disable movement in Gui mode
if (!(MWBase::Environment::get().getWindowManager()->isGuiMode() if (!(MWBase::Environment::get().getWindowManager()->isGuiMode()
@ -714,7 +717,7 @@ namespace MWInput
if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0) if (MyGUI::InputManager::getInstance ().getMouseFocusWidget () != 0)
{ {
MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false); MyGUI::Button* b = MyGUI::InputManager::getInstance ().getMouseFocusWidget ()->castType<MyGUI::Button>(false);
if (b && b->getEnabled()) if (b && b->getEnabled() && id == SDL_BUTTON_LEFT)
{ {
MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f); MWBase::Environment::get().getSoundManager ()->playSound ("Menu Click", 1.f, 1.f);
} }
@ -1268,7 +1271,7 @@ namespace MWInput
if (!controlExists) if (!controlExists)
{ {
float initial; float initial;
if (defaultButtonBindings.find(i) != defaultButtonBindings.end()) if (defaultAxisBindings.find(i) == defaultAxisBindings.end())
initial = 0.0f; initial = 0.0f;
else initial = 0.5f; else initial = 0.5f;
control = new ICS::Control(std::to_string(i), false, true, initial, ICS::ICS_MAX, ICS::ICS_MAX); control = new ICS::Control(std::to_string(i), false, true, initial, ICS::ICS_MAX, ICS::ICS_MAX);
@ -1284,12 +1287,13 @@ namespace MWInput
{ {
clearAllControllerBindings(control); clearAllControllerBindings(control);
if (defaultButtonBindings.find(i) != defaultButtonBindings.end()) if (defaultButtonBindings.find(i) != defaultButtonBindings.end()
&& !mInputBinder->isJoystickButtonBound(mFakeDeviceID, defaultButtonBindings[i]))
{ {
control->setInitialValue(0.0f); control->setInitialValue(0.0f);
mInputBinder->addJoystickButtonBinding(control, mFakeDeviceID, defaultButtonBindings[i], ICS::Control::INCREASE); 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->setValue(0.5f);
control->setInitialValue(0.5f); control->setInitialValue(0.5f);

@ -511,6 +511,8 @@ namespace MWWorld
mechMgr->updateCell(old, player); mechMgr->updateCell(old, player);
mechMgr->watchActor(player); mechMgr->watchActor(player);
mPhysics->updatePtr(old, player);
MWBase::Environment::get().getWorld()->adjustSky(); MWBase::Environment::get().getWorld()->adjustSky();
mLastPlayerPos = pos.asVec3(); mLastPlayerPos = pos.asVec3();

@ -120,6 +120,8 @@ namespace ICS
bool isMouseButtonBound(unsigned int button) const; bool isMouseButtonBound(unsigned int button) const;
void addJoystickAxisBinding(Control* control, int deviceID, int axis, Control::ControlChangingDirection direction); void addJoystickAxisBinding(Control* control, int deviceID, int axis, Control::ControlChangingDirection direction);
void addJoystickButtonBinding(Control* control, int deviceID, unsigned int button, 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 removeKeyBinding(SDL_Scancode key);
void removeMouseAxisBinding(NamedAxis axis); void removeMouseAxisBinding(NamedAxis axis);
void removeMouseButtonBinding(unsigned int button); void removeMouseButtonBinding(unsigned int button);

@ -78,6 +78,9 @@ namespace ICS
// add bindings // add bindings
void InputControlSystem::addJoystickAxisBinding(Control* control, int deviceID, int axis, Control::ControlChangingDirection direction) 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=" ICS_LOG("\tAdding AxisBinder [axis="
+ ToString<int>(axis) + ", deviceID=" + ToString<int>(axis) + ", deviceID="
+ ToString<int>(deviceID) + ", direction=" + ToString<int>(deviceID) + ", direction="
@ -93,6 +96,9 @@ namespace ICS
void InputControlSystem::addJoystickButtonBinding(Control* control, int deviceID, unsigned int button, Control::ControlChangingDirection direction) 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=" ICS_LOG("\tAdding JoystickButtonBinder [button="
+ ToString<int>(button) + ", deviceID=" + ToString<int>(button) + ", deviceID="
+ ToString<int>(deviceID) + ", direction=" + ToString<int>(deviceID) + ", direction="
@ -104,6 +110,24 @@ namespace ICS
mControlsJoystickButtonBinderMap[deviceID][button] = controlJoystickButtonBinderItem; 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 // get bindings
int InputControlSystem::getJoystickAxisBinding(Control* control, int deviceID, ICS::Control::ControlChangingDirection direction) int InputControlSystem::getJoystickAxisBinding(Control* control, int deviceID, ICS::Control::ControlChangingDirection direction)
{ {

Loading…
Cancel
Save