mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-09 01:01:05 +00:00
- added Q16 and Build angle converters to TAngle
To have full coverage. Q16 is what ACS uses and Build angles are needed in Raze.
This commit is contained in:
parent
4032576519
commit
ed5287ef23
2 changed files with 23 additions and 3 deletions
|
@ -1208,6 +1208,16 @@ public:
|
|||
return TAngle(f * (90. / 0x40000000));
|
||||
}
|
||||
|
||||
static constexpr TAngle fromBuild(int bang)
|
||||
{
|
||||
return TAngle(bang * (90. / 512));
|
||||
}
|
||||
|
||||
static constexpr TAngle fromQ16(int bang)
|
||||
{
|
||||
return TAngle(bang * (90. / 16384));
|
||||
}
|
||||
|
||||
TAngle(const TAngle &other) = default;
|
||||
TAngle &operator= (const TAngle &other) = default;
|
||||
|
||||
|
@ -1320,6 +1330,16 @@ public:
|
|||
return Degrees_;
|
||||
}
|
||||
|
||||
constexpr int Buildang() const
|
||||
{
|
||||
return int(Degrees_ * (512 / 90.0));
|
||||
}
|
||||
|
||||
constexpr int Q16() const
|
||||
{
|
||||
return int(Degrees_ * (16384 / 90.0));
|
||||
}
|
||||
|
||||
TVector2<vec_t> ToVector(vec_t length = 1) const
|
||||
{
|
||||
return TVector2<vec_t>(length * Cos(), length * Sin());
|
||||
|
|
|
@ -615,17 +615,17 @@ inline int DoubleToACS(double val)
|
|||
|
||||
inline DAngle ACSToAngle(int acsval)
|
||||
{
|
||||
return DAngle::fromDeg(acsval * (360. / 65536.));
|
||||
return DAngle::fromQ16(acsval);
|
||||
}
|
||||
|
||||
inline int AngleToACS(DAngle ang)
|
||||
{
|
||||
return ang.BAMs() >> 16;
|
||||
return ang.Q16();
|
||||
}
|
||||
|
||||
inline int PitchToACS(DAngle ang)
|
||||
{
|
||||
return int(ang.Normalized180().Degrees() * (65536. / 360));
|
||||
return ang.Normalized180().Q16();
|
||||
}
|
||||
|
||||
struct CallReturn
|
||||
|
|
Loading…
Reference in a new issue