|
|
|
@ -389,8 +389,6 @@ namespace MWInput
|
|
|
|
|
|
|
|
|
|
updateCursorMode();
|
|
|
|
|
|
|
|
|
|
if(mJoystickLastUsed)
|
|
|
|
|
{
|
|
|
|
|
if (mGuiCursorEnabled)
|
|
|
|
|
{
|
|
|
|
|
float xAxis = mInputBinder->getChannel(A_MoveLeftRight)->getValue()*2.0f-1.0f;
|
|
|
|
@ -403,16 +401,21 @@ namespace MWInput
|
|
|
|
|
|
|
|
|
|
// We keep track of our own mouse position, so that moving the mouse while in
|
|
|
|
|
// game mode does not move the position of the GUI cursor
|
|
|
|
|
mGuiCursorX += xAxis * dt * 1500.0f * mInvUiScalingFactor;
|
|
|
|
|
mGuiCursorY += yAxis * dt * 1500.0f * mInvUiScalingFactor;
|
|
|
|
|
float xmove = xAxis * dt * 1500.0f * mInvUiScalingFactor;
|
|
|
|
|
float ymove = yAxis * dt * 1500.0f * mInvUiScalingFactor;
|
|
|
|
|
if (xmove != 0|| ymove != 0)
|
|
|
|
|
{
|
|
|
|
|
mGuiCursorX += xmove;
|
|
|
|
|
mGuiCursorY += ymove;
|
|
|
|
|
mMouseWheel -= static_cast<int>(zAxis * dt * 1500.0f);
|
|
|
|
|
|
|
|
|
|
mGuiCursorX = std::max(0.f, std::min(mGuiCursorX, float(viewSize.width)));
|
|
|
|
|
mGuiCursorY = std::max(0.f, std::min(mGuiCursorY, float(viewSize.height)));
|
|
|
|
|
mGuiCursorX = std::max(0.f, std::min(mGuiCursorX, float(viewSize.width-1)));
|
|
|
|
|
mGuiCursorY = std::max(0.f, std::min(mGuiCursorY, float(viewSize.height-1)));
|
|
|
|
|
|
|
|
|
|
MyGUI::InputManager::getInstance().injectMouseMove(static_cast<int>(mGuiCursorX), static_cast<int>(mGuiCursorY), mMouseWheel);
|
|
|
|
|
mInputManager->warpMouse(static_cast<int>(mGuiCursorX/mInvUiScalingFactor), static_cast<int>(mGuiCursorY/mInvUiScalingFactor));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (mMouseLookEnabled)
|
|
|
|
|
{
|
|
|
|
|
float xAxis = mInputBinder->getChannel(A_LookLeftRight)->getValue()*2.0f-1.0f;
|
|
|
|
@ -431,7 +434,6 @@ namespace MWInput
|
|
|
|
|
mPlayer->pitch(rot[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Disable movement in Gui mode
|
|
|
|
|
if (!(MWBase::Environment::get().getWindowManager()->isGuiMode()
|
|
|
|
@ -443,8 +445,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)
|
|
|
|
@ -470,17 +472,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;
|
|
|
|
@ -510,7 +513,6 @@ namespace MWInput
|
|
|
|
|
triedToMove = true;
|
|
|
|
|
mPlayer->setForwardBackward (1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!mSneakToggles)
|
|
|
|
|
{
|
|
|
|
@ -855,7 +857,6 @@ namespace MWInput
|
|
|
|
|
|
|
|
|
|
void InputManager::axisMoved(int deviceID, const SDL_ControllerAxisEvent &arg )
|
|
|
|
|
{
|
|
|
|
|
mJoystickLastUsed = true;
|
|
|
|
|
if (!mControlsDisabled)
|
|
|
|
|
mInputBinder->axisMoved(deviceID, arg);
|
|
|
|
|
}
|
|
|
|
|