diff options
| author | Theo <65437533+notyourav@users.noreply.github.com> | 2024-01-21 00:19:51 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-21 00:19:51 -0800 |
| commit | eaaeb3a6178dbfc084596c7a953d63c2ebc59f93 (patch) | |
| tree | ad73d7303e8b7e2df4968c2c15efd139843643c4 /src | |
| parent | a804fd336f8764b42130da6df57f1abe8b6dbd04 (diff) | |
| parent | 12f51699d4c07940c80f9afcf9b4f520481836aa (diff) | |
Merge pull request #688 from KEKW555/KEKW555-patch-2
Diffstat (limited to 'src')
| -rw-r--r-- | src/playerUtils.c | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/src/playerUtils.c b/src/playerUtils.c index 906595f3..312eca72 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -1179,9 +1179,29 @@ void ResetPossibleInteraction(void) { gPossibleInteraction.currentObject = (InteractableObject*)&gNoInteraction; } +static inline bool32 InlinePlayerStateCheck() { + u8 frameState; + if ((gPlayerState.field_0x27[0] | gPlayerState.swim_state) != 0) { + return TRUE; + } + if (gPlayerState.framestate == 0) { + frameState = gPlayerState.framestate_last; + } else { + frameState = gPlayerState.framestate; + } + switch (frameState) { + case PL_STATE_SWORD: + case PL_STATE_GUSTJAR: + case PL_STATE_DIE: + case PL_STATE_ITEMGET: + case PL_STATE_DROWN: + return TRUE; + } + return FALSE; +} + // determines which (if any) object the player is currently able to interact with InteractableObject* sub_080784E4(void) { - u8 frameState; PlayerFlags r7; s32 r3; PlayerFlags PVar4; @@ -1198,26 +1218,12 @@ InteractableObject* sub_080784E4(void) { if (gPossibleInteraction.isUpdated != 0) { return gPossibleInteraction.currentObject; } - if ((gPlayerState.field_0x27[0] | gPlayerState.swim_state) != 0) { - goto l; - } - if (gPlayerState.framestate == 0) { - frameState = gPlayerState.framestate_last; - } else { - frameState = gPlayerState.framestate; - } - switch (frameState) { - case PL_STATE_SWORD: - case PL_STATE_GUSTJAR: - case PL_STATE_DIE: - case PL_STATE_ITEMGET: - case PL_STATE_DROWN: - l: - gPossibleInteraction.currentIndex = 0xFF; - gPossibleInteraction.currentObject = (InteractableObject*)&gNoInteraction; - gPossibleInteraction.isUpdated = 1; - return gPossibleInteraction.currentObject; + if (InlinePlayerStateCheck()) { + gPossibleInteraction.currentIndex = 0xFF; + gPossibleInteraction.currentObject = (InteractableObject*)&gNoInteraction; + gPossibleInteraction.isUpdated = 1; + return gPossibleInteraction.currentObject; } if (!(gPlayerState.flags & PL_MINISH)) { |
