From d013e6fbd971126ad9691c48d6188877c133718b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 28 Sep 2022 19:27:02 +0200 Subject: [PATCH] - eliminate the last 5 Sin calls --- source/games/blood/src/triggers.cpp | 2 +- source/games/blood/src/view.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index c2077cca0..299dd57d3 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -2106,7 +2106,7 @@ void ProcessMotion(void) continue; else pXSector->bobTheta += MulScale(pXSector->bobSpeed, pXSector->busy, 16); - int zoff_i = MulScale(Sin(pXSector->bobTheta), pXSector->bobZRange << 8, 30); + int zoff_i = int(BobVal(pXSector->bobTheta) * (pXSector->bobZRange << 8)); double zoff = zoff_i * zinttoworld; BloodSectIterator it(pSector); diff --git a/source/games/blood/src/view.cpp b/source/games/blood/src/view.cpp index 81c5ca872..b08ab5e7f 100644 --- a/source/games/blood/src/view.cpp +++ b/source/games/blood/src/view.cpp @@ -375,13 +375,13 @@ void viewUpdateDelirium(PLAYER* pPlayer) tilt2 = MulScale(tilt2, powerScale, 16); pitch = MulScale(pitch, powerScale, 16); } - int sin2 = Sin(2 * timer) >> 1; - int sin3 = Sin(3 * timer) >> 1; - gScreenTilt = DAngle::fromBuild(MulScale(sin2 + sin3, tilt1, 30)); - int sin4 = Sin(4 * timer) >> 1; - deliriumTurn = DAngle::fromBuild(MulScale(sin3 + sin4, tilt2, 30)); - int sin5 = Sin(5 * timer) >> 1; - deliriumPitch = MulScale(sin4 + sin5, pitch, 30); + double sin2 = BobVal(2 * timer); + double sin3 = BobVal(3 * timer); + double sin4 = BobVal(4 * timer); + double sin5 = BobVal(5 * timer); + gScreenTilt = DAngle::fromBuild((sin2 + sin3) * tilt1 * 0.5); + deliriumTurn = DAngle::fromBuild((sin3 + sin4) * tilt2 * 0.5); + deliriumPitch = int((sin4 + sin5) * pitch * 0.5); return; } gScreenTilt = gScreenTilt.Normalized180();