mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-06 08:41:32 +00:00
More formatting changes
This commit is contained in:
parent
b575712cb1
commit
0455f48d02
3 changed files with 24 additions and 26 deletions
|
@ -90,9 +90,9 @@ namespace MWInput
|
||||||
|
|
||||||
if (mGuiCursorEnabled && !(mJoystickLastUsed && !mGamepadGuiCursorEnabled))
|
if (mGuiCursorEnabled && !(mJoystickLastUsed && !mGamepadGuiCursorEnabled))
|
||||||
{
|
{
|
||||||
float xAxis = mBindingsManager->getActionValue(A_MoveLeftRight)*2.0f-1.0f;
|
float xAxis = mBindingsManager->getActionValue(A_MoveLeftRight) * 2.0f - 1.0f;
|
||||||
float yAxis = mBindingsManager->getActionValue(A_MoveForwardBackward)*2.0f-1.0f;
|
float yAxis = mBindingsManager->getActionValue(A_MoveForwardBackward) * 2.0f - 1.0f;
|
||||||
float zAxis = mBindingsManager->getActionValue(A_LookUpDown)*2.0f-1.0f;
|
float zAxis = mBindingsManager->getActionValue(A_LookUpDown) * 2.0f - 1.0f;
|
||||||
|
|
||||||
xAxis *= (1.5f - mBindingsManager->getActionValue(A_Use));
|
xAxis *= (1.5f - mBindingsManager->getActionValue(A_Use));
|
||||||
yAxis *= (1.5f - mBindingsManager->getActionValue(A_Use));
|
yAxis *= (1.5f - mBindingsManager->getActionValue(A_Use));
|
||||||
|
@ -138,7 +138,7 @@ namespace MWInput
|
||||||
{
|
{
|
||||||
triedToMove = true;
|
triedToMove = true;
|
||||||
player.setAutoMove (false);
|
player.setAutoMove (false);
|
||||||
player.setForwardBackward((yAxis - 0.5f) * 2 * -1);
|
player.setForwardBackward((0.5f - yAxis) * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (triedToMove)
|
if (triedToMove)
|
||||||
|
@ -316,7 +316,6 @@ namespace MWInput
|
||||||
{
|
{
|
||||||
// Presumption of GUI mode will be removed in the future.
|
// Presumption of GUI mode will be removed in the future.
|
||||||
// MyGUI KeyCodes *may* change.
|
// MyGUI KeyCodes *may* change.
|
||||||
|
|
||||||
MyGUI::KeyCode key = MyGUI::KeyCode::None;
|
MyGUI::KeyCode key = MyGUI::KeyCode::None;
|
||||||
switch (arg.button)
|
switch (arg.button)
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,8 +90,8 @@ namespace MWInput
|
||||||
|
|
||||||
if (mMouseLookEnabled && !mControlsDisabled)
|
if (mMouseLookEnabled && !mControlsDisabled)
|
||||||
{
|
{
|
||||||
float x = arg.xrel * mCameraSensitivity * (1.0f/256.f) * (mInvertX ? -1 : 1);
|
float x = arg.xrel * mCameraSensitivity * (mInvertX ? -1 : 1) / 256.f;
|
||||||
float y = arg.yrel * mCameraSensitivity * (1.0f/256.f) * (mInvertY ? -1 : 1) * mCameraYMultiplier;
|
float y = arg.yrel * mCameraSensitivity * (mInvertY ? -1 : 1) * mCameraYMultiplier / 256.f;
|
||||||
|
|
||||||
float rot[3];
|
float rot[3];
|
||||||
rot[0] = -y;
|
rot[0] = -y;
|
||||||
|
@ -117,7 +117,7 @@ namespace MWInput
|
||||||
{
|
{
|
||||||
MWBase::Environment::get().getInputManager()->setJoystickLastUsed(false);
|
MWBase::Environment::get().getInputManager()->setJoystickLastUsed(false);
|
||||||
|
|
||||||
if(mBindingsManager->isDetectingBindingState())
|
if (mBindingsManager->isDetectingBindingState())
|
||||||
{
|
{
|
||||||
mBindingsManager->mouseReleased(arg, id);
|
mBindingsManager->mouseReleased(arg, id);
|
||||||
}
|
}
|
||||||
|
@ -176,18 +176,18 @@ namespace MWInput
|
||||||
if (!mMouseLookEnabled)
|
if (!mMouseLookEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float xAxis = mBindingsManager->getActionValue(A_LookLeftRight)*2.0f-1.0f;
|
float xAxis = mBindingsManager->getActionValue(A_LookLeftRight) * 2.0f - 1.0f;
|
||||||
float yAxis = mBindingsManager->getActionValue(A_LookUpDown)*2.0f-1.0f;
|
float yAxis = mBindingsManager->getActionValue(A_LookUpDown) * 2.0f - 1.0f;
|
||||||
if (xAxis == 0 && yAxis == 0)
|
if (xAxis == 0 && yAxis == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float rot[3];
|
float rot[3];
|
||||||
rot[0] = yAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f) * (mInvertY ? -1 : 1) * mCameraYMultiplier;
|
rot[0] = yAxis * dt * 1000.0f * mCameraSensitivity * (mInvertY ? -1 : 1) * mCameraYMultiplier / 256.f;
|
||||||
rot[1] = 0.0f;
|
rot[1] = 0.0f;
|
||||||
rot[2] = xAxis * (dt * 100.0f) * 10.0f * mCameraSensitivity * (1.0f/256.f) * (mInvertX ? -1 : 1);
|
rot[2] = xAxis * dt * 1000.0f * mCameraSensitivity * (mInvertX ? -1 : 1) / 256.f;
|
||||||
|
|
||||||
// Only actually turn player when we're not in vanity mode
|
// Only actually turn player when we're not in vanity mode
|
||||||
if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot) && MWBase::Environment::get().getInputManager()->getControlSwitch("playercontrols"))
|
if (!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot) && MWBase::Environment::get().getInputManager()->getControlSwitch("playercontrols"))
|
||||||
{
|
{
|
||||||
MWWorld::Player& player = MWBase::Environment::get().getWorld()->getPlayer();
|
MWWorld::Player& player = MWBase::Environment::get().getWorld()->getPlayer();
|
||||||
player.yaw(rot[2]);
|
player.yaw(rot[2]);
|
||||||
|
@ -214,14 +214,14 @@ namespace MWInput
|
||||||
mMouseWheel += mouseWheelMove;
|
mMouseWheel += mouseWheelMove;
|
||||||
|
|
||||||
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
mGuiCursorX = std::max(0.f, std::min(mGuiCursorX, float(viewSize.width-1)));
|
mGuiCursorX = std::max(0.f, std::min(mGuiCursorX, float(viewSize.width - 1)));
|
||||||
mGuiCursorY = std::max(0.f, std::min(mGuiCursorY, float(viewSize.height-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);
|
MyGUI::InputManager::getInstance().injectMouseMove(static_cast<int>(mGuiCursorX), static_cast<int>(mGuiCursorY), mMouseWheel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MouseManager::warpMouse()
|
void MouseManager::warpMouse()
|
||||||
{
|
{
|
||||||
mInputWrapper->warpMouse(static_cast<int>(mGuiCursorX/mInvUiScalingFactor), static_cast<int>(mGuiCursorY/mInvUiScalingFactor));
|
mInputWrapper->warpMouse(static_cast<int>(mGuiCursorX / mInvUiScalingFactor), static_cast<int>(mGuiCursorY / mInvUiScalingFactor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,6 @@ namespace MWInput
|
||||||
if (Settings::Manager::getBool("enable gyroscope", "Input"))
|
if (Settings::Manager::getBool("enable gyroscope", "Input"))
|
||||||
{
|
{
|
||||||
int numSensors = SDL_NumSensors();
|
int numSensors = SDL_NumSensors();
|
||||||
|
|
||||||
for (int i = 0; i < numSensors; ++i)
|
for (int i = 0; i < numSensors; ++i)
|
||||||
{
|
{
|
||||||
if (SDL_SensorGetDeviceType(i) == SDL_SENSOR_GYRO)
|
if (SDL_SensorGetDeviceType(i) == SDL_SENSOR_GYRO)
|
||||||
|
@ -214,15 +213,15 @@ namespace MWInput
|
||||||
|
|
||||||
switch (SDL_SensorGetType(sensor))
|
switch (SDL_SensorGetType(sensor))
|
||||||
{
|
{
|
||||||
case SDL_SENSOR_ACCEL:
|
case SDL_SENSOR_ACCEL:
|
||||||
break;
|
break;
|
||||||
case SDL_SENSOR_GYRO:
|
case SDL_SENSOR_GYRO:
|
||||||
{
|
{
|
||||||
mGyroXSpeed = getGyroAxisSpeed(mGyroHAxis, arg);
|
mGyroXSpeed = getGyroAxisSpeed(mGyroHAxis, arg);
|
||||||
mGyroYSpeed = getGyroAxisSpeed(mGyroVAxis, arg);
|
mGyroYSpeed = getGyroAxisSpeed(mGyroVAxis, arg);
|
||||||
mGyroUpdateTimer = 0.f;
|
mGyroUpdateTimer = 0.f;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -255,7 +254,7 @@ namespace MWInput
|
||||||
rot[2] = mGyroXSpeed * dt * mGyroHSensitivity * 4 * (mInvertX ? -1 : 1);
|
rot[2] = mGyroXSpeed * dt * mGyroHSensitivity * 4 * (mInvertX ? -1 : 1);
|
||||||
|
|
||||||
// Only actually turn player when we're not in vanity mode
|
// Only actually turn player when we're not in vanity mode
|
||||||
if(!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot) && MWBase::Environment::get().getInputManager()->getControlSwitch("playerlooking"))
|
if (!MWBase::Environment::get().getWorld()->vanityRotateCamera(rot) && MWBase::Environment::get().getInputManager()->getControlSwitch("playerlooking"))
|
||||||
{
|
{
|
||||||
MWWorld::Player& player = MWBase::Environment::get().getWorld()->getPlayer();
|
MWWorld::Player& player = MWBase::Environment::get().getWorld()->getPlayer();
|
||||||
player.yaw(rot[2]);
|
player.yaw(rot[2]);
|
||||||
|
|
Loading…
Reference in a new issue