From e959226914b3e1243cbb52ebbe90c5f7e91f85c2 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 11 Apr 2021 18:34:07 +1000 Subject: [PATCH] - Fix RRRA bike/boat angle adjustments following changes in f343bd8d5e5ab963aec354c98785ece217cbd329. * Because we're wrapping a negative number around to be unsigned, we need to do that after we've done our bit-shift operations. --- source/games/duke/src/player_r.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index e450255b3..2100376f9 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -1773,7 +1773,7 @@ static void onMotorcycle(int snum, ESyncBits &actions) if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->vehTurnLeft || p->vehTurnRight)) { velAdjustment = p->vehTurnLeft ? -10 : 10; - auto angAdjustment = buildang(velAdjustment < 0 ? 350 : -350); + auto angAdjustment = (velAdjustment < 0 ? 350 : -350) << BAMBITS; if (p->moto_on_mud || p->moto_on_oil || !p->NotOnWater) { @@ -1811,7 +1811,7 @@ static void onMotorcycle(int snum, ESyncBits &actions) p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4); p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4); - p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - angAdjustment)); + p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - bamang(angAdjustment))); } else if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->moto_on_mud || p->moto_on_oil)) { @@ -2040,7 +2040,7 @@ static void onBoat(int snum, ESyncBits &actions) { int currSpeed = p->MotoSpeed * 4.; short velAdjustment = p->vehTurnLeft ? -10 : 10; - auto angAdjustment = buildang(velAdjustment < 0 ? 350 : -350); + auto angAdjustment = (velAdjustment < 0 ? 350 : -350) << BAMBITS; if (p->moto_do_bump) { @@ -2055,7 +2055,7 @@ static void onBoat(int snum, ESyncBits &actions) p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4); p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4); - p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - angAdjustment)); + p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - bamang(angAdjustment))); } if (p->NotOnWater && p->MotoSpeed > 50) p->MotoSpeed -= (p->MotoSpeed / 2.);