From 97d404de7bee06632236f76bc12f46fc1a212618 Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 19 Feb 2021 16:25:12 +0000 Subject: [PATCH] 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 :pensive: * Fix the vertical jittering when a spectator's camera is on the ground. --- src/k_kart.c | 5 +++++ src/k_respawn.c | 6 ++++++ src/p_user.c | 4 ++-- src/r_main.c | 4 +--- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/k_kart.c b/src/k_kart.c index 0f97aa9d6..adb1cd871 100644 --- a/src/k_kart.c +++ b/src/k_kart.c @@ -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 diff --git a/src/k_respawn.c b/src/k_respawn.c index 409340a3f..71f5ccd0e 100644 --- a/src/k_respawn.c +++ b/src/k_respawn.c @@ -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 diff --git a/src/p_user.c b/src/p_user.c index 4d2705180..764a94883 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -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) diff --git a/src/r_main.c b/src/r_main.c index 835ed26f7..93fadd134 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -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)