override analog cam while left stick is active in deku flower
This commit is contained in:
parent
8cd7718b38
commit
13dfbb151e
|
@ -8,6 +8,7 @@
|
||||||
static bool prev_analog_cam_active = false;
|
static bool prev_analog_cam_active = false;
|
||||||
static bool can_use_analog_cam = false;
|
static bool can_use_analog_cam = false;
|
||||||
static bool analog_cam_active = 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 };
|
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;
|
analog_cam_active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (analog_cam_skip_once) {
|
||||||
|
analog_cam_active = false;
|
||||||
|
analog_cam_skip_once = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Record the Z targeting state.
|
// Record the Z targeting state.
|
||||||
prev_targeting_held = targeting_held;
|
prev_targeting_held = targeting_held;
|
||||||
|
|
||||||
|
@ -1878,6 +1884,9 @@ bool get_analog_cam_active() {
|
||||||
return analog_cam_active;
|
return analog_cam_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_analog_cam_active(bool is_active) {
|
// Calling this will avoid analog cam taking over for the following game loop.
|
||||||
analog_cam_active = is_active;
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2301,7 +2301,7 @@ void draw_dpad_icons(PlayState* play) {
|
||||||
extern s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYawTarget, f32 speedMode,
|
extern s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYawTarget, f32 speedMode,
|
||||||
PlayState* play);
|
PlayState* play);
|
||||||
extern bool get_analog_cam_active();
|
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.
|
// @recomp Updates yaw while inside of deku flower.
|
||||||
void func_80855F9C(PlayState* play, Player* this) {
|
void func_80855F9C(PlayState* play, Player* this) {
|
||||||
|
@ -2311,12 +2311,9 @@ void func_80855F9C(PlayState* play, Player* this) {
|
||||||
this->stateFlags2 |= PLAYER_STATE2_20;
|
this->stateFlags2 |= PLAYER_STATE2_20;
|
||||||
Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, 0.018f, play);
|
Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, 0.018f, play);
|
||||||
|
|
||||||
// @recomp If analog cam is active and left stick inputs are occurring, reset auto cam.
|
// @recomp If left stick inputs are occurring, prevent analog cam.
|
||||||
if (
|
if ((play->state.input[0].rel.stick_y != 0 || play->state.input[0].rel.stick_x != 0)) {
|
||||||
get_analog_cam_active() &&
|
skip_analog_cam_once();
|
||||||
(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()) {
|
if (get_analog_cam_active()) {
|
||||||
|
|
Loading…
Reference in New Issue