- Change InputPacket angles to an FRotator.

This commit is contained in:
Mitchell Richters 2023-10-03 17:56:12 +11:00
parent 95fc2ac6f1
commit 1732cd2e83
12 changed files with 88 additions and 90 deletions

View file

@ -1041,9 +1041,9 @@ void NetUpdate (void)
{
modp = (mod + tic) % LOCALCMDTICS;
vel += localcmds[modp].ucmd.vel;
avel += localcmds[modp].ucmd.avel;
horz += localcmds[modp].ucmd.horz;
roll += localcmds[modp].ucmd.roll;
avel += localcmds[modp].ucmd.ang.Yaw.Degrees();
horz += localcmds[modp].ucmd.ang.Pitch.Degrees();
roll += localcmds[modp].ucmd.ang.Roll.Degrees();
}
vel /= ticdup;
@ -1055,9 +1055,9 @@ void NetUpdate (void)
{
modp = (mod + tic) % LOCALCMDTICS;
localcmds[modp].ucmd.vel = vel;
localcmds[modp].ucmd.avel = avel;
localcmds[modp].ucmd.horz = horz;
localcmds[modp].ucmd.roll = roll;
localcmds[modp].ucmd.ang.Yaw = FAngle::fromDeg(avel);
localcmds[modp].ucmd.ang.Pitch = FAngle::fromDeg(horz);
localcmds[modp].ucmd.ang.Roll = FAngle::fromDeg(roll);
}
Net_NewMakeTic ();

View file

