diff --git a/patches/camera_patches.c b/patches/camera_patches.c index 316109a..842b238 100644 --- a/patches/camera_patches.c +++ b/patches/camera_patches.c @@ -8,6 +8,7 @@ static bool prev_analog_cam_active = false; static bool can_use_analog_cam = false; static bool analog_cam_active = false; +static bool analog_cam_skip_once = false; VecGeo analog_camera_pos = { .r = 66.0f, .pitch = 0, .yaw = 0 }; @@ -62,6 +63,11 @@ void update_analog_cam(Camera* c) { analog_cam_active = true; } + if (analog_cam_skip_once) { + analog_cam_active = false; + analog_cam_skip_once = false; + } + // Record the Z targeting state. prev_targeting_held = targeting_held; @@ -1878,6 +1884,9 @@ bool get_analog_cam_active() { return analog_cam_active; } -void set_analog_cam_active(bool is_active) { - analog_cam_active = is_active; +// Calling this will avoid analog cam taking over for the following game loop. +// E.g. using left stick inputs while in a deku flower taking priority over right stick. +void skip_analog_cam_once() { + analog_cam_skip_once = true; + analog_cam_active = false; } diff --git a/patches/input.c b/patches/input.c index 6b19d55..e35b18e 100644 --- a/patches/input.c +++ b/patches/input.c @@ -2301,7 +2301,7 @@ void draw_dpad_icons(PlayState* play) { extern s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYawTarget, f32 speedMode, PlayState* play); extern bool get_analog_cam_active(); -extern void set_analog_cam_active(bool is_active); +extern void skip_analog_cam_once(); // @recomp Updates yaw while inside of deku flower. void func_80855F9C(PlayState* play, Player* this) { @@ -2311,12 +2311,9 @@ void func_80855F9C(PlayState* play, Player* this) { this->stateFlags2 |= PLAYER_STATE2_20; Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, 0.018f, play); - // @recomp If analog cam is active and left stick inputs are occurring, reset auto cam. - if ( - get_analog_cam_active() && - (play->state.input[0].rel.stick_y != 0 || play->state.input[0].rel.stick_x != 0) - ) { - set_analog_cam_active(false); + // @recomp If left stick inputs are occurring, prevent analog cam. + if ((play->state.input[0].rel.stick_y != 0 || play->state.input[0].rel.stick_x != 0)) { + skip_analog_cam_once(); } if (get_analog_cam_active()) {