A few changes to cameras.

* When lightsnaking, update the camera angle at each waypoint step to prevent being dropped the wrong way around.
    * The above bullet point is WIP. I've tried to restrict manual turning while lightsnaking, but it still happens and just gets yanked back at each waypoint. Would appreciate a bit of insight here.
* Fix HUD tracking for spectators by setting thiscam->chase each tic more definitively.
    * Still happens for the very first tic of the map though, must be another data point I missed 😔
* Fix the vertical jittering when a spectator's camera is on the ground.
This commit is contained in:
toaster 2021-02-19 16:25:12 +00:00
parent 5ee4680c04
commit 97d404de7b
4 changed files with 14 additions and 5 deletions

View file

@ -7016,6 +7016,11 @@ INT16 K_GetKartTurnValue(player_t *player, INT16 turnvalue)
return 0;
}
if (player->respawn.state == RESPAWNST_MOVE)
{
return 0;
}
currentSpeed = R_PointToDist2(0, 0, player->mo->momx, player->mo->momy);
if ((currentSpeed <= 0) // Not moving

View file

@ -371,6 +371,12 @@ static void K_MovePlayerToRespawnPoint(player_t *player)
}
// Set angle, regardless of if we're done or not
P_SetPlayerAngle(player, R_PointToAngle2(
player->respawn.wp->mobj->x,
player->respawn.wp->mobj->y,
player->respawn.wp->nextwaypoints[nwp]->mobj->x,
player->respawn.wp->nextwaypoints[nwp]->mobj->y
));
player->drawangle = R_PointToAngle2(
player->mo->x, player->mo->y,
dest.x, dest.y

View file

@ -206,7 +206,7 @@ void P_CalcHeight(player_t *player)
player->bob = FixedMul(cv_movebob.value, bobmul);
if (!P_IsObjectOnGround(mo))
if (!P_IsObjectOnGround(mo) || player->spectator)
{
if (mo->eflags & MFE_VERTICALFLIP)
{
@ -2997,7 +2997,7 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
if (thiscam->chase && player->mo->health <= 0)
return;
thiscam->chase = true;
thiscam->chase = !player->spectator;
x = player->mo->x - P_ReturnThrustX(player->mo, thiscam->angle, player->mo->radius);
y = player->mo->y - P_ReturnThrustY(player->mo, thiscam->angle, player->mo->radius);
if (player->mo->eflags & MFE_VERTICALFLIP)

View file

@ -1191,9 +1191,7 @@ void R_SetupFrame(player_t *player)
if (i > r_splitscreen)
return; // shouldn't be possible, but just in case
if (player->playerstate == PST_DEAD || gamestate == GS_TITLESCREEN || tutorialmode)
chasecam = true; // force chasecam on
else if (player->spectator) // no spectator chasecam
if (player->spectator) // no spectator chasecam
chasecam = false; // force chasecam off
if (chasecam && !thiscam->chase)