- Negate ControlInfo::dyaw to match data out of backend.

This commit is contained in:
Mitchell Richters 2023-03-17 20:45:52 +11:00
parent 446218dd7b
commit fc069feac6
3 changed files with 17 additions and 17 deletions

View file

@ -127,12 +127,12 @@ void processMovement(InputPacket* const currInput, InputPacket* const inputBuffe
{
const float turndir = clamp(turning + strafing * !allowstrafe, -1.f, 1.f);
const float turnspeed = float(getTicrateScale(YAW_TURNSPEEDS[keymove]) * turnscale * (isTurboTurnTime() ? 1. : YAW_PREAMBLESCALE));
currInput->avel += hidInput->mouseturnx + (hidInput->dyaw * hidspeed + turndir * turnspeed) * scaleAdjustf;
currInput->avel += hidInput->mouseturnx - (hidInput->dyaw * hidspeed - turndir * turnspeed) * scaleAdjustf;
if (turndir) updateTurnHeldAmt(scaleAdjust); else resetTurnHeldAmt();
}
else
{
currInput->svel += hidInput->mousemovex + (hidInput->dyaw + turning) * keymove * scaleAdjustf;
currInput->svel += hidInput->mousemovex - (hidInput->dyaw - turning) * keymove * scaleAdjustf;
}
// process player pitch input.

View file

@ -212,7 +212,7 @@ void getHidInput(HIDInput* const hidInput)
I_GetAxes(joyaxes);
hidInput->dyaw += -joyaxes[JOYAXIS_Yaw];
hidInput->dyaw += joyaxes[JOYAXIS_Yaw];
hidInput->dpitch += -joyaxes[JOYAXIS_Pitch];
hidInput->dforward += joyaxes[JOYAXIS_Forward] * .5f;
hidInput->dside += joyaxes[JOYAXIS_Side] * .5f;
@ -405,9 +405,9 @@ void ApplyGlobalInput(InputPacket& input, HIDInput* hidInput, bool const croucha
else dpad_lock &= ~1;
if (hidInput->dforward < 0 && !(dpad_lock & 2)) { dpad_lock |= 2; input.setNewWeapon(WeaponSel_Next); }
else dpad_lock &= ~2;
if ((hidInput->dside < 0 || hidInput->dyaw < 0) && !(dpad_lock & 4)) { dpad_lock |= 4; input.actions |= SB_INVPREV; }
if ((hidInput->dside < 0 || hidInput->dyaw > 0) && !(dpad_lock & 4)) { dpad_lock |= 4; input.actions |= SB_INVPREV; }
else dpad_lock &= ~4;
if ((hidInput->dside > 0 || hidInput->dyaw > 0) && !(dpad_lock & 8)) { dpad_lock |= 8; input.actions |= SB_INVNEXT; }
if ((hidInput->dside > 0 || hidInput->dyaw < 0) && !(dpad_lock & 8)) { dpad_lock |= 8; input.actions |= SB_INVNEXT; }
else dpad_lock &= ~8;
// This eats the controller input for regular use

View file

@ -564,13 +564,13 @@ static float motoApplyTurn(player_struct* p, HIDInput* const hidInput, bool cons
{
resetTurnHeldAmt();
if (kbdLeft || hidInput->mouseturnx < 0 || hidInput->dyaw < 0)
if (kbdLeft || hidInput->mouseturnx < 0 || hidInput->dyaw > 0)
{
p->TiltStatus -= (float)factor;
if (p->TiltStatus < -10)
p->TiltStatus = -10;
}
else if (kbdRight || hidInput->mouseturnx > 0 || hidInput->dyaw > 0)
else if (kbdRight || hidInput->mouseturnx > 0 || hidInput->dyaw < 0)
{
p->TiltStatus += (float)factor;
if (p->TiltStatus > 10)
@ -584,7 +584,7 @@ static float motoApplyTurn(player_struct* p, HIDInput* const hidInput, bool cons
constexpr float velScale = (3.f / 10.f);
const float baseVel = (buttonMap.ButtonDown(gamefunc_Move_Backward) || hidInput->dforward < 0) && p->MotoSpeed <= 0 ? -VEHICLETURN : VEHICLETURN;
if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw < 0)
if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw > 0)
{
p->TiltStatus -= (float)factor;
@ -597,13 +597,13 @@ static float motoApplyTurn(player_struct* p, HIDInput* const hidInput, bool cons
if (hidInput->mouseturnx < 0)
turnvel -= Sgn(baseVel) * sqrtf(abs(p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * -(hidInput->mouseturnx / factor) * (7.f / 20.f));
if (hidInput->dyaw < 0)
if (hidInput->dyaw > 0)
turnvel += (p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * hidInput->dyaw;
updateTurnHeldAmt(factor);
}
if (kbdRight || p->moto_drink > 0 || hidInput->mouseturnx > 0 || hidInput->dyaw > 0)
if (kbdRight || p->moto_drink > 0 || hidInput->mouseturnx > 0 || hidInput->dyaw < 0)
{
p->TiltStatus += (float)factor;
@ -616,7 +616,7 @@ static float motoApplyTurn(player_struct* p, HIDInput* const hidInput, bool cons
if (hidInput->mouseturnx > 0)
turnvel += Sgn(baseVel) * sqrtf(abs(p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * (hidInput->mouseturnx / factor) * (7.f / 20.f));
if (hidInput->dyaw > 0)
if (hidInput->dyaw < 0)
turnvel += (p->MotoSpeed > 0 ? baseVel : baseVel * velScale) * hidInput->dyaw;
updateTurnHeldAmt(factor);
@ -657,7 +657,7 @@ static float boatApplyTurn(player_struct *p, HIDInput* const hidInput, bool cons
const float velScale = !p->NotOnWater? 1.f : (6.f / 19.f);
const float baseVel = VEHICLETURN * velScale;
if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw < 0)
if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw > 0)
{
if (!p->NotOnWater)
{
@ -672,13 +672,13 @@ static float boatApplyTurn(player_struct *p, HIDInput* const hidInput, bool cons
if (hidInput->mouseturnx < 0)
turnvel -= Sgn(baseVel) * sqrtf(abs(baseVel) * -(hidInput->mouseturnx / factor) * (7.f / 20.f));
if (hidInput->dyaw < 0)
if (hidInput->dyaw > 0)
turnvel += baseVel * hidInput->dyaw;
updateTurnHeldAmt(factor);
}
if (kbdRight || p->moto_drink > 0 || hidInput->mouseturnx > 0 || hidInput->dyaw > 0)
if (kbdRight || p->moto_drink > 0 || hidInput->mouseturnx > 0 || hidInput->dyaw < 0)
{
if (!p->NotOnWater)
{
@ -693,7 +693,7 @@ static float boatApplyTurn(player_struct *p, HIDInput* const hidInput, bool cons
if (hidInput->mouseturnx > 0)
turnvel += Sgn(baseVel) * sqrtf(abs(baseVel) * (hidInput->mouseturnx / factor) * (7.f / 20.f));
if (hidInput->dyaw > 0)
if (hidInput->dyaw < 0)
turnvel += baseVel * hidInput->dyaw;
updateTurnHeldAmt(factor);
@ -739,8 +739,8 @@ static void processVehicleInput(player_struct *p, HIDInput* const hidInput, Inpu
// Cancel out micro-movement
if (fabs(hidInput->mouseturnx) < (m_sensitivity_x * m_yaw * backendinputscale() * 2.f)) hidInput->mouseturnx = 0;
p->vehTurnLeft = kbdLeft || hidInput->mouseturnx < 0 || hidInput->dyaw < 0;
p->vehTurnRight = kbdRight || hidInput->mouseturnx > 0 || hidInput->dyaw > 0;
p->vehTurnLeft = kbdLeft || hidInput->mouseturnx < 0 || hidInput->dyaw > 0;
p->vehTurnRight = kbdRight || hidInput->mouseturnx > 0 || hidInput->dyaw < 0;
if (p->OnBoat || !p->moto_underwater)
{