If player is at wrong distance from axis, correct x/y position in a similar fashion to how momentum is set for homing attacks. Don't use trig here for most cases since that just re-introduces the side drift issue and friends all over again.

This fixes the CEZS issue where the player start is not actually on the track, preventing the player from going backwards until they hit a wall.
This commit is contained in:
Monster Iestyn 2016-05-16 19:00:34 +01:00
parent ea1cac8e24
commit e3dac00aa9

View file

@ -5661,6 +5661,29 @@ static void P_NiGHTSMovement(player_t *player)
if (player->mo->eflags & MFE_VERTICALFLIP)
cmd->forwardmove = (SINT8)(-cmd->forwardmove);
if (!(player->pflags & PF_TRANSFERTOCLOSEST))
{
fixed_t realdist = R_PointToDist2(player->mo->x, player->mo->y, player->mo->target->x, player->mo->target->y);
// teleport player to correct radius if neccessary
if (realdist>>FRACBITS != radius>>FRACBITS)
{
CONS_Debug(DBG_NIGHTS, "Aligning player with axis\n");
P_UnsetThingPosition(player->mo);
if (realdist == 0) // other method won't work if we're exactly on the target lol
{
const angle_t fa = player->old_angle_pos>>ANGLETOFINESHIFT;
player->mo->x = player->mo->target->x + FixedMul(FINECOSINE(fa), radius);
player->mo->y = player->mo->target->y + FixedMul(FINESINE(fa), radius);
}
else
{
player->mo->x = player->mo->target->x + FixedMul(FixedDiv(player->mo->x - player->mo->target->x, realdist), radius);
player->mo->y = player->mo->target->y + FixedMul(FixedDiv(player->mo->y - player->mo->target->y, realdist), radius);
}
P_SetThingPosition(player->mo);
}
}
// Currently reeling from being hit.
if (player->powers[pw_flashing] > (2*flashingtics)/3)
{