mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 01:01:33 +00:00
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:
parent
ea1cac8e24
commit
e3dac00aa9
1 changed files with 23 additions and 0 deletions
23
src/p_user.c
23
src/p_user.c
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue