mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-21 11:44:06 +00:00
Allow gamepad and mouse/keyboard to be used at the same time (Fixes #3093)
This commit is contained in:
parent
29556a1802
commit
2776727794
1 changed files with 98 additions and 102 deletions
|
@ -386,8 +386,6 @@ namespace MWInput
|
||||||
|
|
||||||
updateCursorMode();
|
updateCursorMode();
|
||||||
|
|
||||||
if(mJoystickLastUsed)
|
|
||||||
{
|
|
||||||
if (mGuiCursorEnabled)
|
if (mGuiCursorEnabled)
|
||||||
{
|
{
|
||||||
float xAxis = mInputBinder->getChannel(A_MoveLeftRight)->getValue()*2.0f-1.0f;
|
float xAxis = mInputBinder->getChannel(A_MoveLeftRight)->getValue()*2.0f-1.0f;
|
||||||
|
@ -428,7 +426,6 @@ 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()
|
||||||
|
@ -440,8 +437,8 @@ namespace MWInput
|
||||||
{
|
{
|
||||||
bool triedToMove = false;
|
bool triedToMove = false;
|
||||||
bool isRunning = false;
|
bool isRunning = false;
|
||||||
if(mJoystickLastUsed)
|
|
||||||
{
|
// joystick movement
|
||||||
float xAxis = mInputBinder->getChannel(A_MoveLeftRight)->getValue();
|
float xAxis = mInputBinder->getChannel(A_MoveLeftRight)->getValue();
|
||||||
float yAxis = mInputBinder->getChannel(A_MoveForwardBackward)->getValue();
|
float yAxis = mInputBinder->getChannel(A_MoveForwardBackward)->getValue();
|
||||||
if (xAxis < .5)
|
if (xAxis < .5)
|
||||||
|
@ -467,17 +464,18 @@ namespace MWInput
|
||||||
mPlayer->setAutoMove (false);
|
mPlayer->setAutoMove (false);
|
||||||
mPlayer->setForwardBackward (-1);
|
mPlayer->setForwardBackward (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(mPlayer->getAutoMove())
|
else if(mPlayer->getAutoMove())
|
||||||
{
|
{
|
||||||
triedToMove = true;
|
triedToMove = true;
|
||||||
mPlayer->setForwardBackward (1);
|
mPlayer->setForwardBackward (1);
|
||||||
}
|
}
|
||||||
|
if (triedToMove)
|
||||||
|
mJoystickLastUsed = true;
|
||||||
|
|
||||||
|
// keyboard movement
|
||||||
isRunning = xAxis > .75 || xAxis < .25 || yAxis > .75 || yAxis < .25;
|
isRunning = xAxis > .75 || xAxis < .25 || yAxis > .75 || yAxis < .25;
|
||||||
if(triedToMove) resetIdleTime();
|
if(triedToMove) resetIdleTime();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (actionIsActive(A_MoveLeft))
|
if (actionIsActive(A_MoveLeft))
|
||||||
{
|
{
|
||||||
triedToMove = true;
|
triedToMove = true;
|
||||||
|
@ -507,7 +505,6 @@ namespace MWInput
|
||||||
triedToMove = true;
|
triedToMove = true;
|
||||||
mPlayer->setForwardBackward (1);
|
mPlayer->setForwardBackward (1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!mSneakToggles)
|
if (!mSneakToggles)
|
||||||
{
|
{
|
||||||
|
@ -851,7 +848,6 @@ namespace MWInput
|
||||||
|
|
||||||
void InputManager::axisMoved(int deviceID, const SDL_ControllerAxisEvent &arg )
|
void InputManager::axisMoved(int deviceID, const SDL_ControllerAxisEvent &arg )
|
||||||
{
|
{
|
||||||
mJoystickLastUsed = true;
|
|
||||||
if (!mControlsDisabled)
|
if (!mControlsDisabled)
|
||||||
mInputBinder->axisMoved(deviceID, arg);
|
mInputBinder->axisMoved(deviceID, arg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue