- Remove PlayerAngles::addPitch() method usage.

This commit is contained in:
Mitchell Richters 2022-12-04 21:43:44 +11:00 committed by Christoph Oelckers
parent 1944d04014
commit 7a7758efaa
7 changed files with 20 additions and 15 deletions

View file

@ -89,7 +89,6 @@ struct PlayerAngles
}
// Pitch methods.
void addPitch(const DAngle value) { updateAngle(PITCH, ClampViewPitch(pActor->spr.Angles.Pitch + value)); }
void setPitch(const DAngle value, const bool backup = false) { updateAngle(PITCH, ClampViewPitch(value), backup); }
// Yaw methods.

View file

@ -1546,7 +1546,7 @@ void ProcessInput(PLAYER* pPlayer)
}
pPlayer->deathTime += 4;
if (!bSeqStat)
pPlayer->Angles.addPitch(deltaangle(pPlayer->actor->spr.Angles.Pitch, gi->playerPitchMax() * (1. - BobVal(min((pPlayer->deathTime << 3) + 512, 1536))) * 0.5));
pPlayer->actor->spr.Angles.Pitch += deltaangle(pPlayer->actor->spr.Angles.Pitch, gi->playerPitchMax() * (1. - BobVal(min((pPlayer->deathTime << 3) + 512, 1536))) * 0.5);
if (pPlayer->curWeapon)
pInput->setNewWeapon(pPlayer->curWeapon);
if (pInput->actions & SB_OPEN)

View file

@ -118,7 +118,7 @@ void forceplayerangle(int snum)
player_struct* p = &ps[snum];
const auto ang = (DAngle22_5 - randomAngle(45)) / 2.;
p->Angles.addPitch(DAngle::fromDeg(-26.566));
p->GetActor()->spr.Angles.Pitch -= DAngle::fromDeg(26.566);
p->sync.actions |= SB_CENTERVIEW;
p->Angles.ViewAngles.Yaw = ang;
p->Angles.ViewAngles.Roll = -ang;
@ -797,7 +797,7 @@ void player_struct::checkhardlanding()
{
if (hard_landing > 0)
{
Angles.addPitch(maphoriz(hard_landing << 4));
GetActor()->spr.Angles.Pitch += maphoriz(hard_landing << 4);
hard_landing--;
}
}

View file

@ -1660,7 +1660,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
}
if (horiz != FRACUNIT)
{
p->Angles.addPitch(deltaangle(p->GetActor()->spr.Angles.Pitch, maphoriz(-horiz)));
p->GetActor()->spr.Angles.Pitch += deltaangle(p->GetActor()->spr.Angles.Pitch, maphoriz(-horiz));
}
const DAngle adjust = mapangle(-510);
@ -1928,7 +1928,7 @@ static void onBoat(int snum, ESyncBits &actions)
}
if (horiz != FRACUNIT)
{
p->Angles.addPitch(deltaangle(p->GetActor()->spr.Angles.Pitch, maphoriz(-horiz)));
p->GetActor()->spr.Angles.Pitch += deltaangle(p->GetActor()->spr.Angles.Pitch, maphoriz(-horiz));
}
if (p->MotoSpeed > 0 && p->on_ground == 1 && (p->vehTurnLeft || p->vehTurnRight))
@ -2836,7 +2836,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
case RIFLEGUN_WEAPON:
p->kickback_pic++;
p->Angles.addPitch(DAngle::fromDeg(-0.4476));
p->GetActor()->spr.Angles.Pitch -= DAngle::fromDeg(0.4476);
p->recoil++;
if (p->kickback_pic <= 12)
@ -3008,7 +3008,7 @@ static void operateweapon(int snum, ESyncBits actions, sectortype* psectp)
else if (p->kickback_pic == 12)
{
p->vel.XY() -= p->GetActor()->spr.Angles.Yaw.ToVector();
p->Angles.addPitch(DAngle::fromDeg(-8.88));
p->GetActor()->spr.Angles.Pitch -= DAngle::fromDeg(8.88);
p->recoil += 20;
}
if (p->kickback_pic > 20)
@ -3817,7 +3817,7 @@ HORIZONLY:
if (!d)
d = 1;
p->recoil -= d;
p->Angles.addPitch(maphoriz(d));
p->GetActor()->spr.Angles.Pitch += maphoriz(d);
}
if (SyncInput())

View file

@ -1041,7 +1041,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, angle, dukeplayer_angle)
void dukeplayer_addpitch(player_struct* self, double a)
{
self->Angles.addPitch(DAngle::fromDeg(a));
self->GetActor()->spr.Angles.Pitch += DAngle::fromDeg(a);
}
DEFINE_ACTION_FUNCTION_NATIVE(_DukePlayer, addpitch, dukeplayer_addpitch)

View file

@ -2496,7 +2496,7 @@ sectdone:
{
if (double nVertPan = deltaangle(pPlayer->pActor->spr.Angles.Pitch, pPlayer->nDestVertPan).Tan() * 32.)
{
pPlayer->Angles.addPitch(maphoriz(abs(nVertPan) >= 4 ? clamp(nVertPan, -4., 4.) : nVertPan * 2.));
pPlayer->pActor->spr.Angles.Pitch += maphoriz(abs(nVertPan) >= 4 ? clamp(nVertPan, -4., 4.) : nVertPan * 2.);
}
}
}
@ -2621,7 +2621,7 @@ sectdone:
}
else
{
PlayerList[nPlayer].Angles.addPitch(maphoriz(-dVertPan[nPlayer]));
PlayerList[nPlayer].pActor->spr.Angles.Pitch -= maphoriz(dVertPan[nPlayer]);
if (PlayerList[nPlayer].pActor->spr.Angles.Pitch.Degrees() <= 38)
{

View file

@ -5883,11 +5883,17 @@ void DoPlayerBeginDie(PLAYER* pp)
static inline void DoPlayerDeathHoriz(PLAYER* pp, const DAngle target, const double speed)
{
auto targetdelta = deltaangle(pp->actor->spr.Angles.Pitch, target);
auto& pitch = pp->actor->spr.Angles.Pitch;
auto pspeed = DAngle::fromDeg(speed);
if (abs(targetdelta.Degrees()) > 1)
if (pitch < target)
{
pp->Angles.addPitch(DAngle::fromDeg(speed * targetdelta.Sgn()));
pitch = min(pitch + pspeed, target);
}
if (pitch > target)
{
pitch = max(pitch - pspeed, target);
}
}