@ -160,9 +160,9 @@ int UnpackUserCmd (InputPacket *ucmd, const InputPacket *basis, uint8_t **stream
if (flags & UCMDF_BUTTONS)
ucmd->actions = ESyncBits::FromInt(ReadLong(stream));
if (flags & UCMDF_PITCH)
ucmd->horz = ReadFloat(stream);
ucmd->ang.Pitch = FAngle::fromDeg(ReadFloat(stream));
if (flags & UCMDF_YAW)
ucmd->avel = ReadFloat(stream);
ucmd->ang.Yaw = FAngle::fromDeg(ReadFloat(stream));
if (flags & UCMDF_FORWARDMOVE)
ucmd->vel.X = ReadFloat(stream);
if (flags & UCMDF_SIDEMOVE)
@ -170,7 +170,7 @@ int UnpackUserCmd (InputPacket *ucmd, const InputPacket *basis, uint8_t **stream
if (flags & UCMDF_UPMOVE)
ucmd->vel.Z = ReadFloat(stream);
if (flags & UCMDF_ROLL)
ucmd->roll = ReadFloat(stream);
ucmd->ang.Roll = FAngle::fromDeg(ReadFloat(stream));
}
return int(*stream - start);
@ -197,15 +197,15 @@ int PackUserCmd (const InputPacket *ucmd, const InputPacket *basis, uint8_t **st
flags |= UCMDF_BUTTONS;
WriteLong(ucmd->actions, stream);
}
if (ucmd->horz != basis->horz)
if (ucmd->ang.Pitch != basis->ang.Pitch)
{
flags |= UCMDF_PITCH;
WriteFloat (ucmd->horz, stream);
WriteFloat (ucmd->ang.Pitch.Degrees(), stream);
}
if (ucmd->avel != basis->avel)
if (ucmd->ang.Yaw != basis->ang.Yaw)
{
flags |= UCMDF_YAW;
WriteFloat (ucmd->avel, stream);
WriteFloat (ucmd->ang.Yaw.Degrees(), stream);
}
if (ucmd->vel.X != basis->vel.X)
{
@ -222,10 +222,10 @@ int PackUserCmd (const InputPacket *ucmd, const InputPacket *basis, uint8_t **st
flags |= UCMDF_UPMOVE;
WriteFloat ((float)ucmd->vel.Z, stream);
}
if (ucmd->roll != basis->roll)
if (ucmd->ang.Roll != basis->ang.Roll)
{
flags |= UCMDF_ROLL;
WriteFloat (ucmd->roll, stream);
WriteFloat (ucmd->ang.Roll.Degrees(), stream);
}
// Write the packing bits
@ -250,10 +250,10 @@ FSerializer &Serialize(FSerializer &arc, const char *key, InputPacket &cmd, Inpu
if (arc.BeginObject(key))
{
arc("actions", cmd.actions)
("horz", cmd.horz)
("avel", cmd.avel)
("horz", cmd.ang.Pitch)
("avel", cmd.ang.Yaw)
("vel", cmd.vel)
("roll", cmd.roll)
("roll", cmd.ang.Roll)
.EndObject();
}
return arc;
@ -264,10 +264,10 @@ int WriteUserCmdMessage (InputPacket *ucmd, const InputPacket *basis, uint8_t **
if (basis == NULL)
{
if (ucmd->actions != 0 ||
ucmd->horz != 0 ||
ucmd->avel != 0 ||
ucmd->ang.Pitch.Degrees() != 0 ||
ucmd->ang.Yaw.Degrees() != 0 ||
!ucmd->vel.isZero() ||
ucmd->roll != 0)
ucmd->ang.Roll.Degrees() != 0)
{
WriteByte (DEM_USERCMD, stream);
return PackUserCmd (ucmd, basis, stream) + 1;
@ -275,10 +275,10 @@ int WriteUserCmdMessage (InputPacket *ucmd, const InputPacket *basis, uint8_t **
}
else
if (ucmd->actions != basis->actions ||
ucmd->horz != basis->horz ||
ucmd->avel != basis->avel ||
ucmd->ang.Pitch != basis->ang.Pitch ||
ucmd->ang.Yaw != basis->ang.Yaw ||
ucmd->vel != basis->vel ||
ucmd->roll != basis->roll)
ucmd->ang.Roll != basis->ang.Roll)
{
WriteByte (DEM_USERCMD, stream);
return PackUserCmd (ucmd, basis, stream) + 1;

View file

@ -129,10 +129,10 @@ void GameInput::processMovement(PlayerAngles* const plrAngles, const float scale
const float turndir = clamp(turning + strafing * !allowstrafe, -1.f, 1.f);
const float tttscale = 1.f / (!(cl_noturnscaling || isTurboTurnTime()) * 2.8f + 1.f);
const float turnspeed = float(getTicrateScale(YAW_TURNSPEEDS[keymove]) * tttscale);
thisInput.avel += mouseInput.X * MOUSE_SCALE * m_yaw;
thisInput.avel -= joyAxes[JOYAXIS_Yaw] * hidspeed * scaleAdjust;
thisInput.avel += turndir * turnspeed * scaleAdjust;
thisInput.avel *= turnscale;
thisInput.ang.Yaw += FAngle::fromDeg(mouseInput.X * MOUSE_SCALE * m_yaw);
thisInput.ang.Yaw -= FAngle::fromDeg(joyAxes[JOYAXIS_Yaw] * hidspeed * scaleAdjust);
thisInput.ang.Yaw += FAngle::fromDeg(turndir * turnspeed * scaleAdjust);
thisInput.ang.Yaw *= turnscale;
if (turndir) updateTurnHeldAmt(scaleAdjust); else turnheldtime = 0;
}
else
@ -145,9 +145,9 @@ void GameInput::processMovement(PlayerAngles* const plrAngles, const float scale
// process player pitch input.
if (!(inputBuffer.actions & SB_AIMMODE))
{
thisInput.horz -= mouseInput.Y * MOUSE_SCALE * m_pitch;
thisInput.horz -= joyAxes[JOYAXIS_Pitch] * hidspeed * scaleAdjust;
thisInput.horz *= turnscale;
thisInput.ang.Pitch -= FAngle::fromDeg(mouseInput.Y * MOUSE_SCALE * m_pitch);
thisInput.ang.Pitch -= FAngle::fromDeg(joyAxes[JOYAXIS_Pitch] * hidspeed * scaleAdjust);
thisInput.ang.Pitch *= turnscale;
}
else
{
@ -171,15 +171,15 @@ void GameInput::processMovement(PlayerAngles* const plrAngles, const float scale
inputBuffer.vel.X = clamp(inputBuffer.vel.X + thisInput.vel.X, -(double)keymove, (double)keymove);
inputBuffer.vel.Y = clamp(inputBuffer.vel.Y + thisInput.vel.Y, -(double)keymove, (double)keymove);
inputBuffer.vel.Z = clamp(inputBuffer.vel.Z + thisInput.vel.Z, -1., 1.);
inputBuffer.avel = clamp(inputBuffer.avel + thisInput.avel, -179.f, 179.f);
inputBuffer.horz = clamp(inputBuffer.horz + thisInput.horz, -179.f, 179.f);
inputBuffer.ang.Yaw = clamp(inputBuffer.ang.Yaw + thisInput.ang.Yaw, FAngle::fromDeg(-179.f), FAngle::fromDeg(179.f));
inputBuffer.ang.Pitch = clamp(inputBuffer.ang.Pitch + thisInput.ang.Pitch, FAngle::fromDeg(-179.f), FAngle::fromDeg(179.f));
// directly update player angles if we can.
if (scaleAdjust < 1)
{
plrAngles->CameraAngles.Yaw += DAngle::fromDeg(thisInput.avel);
plrAngles->CameraAngles.Roll += DAngle::fromDeg(thisInput.roll);
plrAngles->CameraAngles.Pitch += DAngle::fromDeg(thisInput.horz);
plrAngles->CameraAngles.Yaw += DAngle::fromDeg(thisInput.ang.Yaw.Degrees());
plrAngles->CameraAngles.Roll += DAngle::fromDeg(thisInput.ang.Roll.Degrees());
plrAngles->CameraAngles.Pitch += DAngle::fromDeg(thisInput.ang.Pitch.Degrees());
}
}
@ -226,14 +226,14 @@ void GameInput::processVehicle(PlayerAngles* const plrAngles, const float scaleA
const auto scaleVel = !(flags & VEH_SCALETURN) && (cl_noturnscaling || hidDir || isTurboTurnTime());
const auto turnVel = scaleVel ? baseVel : baseVel * velScale;
const auto mouseVel = abs(turnVel * mouseInput.X * m_yaw) * (45.f / 2048.f) / scaleAdjust;
const auto maxVel = abs(turnVel * 1.5f);
const auto maxVel = FAngle::fromDeg(abs(turnVel * 1.5f));
// Apply inputs.
thisInput.avel += ((mouseVel > 1) ? sqrtf(mouseVel) : mouseVel) * Sgn(turnVel) * Sgn(mouseInput.X) * Sgn(m_yaw);
thisInput.avel -= turnVel * joyAxes[JOYAXIS_Yaw];
thisInput.avel += turnVel * kbdDir;
thisInput.avel *= scaleAdjust;
inputBuffer.avel = clamp(inputBuffer.avel + thisInput.avel, -maxVel, maxVel);
thisInput.ang.Yaw += FAngle::fromDeg(((mouseVel > 1) ? sqrtf(mouseVel) : mouseVel) * Sgn(turnVel) * Sgn(mouseInput.X) * Sgn(m_yaw));
thisInput.ang.Yaw -= FAngle::fromDeg(turnVel * joyAxes[JOYAXIS_Yaw]);
thisInput.ang.Yaw += FAngle::fromDeg(turnVel * kbdDir);
thisInput.ang.Yaw *= scaleAdjust;
inputBuffer.ang.Yaw = clamp(inputBuffer.ang.Yaw + thisInput.ang.Yaw, -maxVel, maxVel);
if (kbdDir) updateTurnHeldAmt(scaleAdjust); else turnheldtime = 0;
}
else
@ -244,9 +244,9 @@ void GameInput::processVehicle(PlayerAngles* const plrAngles, const float scaleA
// directly update player angles if we can.
if (scaleAdjust < 1)
{
plrAngles->CameraAngles.Yaw += DAngle::fromDeg(thisInput.avel);
plrAngles->CameraAngles.Roll += DAngle::fromDeg(thisInput.roll);
plrAngles->CameraAngles.Pitch += DAngle::fromDeg(thisInput.horz);
plrAngles->CameraAngles.Yaw += DAngle::fromDeg(thisInput.ang.Yaw.Degrees());
plrAngles->CameraAngles.Roll += DAngle::fromDeg(thisInput.ang.Roll.Degrees());
plrAngles->CameraAngles.Pitch += DAngle::fromDeg(thisInput.ang.Pitch.Degrees());
}
}
@ -388,9 +388,9 @@ void GameInput::getInput(const double scaleAdjust, InputPacket* packet)
void PlayerAngles::doPitchInput(InputPacket* const input)
{
// Add player's mouse/device input.
if (input->horz)
if (input->ang.Pitch.Degrees())
{
pActor->spr.Angles.Pitch += DAngle::fromDeg(input->horz * SyncInput());
pActor->spr.Angles.Pitch += DAngle::fromDeg(input->ang.Pitch.Degrees() * SyncInput());
input->actions &= ~SB_CENTERVIEW;
}
@ -437,7 +437,7 @@ void PlayerAngles::doPitchInput(InputPacket* const input)
void PlayerAngles::doYawInput(InputPacket* const input)
{
// Add player's mouse/device input.
pActor->spr.Angles.Yaw += DAngle::fromDeg(input->avel * SyncInput());
pActor->spr.Angles.Yaw += DAngle::fromDeg(input->ang.Yaw.Degrees() * SyncInput());
if (input->actions & SB_TURNAROUND)
{
@ -560,7 +560,7 @@ void PlayerAngles::doRollInput(InputPacket* const input, const DVector2& nVelVec
if (cl_viewtilting == 1)
{
// Console-like yaw rolling. Adjustment == ~(90/32) for keyboard turning. Clamp is 1.5x this value.
const auto rollAdj = DAngle::fromDeg(input->avel * ROLL_TILTAVELSCALE * rollAmp);
const auto rollAdj = DAngle::fromDeg(input->ang.Yaw.Degrees() * ROLL_TILTAVELSCALE * rollAmp);
const auto rollMax = DAngle::fromDeg((90. / 32. * 1.5) * cl_viewtiltscale);
scaletozero(pActor->spr.Angles.Roll, ROLL_TILTRETURN);
pActor->spr.Angles.Roll = clamp(pActor->spr.Angles.Roll + rollAdj, -rollMax, rollMax);
@ -588,7 +588,7 @@ void PlayerAngles::doRollInput(InputPacket* const input, const DVector2& nVelVec
else
{
// Add player's device input.
pActor->spr.Angles.Roll += DAngle::fromDeg(input->roll * SyncInput());
pActor->spr.Angles.Roll += DAngle::fromDeg(input->ang.Roll.Degrees() * SyncInput());
}
}

View file

@ -71,9 +71,7 @@ enum
struct InputPacket
{
DVector3 vel;
float avel;
float horz;
float roll;
FRotator ang;
ESyncBits actions;

View file

@ -857,10 +857,10 @@ void playerStart(int nPlayer, int bNewLevel)
pPlayer->deathTime = 0;
pPlayer->nextWeapon = kWeapNone;
actor->vel.Zero();
pInput->avel = 0;
pInput->ang.Yaw = nullFAngle;
pInput->actions = 0;
pInput->vel.Zero();
pInput->horz = 0;
pInput->ang.Pitch = nullFAngle;
pPlayer->flickerEffect = 0;
pPlayer->quakeEffect = 0;
pPlayer->tiltEffect = 0;
@ -1525,7 +1525,7 @@ void ProcessInput(DBloodPlayer* pPlayer)
// Allow it to become true behind a CVAR to offer an alternate playing experience if desired.
pPlayer->isRunning = !!(pInput->actions & SB_RUN) && !cl_bloodvanillarun;
if ((pInput->actions & SB_BUTTON_MASK) || !pInput->vel.XY().isZero() || pInput->avel)
if ((pInput->actions & SB_BUTTON_MASK) || !pInput->vel.XY().isZero() || pInput->ang.Yaw.Degrees())
pPlayer->restTime = 0;
else if (pPlayer->restTime >= 0)
pPlayer->restTime += 4;

View file

@ -41,7 +41,7 @@ BEGIN_DUKE_NS
inline static double getavel(DDukePlayer* const p)
{
return p->cmd.ucmd.avel * (2048. / 360.);
return p->cmd.ucmd.ang.Yaw.Degrees() * (2048. / 360.);
}
//---------------------------------------------------------------------------

View file

@ -857,7 +857,7 @@ void playerCenterView(int snum)
if (GetGameVarID(g_iReturnVarID, p->GetActor(), snum).value() == 0)
{
p->cmd.ucmd.actions |= SB_CENTERVIEW;
p->cmd.ucmd.horz = 0;
p->cmd.ucmd.ang.Pitch = nullFAngle;
setForcedSyncInput(snum);
}
else

View file

@ -1714,7 +1714,7 @@ void processinput_d(int snum)
doubvel = 0;
p->vel.X = 0;
p->vel.Y = 0;
p->cmd.ucmd.avel = 0;
p->cmd.ucmd.ang.Yaw = nullFAngle;
setForcedSyncInput(snum);
}

View file

@ -714,8 +714,8 @@ static unsigned outVehicleFlags(DDukePlayer* p, ESyncBits& actions)
unsigned flags = 0;
flags += VEH_FORWARD * (p->cmd.ucmd.vel.X > 0);
flags += VEH_REVERSE * (p->cmd.ucmd.vel.X < 0);
flags += VEH_TURNLEFT * (p->cmd.ucmd.avel < 0);
flags += VEH_TURNRIGHT * (p->cmd.ucmd.avel > 0);
flags += VEH_TURNLEFT * (p->cmd.ucmd.ang.Yaw.Degrees() < 0);
flags += VEH_TURNRIGHT * (p->cmd.ucmd.ang.Yaw.Degrees() > 0);
flags += VEH_BRAKING * (!!(actions & SB_CROUCH) || (p->cmd.ucmd.vel.X < 0 && p->MotoSpeed > 0));
actions &= ~SB_CROUCH;
return flags;
@ -729,7 +729,7 @@ static unsigned outVehicleFlags(DDukePlayer* p, ESyncBits& actions)
static void doVehicleTilting(DDukePlayer* const p, const bool canTilt)
{
auto adj = DAngle::fromDeg(p->cmd.ucmd.avel * (545943. / 3200000.) * canTilt);
auto adj = DAngle::fromDeg(p->cmd.ucmd.ang.Yaw.Degrees() * (545943. / 3200000.) * canTilt);
if (p->OnMotorcycle) adj *= 5 * Sgn(p->MotoSpeed);
if (cl_rrvehicletilting) adj *= cl_viewtiltscale;
p->oTiltStatus = p->TiltStatus;
@ -970,7 +970,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
auto pact = p->GetActor();
unsigned flags = outVehicleFlags(p, actions);
doVehicleTilting(p, !p->on_ground || p->cmd.ucmd.avel);
doVehicleTilting(p, !p->on_ground || p->cmd.ucmd.ang.Yaw.Degrees());
if (p->MotoSpeed < 0 || p->moto_underwater)
p->MotoSpeed = 0;
@ -1066,7 +1066,7 @@ static void onBoat(int snum, ESyncBits &actions)
p->MotoSpeed = 0;
unsigned flags = outVehicleFlags(p, actions);
doVehicleTilting(p, (p->MotoSpeed != 0 && (p->cmd.ucmd.avel || p->moto_drink)) || !p->NotOnWater);
doVehicleTilting(p, (p->MotoSpeed != 0 && (p->cmd.ucmd.ang.Yaw.Degrees() || p->moto_drink)) || !p->NotOnWater);
doVehicleSounds(p, pact, flags, 87, 88, 89, 90);
if (!p->NotOnWater)
@ -2541,7 +2541,7 @@ void processinput_r(int snum)
doubvel = 0;
p->vel.X = 0;
p->vel.Y = 0;
p->cmd.ucmd.avel = 0;
p->cmd.ucmd.ang.Yaw = nullFAngle;
setForcedSyncInput(snum);
}

View file

@ -384,10 +384,10 @@ public:
const bool returnlock = cl_dukepitchmode & kDukePitchLockReturn;
const bool centertest = abs(GetActor()->spr.Angles.Pitch.Degrees()) > 2.2370; // Build horizon value of 5.
if ((centertest && returnlock) || !cmd.ucmd.horz)
if ((centertest && returnlock) || !cmd.ucmd.ang.Pitch.Degrees())
{
setForcedSyncInput(snum);
cmd.ucmd.horz = 0;
cmd.ucmd.ang.Pitch = nullFAngle;
}
else
{

View file

@ -46,7 +46,7 @@ Weapon WeaponInfo[] = {
};
static const uint8_t nMinAmmo[] = { 0, 24, 51, 50, 1, 0, 0 };
static float lastavel;
static FAngle lastavel;
int isRed = 0;
@ -933,8 +933,8 @@ void DrawWeapons(DExhumedPlayer* const pPlayer, double interpfrac)
double xPos = 160 + weaponOffsets.first.X;
double yPos = 100 + weaponOffsets.first.Y;
double nFlameAng = interpolatedvalue(lastavel, pPlayer->cmd.ucmd.avel, interpfrac);
lastavel = pPlayer->cmd.ucmd.avel;
double nFlameAng = interpolatedvalue(lastavel, pPlayer->cmd.ucmd.ang.Yaw, interpfrac).Degrees();
lastavel = pPlayer->cmd.ucmd.ang.Yaw;
if (cl_weaponsway)
{

View file

@ -1444,17 +1444,17 @@ void UpdatePlayerSpriteAngle(DSWPlayer* pp)
//
//---------------------------------------------------------------------------
void DoPlayerVehicleInputScaling(DSWPlayer* const pp, float InputPacket::* angle, const float scale)
void DoPlayerVehicleInputScaling(DSWPlayer* const pp, FAngle FRotator::* angle, const float scale)
{
SECTOR_OBJECT* sop = pp->sop;
if (sop->drive_angspeed)
{
pp->cmd.ucmd.*angle = float(((pp->cmd.ucmd.*angle * sop->drive_angspeed) + (pp->lastcmd.ucmd.*angle * (sop->drive_angslide - 1))) / sop->drive_angslide);
pp->cmd.ucmd.ang.*angle = FAngle::fromDeg(float((((pp->cmd.ucmd.ang.*angle).Degrees() * sop->drive_angspeed) + ((pp->lastcmd.ucmd.ang.*angle).Degrees() * (sop->drive_angslide - 1))) / sop->drive_angslide));
}
else
{
pp->cmd.ucmd.*angle *= synctics * scale;
pp->cmd.ucmd.ang.*angle *= synctics * scale;
}
}
@ -2231,7 +2231,7 @@ void DriveCrush(DSWPlayer* pp, DVector2* quad)
return;
// not moving - don't crush
if ((pp->vect.isZero()) == 0 && pp->cmd.ucmd.avel == 0)
if ((pp->vect.isZero()) == 0 && pp->cmd.ucmd.ang.Yaw == nullFAngle)
return;
// main sector
@ -2455,8 +2455,8 @@ void DoPlayerMoveVehicle(DSWPlayer* pp)
double floordist = abs(zz - pp->sop->floor_loz);
setForcedSyncInput(pp->pnum);
DoPlayerVehicleInputScaling(pp, &InputPacket::avel, 0.125f);
DoPlayerVehicleInputScaling(pp, &InputPacket::horz, 0.125f);
DoPlayerVehicleInputScaling(pp, &FRotator::Yaw, 0.125f);
DoPlayerVehicleInputScaling(pp, &FRotator::Pitch, 0.125f);
if (RectClip)
{
@ -2466,9 +2466,9 @@ void DoPlayerMoveVehicle(DSWPlayer* pp)
auto save_cstat = plActor->spr.cstat;
plActor->spr.cstat &= ~(CSTAT_SPRITE_BLOCK);
if (pp->cmd.ucmd.avel != 0)
if (pp->cmd.ucmd.ang.Yaw != nullFAngle)
{
auto sum = plActor->spr.Angles.Yaw + DAngle::fromDeg(pp->cmd.ucmd.avel);
auto sum = plActor->spr.Angles.Yaw + DAngle::fromDeg(pp->cmd.ucmd.ang.Yaw.Degrees());
if (RectClipTurn(pp, sum, pos, opos))
{
plActor->spr.Angles.Yaw = sum;
@ -2518,9 +2518,9 @@ void DoPlayerMoveVehicle(DSWPlayer* pp)
}
else
{
if (pp->cmd.ucmd.avel != 0)
if (pp->cmd.ucmd.ang.Yaw != nullFAngle)
{
auto sum = plActor->spr.Angles.Yaw + DAngle::fromDeg(pp->cmd.ucmd.avel);
auto sum = plActor->spr.Angles.Yaw + DAngle::fromDeg(pp->cmd.ucmd.ang.Yaw.Degrees());
if (MultiClipTurn(pp, sum, zz, floordist))
{
plActor->spr.Angles.Yaw = sum;
@ -2582,20 +2582,20 @@ void DoPlayerMoveTurret(DSWPlayer* pp)
if (!Prediction)
{
if (pp->cmd.ucmd.avel && !pp->lastcmd.ucmd.avel)
if (pp->cmd.ucmd.ang.Yaw.Degrees() && !pp->lastcmd.ucmd.ang.Yaw.Degrees())
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
else if (!pp->cmd.ucmd.avel && pp->lastcmd.ucmd.avel)
else if (!pp->cmd.ucmd.ang.Yaw.Degrees() && pp->lastcmd.ucmd.ang.Yaw.Degrees())
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
}
setForcedSyncInput(pp->pnum);
DoPlayerVehicleInputScaling(pp, &InputPacket::avel, 0.125f);
DoPlayerVehicleInputScaling(pp, &InputPacket::horz, 0.125f);
DoPlayerVehicleInputScaling(pp, &FRotator::Yaw, 0.125f);
DoPlayerVehicleInputScaling(pp, &FRotator::Pitch, 0.125f);
if (fabs(pp->cmd.ucmd.avel) >= FLT_EPSILON)
if (fabs(pp->cmd.ucmd.ang.Yaw) >= FAngle::fromDeg(FLT_EPSILON))
{
DAngle new_ang = pact->spr.Angles.Yaw + DAngle::fromDeg(pp->cmd.ucmd.avel);
DAngle new_ang = pact->spr.Angles.Yaw + DAngle::fromDeg(pp->cmd.ucmd.ang.Yaw.Degrees());
if (pp->sop->limit_ang_center >= nullAngle)
{
@ -4965,7 +4965,7 @@ void DoPlayerBeginOperate(DSWPlayer* pp)
break;
case SO_TURRET_MGUN:
case SO_TURRET:
if (pp->cmd.ucmd.avel)
if (pp->cmd.ucmd.ang.Yaw.Degrees())
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
else
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
@ -5058,7 +5058,7 @@ void DoPlayerBeginRemoteOperate(DSWPlayer* pp, SECTOR_OBJECT* sop)
break;
case SO_TURRET_MGUN:
case SO_TURRET:
if (pp->cmd.ucmd.avel)
if (pp->cmd.ucmd.ang.Yaw.Degrees())
PlaySOsound(pp->sop->mid_sector, SO_DRIVE_SOUND);
else
PlaySOsound(pp->sop->mid_sector, SO_IDLE_SOUND);
@ -5769,7 +5769,7 @@ void DoPlayerDeathFollowKiller(DSWPlayer* pp)
// allow turning
if (pp->Flags & (PF_DEAD_HEAD|PF_HEAD_CONTROL))
{
pp->GetActor()->spr.Angles.Yaw += DAngle::fromDeg(pp->cmd.ucmd.avel);
pp->GetActor()->spr.Angles.Yaw += DAngle::fromDeg(pp->cmd.ucmd.ang.Yaw.Degrees());
UpdatePlayerSpriteAngle(pp);
}
@ -6550,7 +6550,7 @@ void ChopsCheck(DSWPlayer* pp)
{
if (!M_Active() && !(pp->Flags & PF_DEAD) && !pp->sop_riding && numplayers <= 1)
{
if (pp->cmd.ucmd.actions & ~SB_RUN || !pp->cmd.ucmd.vel.XY().isZero() || pp->cmd.ucmd.avel || pp->cmd.ucmd.horz ||
if (pp->cmd.ucmd.actions & ~SB_RUN || !pp->cmd.ucmd.vel.XY().isZero() || pp->cmd.ucmd.ang.Yaw.Degrees() || pp->cmd.ucmd.ang.Pitch.Degrees() ||
(pp->Flags & (PF_CLIMBING | PF_FALLING | PF_DIVING)))
{
// Hit a input key or other reason to stop chops