- Fix some constexpr issues with the latest DAngle works.

* We can't make `BAMs()` constexpr as we can't update to a C++20 compatible version of xs_Float where we use legal std::bit_cast instead of a union.
This commit is contained in:
Mitchell Richters 2022-08-28 09:40:14 +10:00 committed by Christoph Oelckers
parent 0edc6024e6
commit bd6b0eaac5
4 changed files with 7 additions and 7 deletions

View file

@ -1375,7 +1375,7 @@ public:
return clamp(Tan(), -max, max);
}
constexpr int Sgn() const
int Sgn() const
{
const auto normalized = (signed int)BAMs();
return (normalized > 0) - (normalized < 0);

View file

@ -299,14 +299,14 @@ inline constexpr int32_t interpolatedangle(int32_t oang, int32_t ang, int const
return oang + MulScale(((ang + 1024 - oang) & 2047) - 1024, smoothratio, scale);
}
inline constexpr DAngle interpolatedangle(DAngle oang, DAngle ang, double const smoothratio, int const scale = 16)
inline DAngle interpolatedangle(DAngle oang, DAngle ang, double const smoothratio, int const scale = 16)
{
return DAngle::fromBam(oang.BAMs() + MulScale(((ang.BAMs() + 0x80000000 - oang.BAMs()) & 0xFFFFFFFF) - 0x80000000, int(smoothratio), scale));
return oang + (deltaangle(oang, ang) * smoothratio * (1. / (1 << scale)));
}
inline constexpr DAngle interpolatedangle(DAngle oang, DAngle ang, int const smoothratio, int const scale = 16)
inline DAngle interpolatedangle(DAngle oang, DAngle ang, int const smoothratio, int const scale = 16)
{
return DAngle::fromBam(oang.BAMs() + MulScale(((ang.BAMs() + 0x80000000 - oang.BAMs()) & 0xFFFFFFFF) - 0x80000000, smoothratio, scale));
return oang + (deltaangle(oang, ang) * smoothratio * (1. / (1 << scale)));
}
inline constexpr fixedhoriz interpolatedhorizon(fixedhoriz oval, fixedhoriz val, double const smoothratio, int const scale = 16)

View file

@ -107,7 +107,7 @@ public:
spr.pos.Y = y * inttoworld;
}
const int16_t int_ang() const
constexpr int16_t int_ang() const
{
return spr.__int_angle;
}

View file

@ -493,7 +493,7 @@ struct spritetypebase
return { int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint) };
}
const int16_t int_ang() const
constexpr int16_t int_ang() const
{
return __int_angle;
}