From c68875ad938bc7b8b44607361392360b43066f74 Mon Sep 17 00:00:00 2001 From: MPC Date: Tue, 11 Dec 2018 20:27:26 -0300 Subject: [PATCH] Fix remote viewpoint cameras for real I'm so sorry --- src/p_user.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/p_user.c b/src/p_user.c index cf129669..af3f7ebf 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -8712,9 +8712,15 @@ void P_PlayerThink(player_t *player) if (player->flashcount) player->flashcount--; - // By the time P_MoveChaseCamera is called, this might be zero. Do not do it here. - //if (player->awayviewtics) - // player->awayviewtics--; + // Re-fixed by Jimita (11-12-2018) + if (player->awayviewtics) + { + player->awayviewtics--; + if (!player->awayviewtics) + player->awayviewtics = -1; + // The timer might've reached zero, but we'll run the remote view camera anyway. + // This is completely fine to do, since -1 evaluates to true in a "if (!player->awayviewtics)" conditional. + } /// \note do this in the cheat code if (player->pflags & PF_NOCLIP) @@ -9492,8 +9498,9 @@ void P_PlayerAfterThink(player_t *player) } } - if (player->awayviewtics) - player->awayviewtics--; + // Reset it to zero if it's a -1. + if (player->awayviewtics < 0) + player->awayviewtics = 0; // spectator invisibility and nogravity. if ((netgame || multiplayer) && player->spectator)