mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- Convert all remaining angle internals of PlayerAngle
into DAngle
units.
* With the old setup, we needed to use primitives to get the desired outcome, but since DAngle stores a proper angle in true degrees, we can use it all the way.
This commit is contained in:
parent
bd7a004c4c
commit
2757140ad1
2 changed files with 11 additions and 11 deletions
|
@ -169,6 +169,7 @@ enum
|
|||
|
||||
constexpr double BAngRadian = pi::pi() * (1. / 1024.);
|
||||
constexpr double BAngToDegree = 360. / 2048.;
|
||||
constexpr DAngle DAngleBuildToDeg = DAngle::fromDeg(BAngToDegree);
|
||||
|
||||
extern int sintable[2048];
|
||||
|
||||
|
|
|
@ -145,8 +145,8 @@ struct PlayerAngle
|
|||
DAngle interpolatedrotscrn(double const smoothratio) { return interpolatedangle(orotscrnang, rotscrnang, smoothratio); }
|
||||
|
||||
// Ticrate playsim adjustment helpers.
|
||||
void resetadjustment() { adjustment = 0; }
|
||||
bool targetset() { return target.BAMs(); }
|
||||
void resetadjustment() { adjustment = nullAngle; }
|
||||
bool targetset() { return target.Sgn(); }
|
||||
|
||||
// Input locking helpers.
|
||||
void lockinput() { inputdisabled = true; }
|
||||
|
@ -162,7 +162,7 @@ struct PlayerAngle
|
|||
{
|
||||
if (!SyncInput())
|
||||
{
|
||||
adjustment += value.Normalized180().Degrees();
|
||||
adjustment += value.Normalized180();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ struct PlayerAngle
|
|||
{
|
||||
if (!SyncInput() && !backup)
|
||||
{
|
||||
target = value.BAMs() ? value : DAngle::fromBam(1);
|
||||
target = value.Sgn() ? value : DAngle::fromBam(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -187,11 +187,11 @@ struct PlayerAngle
|
|||
{
|
||||
if (targetset())
|
||||
{
|
||||
auto delta = deltaangle(ang, target).Degrees();
|
||||
auto delta = deltaangle(ang, target);
|
||||
|
||||
if (abs(delta) > BAngToDegree)
|
||||
if (abs(delta) > DAngleBuildToDeg)
|
||||
{
|
||||
ang += DAngle::fromDeg(scaleAdjust * delta);
|
||||
ang += delta * scaleAdjust;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -199,15 +199,14 @@ struct PlayerAngle
|
|||
target = nullAngle;
|
||||
}
|
||||
}
|
||||
else if (adjustment)
|
||||
else if (adjustment.Sgn())
|
||||
{
|
||||
ang += DAngle::fromDeg(scaleAdjust * adjustment);
|
||||
ang += adjustment * scaleAdjust;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
DAngle target;
|
||||
double adjustment;
|
||||
DAngle target, adjustment;
|
||||
bool inputdisabled;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue