forked from teamnwah/openmw-tes3coop
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();
|
||||
|
||||
if(mJoystickLastUsed)
|
||||
{
|
||||
if (mGuiCursorEnabled)
|
||||
{
|
||||
float xAxis = mInputBinder->getChannel(A_MoveLeftRight)->getValue()*2.0f-1.0f;
|
||||
|
@ -428,7 +426,6 @@ namespace MWInput
|
|||
mPlayer->pitch(rot[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Disable movement in Gui mode
|
||||
if (!(MWBase::Environment::get().getWindowManager()->isGuiMode()
|
||||
|
@ -440,8 +437,8 @@ namespace MWInput
|
|||
{
|
||||
bool triedToMove = false;
|
||||
bool isRunning = false;
|
||||
if(mJoystickLastUsed)
|
||||
{
|
||||
|
||||
// joystick movement
|
||||
float xAxis = mInputBinder->getChannel(A_MoveLeftRight)->getValue();
|
||||
float yAxis = mInputBinder->getChannel(A_MoveForwardBackward)->getValue();
|
||||
if (xAxis < .5)
|
||||
|
@ -467,17 +464,18 @@ namespace MWInput
|
|||
mPlayer->setAutoMove (false);
|
||||
mPlayer->setForwardBackward (-1);
|
||||
}
|
||||
|
||||
else if(mPlayer->getAutoMove())
|
||||
{
|
||||
triedToMove = true;
|
||||
mPlayer->setForwardBackward (1);
|
||||
}
|
||||
if (triedToMove)
|
||||
mJoystickLastUsed = true;
|
||||
|
||||
// keyboard movement
|
||||
isRunning = xAxis > .75 || xAxis < .25 || yAxis > .75 || yAxis < .25;
|
||||
if(triedToMove) resetIdleTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (actionIsActive(A_MoveLeft))
|
||||
{
|
||||
triedToMove = true;
|
||||
|
@ -507,7 +505,6 @@ namespace MWInput
|
|||
triedToMove = true;
|
||||
mPlayer->setForwardBackward (1);
|
||||
}
|
||||
}
|
||||
|
||||
if (!mSneakToggles)
|
||||
{
|
||||
|
@ -851,7 +848,6 @@ namespace MWInput
|
|||
|
||||
void InputManager::axisMoved(int deviceID, const SDL_ControllerAxisEvent &arg )
|
||||
{
|
||||
mJoystickLastUsed = true;
|
||||
if (!mControlsDisabled)
|
||||
mInputBinder->axisMoved(deviceID, arg);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue