From 36d81d7996faa83a9c355da50e0d9768d2d03de7 Mon Sep 17 00:00:00 2001 From: toaster Date: Tue, 30 May 2023 01:12:59 +0100 Subject: [PATCH] Final lack of smoothness in camera cutaway killed: A one-frame window where focus angle/pitch was incorrect due to not having thunk yet --- src/p_mobj.c | 1 + src/p_spec.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/p_mobj.c b/src/p_mobj.c index 4d87491b1..d8adcea8a 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -9463,6 +9463,7 @@ static boolean P_MobjRegularThink(mobj_t *mobj) } // If target is valid, then we'll focus on it. + // See also linedef type 422 if (mobj->target != NULL && P_MobjWasRemoved(mobj->target) == false) { mobj->angle = R_PointToAngle2( diff --git a/src/p_spec.c b/src/p_spec.c index aa1411f74..244f2ae6d 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -3135,6 +3135,28 @@ boolean P_ProcessSpecial(activator_t *activator, INT16 special, INT32 *args, cha break; } } + + // If target is valid, then we'll focus on it. + // See also MT_ALTVIEWMAN mobjthinker + if (newViewMobj->target != NULL && P_MobjWasRemoved(newViewMobj->target) == false) + { + newViewMobj->angle = R_PointToAngle2( + newViewMobj->x, + newViewMobj->y, + newViewMobj->target->x, + newViewMobj->target->y + ); + + newViewMobj->pitch = R_PointToAngle2( + 0, + newViewMobj->z, + R_PointToDist2( + newViewMobj->x, newViewMobj->y, + newViewMobj->target->x, newViewMobj->target->y + ), + newViewMobj->target->z + (newViewMobj->target->height >> 1) + ); + } } else {