- PlayerAngle: Repair issues with addadjustment() method following changes in 4ffe004483 that were affecting negative input.

This commit is contained in:
Mitchell Richters 2021-04-05 21:41:11 +10:00
parent 8ea13f7c65
commit 5984fda8a1
2 changed files with 8 additions and 6 deletions

View file

@ -122,6 +122,7 @@ class lookangle
friend constexpr lookangle bamlook(int32_t v);
friend constexpr lookangle q16look(int32_t v);
friend constexpr lookangle buildlook(int32_t v);
friend lookangle buildflook(double v);
friend lookangle radlook(double v);
friend lookangle deglook(double v);
@ -224,7 +225,8 @@ public:
inline constexpr lookangle bamlook(int32_t v) { return lookangle(v); }
inline constexpr lookangle q16look(int32_t v) { return lookangle(v << 5); }
inline constexpr lookangle buildlook(int32_t v) { return lookangle(v << BAMBITS); }
inline lookangle radlook(double v) { return lookangle(xs_CRoundToUInt(v * (0x80000000u / pi::pi()))); }
inline lookangle buildflook(double v) { return lookangle(xs_CRoundToInt(v * BAMUNIT)); }
inline lookangle radlook(double v) { return lookangle(xs_CRoundToInt(v * (0x80000000u / pi::pi()))); }
inline lookangle deglook(double v) { return lookangle(FloatToAngle(v)); }
inline FSerializer &Serialize(FSerializer &arc, const char *key, lookangle &obj, lookangle *defval)

View file

@ -149,22 +149,22 @@ struct PlayerAngle
void addadjustment(int value)
{
__addadjustment(buildang(value));
__addadjustment(buildlook(value));
}
void addadjustment(double value)
{
__addadjustment(buildfang(value));
__addadjustment(buildflook(value));
}
void addadjustment(lookangle value)
{
__addadjustment(bamang(value.asbam()));
__addadjustment(value);
}
void addadjustment(binangle value)
{
__addadjustment(value);
__addadjustment(bamlook(value.asbam()));
}
void resetadjustment()
@ -254,7 +254,7 @@ private:
binangle target;
double adjustment;
void __addadjustment(binangle value)
void __addadjustment(lookangle value)
{
if (!SyncInput())
{