From bb6e12a2b1d46abe6e4d8eae0174bfb03ebb72e4 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 28 Sep 2022 13:50:18 +1000 Subject: [PATCH] - Eliminate remaining calls to `TAngle::fromBuildf()`. --- source/common/utility/vectors.h | 5 ----- source/games/blood/src/view.cpp | 2 +- source/games/duke/src/player_r.cpp | 6 ++++-- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/source/common/utility/vectors.h b/source/common/utility/vectors.h index ea8bcd209..3f2423e2c 100644 --- a/source/common/utility/vectors.h +++ b/source/common/utility/vectors.h @@ -1286,11 +1286,6 @@ public: return TAngle(bang * (90. / 512)); } - static constexpr TAngle fromBuildf(double bang) - { - return TAngle(bang * (90. / 512)); - } - static constexpr TAngle fromQ16(int bang) { return TAngle(bang * (90. / 16384)); diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index d677293c6..6d74399c9 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -413,7 +413,7 @@ void viewUpdateShake(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, DAngle& cH, do { int nValue = ClipHigh(effectType * 8, 2000); cH += maphoriz(QRandom2F(nValue * (1. / 256.))); - cA += DAngle::fromBuildf(QRandom2F(nValue * (1. / 256.))); + cA += DAngle::fromDeg(QRandom2F(nValue * (360. / 524288.))); cPos.X += QRandom2F(nValue * inttoworld) * inttoworld; cPos.Y += QRandom2F(nValue * inttoworld) * inttoworld; cPos.Z += QRandom2F(nValue) * zinttoworld; diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 44ef737c2..0c92dbf4b 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -2377,7 +2377,8 @@ void onMotorcycleMove(int snum, walltype* wal) double angleDelta = absangle(p->angle.ang, VecToAngle(wal->delta())).Degrees(); double damageAmount = p->MotoSpeed * p->MotoSpeed; - p->angle.addadjustment(DAngle::fromBuildf(p->MotoSpeed / (krand() & 1 ? -2 : 2))); + const double scale = (180. / 2048.); + p->angle.addadjustment(DAngle::fromDeg(p->MotoSpeed * (krand() & 1 ? -scale : scale))); // That's some very weird angles here... if (angleDelta >= 77.51 && angleDelta <= 102.13) @@ -2431,7 +2432,8 @@ void onBoatMove(int snum, int psectlotag, walltype* wal) auto pact = p->GetActor(); double angleDelta = absangle(p->angle.ang, VecToAngle(wal->delta())).Degrees(); - p->angle.addadjustment(DAngle::fromBuildf(p->MotoSpeed / (krand() & 1 ? -4 : 4))); + const double scale = (90. / 2048.); + p->angle.addadjustment(DAngle::fromDeg(p->MotoSpeed * (krand() & 1 ? -scale : scale))); if (angleDelta >= 77.51 && angleDelta <= 102.13) {