From 06079093ee441b7ea04ac0fa61414fafb31b969b Mon Sep 17 00:00:00 2001 From: danielryb <59661841+danielryb@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:46:17 +0100 Subject: [PATCH] embed timer4 into timer2 --- patches/camera_patches.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/patches/camera_patches.c b/patches/camera_patches.c index 3066957..e92a446 100644 --- a/patches/camera_patches.c +++ b/patches/camera_patches.c @@ -1071,11 +1071,7 @@ RECOMP_PATCH s32 Camera_Jump2(Camera* camera) { // @recomp Patched for analog cam. RECOMP_PATCH s32 Camera_Parallel1(Camera* camera) { // @recomp - // TODO Replace static prev_targeting_held and timer4 with new fields in rwData. static bool prev_targeting_held = false; - static s16 timer4 = 0; // @recomp Used to check if z-target can be quit. Mirrors timer2 values during z-target in unmodified function. - - // @recomp bool isChargingDekuFlowerDive = !!(((Player*)camera->focalActor)->stateFlags3 & PLAYER_STATE3_100); Vec3f* eye = &camera->eye; @@ -1103,6 +1099,10 @@ RECOMP_PATCH s32 Camera_Parallel1(Camera* camera) { CameraModeValue* values; f32 yNormal; + // @recomp Read timer4 from timer2. + s16 timer4 = rwData->timer2 >> 5; // @recomp Used to check if z-target can be quit. Mirrors timer2 values during z-target in unmodified function. + rwData->timer2 &= 0x001F; + if (!RELOAD_PARAMS(camera)) { } else { values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; @@ -1481,6 +1481,9 @@ RECOMP_PATCH s32 Camera_Parallel1(Camera* camera) { camera->atLerpStepScale = Camera_ClampLerpScale(camera, sp72 ? roData->unk_1C : roData->unk_18); rwData->unk_26 &= ~1; + // @recomp Save timer4 in unused bits of timer2. + rwData->timer2 |= timer4 << 5; + return 1; }