From 43fa9da52a4a204d6e75640b17b2416648f1ddc0 Mon Sep 17 00:00:00 2001 From: MCboy Date: Fri, 20 Jul 2018 03:44:20 +0430 Subject: [PATCH] decompile more code 1 non matching need help --- src/field_player_avatar.c | 81 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index b0d703e251..191fc8aa4f 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -8,10 +8,13 @@ static u8 EventObjectCB2_NoMovement2(); void sub_808C280(struct EventObject *); //struct EventObject *playerEventObj bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8); void npc_clear_strange_bits(struct EventObject *); +u8 EventObjectGetHeldMovementActionId(struct EventObject *); void DoPlayerAvatarTransition(void); bool8 TryDoMetatileBehaviorForcedMovement(); void MovePlayerAvatarUsingKeypadInput(u8, u16, u16); void PlayerAllowForcedMovementIfMovingSameDirection(); +void MovePlayerNotOnBike(u8 a, u16 b); +u8 sub_808B028(u8); void MovementType_Player(struct Sprite *sprite) { @@ -44,3 +47,81 @@ void player_step(u8 direction, u16 newKeys, u16 heldKeys) } } } + +NAKED +bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *eventObject, u8 direction) +{ + asm_unified("push {r4-r6,lr}\n\ + adds r4, r0, 0\n\ + lsls r1, 24\n\ + lsrs r5, r1, 24\n\ + adds r6, r5, 0\n\ + bl EventObjectIsMovementOverridden\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _0808AA92\n\ + adds r0, r4, 0\n\ + bl EventObjectClearHeldMovementIfFinished\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + bne _0808AA92\n\ + adds r0, r4, 0\n\ + bl EventObjectGetHeldMovementActionId\n\ + lsls r0, 24\n\ + movs r1, 0xE7\n\ + lsls r1, 24\n\ + adds r0, r1\n\ + lsrs r0, 24\n\ + cmp r0, 0x3\n\ + bhi _0808AA70\n\ + cmp r5, 0\n\ + bne _0808AA74\n\ +_0808AA70:\n\ + movs r0, 0x1\n\ + b _0808AA94\n\ +_0808AA74:\n\ + ldrb r0, [r4, 0x18]\n\ + lsrs r0, 4\n\ + cmp r0, r5\n\ + beq _0808AA84\n\ +_0808AA7C:\n\ + adds r0, r4, 0\n\ + bl EventObjectClearHeldMovement\n\ + b _0808AA92\n\ +_0808AA84:\n\ + adds r0, r6, 0\n\ + bl sub_808B028\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _0808AA7C\n\ + b _0808AA70\n\ +_0808AA92:\n\ + movs r0, 0\n\ +_0808AA94:\n\ + pop {r4-r6}\n\ + pop {r1}\n\ + bx r1"); +} + +void npc_clear_strange_bits(struct EventObject *eventObj) +{ + eventObj->inanimate = 0; + eventObj->disableAnim = 0; + eventObj->facingDirectionLocked = 0; + gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_DASH; +} + +void MovePlayerAvatarUsingKeypadInput(u8 direction, u16 newKeys, u16 heldKeys) +{ + if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE) + || (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE)) + MovePlayerOnBike(direction, newKeys, heldKeys); + else + MovePlayerNotOnBike(direction, heldKeys); +} + +void PlayerAllowForcedMovementIfMovingSameDirection(void) +{ + if (gPlayerAvatar.runningState == MOVING) + gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_5; +}