- Remove wrapper usage within gameinput.cpp.

This commit is contained in:
Mitchell Richters 2022-11-25 20:55:29 +11:00 committed by Christoph Oelckers
parent d7d76d5fc4
commit 2b9e3f804d

View file

@ -181,33 +181,33 @@ void PlayerAngles::applyPitch(float const horz, ESyncBits* actions, double const
// Process mouse input.
if (horz)
{
ZzHORIZON() += DAngle::fromDeg(horz);
pActor->spr.Angles.Pitch += DAngle::fromDeg(horz);
*actions &= ~SB_CENTERVIEW;
}
// Process keyboard input.
if (auto aiming = !!(*actions & SB_AIM_DOWN) - !!(*actions & SB_AIM_UP))
{
ZzHORIZON() += getTicrateScale(PITCH_AIMSPEED) * scaleAdjust * aiming;
pActor->spr.Angles.Pitch += getTicrateScale(PITCH_AIMSPEED) * scaleAdjust * aiming;
*actions &= ~SB_CENTERVIEW;
}
if (auto looking = !!(*actions & SB_LOOK_DOWN) - !!(*actions & SB_LOOK_UP))
{
ZzHORIZON() += getTicrateScale(PITCH_LOOKSPEED) * scaleAdjust * looking;
pActor->spr.Angles.Pitch += getTicrateScale(PITCH_LOOKSPEED) * scaleAdjust * looking;
*actions |= SB_CENTERVIEW;
}
// Do return to centre.
if ((*actions & SB_CENTERVIEW) && !(*actions & (SB_LOOK_UP|SB_LOOK_DOWN)))
{
const auto pitch = abs(ZzHORIZON());
const auto pitch = abs(pActor->spr.Angles.Pitch);
const auto scale = pitch > PITCH_CNTRSINEOFFSET ? (pitch - PITCH_CNTRSINEOFFSET).Cos() : 1.;
scaletozero(ZzHORIZON(), PITCH_CENTERSPEED * scale, scaleAdjust);
if (!ZzHORIZON().Sgn()) *actions &= ~SB_CENTERVIEW;
scaletozero(pActor->spr.Angles.Pitch, PITCH_CENTERSPEED * scale, scaleAdjust);
if (!pActor->spr.Angles.Pitch.Sgn()) *actions &= ~SB_CENTERVIEW;
}
// clamp before we finish, even if it's clamped in the drawer.
ZzHORIZON() = ClampViewPitch(ZzHORIZON());
pActor->spr.Angles.Pitch = ClampViewPitch(pActor->spr.Angles.Pitch);
}
else
{
@ -238,7 +238,7 @@ void PlayerAngles::applyYaw(float const avel, ESyncBits* actions, double const s
if (!lockedYaw())
{
// add player's input
ZzANGLE() += DAngle::fromDeg(avel);
pActor->spr.Angles.Yaw += DAngle::fromDeg(avel);
if (*actions & SB_TURNAROUND)
{
@ -261,7 +261,7 @@ void PlayerAngles::applyYaw(float const avel, ESyncBits* actions, double const s
add -= YawSpin;
YawSpin = nullAngle;
}
ZzANGLE() += add;
pActor->spr.Angles.Yaw += add;
}
}
else