mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 21:35:24 +00:00
Correct always run behavior when both a gamepad and a keyboard are used
This commit is contained in:
parent
2436652181
commit
70635ed1e2
@ -606,6 +606,7 @@ namespace MWInput
|
|||||||
{
|
{
|
||||||
bool triedToMove = false;
|
bool triedToMove = false;
|
||||||
bool isRunning = false;
|
bool isRunning = false;
|
||||||
|
bool alwaysRunAllowed = false;
|
||||||
|
|
||||||
// joystick movement
|
// joystick movement
|
||||||
float xAxis = mInputBinder->getChannel(A_MoveLeftRight)->getValue();
|
float xAxis = mInputBinder->getChannel(A_MoveLeftRight)->getValue();
|
||||||
@ -634,31 +635,23 @@ namespace MWInput
|
|||||||
isRunning = xAxis > .75 || xAxis < .25 || yAxis > .75 || yAxis < .25;
|
isRunning = xAxis > .75 || xAxis < .25 || yAxis > .75 || yAxis < .25;
|
||||||
if(triedToMove) resetIdleTime();
|
if(triedToMove) resetIdleTime();
|
||||||
|
|
||||||
if (actionIsActive(A_MoveLeft) && !actionIsActive(A_MoveRight))
|
if (actionIsActive(A_MoveLeft) != actionIsActive(A_MoveRight))
|
||||||
{
|
{
|
||||||
|
alwaysRunAllowed = true;
|
||||||
triedToMove = true;
|
triedToMove = true;
|
||||||
mPlayer->setLeftRight (-1);
|
mPlayer->setLeftRight (actionIsActive(A_MoveRight) ? 1 : -1);
|
||||||
}
|
|
||||||
else if (actionIsActive(A_MoveRight) && !actionIsActive(A_MoveLeft))
|
|
||||||
{
|
|
||||||
triedToMove = true;
|
|
||||||
mPlayer->setLeftRight (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (actionIsActive(A_MoveForward) && !actionIsActive(A_MoveBackward))
|
if (actionIsActive(A_MoveForward) != actionIsActive(A_MoveBackward))
|
||||||
{
|
{
|
||||||
|
alwaysRunAllowed = true;
|
||||||
triedToMove = true;
|
triedToMove = true;
|
||||||
mPlayer->setAutoMove (false);
|
mPlayer->setAutoMove (false);
|
||||||
mPlayer->setForwardBackward (1);
|
mPlayer->setForwardBackward (actionIsActive(A_MoveForward) ? 1 : -1);
|
||||||
}
|
|
||||||
else if (actionIsActive(A_MoveBackward) && !actionIsActive(A_MoveForward))
|
|
||||||
{
|
|
||||||
triedToMove = true;
|
|
||||||
mPlayer->setAutoMove (false);
|
|
||||||
mPlayer->setForwardBackward (-1);
|
|
||||||
}
|
}
|
||||||
else if(mPlayer->getAutoMove())
|
else if(mPlayer->getAutoMove())
|
||||||
{
|
{
|
||||||
|
alwaysRunAllowed = true;
|
||||||
triedToMove = true;
|
triedToMove = true;
|
||||||
mPlayer->setForwardBackward (1);
|
mPlayer->setForwardBackward (1);
|
||||||
}
|
}
|
||||||
@ -703,7 +696,7 @@ namespace MWInput
|
|||||||
mOverencumberedMessageDelay = 0.f;
|
mOverencumberedMessageDelay = 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mAlwaysRunActive && !mJoystickLastUsed) || isRunning)
|
if ((mAlwaysRunActive && alwaysRunAllowed) || isRunning)
|
||||||
mPlayer->setRunState(!actionIsActive(A_Run));
|
mPlayer->setRunState(!actionIsActive(A_Run));
|
||||||
else
|
else
|
||||||
mPlayer->setRunState(actionIsActive(A_Run));
|
mPlayer->setRunState(actionIsActive(A_Run));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user