Make camera follow platform momentum

This commit is contained in:
Sally Coolatta 2023-04-23 14:51:29 -04:00 committed by NepDisk
parent 5dd799ebd7
commit 778de306c5
3 changed files with 12 additions and 9 deletions

View file

@ -125,6 +125,7 @@ struct camera_t
// Momentums, used to update position.
fixed_t momx, momy, momz;
fixed_t pmomz;
// SRB2Kart: camera pans while drifting
fixed_t pan;

View file

@ -3721,10 +3721,10 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
thiscam->floorz = g_tm.floorz;
thiscam->ceilingz = g_tm.ceilingz;
if (thiscam->momz || player->mo->pmomz)
if (thiscam->momz || thiscam->pmomz)
{
// adjust height
thiscam->z += thiscam->momz + player->mo->pmomz;
thiscam->z += thiscam->momz + thiscam->pmomz;
}
if (thiscam->ceilingz - thiscam->z < thiscam->height

View file

@ -2440,9 +2440,6 @@ void P_MovePlayer(player_t *player)
// Look for Quicksand!
if (CheckForQuicksand)
P_CheckQuicksand(player);
if (P_IsObjectOnGround(player->mo))
player->mo->pmomz = 0;
}
static void P_DoZoomTube(player_t *player)
@ -4575,9 +4572,6 @@ void P_PlayerAfterThink(player_t *player)
player->mo->flags |= MF_NOGRAVITY;
}
if (P_IsObjectOnGround(player->mo))
player->mo->pmomz = 0;
K_KartPlayerAfterThink(player);
if (player->followmobj && (player->spectator || player->mo->health <= 0 || player->followmobj->type != player->followitem))
@ -4622,11 +4616,19 @@ void P_PlayerAfterThink(player_t *player)
// so a lag value of 1 is exactly attached to the player.
K_HandleFollower(player);
if (K_PlayerUsesBotMovement(player))
{
K_UpdateBotGameplayVars(player);
}
if (thiscam)
{
// Store before it gets 0'd out
thiscam->pmomz = player->mo->pmomz;
}
if (P_IsObjectOnGround(player->mo))
player->mo->pmomz = 0;
}
void P_SetPlayerAngle(player_t *player, angle_t angle)