- Rename DCorePlayer::StrafeVel to DCorePlayer::RollVel as it better matches its usage.

This commit is contained in:
Mitchell Richters 2023-11-19 19:26:06 +11:00
parent 7c1aa53c45
commit 1da71c3ca8
8 changed files with 32 additions and 32 deletions

View file

@ -249,7 +249,7 @@ void DCorePlayer::doRollInput(const bool bUnderwater)
else if (cl_viewtilting == 2)
{
// Quake-like strafe rolling. Adjustment == (90/48) for running keyboard strafe.
const auto rollAdj = StrafeVel * strafeScale * rollAmp;
const auto rollAdj = RollVel * strafeScale * rollAmp;
const auto rollMax = nMaxVel * runScale * cl_viewtiltscale;
actor->spr.Angles.Roll = DAngle::fromDeg(clamp(rollAdj, -rollMax, rollMax) * (1.875 / nMaxVel));
}

View file

@ -14,7 +14,7 @@ protected:
void Clear()
{
CameraAngles = PrevLerpAngles = PrevViewAngles = ViewAngles = {};
PrevStrafeVel = StrafeVel = 0;
PrevRollVel = RollVel = 0;
YawSpin = nullAngle;
CameraPos = {};
memset(&lastcmd, 0, sizeof(lastcmd));
@ -26,7 +26,7 @@ protected:
public:
DRotator PrevLerpAngles, CameraAngles;
DRotator PrevViewAngles, ViewAngles;
double PrevStrafeVel, StrafeVel;
double PrevRollVel, RollVel;
DAngle YawSpin;
DVector3 CameraPos;
ticcmd_t lastcmd, cmd;
@ -56,7 +56,7 @@ public:
{
PrevLerpAngles = CameraAngles = actor->spr.Angles;
PrevViewAngles = ViewAngles = { nullAngle, viewyaw, nullAngle };
PrevStrafeVel = StrafeVel = 0;
PrevRollVel = RollVel = 0;
YawSpin = nullAngle;
}

View file

@ -6055,7 +6055,7 @@ static void actCheckDudes()
nDrag -= Scale(nDrag, (double)actor->xspr.height, 256.);
pPlayer->doRollInput(false);
pPlayer->StrafeVel -= pPlayer->StrafeVel * nDrag;
pPlayer->RollVel -= pPlayer->RollVel * nDrag;
}
if ((actor->spr.flags & 4) || !actor->vel.isZero() || actor->sector()->velFloor || actor->sector()->velCeil)

View file

@ -1567,7 +1567,7 @@ void ProcessInput(DBloodPlayer* pPlayer)
pInput->vel.X *= pInput->vel.X > 0 ? pPosture->frontAccel : pPosture->backAccel;
pInput->vel.Y *= pPosture->sideAccel;
actor->vel.XY() += pInput->vel.XY().Rotated(actor->spr.Angles.Yaw) * speed;
pPlayer->StrafeVel += pInput->vel.Y * speed;
pPlayer->RollVel += pInput->vel.Y * speed;
}
pPlayer->doViewYaw();

View file

@ -1536,7 +1536,7 @@ void processinput_d(DDukePlayer* const p)
ESyncBits& actions = p->cmd.ucmd.actions;
// Get strafe value before it's rotated by the angle.
const auto strafeVel = p->cmd.ucmd.vel.Y;
const auto RollVel = p->cmd.ucmd.vel.Y;
rotateInputVel(p);
@ -1773,7 +1773,7 @@ void processinput_d(DDukePlayer* const p)
doubvel <<= 1;
p->vel.XY() += p->cmd.ucmd.vel.XY() * doubvel * (5. / 16.);
p->StrafeVel += strafeVel * doubvel * (5. / 16.);
p->RollVel += RollVel * doubvel * (5. / 16.);
bool check;
@ -1782,32 +1782,32 @@ void processinput_d(DDukePlayer* const p)
if (check)
{
p->vel.XY() *= gs.playerfriction - 0.125;
p->StrafeVel *= gs.playerfriction - 0.125;
p->RollVel *= gs.playerfriction - 0.125;
}
else
{
if (psectlotag == ST_2_UNDERWATER)
{
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1400);
p->StrafeVel *= gs.playerfriction - FixedToFloat(0x1400);
p->RollVel *= gs.playerfriction - FixedToFloat(0x1400);
}
else
{
p->vel.XY() *= gs.playerfriction;
p->StrafeVel *= gs.playerfriction;
p->RollVel *= gs.playerfriction;
}
}
if (abs(p->vel.X) < 1/128. && abs(p->vel.Y) < 1 / 128.)
{
p->vel.X = p->vel.Y = 0;
p->StrafeVel = 0;
p->RollVel = 0;
}
if (shrunk)
{
p->vel.XY() *= gs.playerfriction * 0.75;
p->StrafeVel *= gs.playerfriction * 0.75;
p->RollVel *= gs.playerfriction * 0.75;
}
}

View file

@ -2276,7 +2276,7 @@ void processinput_r(DDukePlayer* const p)
ESyncBits& actions = p->cmd.ucmd.actions;
// Get strafe value before it's rotated by the angle.
const auto strafeVel = p->cmd.ucmd.vel.Y;
const auto RollVel = p->cmd.ucmd.vel.Y;
auto psectp = p->cursector;
if (p->OnMotorcycle && pact->spr.extra > 0)
@ -2625,24 +2625,24 @@ void processinput_r(DDukePlayer* const p)
doubvel <<= 1;
p->vel.XY() += p->cmd.ucmd.vel.XY() * doubvel * (5. / 16.);
p->StrafeVel += strafeVel * doubvel * (5. / 16.);
p->RollVel += RollVel * doubvel * (5. / 16.);
if (!isRRRA() && ((p->curr_weapon == KNEE_WEAPON && p->kickback_pic > 10 && p->on_ground) || (p->on_ground && (actions & SB_CROUCH))))
{
p->vel.XY() *= gs.playerfriction - 0.125;
p->StrafeVel *= gs.playerfriction - 0.125;
p->RollVel *= gs.playerfriction - 0.125;
}
else
{
if (psectlotag == 2)
{
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1400);
p->StrafeVel *= gs.playerfriction - FixedToFloat(0x1400);
p->RollVel *= gs.playerfriction - FixedToFloat(0x1400);
}
else
{
p->vel.XY() *= gs.playerfriction;
p->StrafeVel *= gs.playerfriction;
p->RollVel *= gs.playerfriction;
}
}
@ -2664,7 +2664,7 @@ void processinput_r(DDukePlayer* const p)
else
{
p->vel.XY() *= gs.playerfriction;
p->StrafeVel *= gs.playerfriction;
p->RollVel *= gs.playerfriction;
}
}
else if (tilesurface(psectp->floortexture) == TSURF_MUDDY)
@ -2674,7 +2674,7 @@ void processinput_r(DDukePlayer* const p)
if (p->on_ground)
{
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1800);
p->StrafeVel *= gs.playerfriction - FixedToFloat(0x1800);
p->RollVel *= gs.playerfriction - FixedToFloat(0x1800);
}
}
else
@ -2683,20 +2683,20 @@ void processinput_r(DDukePlayer* const p)
else
{
p->vel.XY() *= gs.playerfriction - FixedToFloat(0x1800);
p->StrafeVel *= gs.playerfriction - FixedToFloat(0x1800);
p->RollVel *= gs.playerfriction - FixedToFloat(0x1800);
}
}
if (abs(p->vel.X) < 1 / 128. && abs(p->vel.Y) < 1 / 128.)
{
p->vel.X = p->vel.Y = 0;
p->StrafeVel = 0;
p->RollVel = 0;
}
if (shrunk)
{
p->vel.XY() *= gs.playerfriction * 0.75;
p->StrafeVel *= gs.playerfriction * 0.75;
p->RollVel *= gs.playerfriction * 0.75;
}
}

View file

@ -1094,8 +1094,8 @@ static void updatePlayerVelocity(DExhumedPlayer* const pPlayer)
{
pPlayerActor->vel.XY() += inputvect;
pPlayerActor->vel.XY() *= 0.953125;
pPlayer->StrafeVel += pInput->vel.Y * 0.375;
pPlayer->StrafeVel *= 0.953125;
pPlayer->RollVel += pInput->vel.Y * 0.375;
pPlayer->RollVel *= 0.953125;
}
}
@ -1103,7 +1103,7 @@ static void updatePlayerVelocity(DExhumedPlayer* const pPlayer)
{
pPlayerActor->vel.XY().Zero();
pPlayer->nIdxBobZ = 0;
pPlayer->StrafeVel = 0;
pPlayer->RollVel = 0;
}
}

View file

@ -1851,10 +1851,10 @@ void DoPlayerMove(DSWPlayer* pp)
DoPlayerSlide(pp);
pp->ovect = pp->vect;
pp->PrevStrafeVel = pp->StrafeVel;
pp->PrevRollVel = pp->RollVel;
pp->vect += pp->cmd.ucmd.vel.XY() * INPUT_SCALE;
pp->StrafeVel += pp->svel * INPUT_SCALE;
pp->RollVel += pp->svel * INPUT_SCALE;
friction = pp->friction;
if (!(pp->Flags & PF_SWIMMING) && pp->WadeDepth)
@ -1863,25 +1863,25 @@ void DoPlayerMove(DSWPlayer* pp)
}
pp->vect *= FixedToFloat(friction);
pp->StrafeVel *= FixedToFloat(friction);
pp->RollVel *= FixedToFloat(friction);
if (pp->Flags & (PF_FLYING))
{
// do a bit of weighted averaging
pp->vect = (pp->vect + (pp->ovect*1))/2;
pp->StrafeVel = (pp->StrafeVel + (pp->PrevStrafeVel*1))/2;
pp->RollVel = (pp->RollVel + (pp->PrevRollVel*1))/2;
}
else if (pp->Flags & (PF_DIVING))
{
// do a bit of weighted averaging
pp->vect = (pp->vect + (pp->ovect*2))/3;
pp->StrafeVel = (pp->StrafeVel + (pp->PrevStrafeVel*2))/3;
pp->RollVel = (pp->RollVel + (pp->PrevRollVel*2))/3;
}
if (abs(pp->vect.X) < 0.05 && abs(pp->vect.Y) < 0.05)
{
pp->vect.Zero();
pp->StrafeVel = 0;
pp->RollVel = 0;
}
actor->vel.X = pp->vect.Length();