From 50985375b9cc96d3431ece84945a7135c378046b Mon Sep 17 00:00:00 2001 From: fig02 Date: Wed, 25 Sep 2024 10:58:27 -0400 Subject: [PATCH] ActionChange -> ActionHandler (#2219) --- .../actors/ovl_player_actor/z_player.c | 323 +++++++++--------- 1 file changed, 165 insertions(+), 158 deletions(-) diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index d297308365..e6ed9f1961 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -2764,7 +2764,7 @@ s32 func_8083499C(Player* this, PlayState* play) { } /** - * The actual sword weapon is not handled here. See `Player_ActionChange_7` for melee weapon usage. + * The actual sword weapon is not handled here. See `Player_ActionHandler_7` for melee weapon usage. * This upper body action allows for shielding or changing held items while a sword is in hand. */ s32 Player_UpperAction_Sword(Player* this, PlayState* play) { @@ -3921,134 +3921,140 @@ s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYaw } } -typedef enum ActionChangeIndex { - /* 0 */ PLAYER_ACTION_CHG_0, - /* 1 */ PLAYER_ACTION_CHG_1, - /* 2 */ PLAYER_ACTION_CHG_2, - /* 3 */ PLAYER_ACTION_CHG_3, - /* 4 */ PLAYER_ACTION_CHG_4, - /* 5 */ PLAYER_ACTION_CHG_5, - /* 6 */ PLAYER_ACTION_CHG_6, - /* 7 */ PLAYER_ACTION_CHG_7, - /* 8 */ PLAYER_ACTION_CHG_8, - /* 9 */ PLAYER_ACTION_CHG_9, - /* 10 */ PLAYER_ACTION_CHG_10, - /* 11 */ PLAYER_ACTION_CHG_11, - /* 12 */ PLAYER_ACTION_CHG_12, - /* 13 */ PLAYER_ACTION_CHG_13 -} ActionChangeIndex; +typedef enum ActionHandlerIndex { + /* 0 */ PLAYER_ACTION_HANDLER_0, + /* 1 */ PLAYER_ACTION_HANDLER_1, + /* 2 */ PLAYER_ACTION_HANDLER_2, + /* 3 */ PLAYER_ACTION_HANDLER_3, + /* 4 */ PLAYER_ACTION_HANDLER_4, + /* 5 */ PLAYER_ACTION_HANDLER_5, + /* 6 */ PLAYER_ACTION_HANDLER_6, + /* 7 */ PLAYER_ACTION_HANDLER_7, + /* 8 */ PLAYER_ACTION_HANDLER_8, + /* 9 */ PLAYER_ACTION_HANDLER_9, + /* 10 */ PLAYER_ACTION_HANDLER_10, + /* 11 */ PLAYER_ACTION_HANDLER_11, + /* 12 */ PLAYER_ACTION_HANDLER_12, + /* 13 */ PLAYER_ACTION_HANDLER_13 +} ActionHandlerIndex; -static s8 sActionChangeList1[] = { - PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, - PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_7, +static s8 sActionHandlerList1[] = { + PLAYER_ACTION_HANDLER_13, PLAYER_ACTION_HANDLER_2, PLAYER_ACTION_HANDLER_4, PLAYER_ACTION_HANDLER_9, + PLAYER_ACTION_HANDLER_10, PLAYER_ACTION_HANDLER_11, PLAYER_ACTION_HANDLER_8, -PLAYER_ACTION_HANDLER_7, }; -static s8 sActionChangeList2[] = { - PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_5, - PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, - PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_7, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_6, +static s8 sActionHandlerList2[] = { + PLAYER_ACTION_HANDLER_13, PLAYER_ACTION_HANDLER_1, PLAYER_ACTION_HANDLER_2, PLAYER_ACTION_HANDLER_5, + PLAYER_ACTION_HANDLER_3, PLAYER_ACTION_HANDLER_4, PLAYER_ACTION_HANDLER_9, PLAYER_ACTION_HANDLER_10, + PLAYER_ACTION_HANDLER_11, PLAYER_ACTION_HANDLER_7, PLAYER_ACTION_HANDLER_8, -PLAYER_ACTION_HANDLER_6, }; -static s8 sActionChangeList3[] = { - PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_3, - PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, - PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +static s8 sActionHandlerList3[] = { + PLAYER_ACTION_HANDLER_13, PLAYER_ACTION_HANDLER_1, PLAYER_ACTION_HANDLER_2, PLAYER_ACTION_HANDLER_3, + PLAYER_ACTION_HANDLER_4, PLAYER_ACTION_HANDLER_9, PLAYER_ACTION_HANDLER_10, PLAYER_ACTION_HANDLER_11, + PLAYER_ACTION_HANDLER_8, PLAYER_ACTION_HANDLER_7, -PLAYER_ACTION_HANDLER_6, }; -static s8 sActionChangeList4[] = { - PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, - PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_7, +static s8 sActionHandlerList4[] = { + PLAYER_ACTION_HANDLER_13, PLAYER_ACTION_HANDLER_2, PLAYER_ACTION_HANDLER_4, PLAYER_ACTION_HANDLER_9, + PLAYER_ACTION_HANDLER_10, PLAYER_ACTION_HANDLER_11, PLAYER_ACTION_HANDLER_8, -PLAYER_ACTION_HANDLER_7, }; -static s8 sActionChangeList5[] = { - PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, - PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_12, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_7, +static s8 sActionHandlerList5[] = { + PLAYER_ACTION_HANDLER_13, PLAYER_ACTION_HANDLER_2, PLAYER_ACTION_HANDLER_4, + PLAYER_ACTION_HANDLER_9, PLAYER_ACTION_HANDLER_10, PLAYER_ACTION_HANDLER_11, + PLAYER_ACTION_HANDLER_12, PLAYER_ACTION_HANDLER_8, -PLAYER_ACTION_HANDLER_7, }; -static s8 sActionChangeList6[] = { - -PLAYER_ACTION_CHG_7, +static s8 sActionHandlerList6[] = { + -PLAYER_ACTION_HANDLER_7, }; -static s8 sActionChangeList7[] = { - PLAYER_ACTION_CHG_0, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, - PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_5, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, - PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +static s8 sActionHandlerList7[] = { + PLAYER_ACTION_HANDLER_0, PLAYER_ACTION_HANDLER_11, PLAYER_ACTION_HANDLER_1, PLAYER_ACTION_HANDLER_2, + PLAYER_ACTION_HANDLER_3, PLAYER_ACTION_HANDLER_5, PLAYER_ACTION_HANDLER_4, PLAYER_ACTION_HANDLER_9, + PLAYER_ACTION_HANDLER_8, PLAYER_ACTION_HANDLER_7, -PLAYER_ACTION_HANDLER_6, }; -static s8 sActionChangeList8[] = { - PLAYER_ACTION_CHG_0, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, - PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_12, PLAYER_ACTION_CHG_5, PLAYER_ACTION_CHG_4, - PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +static s8 sActionHandlerList8[] = { + PLAYER_ACTION_HANDLER_0, PLAYER_ACTION_HANDLER_11, PLAYER_ACTION_HANDLER_1, PLAYER_ACTION_HANDLER_2, + PLAYER_ACTION_HANDLER_3, PLAYER_ACTION_HANDLER_12, PLAYER_ACTION_HANDLER_5, PLAYER_ACTION_HANDLER_4, + PLAYER_ACTION_HANDLER_9, PLAYER_ACTION_HANDLER_8, PLAYER_ACTION_HANDLER_7, -PLAYER_ACTION_HANDLER_6, }; -static s8 sActionChangeList9[] = { - PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_12, - PLAYER_ACTION_CHG_5, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, - PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +static s8 sActionHandlerList9[] = { + PLAYER_ACTION_HANDLER_13, PLAYER_ACTION_HANDLER_1, PLAYER_ACTION_HANDLER_2, PLAYER_ACTION_HANDLER_3, + PLAYER_ACTION_HANDLER_12, PLAYER_ACTION_HANDLER_5, PLAYER_ACTION_HANDLER_4, PLAYER_ACTION_HANDLER_9, + PLAYER_ACTION_HANDLER_10, PLAYER_ACTION_HANDLER_11, PLAYER_ACTION_HANDLER_8, PLAYER_ACTION_HANDLER_7, + -PLAYER_ACTION_HANDLER_6, }; -static s8 sActionChangeList10[] = { - PLAYER_ACTION_CHG_10, - PLAYER_ACTION_CHG_8, - -PLAYER_ACTION_CHG_7, +static s8 sActionHandlerList10[] = { + PLAYER_ACTION_HANDLER_10, + PLAYER_ACTION_HANDLER_8, + -PLAYER_ACTION_HANDLER_7, }; -static s8 sActionChangeList11[] = { - PLAYER_ACTION_CHG_0, - PLAYER_ACTION_CHG_12, - PLAYER_ACTION_CHG_5, - -PLAYER_ACTION_CHG_4, +static s8 sActionHandlerList11[] = { + PLAYER_ACTION_HANDLER_0, + PLAYER_ACTION_HANDLER_12, + PLAYER_ACTION_HANDLER_5, + -PLAYER_ACTION_HANDLER_4, }; -s32 Player_ActionChange_0(Player* this, PlayState* play); -s32 Player_ActionChange_1(Player* this, PlayState* play); -s32 Player_ActionChange_2(Player* this, PlayState* play); -s32 Player_ActionChange_3(Player* this, PlayState* play); -s32 Player_ActionChange_4(Player* this, PlayState* play); -s32 Player_ActionChange_5(Player* this, PlayState* play); -s32 Player_ActionChange_6(Player* this, PlayState* play); -s32 Player_ActionChange_7(Player* this, PlayState* play); -s32 Player_ActionChange_8(Player* this, PlayState* play); -s32 Player_ActionChange_9(Player* this, PlayState* play); -s32 Player_ActionChange_10(Player* this, PlayState* play); -s32 Player_ActionChange_11(Player* this, PlayState* play); -s32 Player_ActionChange_12(Player* this, PlayState* play); -s32 Player_ActionChange_13(Player* this, PlayState* play); +s32 Player_ActionHandler_0(Player* this, PlayState* play); +s32 Player_ActionHandler_1(Player* this, PlayState* play); +s32 Player_ActionHandler_2(Player* this, PlayState* play); +s32 Player_ActionHandler_3(Player* this, PlayState* play); +s32 Player_ActionHandler_4(Player* this, PlayState* play); +s32 Player_ActionHandler_5(Player* this, PlayState* play); +s32 Player_ActionHandler_6(Player* this, PlayState* play); +s32 Player_ActionHandler_7(Player* this, PlayState* play); +s32 Player_ActionHandler_8(Player* this, PlayState* play); +s32 Player_ActionHandler_9(Player* this, PlayState* play); +s32 Player_ActionHandler_10(Player* this, PlayState* play); +s32 Player_ActionHandler_11(Player* this, PlayState* play); +s32 Player_ActionHandler_12(Player* this, PlayState* play); +s32 Player_ActionHandler_13(Player* this, PlayState* play); -static s32 (*sActionChangeFuncs[])(Player* this, PlayState* play) = { - /* PLAYER_ACTION_CHG_0 */ Player_ActionChange_0, - /* PLAYER_ACTION_CHG_1 */ Player_ActionChange_1, - /* PLAYER_ACTION_CHG_2 */ Player_ActionChange_2, - /* PLAYER_ACTION_CHG_3 */ Player_ActionChange_3, - /* PLAYER_ACTION_CHG_4 */ Player_ActionChange_4, - /* PLAYER_ACTION_CHG_5 */ Player_ActionChange_5, - /* PLAYER_ACTION_CHG_6 */ Player_ActionChange_6, - /* PLAYER_ACTION_CHG_7 */ Player_ActionChange_7, - /* PLAYER_ACTION_CHG_8 */ Player_ActionChange_8, - /* PLAYER_ACTION_CHG_9 */ Player_ActionChange_9, - /* PLAYER_ACTION_CHG_10 */ Player_ActionChange_10, - /* PLAYER_ACTION_CHG_11 */ Player_ActionChange_11, - /* PLAYER_ACTION_CHG_12 */ Player_ActionChange_12, - /* PLAYER_ACTION_CHG_13 */ Player_ActionChange_13, +static s32 (*sActionHandlerFuncs[])(Player* this, PlayState* play) = { + Player_ActionHandler_0, // PLAYER_ACTION_HANDLER_0 + Player_ActionHandler_1, // PLAYER_ACTION_HANDLER_1 + Player_ActionHandler_2, // PLAYER_ACTION_HANDLER_2 + Player_ActionHandler_3, // PLAYER_ACTION_HANDLER_3 + Player_ActionHandler_4, // PLAYER_ACTION_HANDLER_4 + Player_ActionHandler_5, // PLAYER_ACTION_HANDLER_5 + Player_ActionHandler_6, // PLAYER_ACTION_HANDLER_6 + Player_ActionHandler_7, // PLAYER_ACTION_HANDLER_7 + Player_ActionHandler_8, // PLAYER_ACTION_HANDLER_8 + Player_ActionHandler_9, // PLAYER_ACTION_HANDLER_9 + Player_ActionHandler_10, // PLAYER_ACTION_HANDLER_10 + Player_ActionHandler_11, // PLAYER_ACTION_HANDLER_11 + Player_ActionHandler_12, // PLAYER_ACTION_HANDLER_12 + Player_ActionHandler_13, // PLAYER_ACTION_HANDLER_13 }; /** - * This function processes "Action Change Lists", which run various functions that - * check if it is appropriate to change to a new action. + * This function processes "Action Handler Lists". * - * Action Change Lists are a list of indices for the `sActionChangeFuncs` array. - * The functions are ran in order until one of them returns true, or the end of the list is reached. - * An Action Change index having a negative value indicates that it is the last member in the list. + * An Action Handler is a function that "listens" for certain conditions or the right time + * to change to a certain action. These can include actions triggered manually by the player + * or actions that happen automatically, given some other condition(s). * - * Because these lists are processed sequentially, the order of the indices in the list determines its priority. + * Action Handler Lists are a list of indices for the `sActionHandlerFuncs` array. + * The Action Handlers are ran in order until one of them returns true, or the end of the list is reached. + * An Action Handler index having a negative value indicates that it is the last member in the list. * - * If the `updateUpperBody` argument is true, Player's upper body will update before the Action Change List - * is processed. This allows for Item Action functions to run. + * Because these lists are processed sequentially, the order of the indices in the list + * determines an Action Handler's priority. + * + * If the `updateUpperBody` argument is true, Player's upper body will update before the Action Handler List + * is processed. This allows for Item Action functions to run, for example. * * @return true if a new action has been chosen * */ -s32 Player_TryActionChangeList(PlayState* play, Player* this, s8* actionChangeList, s32 updateUpperBody) { +s32 Player_TryActionHandlerList(PlayState* play, Player* this, s8* actionHandlerList, s32 updateUpperBody) { s32 i; if (!(this->stateFlags1 & (PLAYER_STATE1_0 | PLAYER_STATE1_DEAD | PLAYER_STATE1_29))) { @@ -4067,16 +4073,16 @@ s32 Player_TryActionChangeList(PlayState* play, Player* this, s8* actionChangeLi if (!(this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) && (Player_UpperAction_ChangeHeldItem != this->upperActionFunc)) { - // Process all entries in the Action Change List with a positive index - while (*actionChangeList >= 0) { - if (sActionChangeFuncs[*actionChangeList](this, play)) { + // Process all entries in the Action Handler List with a positive index + while (*actionHandlerList >= 0) { + if (sActionHandlerFuncs[*actionHandlerList](this, play)) { return true; } - actionChangeList++; + actionHandlerList++; } // Try the last entry in the list. Negate the index to make it positive again. - if (sActionChangeFuncs[-(*actionChangeList)](this, play)) { + if (sActionHandlerFuncs[-(*actionHandlerList)](this, play)) { return true; } } @@ -4094,14 +4100,14 @@ typedef enum PlayerActionInterruptResult { /** * An Action Interrupt allows for ending an action early, toward the end of an animation. * - * First, `sActionChangeList7` will be checked to see if any of those actions should be used. - * It should be noted that the `updateUpperBody` argument passed to `Player_TryActionChangeList` + * First, `sActionHandlerList7` will be checked to see if any of those actions should be used. + * It should be noted that the `updateUpperBody` argument passed to `Player_TryActionHandlerList` * is `true`. This means that an item can be used during the interrupt window. * - * If no actions from the Action Change List are used, then the control stick is checked to see if + * If no actions from the Action Handler List are used, then the control stick is checked to see if * any movement should occur. * - * Note that while this function can set up a new action with `sActionChangeList7`, this function + * Note that while this function can set up a new action with `sActionHandlerList7`, this function * will not set up an appropriate action for moving. * It is the callers responsibility to react accordingly to `PLAYER_INTERRUPT_MOVE`. * @@ -4113,7 +4119,7 @@ s32 Player_TryActionInterrupt(PlayState* play, Player* this, SkelAnime* skelAnim s16 yawTarget; if ((skelAnime->endFrame - frameRange) <= skelAnime->curFrame) { - if (Player_TryActionChangeList(play, this, sActionChangeList7, true)) { + if (Player_TryActionHandlerList(play, this, sActionHandlerList7, true)) { return PLAYER_INTERRUPT_NEW_ACTION; } @@ -4765,7 +4771,7 @@ void func_808389E8(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* func_80838940(this, anim, arg2, play, NA_SE_VO_LI_SWORD_N); } -s32 Player_ActionChange_12(Player* this, PlayState* play) { +s32 Player_ActionHandler_12(Player* this, PlayState* play) { s32 sp3C; LinkAnimationHeader* anim; f32 sp34; @@ -5134,7 +5140,7 @@ s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, Colli return BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, posResult, wallPoly, true, false, false, true, bgId); } -s32 Player_ActionChange_1(Player* this, PlayState* play) { +s32 Player_ActionHandler_1(Player* this, PlayState* play) { Actor* attachedActor; s32 pad3; s32 doorDirection; @@ -5789,7 +5795,7 @@ static LinkAnimationHeader* D_80854548[] = { &gPlayerAnim_link_normal_take_out, }; -s32 Player_ActionChange_13(Player* this, PlayState* play) { +s32 Player_ActionHandler_13(Player* this, PlayState* play) { s32 sp2C; s32 sp28; GetItemEntry* giEntry; @@ -5935,7 +5941,7 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { return 0; } -s32 Player_ActionChange_4(Player* this, PlayState* play) { +s32 Player_ActionHandler_4(Player* this, PlayState* play) { Actor* sp34 = this->talkActor; Actor* sp30 = this->focusActor; Actor* sp2C = NULL; @@ -6020,9 +6026,9 @@ s32 func_8083B8F4(Player* this, PlayState* play) { return 0; } -s32 Player_ActionChange_0(Player* this, PlayState* play) { +s32 Player_ActionHandler_0(Player* this, PlayState* play) { if (this->unk_6AD != 0) { - Player_ActionChange_13(this, play); + Player_ActionHandler_13(this, play); return 1; } @@ -6112,7 +6118,7 @@ void func_8083BCD0(Player* this, PlayState* play, s32 controlStickDirection) { Player_PlaySfx(this, ((controlStickDirection << 0xE) == 0x8000) ? NA_SE_PL_ROLL : NA_SE_PL_SKIP); } -s32 Player_ActionChange_10(Player* this, PlayState* play) { +s32 Player_ActionHandler_10(Player* this, PlayState* play) { s32 controlStickDirection; if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && @@ -6205,7 +6211,7 @@ void func_8083C148(Player* this, PlayState* play) { this->stateFlags1 &= ~(PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_20); } -s32 Player_ActionChange_6(Player* this, PlayState* play) { +s32 Player_ActionHandler_6(Player* this, PlayState* play) { if (!Player_UpdateHostileLockOn(this) && !sUpperBodyIsBusy && !(this->stateFlags1 & PLAYER_STATE1_23) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { if (func_8083BC7C(this, play)) { @@ -6221,7 +6227,7 @@ s32 Player_ActionChange_6(Player* this, PlayState* play) { return 0; } -s32 Player_ActionChange_11(Player* this, PlayState* play) { +s32 Player_ActionHandler_11(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 frame; @@ -6290,7 +6296,7 @@ void func_8083C50C(Player* this) { } } -s32 Player_ActionChange_8(Player* this, PlayState* play) { +s32 Player_ActionHandler_8(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { if (!(this->stateFlags1 & PLAYER_STATE1_22) && (Player_GetMeleeWeaponHeld(this) != 0) && (this->unk_844 == 1) && (this->heldItemAction != PLAYER_IA_DEKU_STICK)) { @@ -6880,7 +6886,7 @@ static struct_80854578 D_80854578[] = { { &gPlayerAnim_link_uma_right_up, -34.16f, 7.91f }, }; -s32 Player_ActionChange_3(Player* this, PlayState* play) { +s32 Player_ActionHandler_3(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; if ((rideActor != NULL) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { @@ -7017,7 +7023,7 @@ void func_8083E4C4(PlayState* play, Player* this, GetItemEntry* giEntry) { #define DEBUG_iREG_67 0 #endif -s32 Player_ActionChange_2(Player* this, PlayState* play) { +s32 Player_ActionHandler_2(Player* this, PlayState* play) { Actor* interactedActor; if (DEBUG_iREG_67 || @@ -7149,7 +7155,7 @@ s32 func_8083EAF0(Player* this, Actor* actor) { return 1; } -s32 Player_ActionChange_9(Player* this, PlayState* play) { +s32 Player_ActionHandler_9(Player* this, PlayState* play) { if ((this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && (this->heldActor != NULL) && CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT)) { if (!func_80835644(play, this, this->heldActor)) { @@ -7476,7 +7482,7 @@ void func_8083F72C(Player* this, LinkAnimationHeader* anim, PlayState* play) { this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; } -s32 Player_ActionChange_5(Player* this, PlayState* play) { +s32 Player_ActionHandler_5(Player* this, PlayState* play) { DynaPolyActor* wallPolyActor; if (!(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && @@ -7768,7 +7774,7 @@ void Player_Action_80840450(Player* this, PlayState* play) { func_8083721C(this); - if (!Player_TryActionChangeList(play, this, sActionChangeList1, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList1, true)) { if (!Player_UpdateHostileLockOn(this) && (!Player_FriendlyLockOnOrParallel(this) || (func_80834B5C != this->upperActionFunc))) { func_8083CF10(this, play); @@ -7835,7 +7841,7 @@ void Player_Action_808407CC(Player* this, PlayState* play) { func_8083721C(this); - if (!Player_TryActionChangeList(play, this, sActionChangeList2, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList2, true)) { if (Player_UpdateHostileLockOn(this)) { func_8083CEAC(this, play); return; @@ -7960,7 +7966,7 @@ void Player_Action_80840BC8(Player* this, PlayState* play) { func_8083721C(this); if (this->av2.actionVar2 == 0) { - if (!Player_TryActionChangeList(play, this, sActionChangeList7, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList7, true)) { if (Player_UpdateHostileLockOn(this)) { func_8083CEAC(this, play); return; @@ -8033,7 +8039,7 @@ void Player_Action_80840DE4(Player* this, PlayState* play) { Player_PlaySteppingSfx(this, this->speedXZ); } - if (!Player_TryActionChangeList(play, this, sActionChangeList3, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList3, true)) { if (Player_UpdateHostileLockOn(this)) { func_8083CEAC(this, play); return; @@ -8156,7 +8162,7 @@ void Player_Action_808414F8(Player* this, PlayState* play) { func_80841138(this, play); - if (!Player_TryActionChangeList(play, this, sActionChangeList4, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList4, true)) { if (!Player_IsZTargetingWithHostileUpdate(this)) { func_8083C8DC(this, play, this->yaw); return; @@ -8201,7 +8207,7 @@ void Player_Action_8084170C(Player* this, PlayState* play) { sp34 = LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); - if (!Player_TryActionChangeList(play, this, sActionChangeList4, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList4, true)) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (this->speedXZ == 0.0f) { @@ -8221,7 +8227,7 @@ void Player_Action_808417FC(Player* this, PlayState* play) { sp1C = LinkAnimation_Update(play, &this->skelAnime); - if (!Player_TryActionChangeList(play, this, sActionChangeList4, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList4, true)) { if (sp1C != 0) { func_80839F30(this, play); } @@ -8248,7 +8254,7 @@ void Player_Action_8084193C(Player* this, PlayState* play) { func_80841860(play, this); - if (!Player_TryActionChangeList(play, this, sActionChangeList5, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList5, true)) { if (!Player_IsZTargetingWithHostileUpdate(this)) { func_8083C858(this, play); return; @@ -8313,7 +8319,7 @@ void Player_Action_80841BA8(Player* this, PlayState* play) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); - if (!Player_TryActionChangeList(play, this, sActionChangeList6, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList6, true)) { if (speedTarget != 0.0f) { this->actor.shape.rot.y = yawTarget; func_8083C858(this, play); @@ -8431,7 +8437,7 @@ void Player_Action_80842180(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; func_80841EE4(this, play); - if (!Player_TryActionChangeList(play, this, sActionChangeList8, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList8, true)) { if (Player_IsZTargetingWithHostileUpdate(this)) { func_8083C858(this, play); return; @@ -8457,7 +8463,7 @@ void Player_Action_8084227C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; func_80841EE4(this, play); - if (!Player_TryActionChangeList(play, this, sActionChangeList9, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList9, true)) { if (!Player_IsZTargetingWithHostileUpdate(this)) { func_8083C858(this, play); return; @@ -8490,7 +8496,7 @@ void Player_Action_808423EC(Player* this, PlayState* play) { sp34 = LinkAnimation_Update(play, &this->skelAnime); - if (!Player_TryActionChangeList(play, this, sActionChangeList5, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList5, true)) { if (!Player_IsZTargetingWithHostileUpdate(this)) { func_8083C858(this, play); return; @@ -8522,7 +8528,7 @@ void Player_Action_8084251C(Player* this, PlayState* play) { func_8083721C(this); - if (!Player_TryActionChangeList(play, this, sActionChangeList10, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList10, true)) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (this->speedXZ == 0.0f) { @@ -8569,7 +8575,7 @@ void Player_Action_8084279C(Player* this, PlayState* play) { func_80832CB0(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check_wait, this->modelAnimType)); if (DECR(this->av2.actionVar2) == 0) { - if (!Player_ActionChange_13(this, play)) { + if (!Player_ActionHandler_13(this, play)) { func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check_end, this->modelAnimType), play); } @@ -8601,7 +8607,8 @@ s32 func_808428D8(Player* this, PlayState* play) { } int func_80842964(Player* this, PlayState* play) { - return Player_ActionChange_13(this, play) || Player_ActionChange_4(this, play) || Player_ActionChange_2(this, play); + return Player_ActionHandler_13(this, play) || Player_ActionHandler_4(this, play) || + Player_ActionHandler_2(this, play); } void Player_RequestQuake(PlayState* play, s32 speed, s32 y, s32 duration) { @@ -8847,7 +8854,7 @@ void Player_Action_80843188(Player* this, PlayState* play) { this->av1.actionVar1 = 0; } } else if (!func_80842964(this, play)) { - if (Player_ActionChange_11(this, play)) { + if (Player_ActionHandler_11(this, play)) { func_808428D8(this, play); } else { this->stateFlags1 &= ~PLAYER_STATE1_22; @@ -9356,7 +9363,7 @@ void Player_Action_80844708(Player* this, PlayState* play) { } } - if ((this->skelAnime.curFrame < 15.0f) || !Player_ActionChange_7(this, play)) { + if ((this->skelAnime.curFrame < 15.0f) || !Player_ActionHandler_7(this, play)) { if (this->skelAnime.curFrame >= 20.0f) { func_8083A060(this, play); return; @@ -9823,7 +9830,7 @@ s32 func_80845C68(PlayState* play, s32 arg1) { } void Player_Action_80845CA4(Player* this, PlayState* play) { - if (!Player_ActionChange_13(this, play)) { + if (!Player_ActionHandler_13(this, play)) { if (this->av2.actionVar2 == 0) { LinkAnimation_Update(play, &this->skelAnime); @@ -9870,7 +9877,7 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); func_80845C68(play, gSaveContext.respawn[RESPAWN_MODE_DOWN].data); - if (!Player_ActionChange_4(this, play)) { + if (!Player_ActionHandler_4(this, play)) { func_8083CF5C(this, play); } } @@ -9942,7 +9949,7 @@ static AnimSfxEntry D_8085461C[] = { void Player_Action_80846120(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime) && (this->av2.actionVar2++ > 20)) { - if (!Player_ActionChange_13(this, play)) { + if (!Player_ActionHandler_13(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_heavy_carry_end, play); } } else if (LinkAnimation_OnFrame(&this->skelAnime, 41.0f)) { @@ -12110,7 +12117,7 @@ s32 func_8084B4D4(PlayState* play, Player* this) { this->stateFlags3 &= ~PLAYER_STATE3_5; func_8084B498(this); this->unk_6AD = 4; - Player_ActionChange_13(this, play); + Player_ActionHandler_13(this, play); return 1; } @@ -12131,7 +12138,7 @@ void Player_Action_8084B530(Player* this, PlayState* play) { Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); if (!func_8084B4D4(play, this) && !func_8084B3CC(play, this) && !Player_StartCsAction(play, this)) { - if ((this->talkActor != this->interactRangeActor) || !Player_ActionChange_2(this, play)) { + if ((this->talkActor != this->interactRangeActor) || !Player_ActionHandler_2(this, play)) { if (this->stateFlags1 & PLAYER_STATE1_23) { s32 sp24 = this->av2.actionVar2; func_8083A360(play, this); @@ -12877,8 +12884,8 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { this->yaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; if ((this->csAction != PLAYER_CSACTION_NONE) || - (!func_8083224C(play) && ((rideActor->actor.speed != 0.0f) || !Player_ActionChange_4(this, play)) && - !Player_ActionChange_6(this, play))) { + (!func_8083224C(play) && ((rideActor->actor.speed != 0.0f) || !Player_ActionHandler_4(this, play)) && + !Player_ActionHandler_6(this, play))) { if (!sUpperBodyIsBusy) { if (this->av1.actionVar1 != 0) { if (LinkAnimation_Update(play, &this->upperSkelAnime)) { @@ -12935,7 +12942,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { } if ((this->csAction != PLAYER_CSACTION_NONE) || - (!func_8084C9BC(this, play) && !Player_ActionChange_13(this, play))) { + (!func_8084C9BC(this, play) && !Player_ActionHandler_13(this, play))) { if (this->focusActor != NULL) { if (func_8002DD78(this) != 0) { this->unk_6BE = func_8083DB98(this, 1) - this->actor.shape.rot.y; @@ -13017,7 +13024,7 @@ void Player_Action_8084D610(Player* this, PlayState* play) { func_80832CB0(play, this, &gPlayerAnim_link_swimer_swim_wait); func_8084B000(this); - if (!func_8083224C(play) && !Player_TryActionChangeList(play, this, sActionChangeList11, true) && + if (!func_8083224C(play) && !Player_TryActionHandlerList(play, this, sActionHandlerList11, true) && !func_8083D12C(play, this, sControlInput)) { f32 speedTarget; s16 yawTarget; @@ -13057,7 +13064,7 @@ void Player_Action_8084D610(Player* this, PlayState* play) { } void Player_Action_8084D7C4(Player* this, PlayState* play) { - if (!Player_ActionChange_13(this, play)) { + if (!Player_ActionHandler_13(this, play)) { this->stateFlags2 |= PLAYER_STATE2_5; func_8084B158(play, this, NULL, this->speedXZ); @@ -13079,7 +13086,7 @@ void Player_Action_8084D84C(Player* this, PlayState* play) { func_8084B158(play, this, sControlInput, this->speedXZ); func_8084B000(this); - if (!Player_TryActionChangeList(play, this, sActionChangeList11, true) && + if (!Player_TryActionHandlerList(play, this, sActionHandlerList11, true) && !func_8083D12C(play, this, sControlInput)) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); @@ -13139,7 +13146,7 @@ void Player_Action_8084DAB4(Player* this, PlayState* play) { func_8084B158(play, this, sControlInput, this->speedXZ); func_8084B000(this); - if (!Player_TryActionChangeList(play, this, sActionChangeList11, true) && + if (!Player_TryActionHandlerList(play, this, sActionHandlerList11, true) && !func_8083D12C(play, this, sControlInput)) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); @@ -13171,7 +13178,7 @@ void Player_Action_8084DC48(Player* this, PlayState* play) { this->actor.gravity = 0.0f; Player_UpdateUpperBody(this, play); - if (!Player_ActionChange_13(this, play)) { + if (!Player_ActionHandler_13(this, play)) { if (this->currentBoots == PLAYER_BOOTS_IRON) { func_80838F18(play, this); return; @@ -13193,7 +13200,7 @@ void Player_Action_8084DC48(Player* this, PlayState* play) { func_8084B158(play, this, sControlInput, this->actor.velocity.y); this->unk_6C2 = 16000; - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !Player_ActionChange_2(this, play) && + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !Player_ActionHandler_2(this, play) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.depthInWater < D_80854784[CUR_UPG_VALUE(UPG_SCALE)])) { func_8084DBC4(play, this, -2.0f); @@ -13369,7 +13376,7 @@ void Player_Action_8084E3C4(Player* this, PlayState* play) { this->talkActor = this->naviActor; this->naviActor->textId = -this->naviTextId; func_80853148(play, this->talkActor); - } else if (!Player_ActionChange_13(this, play)) { + } else if (!Player_ActionHandler_13(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_okarina_end, play); } @@ -13794,7 +13801,7 @@ void Player_Action_8084F390(Player* this, PlayState* play) { func_8084269C(play, this); func_800F4138(&this->actor.projectedPos, NA_SE_PL_SLIP_LEVEL - SFX_FLAG, this->actor.speed); - if (Player_ActionChange_13(this, play) == 0) { + if (Player_ActionHandler_13(this, play) == 0) { floorPoly = this->actor.floorPoly; if (floorPoly == NULL) { @@ -13921,7 +13928,7 @@ void Player_Action_8084F88C(Player* this, PlayState* play) { } void Player_Action_8084F9A0(Player* this, PlayState* play) { - Player_ActionChange_1(this, play); + Player_ActionHandler_1(this, play); } void Player_Action_8084F9C0(Player* this, PlayState* play) { @@ -14143,7 +14150,7 @@ void Player_UpdateBunnyEars(Player* this) { } } -s32 Player_ActionChange_7(Player* this, PlayState* play) { +s32 Player_ActionHandler_7(Player* this, PlayState* play) { if (func_8083C6B8(play, this) == 0) { if (func_8083BB20(this) != 0) { s32 sp24 = func_80837818(this); @@ -14187,7 +14194,7 @@ void Player_Action_808502D0(Player* this, PlayState* play) { func_8083C50C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { - if (!Player_ActionChange_7(this, play)) { + if (!Player_ActionHandler_7(this, play)) { u8 sp43 = this->skelAnime.movementFlags; LinkAnimationHeader* sp3C; @@ -14889,7 +14896,7 @@ void func_808514C0(PlayState* play, Player* this, CsCmdActorCue* cue) { } if ((this->interactRangeActor != NULL) && (this->interactRangeActor->textId == 0xFFFF)) { - Player_ActionChange_2(this, play); + Player_ActionHandler_2(this, play); } } @@ -15450,8 +15457,8 @@ void func_80852944(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80832340(play, this); } else { func_8083C148(this, play); - if (!Player_ActionChange_4(this, play)) { - Player_ActionChange_2(this, play); + if (!Player_ActionHandler_4(this, play)) { + Player_ActionHandler_2(this, play); } }