- SW: Hook up horizAdjust and adjust all ticrate amendments of q16horiz via playerAddHoriz()/playerSetHoriz().

This commit is contained in:
Mitchell Richters 2020-09-07 21:47:15 +10:00
parent 2e2ca03812
commit 681a8ebec2
2 changed files with 21 additions and 10 deletions

View file

@ -280,7 +280,7 @@ static void processMovement(PLAYERp const pp, ControlInfo* const hidInput, bool
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);
if (TEST(pp->Flags2, PF2_INPUT_CAN_AIM))
DoPlayerHorizon(pp, q16horz, scaleAdjust);
DoPlayerHorizon(pp, !TEST(pp->Flags, PF_DEAD) ? q16horz : 0, scaleAdjust);
}
loc.fvel = clamp(loc.fvel + fvel, -MAXFVEL, MAXFVEL);

View file

@ -1936,6 +1936,11 @@ DoPlayerHorizon(PLAYERp pp, fixed_t const q16horz, double const scaleAdjust)
// add base and offsets
pp->q16horiz = pp->q16horizbase + pp->q16horizoff;
if (!cl_syncinput)
{
pp->q16horiz += xs_CRoundToInt(scaleAdjust * pp->horizAdjust);
}
}
void
@ -6288,24 +6293,30 @@ DoPlayerBeginDie(PLAYERp pp)
RESET(pp->Flags, PF_HEAD_CONTROL);
}
int
void
DoPlayerDeathHoriz(PLAYERp pp, short target, short speed)
{
if (pp->q16horiz > IntToFixed(target))
{
pp->q16horiz -= IntToFixed(speed);
{
if (!cl_syncinput)
SET(pp->Flags2, PF2_INPUT_CAN_AIM);
playerAddHoriz(pp, -speed);
if (pp->q16horiz <= IntToFixed(target))
pp->q16horiz = IntToFixed(target);
playerSetHoriz(pp, target);
}
if (pp->q16horiz < IntToFixed(target))
{
pp->q16horiz += IntToFixed(speed);
if (pp->q16horiz >= IntToFixed(target))
pp->q16horiz = IntToFixed(target);
}
if (!cl_syncinput)
SET(pp->Flags2, PF2_INPUT_CAN_AIM);
return pp->q16horiz == IntToFixed(target);
playerAddHoriz(pp, speed);
if (pp->q16horiz >= IntToFixed(target))
playerSetHoriz(pp, target);
}
}
int