Init auto cam when spike rolling

This commit is contained in:
thecozies 2024-05-30 08:43:10 -05:00
parent 13dfbb151e
commit 7ceac49098
2 changed files with 40 additions and 0 deletions

View file

@ -1884,6 +1884,10 @@ bool get_analog_cam_active() {
return analog_cam_active;
}
void set_analog_cam_active(bool isActive) {
analog_cam_active = isActive;
}
// 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() {

View file

@ -2323,3 +2323,39 @@ void func_80855F9C(PlayState* play, Player* this) {
Math_ScaledStepToS(&this->currentYaw, yawTarget, 0x258);
}
}
extern void set_analog_cam_active(bool isActive);
extern void Player_Action_4(Player* this, PlayState* play);
extern s32 Player_SetAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 arg3);
extern LinkAnimationHeader gPlayerAnim_pg_maru_change;
s32 func_80857950(PlayState* play, Player* this) {
// @recomp track if newly going from non-spike roll to spike roll (spike rolling when this->unk_B86[1] == 1)
static bool wasOff = true;
bool isOff = this->unk_B86[1] == 0;
if (wasOff && !isOff) {
// @recomp set analog cam to be active now that rolling has started
set_analog_cam_active(false);
}
wasOff = isOff;
// @recomp Manual relocation, TODO remove when automated.
Input* player_control_input = *(Input**)KaleidoManager_GetRamAddr(&sPlayerControlInput);
if (((this->unk_B86[1] == 0) && !CHECK_BTN_ALL(player_control_input->cur.button, BTN_A)) ||
((this->av1.actionVar1 == 3) && (this->actor.velocity.y < 0.0f))) {
// @recomp Manual relocation, TODO remove when automated.
PlayerActionFunc Player_Action_4_reloc = KaleidoManager_GetRamAddr(Player_Action_4);
Player_SetAction(play, this, Player_Action_4_reloc, 1);
Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos);
PlayerAnimation_Change(play, &this->skelAnime, &gPlayerAnim_pg_maru_change, -2.0f / 3.0f, 7.0f, 0.0f,
ANIMMODE_ONCE, 0.0f);
Player_PlaySfx(this, NA_SE_PL_BALL_TO_GORON);
wasOff = true;
return true;
}
return false;
}