Improve player view recentering

git-svn-id: https://svn.eduke32.com/eduke32@8552 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2020-01-29 11:36:48 +00:00 committed by Christoph Oelckers
parent 3b43bba32f
commit 659ebf82d8

View file

@ -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)