mirror of
https://github.com/DrBeef/Raze.git
synced 2025-04-04 15:10:45 +00:00
- Simplify PlayerAngle::settarget()
by adding a dedicated angle setter that resets interpolated value as well.
This commit is contained in:
parent
0416834d9d
commit
5a550613f3
3 changed files with 7 additions and 5 deletions
|
@ -166,6 +166,9 @@ struct PlayerAngle
|
|||
binangle interpolatedlookang(double const smoothratio) { return interpolatedangle(olook_ang, look_ang, smoothratio); }
|
||||
binangle interpolatedrotscrn(double const smoothratio) { return interpolatedangle(orotscrnang, rotscrnang, smoothratio); }
|
||||
|
||||
// Setter to force angle and its interpolation companion.
|
||||
void setvalue(binangle const value) { oang = ang = value; }
|
||||
|
||||
// Ticrate playsim adjustment helpers.
|
||||
void resetadjustment() { adjustment = 0; }
|
||||
bool targetset() { return target.asbam(); }
|
||||
|
@ -207,9 +210,9 @@ struct PlayerAngle
|
|||
}
|
||||
}
|
||||
|
||||
void settarget(binangle const value, bool const backup = false)
|
||||
void settarget(binangle const value)
|
||||
{
|
||||
if (!SyncInput() && !backup)
|
||||
if (!SyncInput())
|
||||
{
|
||||
target = value;
|
||||
if (!targetset()) target = bamang(1);
|
||||
|
@ -217,7 +220,6 @@ struct PlayerAngle
|
|||
else
|
||||
{
|
||||
ang = value;
|
||||
if (backup) oang = ang;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1543,7 +1543,7 @@ void OperateTeleport(sectortype* pSector)
|
|||
{
|
||||
playerResetInertia(pPlayer);
|
||||
pPlayer->zViewVel = pPlayer->zWeaponVel = 0;
|
||||
pPlayer->angle.settarget(buildang(actor->spr.ang), true);
|
||||
pPlayer->angle.setvalue(buildang(actor->spr.ang));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -935,7 +935,7 @@ void AIPlayer::Tick(RunListEvent* ev)
|
|||
if (nTotalPlayers <= 1)
|
||||
{
|
||||
auto ang = GetAngleToSprite(pPlayerActor, pSpiritSprite) & kAngleMask;
|
||||
PlayerList[nPlayer].angle.settarget(buildang(ang), true);
|
||||
PlayerList[nPlayer].angle.setvalue(buildang(ang));
|
||||
pPlayerActor->spr.ang = ang;
|
||||
|
||||
PlayerList[nPlayer].horizon.setvalue(buildhoriz(0));
|
||||
|
|
Loading…
Reference in a new issue