From fcff62fc9e5e42dbb092d62b503d1d53f9a7196e Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Mon, 23 May 2022 02:45:32 -0400 Subject: [PATCH] Lag of FRACUNIT matches your position exactly --- src/k_follower.c | 6 +++--- src/p_user.c | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/k_follower.c b/src/k_follower.c index 7bd1b2194..25e0c5814 100644 --- a/src/k_follower.c +++ b/src/k_follower.c @@ -228,14 +228,14 @@ void K_HandleFollower(player_t *player) bubble = fl.bubblescale; // 0 if no bubble to spawn. // do you like angle maths? I certainly don't... - sx = player->mo->x + FixedMul(FixedMul(player->mo->scale, fl.dist), FINECOSINE((an) >> ANGLETOFINESHIFT)); - sy = player->mo->y + FixedMul(FixedMul(player->mo->scale, fl.dist), FINESINE((an) >> ANGLETOFINESHIFT)); + sx = player->mo->x + player->mo->momx + FixedMul(FixedMul(player->mo->scale, fl.dist), FINECOSINE((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 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 - 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) { sz += FixedMul(fl.height, player->mo->scale); diff --git a/src/p_user.c b/src/p_user.c index 648077340..ffef501e9 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4482,10 +4482,6 @@ void P_PlayerAfterThink(player_t *player) } #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 if (player->onconveyor != 1 || !P_IsObjectOnGround(player->mo)) player->onconveyor = 0; @@ -4506,11 +4502,15 @@ void P_PlayerAfterThink(player_t *player) if (player->playerstate == PST_DEAD) { + // Followers need handled while dead. + K_HandleFollower(player); + if (player->followmobj) { P_RemoveMobj(player->followmobj); P_SetTarget(&player->followmobj, NULL); } + 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)