diff --git a/source/core/fixedhorizon.h b/source/core/fixedhorizon.h index 2788ee17f..573bb9fff 100644 --- a/source/core/fixedhorizon.h +++ b/source/core/fixedhorizon.h @@ -86,6 +86,8 @@ public: constexpr fixed_t asq16() const { return value; } double Degrees() const { return HorizToPitch(value); } + int Sgn() const { return ::Sgn(value); } + bool operator< (fixedhoriz other) const { return value < other.value; diff --git a/source/core/gameinput.cpp b/source/core/gameinput.cpp index 107fc6d39..37659c62a 100644 --- a/source/core/gameinput.cpp +++ b/source/core/gameinput.cpp @@ -58,10 +58,10 @@ inline static DAngle getscaledangle(const double value, const double scaleAdjust inline static void scaletozero(fixedhoriz& object, const double value, const double scaleAdjust, const double push = DBL_MAX) { - if (auto sgn = Sgn(object.asq16())) + if (auto sgn = object.Sgn()) { object -= getscaledhoriz(value, scaleAdjust, object, push == DBL_MAX ? sgn * 2. / 9. : push); - if (sgn != Sgn(object.asq16())) object = q16horiz(0); + if (sgn != object.Sgn()) object = q16horiz(0); } } @@ -433,7 +433,7 @@ void PlayerHorizon::calcviewpitch(const DVector2& pos, DAngle const ang, bool co else { // Make horizoff grow towards 0 since horizoff is not modified when you're not on a slope. - scaletozero(horizoff, HORIZOFFSPEED, scaleAdjust, Sgn(horizoff.asq16())); + scaletozero(horizoff, HORIZOFFSPEED, scaleAdjust, horizoff.Sgn()); } } }