From d951422e953a00e9a6d017800a379fec2891dba4 Mon Sep 17 00:00:00 2001 From: InspirationByte Date: Sat, 12 Mar 2022 10:11:36 +0300 Subject: [PATCH] - fix crash when switching camera to event in film director --- src_rebuild/Game/C/camera.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src_rebuild/Game/C/camera.c b/src_rebuild/Game/C/camera.c index 2dfc3a07..09edde35 100644 --- a/src_rebuild/Game/C/camera.c +++ b/src_rebuild/Game/C/camera.c @@ -592,9 +592,9 @@ void PlaceCameraInCar(PLAYER *lp, int BumperCam) // [A] handle REDRIVER2 dedicated look back button if ((paddCamera & CAMERA_PAD_LOOK_BACK) == CAMERA_PAD_LOOK_BACK || (paddCamera & CAMERA_PAD_LOOK_BACK_DED)) - camera_angle.vy = 2048 - baseDir & 0xfff; + camera_angle.vy = 2048 - baseDir & 4095; else - camera_angle.vy = (lp->headPos >> 16) - baseDir & 0xfff; + camera_angle.vy = (lp->headPos >> 16) - baseDir & 4095; if (cp) { @@ -632,13 +632,18 @@ void PlaceCameraInCar(PLAYER *lp, int BumperCam) } else { + LPPEDESTRIAN pPlayerPed; + pPlayerPed = lp->pPed; + camera_angle.vx = -tannerLookAngle.vx; - // pedestrian camera is much simpler BuildWorldMatrix(); - viewer_position.vy += lp->pPed->head_pos - 25; - //viewer_position.vz += 45; + if (pPlayerPed) + { + // apply pedestrian bobbing + viewer_position.vy += pPlayerPed->head_pos - 25; + } angle = -baseDir;