Make camera follow platform momentum

This commit is contained in:
Sally Coolatta 2023-04-23 14:51:29 -04:00
parent 57022fafe5
commit 85eaf2eeea
3 changed files with 12 additions and 9 deletions

View file

@ -121,6 +121,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

@ -3885,10 +3885,10 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
thiscam->floorz = tm.floorz;
thiscam->ceilingz = 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

@ -2549,9 +2549,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)
@ -4545,9 +4542,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))
@ -4598,11 +4592,19 @@ void P_PlayerAfterThink(player_t *player)
player->timeshit = 0;
}
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)