From d3d9bb082365f83a5849a3010d68b3e528b8e006 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Mon, 3 Aug 2020 22:39:09 +1000 Subject: [PATCH] - partially revert 19e4393a4f17f705d7a8f17aa502754f0bd60710 by adding the player's mouse input after calculating the true pitch of `p->q16horiz`. * Need to add `p->horizAdjust` in with `p->q16horiz` because the values passed to that variable are the same as what would have been directly added to `p->q16horiz` in `processinput()`. * Leaving mouse input to apply after calculating the pitch lets us take advantage of the calculated pitch's accuracy to provide consistent mouse input across the pitch's range. --- source/games/duke/src/player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index c667530d5..f79522083 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -961,7 +961,7 @@ void sethorizon(int snum, int sb_snum, double factor, bool frominput, fixed_t ad auto p = &ps[snum]; // Calculate adjustment as true pitch (Fixed point math really sucks...) - double horizAngle = atan2((p->q16horiz + ((factor * p->horizAdjust) * 65536) + adjustment) - F16(100), F16(128)) * (512. / pi::pi()); + double horizAngle = atan2((p->q16horiz + ((factor * p->horizAdjust) * 65536)) - F16(100), F16(128)) * (512. / pi::pi()) + (adjustment / 65536.); if (p->return_to_center > 0 && (sb_snum & (SKB_LOOK_UP | SKB_LOOK_DOWN)) == 0) // only snap back if no relevant button is pressed. {