- SW: Handle DoPlayerTurn()/DoPlayerHorizon() better while dead.

This commit is contained in:
Mitchell Richters 2020-09-07 21:50:43 +10:00
parent 681a8ebec2
commit e1a5e37126
2 changed files with 102 additions and 96 deletions

View file

@ -278,9 +278,9 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool
if (!cl_syncinput)
{
if (TEST(pp->Flags2, PF2_INPUT_CAN_TURN))
DoPlayerTurn(pp, !TEST(pp->Flags, PF_DEAD) || TEST(pp->Flags, PF_DEAD) && TEST(pp->Flags, PF_DEAD_HEAD|PF_HEAD_CONTROL) ? q16avel : 0, scaleAdjust);
DoPlayerTurn(pp, q16avel, scaleAdjust);
if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM))
DoPlayerHorizon(pp, !TEST(pp->Flags, PF_DEAD) ? q16horz : 0, scaleAdjust);
DoPlayerHorizon(pp, q16horz, scaleAdjust);
}
loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL);

View file

@ -1550,6 +1550,8 @@ DoPlayerCrawlHeight(PLAYERp pp)
void
DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust)
{
if (!TEST(pp->Flags, PF_DEAD) || TEST(pp->Flags, PF_DEAD) && TEST(pp->Flags, PF_DEAD_HEAD|PF_HEAD_CONTROL))
{
if (!TEST(pp->Flags, PF_TURN_180))
{
@ -1609,6 +1611,7 @@ DoPlayerTurn(PLAYERp pp, fixed_t const q16avel, double const scaleAdjust)
{
pp->q16ang = (pp->q16ang + q16avel) & 0x7FFFFFF;
}
}
if (!cl_syncinput && pp->angAdjust)
{
@ -1858,6 +1861,8 @@ PlayerAutoLook(PLAYERp pp, double const scaleAdjust)
void
DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust)
{
if (!TEST(pp->Flags, PF_DEAD))
{
// Fixme: This should probably be made optional.
if (cl_slopetilting)
@ -1923,6 +1928,7 @@ DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust)
}
}
}
}
// bound the base
pp->q16horizbase = max(pp->q16horizbase, IntToFixed(PLAYER_HORIZ_MIN));