Lag of FRACUNIT matches your position exactly

This commit is contained in:
Sally Coolatta 2022-05-23 02:45:32 -04:00
parent d67c658643
commit fcff62fc9e
2 changed files with 11 additions and 7 deletions

View file

@ -228,14 +228,14 @@ void K_HandleFollower(player_t *player)
bubble = fl.bubblescale; // 0 if no bubble to spawn. bubble = fl.bubblescale; // 0 if no bubble to spawn.
// do you like angle maths? I certainly don't... // do you like angle maths? I certainly don't...
sx = player->mo->x + FixedMul(FixedMul(player->mo->scale, fl.dist), FINECOSINE((an) >> ANGLETOFINESHIFT)); sx = player->mo->x + player->mo->momx + FixedMul(FixedMul(player->mo->scale, fl.dist), FINECOSINE((an) >> ANGLETOFINESHIFT));
sy = player->mo->y + FixedMul(FixedMul(player->mo->scale, fl.dist), FINESINE((an) >> ANGLETOFINESHIFT)); sy = player->mo->y + player->mo->momy + FixedMul(FixedMul(player->mo->scale, fl.dist), FINESINE((an) >> ANGLETOFINESHIFT));
// interp info helps with stretchy fix // interp info helps with stretchy fix
deltaz = (player->mo->z - player->mo->old_z); deltaz = (player->mo->z - player->mo->old_z);
// for the z coordinate, don't be a doof like Steel and forget that MFE_VERTICALFLIP exists :P // for the z coordinate, don't be a doof like Steel and forget that MFE_VERTICALFLIP exists :P
sz = player->mo->z + FixedMul(player->mo->scale, zoffs) * P_MobjFlip(player->mo); sz = player->mo->z + player->mo->momz + FixedMul(player->mo->scale, zoffs) * P_MobjFlip(player->mo);
if (player->mo->eflags & MFE_VERTICALFLIP) if (player->mo->eflags & MFE_VERTICALFLIP)
{ {
sz += FixedMul(fl.height, player->mo->scale); sz += FixedMul(fl.height, player->mo->scale);

View file

@ -4482,10 +4482,6 @@ void P_PlayerAfterThink(player_t *player)
} }
#endif #endif
// Run followers in AfterThink, after the players have moved,
// so a lag value of 1 is exactly attached to the player.
K_HandleFollower(player);
#ifdef SECTORSPECIALSAFTERTHINK #ifdef SECTORSPECIALSAFTERTHINK
if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo)) if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo))
player->onconveyor = 0; player->onconveyor = 0;
@ -4506,11 +4502,15 @@ void P_PlayerAfterThink(player_t *player)
if (player->playerstate == PST_DEAD) if (player->playerstate == PST_DEAD)
{ {
// Followers need handled while dead.
K_HandleFollower(player);
if (player->followmobj) if (player->followmobj)
{ {
P_RemoveMobj(player->followmobj); P_RemoveMobj(player->followmobj);
P_SetTarget(&player->followmobj, NULL); P_SetTarget(&player->followmobj, NULL);
} }
return; return;
} }
@ -4583,6 +4583,10 @@ void P_PlayerAfterThink(player_t *player)
} }
} }
} }
// Run followers in AfterThink, after the players have moved,
// so a lag value of 1 is exactly attached to the player.
K_HandleFollower(player);
} }
void P_SetPlayerAngle(player_t *player, angle_t angle) void P_SetPlayerAngle(player_t *player, angle_t angle)