#279 Adjusted autocam/analog cam behavior while inside of a deku flower

This commit is contained in:
thecozies 2024-05-28 09:26:30 -05:00
parent b6b3bca731
commit 8cd7718b38
2 changed files with 37 additions and 0 deletions

View File

@ -1873,3 +1873,11 @@ void analog_cam_post_play_update(PlayState* play) {
active_cam->inputDir.y = analog_camera_pos.yaw + DEG_TO_BINANG(180);
}
}
bool get_analog_cam_active() {
return analog_cam_active;
}
void set_analog_cam_active(bool is_active) {
analog_cam_active = is_active;
}

View File

@ -2297,3 +2297,32 @@ void draw_dpad_icons(PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx);
}
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);
// @recomp Updates yaw while inside of deku flower.
void func_80855F9C(PlayState* play, Player* this) {
f32 speedTarget;
s16 yawTarget;
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);
}
if (get_analog_cam_active()) {
// @recomp set current yaw to active camera's yaw.
this->currentYaw = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play));
} else {
Math_ScaledStepToS(&this->currentYaw, yawTarget, 0x258);
}
}