Commit 16fc20a5 authored by Richard Gobeille's avatar Richard Gobeille
Browse files

Improve player view recentering

From-SVN: r8552
parent d8a523e5
...@@ -3179,12 +3179,12 @@ void P_GetInput(int const playerNum) ...@@ -3179,12 +3179,12 @@ void P_GetInput(int const playerNum)
} }
else if (pPlayer->return_to_center > 0 || g_horizRecenter) 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); pPlayer->q16horiz = F16(100);
g_horizRecenter = 0; g_horizRecenter = false;
} }
if (pPlayer->q16horizoff >= F16(-0.1) && pPlayer->q16horizoff <= F16(0.1)) if (pPlayer->q16horizoff >= F16(-0.1) && pPlayer->q16horizoff <= F16(0.1))
...@@ -5510,10 +5510,7 @@ RECHECK: ...@@ -5510,10 +5510,7 @@ RECHECK:
} }
if (pPlayer->return_to_center > 0) if (pPlayer->return_to_center > 0)
{
pPlayer->return_to_center--; pPlayer->return_to_center--;
g_horizRecenter = true;
}
if (TEST_SYNC_KEY(playerBits, SK_CENTER_VIEW) || pPlayer->hard_landing) if (TEST_SYNC_KEY(playerBits, SK_CENTER_VIEW) || pPlayer->hard_landing)
if (VM_OnEvent(EVENT_RETURNTOCENTER, pPlayer->i,playerNum) == 0) if (VM_OnEvent(EVENT_RETURNTOCENTER, pPlayer->i,playerNum) == 0)
...@@ -5524,6 +5521,7 @@ RECHECK: ...@@ -5524,6 +5521,7 @@ RECHECK:
if (VM_OnEvent(EVENT_LOOKUP,pPlayer->i,playerNum) == 0) if (VM_OnEvent(EVENT_LOOKUP,pPlayer->i,playerNum) == 0)
{ {
pPlayer->return_to_center = 9; pPlayer->return_to_center = 9;
g_horizRecenter = true;
g_horizAngleAdjust = float(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN))); g_horizAngleAdjust = float(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
} }
} }
...@@ -5533,6 +5531,7 @@ RECHECK: ...@@ -5533,6 +5531,7 @@ RECHECK:
if (VM_OnEvent(EVENT_LOOKDOWN,pPlayer->i,playerNum) == 0) if (VM_OnEvent(EVENT_LOOKDOWN,pPlayer->i,playerNum) == 0)
{ {
pPlayer->return_to_center = 9; pPlayer->return_to_center = 9;
g_horizRecenter = true;
g_horizAngleAdjust = -float(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN))); g_horizAngleAdjust = -float(12<<(int)(TEST_SYNC_KEY(playerBits, SK_RUN)));
} }
} }
...@@ -5587,6 +5586,7 @@ RECHECK: ...@@ -5587,6 +5586,7 @@ RECHECK:
if (!FURY && pPlayer->knee_incs > 0) if (!FURY && pPlayer->knee_incs > 0)
{ {
g_horizSkew = F16(-48); g_horizSkew = F16(-48);
g_horizRecenter = true;
pPlayer->return_to_center = 9; pPlayer->return_to_center = 9;
if (++pPlayer->knee_incs > 15) if (++pPlayer->knee_incs > 15)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment