From 659ebf82d8e22a91d50dba95f1a4a7cea196fbaf Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 29 Jan 2020 11:36:48 +0000 Subject: [PATCH] Improve player view recentering git-svn-id: https://svn.eduke32.com/eduke32@8552 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/player.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/duke3d/src/player.cpp b/source/duke3d/src/player.cpp index 92a980055..3ff45b6a0 100644 --- a/source/duke3d/src/player.cpp +++ b/source/duke3d/src/player.cpp @@ -3162,12 +3162,12 @@ void P_GetInput(int const playerNum) } else if (pPlayer->return_to_center > 0 || g_horizRecenter) { - pPlayer->q16horiz += fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(F16(33) - fix16_div(pPlayer->q16horiz, F16(3))))); + pPlayer->q16horiz += fix16_from_float(scaleAdjustmentToInterval(fix16_to_float(F16(66.666) - fix16_div(pPlayer->q16horiz, F16(1.5))))); - if (pPlayer->q16horiz >= F16(99.9) && pPlayer->q16horiz <= F16(100.1)) + if ((!pPlayer->return_to_center && g_horizRecenter) || (pPlayer->q16horiz >= F16(99.9) && pPlayer->q16horiz <= F16(100.1))) { pPlayer->q16horiz = F16(100); - g_horizRecenter = 0; + g_horizRecenter = false; } if (pPlayer->q16horizoff >= F16(-0.1) && pPlayer->q16horizoff <= F16(0.1)) @@ -5517,10 +5517,7 @@ RECHECK: } if (pPlayer->return_to_center > 0) - { pPlayer->return_to_center--; - g_horizRecenter = true; - } if (TEST_SYNC_KEY(playerBits, SK_CENTER_VIEW) || pPlayer->hard_landing) if (VM_OnEvent(EVENT_RETURNTOCENTER, pPlayer->i,playerNum) == 0) @@ -5531,6 +5528,7 @@ RECHECK: if (VM_OnEvent(EVENT_LOOKUP,pPlayer->i,playerNum) == 0) { pPlayer->return_to_center = 9; + g_horizRecenter = true; g_horizAngleAdjust = float(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN))); } } @@ -5540,6 +5538,7 @@ RECHECK: if (VM_OnEvent(EVENT_LOOKDOWN,pPlayer->i,playerNum) == 0) { pPlayer->return_to_center = 9; + g_horizRecenter = true; g_horizAngleAdjust = -float(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN))); } } @@ -5594,6 +5593,7 @@ RECHECK: if (!FURY && pPlayer->knee_incs > 0) { g_horizSkew = F16(-48); + g_horizRecenter = true; pPlayer->return_to_center = 9; if (++pPlayer->knee_incs > 15)