diff --git a/asm/field_player_avatar.s b/asm/field_player_avatar.s deleted file mode 100644 index c7b3a0486..000000000 --- a/asm/field_player_avatar.s +++ /dev/null @@ -1,4180 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start IsPlayerCollidingWithFarawayIslandMew -@ bool8 IsPlayerCollidingWithFarawayIslandMew(u8 direction) -IsPlayerCollidingWithFarawayIslandMew: @ 808B324 - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gPlayerAvatar - ldrb r2, [r1, 0x5] - lsls r1, r2, 3 - adds r1, r2 - lsls r1, 2 - ldr r5, =gEventObjects - adds r3, r1, r5 - ldrh r2, [r3, 0x10] - mov r1, sp - strh r2, [r1] - ldrh r1, [r3, 0x12] - mov r4, sp - adds r4, 0x2 - strh r1, [r4] - mov r1, sp - adds r2, r4, 0 - bl MoveCoords - movs r0, 0x1 - movs r1, 0x39 - movs r2, 0x1A - bl GetEventObjectIdByLocalIdAndMap - lsls r0, 24 - lsrs r1, r0, 24 - adds r6, r4, 0 - cmp r1, 0x10 - beq _0808B3C0 - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r3, r0, r5 - mov r0, sp - movs r1, 0x14 - ldrsh r2, [r3, r1] - movs r4, 0 - ldrsh r0, [r0, r4] - cmp r2, r0 - bne _0808B3C0 - movs r5, 0x16 - ldrsh r1, [r3, r5] - movs r4, 0 - ldrsh r0, [r6, r4] - ldrh r4, [r3, 0x16] - cmp r1, r0 - bne _0808B398 - movs r5, 0x10 - ldrsh r0, [r3, r5] - cmp r0, r2 - bne _0808B398 - movs r2, 0x12 - ldrsh r0, [r3, r2] - cmp r0, r1 - beq _0808B3C0 -_0808B398: - mov r0, sp - movs r5, 0x14 - ldrsh r1, [r3, r5] - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r1, r0 - bne _0808B3C0 - lsls r0, r4, 16 - asrs r0, 16 - movs r4, 0 - ldrsh r1, [r6, r4] - cmp r0, r1 - bne _0808B3C0 - movs r0, 0x1 - b _0808B3C2 - .pool -_0808B3C0: - movs r0, 0 -_0808B3C2: - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end IsPlayerCollidingWithFarawayIslandMew - - thumb_func_start SetPlayerAvatarTransitionFlags -@ void SetPlayerAvatarTransitionFlags(u16 transitionFlags) -SetPlayerAvatarTransitionFlags: @ 808B3CC - push {lr} - lsls r0, 16 - lsrs r0, 16 - ldr r2, =gPlayerAvatar - ldrb r1, [r2, 0x1] - orrs r0, r1 - strb r0, [r2, 0x1] - bl DoPlayerAvatarTransition - pop {r0} - bx r0 - .pool - thumb_func_end SetPlayerAvatarTransitionFlags - - thumb_func_start DoPlayerAvatarTransition -@ void DoPlayerAvatarTransition() -DoPlayerAvatarTransition: @ 808B3E8 - push {r4,r5,lr} - ldr r0, =gPlayerAvatar - ldrb r4, [r0, 0x1] - cmp r4, 0 - beq _0808B428 - movs r5, 0 -_0808B3F4: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0808B416 - ldr r0, =gUnknown_084974B8 - lsls r2, r5, 2 - adds r2, r0 - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r0, r1 - ldr r1, [r2] - bl _call_via_r1 -_0808B416: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - lsrs r4, 1 - cmp r5, 0x7 - bls _0808B3F4 - ldr r1, =gPlayerAvatar - movs r0, 0 - strb r0, [r1, 0x1] -_0808B428: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end DoPlayerAvatarTransition - - thumb_func_start PlayerAvatarTransition_Dummy -@ void PlayerAvatarTransition_Dummy(struct npc_state *eventObject) -PlayerAvatarTransition_Dummy: @ 808B43C - bx lr - thumb_func_end PlayerAvatarTransition_Dummy - - thumb_func_start PlayerAvatarTransition_Normal -@ void PlayerAvatarTransition_Normal(struct npc_state *eventObject) -PlayerAvatarTransition_Normal: @ 808B440 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0 - bl GetPlayerAvatarGraphicsIdByStateId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetGraphicsId - ldrb r1, [r4, 0x18] - lsrs r1, 4 - adds r0, r4, 0 - bl EventObjectTurn - movs r0, 0x1 - bl SetPlayerAvatarStateMask - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayerAvatarTransition_Normal - - thumb_func_start PlayerAvatarTransition_MachBike -@ void PlayerAvatarTransition_MachBike(struct npc_state *eventObject) -PlayerAvatarTransition_MachBike: @ 808B46C - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1 - bl GetPlayerAvatarGraphicsIdByStateId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetGraphicsId - ldrb r1, [r4, 0x18] - lsrs r1, 4 - adds r0, r4, 0 - bl EventObjectTurn - movs r0, 0x2 - bl SetPlayerAvatarStateMask - movs r0, 0 - movs r1, 0 - bl BikeClearState - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayerAvatarTransition_MachBike - - thumb_func_start PlayerAvatarTransition_AcroBike -@ void PlayerAvatarTransition_AcroBike(struct npc_state *eventObject) -PlayerAvatarTransition_AcroBike: @ 808B4A0 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x2 - bl GetPlayerAvatarGraphicsIdByStateId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetGraphicsId - ldrb r1, [r4, 0x18] - lsrs r1, 4 - adds r0, r4, 0 - bl EventObjectTurn - movs r0, 0x4 - bl SetPlayerAvatarStateMask - movs r0, 0 - movs r1, 0 - bl BikeClearState - bl Bike_HandleBumpySlopeJump - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayerAvatarTransition_AcroBike - - thumb_func_start PlayerAvatarTransition_Surfing -@ void PlayerAvatarTransition_Surfing(struct npc_state *eventObject) -PlayerAvatarTransition_Surfing: @ 808B4D8 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x3 - bl GetPlayerAvatarGraphicsIdByStateId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetGraphicsId - ldrb r1, [r4, 0x18] - lsrs r1, 4 - adds r0, r4, 0 - bl EventObjectTurn - movs r0, 0x8 - bl SetPlayerAvatarStateMask - ldr r1, =gFieldEffectArguments - movs r2, 0x10 - ldrsh r0, [r4, r2] - str r0, [r1] - movs r2, 0x12 - ldrsh r0, [r4, r2] - str r0, [r1, 0x4] - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x5] - str r0, [r1, 0x8] - movs r0, 0x8 - bl FieldEffectStart - lsls r0, 24 - lsrs r0, 24 - strb r0, [r4, 0x1A] - movs r1, 0x1 - bl sub_81555AC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerAvatarTransition_Surfing - - thumb_func_start PlayerAvatarTransition_Underwater -@ void PlayerAvatarTransition_Underwater(struct npc_state *eventObject) -PlayerAvatarTransition_Underwater: @ 808B534 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x4 - bl GetPlayerAvatarGraphicsIdByStateId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetGraphicsId - ldrb r1, [r4, 0x18] - lsrs r1, 4 - adds r0, r4, 0 - bl EventObjectTurn - movs r0, 0x10 - bl SetPlayerAvatarStateMask - ldrb r0, [r4, 0x4] - bl sub_8155800 - strb r0, [r4, 0x1A] - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayerAvatarTransition_Underwater - - thumb_func_start PlayerAvatarTransition_ReturnToField -@ void PlayerAvatarTransition_ReturnToField(struct npc_state *eventObject) -PlayerAvatarTransition_ReturnToField: @ 808B568 - ldr r2, =gPlayerAvatar - ldrb r1, [r2] - movs r0, 0x20 - orrs r0, r1 - strb r0, [r2] - bx lr - .pool - thumb_func_end PlayerAvatarTransition_ReturnToField - - thumb_func_start sub_808B578 -sub_808B578: @ 808B578 - push {r4,lr} - ldr r4, =gPlayerAvatar - movs r0, 0 - strb r0, [r4, 0x3] - bl PlayerIsAnimActive - lsls r0, 24 - cmp r0, 0 - beq _0808B5B6 - bl PlayerCheckIfAnimFinishedOrInactive - lsls r0, 24 - cmp r0, 0 - bne _0808B5A8 - bl player_is_anim_in_certain_ranges - lsls r0, 24 - cmp r0, 0 - bne _0808B5B6 - movs r0, 0x1 - b _0808B5B4 - .pool -_0808B5A8: - bl sub_808B618 - lsls r0, 24 - cmp r0, 0 - bne _0808B5B6 - movs r0, 0x2 -_0808B5B4: - strb r0, [r4, 0x3] -_0808B5B6: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_808B578 - - thumb_func_start player_is_anim_in_certain_ranges -player_is_anim_in_certain_ranges: @ 808B5BC - push {lr} - ldr r2, =gEventObjects - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r1, [r0, 0x1C] - cmp r1, 0x3 - bls _0808B602 - adds r0, r1, 0 - subs r0, 0x10 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _0808B602 - adds r0, r1, 0 - subs r0, 0x19 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xF - bls _0808B602 - adds r0, r1, 0 - subs r0, 0x64 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xB - bls _0808B602 - adds r0, r1, 0 - subs r0, 0x7C - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bhi _0808B610 -_0808B602: - movs r0, 0x1 - b _0808B612 - .pool -_0808B610: - movs r0, 0 -_0808B612: - pop {r1} - bx r1 - thumb_func_end player_is_anim_in_certain_ranges - - thumb_func_start sub_808B618 -sub_808B618: @ 808B618 - push {lr} - bl player_is_anim_in_certain_ranges - lsls r0, 24 - cmp r0, 0 - beq _0808B634 - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x2] - cmp r0, 0x1 - beq _0808B634 - movs r0, 0x1 - b _0808B636 - .pool -_0808B634: - movs r0, 0 -_0808B636: - pop {r1} - bx r1 - thumb_func_end sub_808B618 - - thumb_func_start PlayerIsAnimActive -@ bool8 PlayerIsAnimActive() -PlayerIsAnimActive: @ 808B63C - push {lr} - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r0, r1 - bl EventObjectIsMovementOverridden - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end PlayerIsAnimActive - - thumb_func_start PlayerCheckIfAnimFinishedOrInactive -@ bool8 PlayerCheckIfAnimFinishedOrInactive() -PlayerCheckIfAnimFinishedOrInactive: @ 808B660 - push {lr} - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r0, r1 - bl EventObjectCheckHeldMovementStatus - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end PlayerCheckIfAnimFinishedOrInactive - - thumb_func_start player_set_x22 -player_set_x22: @ 808B684 - ldr r3, =gEventObjects - ldr r1, =gPlayerAvatar - ldrb r2, [r1, 0x5] - lsls r1, r2, 3 - adds r1, r2 - lsls r1, 2 - adds r1, r3 - adds r1, 0x22 - strb r0, [r1] - bx lr - .pool - thumb_func_end player_set_x22 - - thumb_func_start PlayerGetCopyableMovement -PlayerGetCopyableMovement: @ 808B6A0 - ldr r2, =gEventObjects - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x22 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end PlayerGetCopyableMovement - - thumb_func_start sub_808B6BC -sub_808B6BC: @ 808B6BC - push {lr} - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - ldr r0, =gPlayerAvatar - ldrb r2, [r0, 0x5] - lsls r0, r2, 3 - adds r0, r2 - lsls r0, 2 - ldr r2, =gEventObjects - adds r0, r2 - bl EventObjectForceSetHeldMovement - pop {r0} - bx r0 - .pool - thumb_func_end sub_808B6BC - - thumb_func_start PlayerSetAnimId -@ void PlayerSetAnimId(u8 animState, u8 a2) -PlayerSetAnimId: @ 808B6E4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r4, r1, 24 - bl PlayerIsAnimActive - lsls r0, 24 - cmp r0, 0 - bne _0808B712 - adds r0, r4, 0 - bl player_set_x22 - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r0, r1 - adds r1, r5, 0 - bl EventObjectSetHeldMovement -_0808B712: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerSetAnimId - - thumb_func_start PlayerGoSpeed1 -@ void PlayerGoSpeed1(u8 direction) -PlayerGoSpeed1: @ 808B720 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetWalkNormalMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end PlayerGoSpeed1 - - thumb_func_start PlayerGoSpeed2 -@ void PlayerGoSpeed2(u8 direction) -PlayerGoSpeed2: @ 808B738 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetWalkFastMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end PlayerGoSpeed2 - - thumb_func_start PlayerGoSpeed3 -@ void PlayerGoSpeed3(u8 direction) -PlayerGoSpeed3: @ 808B750 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetRideWaterCurrentMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end PlayerGoSpeed3 - - thumb_func_start PlayerGoSpeed4 -@ void PlayerGoSpeed4(u8 direction) -PlayerGoSpeed4: @ 808B768 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetWalkFastestMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end PlayerGoSpeed4 - - thumb_func_start PlayerRun -@ void PlayerRun(u8 direction) -PlayerRun: @ 808B780 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetPlayerRunMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end PlayerRun - - thumb_func_start PlayerOnBikeCollide -@ void PlayerOnBikeCollide(u8 direction) -PlayerOnBikeCollide: @ 808B798 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl PlayCollisionSoundIfNotFacingWarp - adds r0, r4, 0 - bl GetWalkInPlaceNormalMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayerOnBikeCollide - - thumb_func_start PlayerOnBikeCollideWithFarawayIslandMew -@ void PlayerOnBikeCollideWithFarawayIslandMew(u8 direction) -PlayerOnBikeCollideWithFarawayIslandMew: @ 808B7BC - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetWalkInPlaceNormalMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end PlayerOnBikeCollideWithFarawayIslandMew - - thumb_func_start PlayerNotOnBikeCollide -@ void PlayerNotOnBikeCollide(u8 direction) -PlayerNotOnBikeCollide: @ 808B7D4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl PlayCollisionSoundIfNotFacingWarp - adds r0, r4, 0 - bl GetWalkInPlaceSlowMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayerNotOnBikeCollide - - thumb_func_start PlayerNotOnBikeCollideWithFarawayIslandMew -@ void PlayerNotOnBikeCollideWithFarawayIslandMew(u8 direction) -PlayerNotOnBikeCollideWithFarawayIslandMew: @ 808B7F8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetWalkInPlaceSlowMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end PlayerNotOnBikeCollideWithFarawayIslandMew - - thumb_func_start PlayerFaceDirection -@ void PlayerFaceDirection(u8 direction) -PlayerFaceDirection: @ 808B810 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetFaceDirectionMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end PlayerFaceDirection - - thumb_func_start PlayerTurnInPlace -@ void PlayerTurnInPlace(u8 direction) -PlayerTurnInPlace: @ 808B828 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetWalkInPlaceFastMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end PlayerTurnInPlace - - thumb_func_start PlayerJumpLedge -@ void PlayerJumpLedge(u8 direction) -PlayerJumpLedge: @ 808B840 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0xA - bl PlaySE - adds r0, r4, 0 - bl GetJump2MovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x8 - bl PlayerSetAnimId - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayerJumpLedge - - thumb_func_start sub_808B864 -sub_808B864: @ 808B864 - push {r4,lr} - ldr r4, =gPlayerAvatar - ldrb r0, [r4, 0x3] - cmp r0, 0x2 - beq _0808B872 - cmp r0, 0 - bne _0808B89A -_0808B872: - bl player_should_look_direction_be_enforced_upon_movement - lsls r0, 24 - cmp r0, 0 - beq _0808B89A - ldr r2, =gEventObjects - ldrb r1, [r4, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x18] - lsls r0, 28 - lsrs r0, 28 - bl GetFaceDirectionMovementAction - lsls r0, 24 - lsrs r0, 24 - bl sub_808B6BC -_0808B89A: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808B864 - - thumb_func_start PlayerIdleWheelie -PlayerIdleWheelie: @ 808B8A8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetAcroWheelieFaceDirectionMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end PlayerIdleWheelie - - thumb_func_start PlayerStartWheelie -PlayerStartWheelie: @ 808B8C0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetAcroPopWheelieFaceDirectionMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end PlayerStartWheelie - - thumb_func_start PlayerEndWheelie -PlayerEndWheelie: @ 808B8D8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetAcroEndWheelieFaceDirectionMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end PlayerEndWheelie - - thumb_func_start PlayerStandingHoppingWheelie -PlayerStandingHoppingWheelie: @ 808B8F0 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x22 - bl PlaySE - adds r0, r4, 0 - bl GetAcroWheelieHopFaceDirectionMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl PlayerSetAnimId - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayerStandingHoppingWheelie - - thumb_func_start PlayerMovingHoppingWheelie -PlayerMovingHoppingWheelie: @ 808B914 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x22 - bl PlaySE - adds r0, r4, 0 - bl GetAcroWheelieHopDirectionMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayerMovingHoppingWheelie - - thumb_func_start PlayerLedgeHoppingWheelie -PlayerLedgeHoppingWheelie: @ 808B938 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x22 - bl PlaySE - adds r0, r4, 0 - bl GetAcroWheelieJumpDirectionMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x8 - bl PlayerSetAnimId - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayerLedgeHoppingWheelie - - thumb_func_start PlayerAcroTurnJump -PlayerAcroTurnJump: @ 808B95C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x22 - bl PlaySE - adds r0, r4, 0 - bl GetJumpInPlaceTurnAroundMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - bl PlayerSetAnimId - pop {r4} - pop {r0} - bx r0 - thumb_func_end PlayerAcroTurnJump - - thumb_func_start sub_808B980 -sub_808B980: @ 808B980 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0x7 - bl PlaySE - adds r0, r4, 0 - bl GetAcroWheelieInPlaceDirectionMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_808B980 - - thumb_func_start sub_808B9A4 -sub_808B9A4: @ 808B9A4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetAcroPopWheelieMoveDirectionMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end sub_808B9A4 - - thumb_func_start sub_808B9BC -sub_808B9BC: @ 808B9BC - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetAcroWheelieMoveDirectionMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end sub_808B9BC - - thumb_func_start npc_use_some_d2s -npc_use_some_d2s: @ 808B9D4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - bl GetAcroEndWheelieMoveDirectionMovementAction - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x2 - bl PlayerSetAnimId - pop {r0} - bx r0 - thumb_func_end npc_use_some_d2s - - thumb_func_start PlayCollisionSoundIfNotFacingWarp -@ void PlayCollisionSoundIfNotFacingWarp(u8 direction) -PlayCollisionSoundIfNotFacingWarp: @ 808B9EC - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r2, =gEventObjects - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x1E] - ldr r2, =gUnknown_084974D8 - subs r1, r4, 0x1 - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0808BA54 - cmp r4, 0x2 - bne _0808BA4E - mov r4, sp - adds r4, 0x2 - mov r0, sp - adds r1, r4, 0 - bl PlayerGetDestCoords - movs r0, 0x2 - mov r1, sp - adds r2, r4, 0 - bl MoveCoords - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r4, r2] - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r0, 24 - bl MetatileBehavior_IsWarpDoor - lsls r0, 24 - cmp r0, 0 - bne _0808BA54 -_0808BA4E: - movs r0, 0x7 - bl PlaySE -_0808BA54: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end PlayCollisionSoundIfNotFacingWarp - - thumb_func_start GetXYCoordsOneStepInFrontOfPlayer -GetXYCoordsOneStepInFrontOfPlayer: @ 808BA68 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldr r3, =gEventObjects - ldr r2, =gPlayerAvatar - ldrb r1, [r2, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r0, [r0, 0x10] - strh r0, [r4] - ldrb r1, [r2, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrh r0, [r0, 0x12] - strh r0, [r5] - bl GetPlayerFacingDirection - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - adds r2, r5, 0 - bl MoveCoords - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end GetXYCoordsOneStepInFrontOfPlayer - - thumb_func_start PlayerGetDestCoords -@ void PlayerGetDestCoords(u16 *x, u16 *y) -PlayerGetDestCoords: @ 808BAAC - push {r4,r5,lr} - ldr r5, =gEventObjects - ldr r4, =gPlayerAvatar - ldrb r3, [r4, 0x5] - lsls r2, r3, 3 - adds r2, r3 - lsls r2, 2 - adds r2, r5 - ldrh r2, [r2, 0x10] - strh r2, [r0] - ldrb r2, [r4, 0x5] - lsls r0, r2, 3 - adds r0, r2 - lsls r0, 2 - adds r0, r5 - ldrh r0, [r0, 0x12] - strh r0, [r1] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end PlayerGetDestCoords - - thumb_func_start plaer_get_pos_including_state_based_drift -plaer_get_pos_including_state_based_drift: @ 808BADC - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r3, r0, r1 - ldrb r1, [r3] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0x40 - beq _0808BAFC - b _0808BC24 -_0808BAFC: - ldr r2, =gSprites - ldrb r1, [r3, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r1, 0x32 - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _0808BB12 - b _0808BC24 -_0808BB12: - ldrh r0, [r3, 0x10] - strh r0, [r4] - ldrh r0, [r3, 0x12] - strh r0, [r5] - ldrb r0, [r3, 0x1C] - subs r0, 0x8 - cmp r0, 0x30 - bls _0808BB24 - b _0808BC24 -_0808BB24: - lsls r0, 2 - ldr r1, =_0808BB40 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0808BB40: - .4byte _0808BC04 - .4byte _0808BC0A - .4byte _0808BC14 - .4byte _0808BC1A - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC24 - .4byte _0808BC04 - .4byte _0808BC0A - .4byte _0808BC14 - .4byte _0808BC1A -_0808BC04: - ldrh r0, [r5] - adds r0, 0x1 - b _0808BC0E -_0808BC0A: - ldrh r0, [r5] - subs r0, 0x1 -_0808BC0E: - strh r0, [r5] - movs r0, 0x1 - b _0808BC30 -_0808BC14: - ldrh r0, [r4] - subs r0, 0x1 - b _0808BC1E -_0808BC1A: - ldrh r0, [r4] - adds r0, 0x1 -_0808BC1E: - strh r0, [r4] - movs r0, 0x1 - b _0808BC30 -_0808BC24: - movs r1, 0x1 - negs r1, r1 - adds r0, r1, 0 - strh r0, [r4] - strh r0, [r5] - movs r0, 0 -_0808BC30: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end plaer_get_pos_including_state_based_drift - - thumb_func_start GetPlayerFacingDirection -@ u8 GetPlayerFacingDirection() -GetPlayerFacingDirection: @ 808BC38 - ldr r2, =gEventObjects - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x18] - lsls r0, 28 - lsrs r0, 28 - bx lr - .pool - thumb_func_end GetPlayerFacingDirection - - thumb_func_start GetPlayerMovementDirection -@ u8 GetPlayerMovementDirection() -GetPlayerMovementDirection: @ 808BC58 - ldr r2, =gEventObjects - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x18] - lsrs r0, 4 - bx lr - .pool - thumb_func_end GetPlayerMovementDirection - - thumb_func_start PlayerGetZCoord -@ u8 PlayerGetZCoord() -PlayerGetZCoord: @ 808BC74 - ldr r2, =gEventObjects - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0xB] - lsrs r0, 4 - bx lr - .pool - thumb_func_end PlayerGetZCoord - - thumb_func_start sub_808BC90 -sub_808BC90: @ 808BC90 - push {lr} - adds r3, r0, 0 - adds r2, r1, 0 - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r0, r1 - lsls r3, 16 - asrs r3, 16 - lsls r2, 16 - asrs r2, 16 - adds r1, r3, 0 - bl sub_808EB08 - pop {r0} - bx r0 - .pool - thumb_func_end sub_808BC90 - - thumb_func_start TestPlayerAvatarFlags -@ u32 TestPlayerAvatarFlags(u32 mask) -TestPlayerAvatarFlags: @ 808BCC0 - ldr r1, =gPlayerAvatar - ldrb r1, [r1] - ands r1, r0 - adds r0, r1, 0 - bx lr - .pool - thumb_func_end TestPlayerAvatarFlags - - thumb_func_start sub_808BCD0 -sub_808BCD0: @ 808BCD0 - ldr r0, =gPlayerAvatar - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_808BCD0 - - thumb_func_start GetPlayerAvatarObjectId -@ u8 GetPlayerAvatarObjectId() -GetPlayerAvatarObjectId: @ 808BCDC - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x4] - bx lr - .pool - thumb_func_end GetPlayerAvatarObjectId - - thumb_func_start sub_808BCE8 -sub_808BCE8: @ 808BCE8 - push {lr} - bl ForcedMovement_None - pop {r0} - bx r0 - thumb_func_end sub_808BCE8 - - thumb_func_start sub_808BCF4 -sub_808BCF4: @ 808BCF4 - push {r4,lr} - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x5] - lsls r4, r0, 3 - adds r4, r0 - lsls r4, 2 - ldr r0, =gEventObjects - adds r4, r0 - adds r0, r4, 0 - bl npc_clear_strange_bits - ldrb r1, [r4, 0x18] - lsls r1, 28 - lsrs r1, 28 - adds r0, r4, 0 - bl SetEventObjectDirection - movs r0, 0x6 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - beq _0808BD2C - bl Bike_HandleBumpySlopeJump - movs r0, 0 - bl Bike_UpdateBikeCounterSpeed -_0808BD2C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808BCF4 - - thumb_func_start GetRivalAvatarGraphicsIdByStateIdAndGender -GetRivalAvatarGraphicsIdByStateIdAndGender: @ 808BD3C - lsls r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_084974E8 - lsrs r0, 23 - adds r1, r0 - adds r1, r2 - ldrb r0, [r1] - bx lr - .pool - thumb_func_end GetRivalAvatarGraphicsIdByStateIdAndGender - - thumb_func_start GetPlayerAvatarGraphicsIdByStateIdAndGender -@ u8 GetPlayerAvatarGraphicsIdByStateIdAndGender(u8 stateId, u8 gender) -GetPlayerAvatarGraphicsIdByStateIdAndGender: @ 808BD54 - lsls r0, 24 - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gUnknown_084974F8 - lsrs r0, 23 - adds r1, r0 - adds r1, r2 - ldrb r0, [r1] - bx lr - .pool - thumb_func_end GetPlayerAvatarGraphicsIdByStateIdAndGender - - thumb_func_start sub_808BD6C -sub_808BD6C: @ 808BD6C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_08497508 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_808BD6C - - thumb_func_start sub_808BD7C -sub_808BD7C: @ 808BD7C - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0849750A - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_808BD7C - - thumb_func_start GetPlayerAvatarGraphicsIdByStateId -@ u8 GetPlayerAvatarGraphicsIdByStateId(u8 stateId) -GetPlayerAvatarGraphicsIdByStateId: @ 808BD8C - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gPlayerAvatar - ldrb r1, [r1, 0x7] - bl GetPlayerAvatarGraphicsIdByStateIdAndGender - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end GetPlayerAvatarGraphicsIdByStateId - - thumb_func_start sub_808BDA8 -sub_808BDA8: @ 808BDA8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r0, 0x70 - beq _0808BDCA - cmp r0, 0x70 - bgt _0808BDC2 - cmp r0, 0x6D - bgt _0808BDCE - cmp r0, 0x69 - blt _0808BDCE - b _0808BDCA -_0808BDC2: - cmp r1, 0x8A - beq _0808BDCA - cmp r1, 0xC0 - bne _0808BDCE -_0808BDCA: - movs r0, 0x1 - b _0808BDD0 -_0808BDCE: - movs r0, 0 -_0808BDD0: - pop {r1} - bx r1 - thumb_func_end sub_808BDA8 - - thumb_func_start GetPlayerAvatarGenderByGraphicsId -@ u8 GetPlayerAvatarGenderByGraphicsId(u8 graphicsId) -GetPlayerAvatarGenderByGraphicsId: @ 808BDD4 - push {lr} - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - cmp r0, 0x70 - beq _0808BDF6 - cmp r0, 0x70 - bgt _0808BDEE - cmp r0, 0x5D - bgt _0808BDFA - cmp r0, 0x59 - blt _0808BDFA - b _0808BDF6 -_0808BDEE: - cmp r1, 0x8A - beq _0808BDF6 - cmp r1, 0xC0 - bne _0808BDFA -_0808BDF6: - movs r0, 0x1 - b _0808BDFC -_0808BDFA: - movs r0, 0 -_0808BDFC: - pop {r1} - bx r1 - thumb_func_end GetPlayerAvatarGenderByGraphicsId - - thumb_func_start PartyHasMonWithSurf -@ bool8 PartyHasMonWithSurf() -PartyHasMonWithSurf: @ 808BE00 - push {r4,r5,lr} - movs r0, 0x8 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - bne _0808BE44 - movs r5, 0 - b _0808BE2A -_0808BE12: - adds r0, r4, 0 - movs r1, 0x39 - bl pokemon_has_move - lsls r0, 24 - cmp r0, 0 - beq _0808BE24 - movs r0, 0x1 - b _0808BE46 -_0808BE24: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_0808BE2A: - cmp r5, 0x5 - bhi _0808BE44 - movs r0, 0x64 - adds r1, r5, 0 - muls r1, r0 - ldr r0, =gPlayerParty - adds r4, r1, r0 - adds r0, r4, 0 - movs r1, 0xB - bl GetMonData - cmp r0, 0 - bne _0808BE12 -_0808BE44: - movs r0, 0 -_0808BE46: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end PartyHasMonWithSurf - - thumb_func_start IsPlayerSurfingNorth -@ bool8 IsPlayerSurfingNorth() -IsPlayerSurfingNorth: @ 808BE50 - push {lr} - bl GetPlayerMovementDirection - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bne _0808BE6E - movs r0, 0x8 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - beq _0808BE6E - movs r0, 0x1 - b _0808BE70 -_0808BE6E: - movs r0, 0 -_0808BE70: - pop {r1} - bx r1 - thumb_func_end IsPlayerSurfingNorth - - thumb_func_start IsPlayerFacingSurfableFishableWater -@ bool8 IsPlayerFacingSurfableFishableWater() -IsPlayerFacingSurfableFishableWater: @ 808BE74 - push {r4,r5,lr} - sub sp, 0x4 - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x5] - lsls r4, r0, 3 - adds r4, r0 - lsls r4, 2 - ldr r0, =gEventObjects - adds r4, r0 - ldrh r1, [r4, 0x10] - mov r0, sp - strh r1, [r0] - ldrh r0, [r4, 0x12] - mov r5, sp - adds r5, 0x2 - strh r0, [r5] - ldrb r0, [r4, 0x18] - lsls r0, 28 - lsrs r0, 28 - mov r1, sp - adds r2, r5, 0 - bl MoveCoords - mov r0, sp - movs r2, 0 - ldrsh r1, [r0, r2] - movs r0, 0 - ldrsh r2, [r5, r0] - ldrb r3, [r4, 0x18] - lsls r3, 28 - lsrs r3, 28 - adds r0, r4, 0 - bl GetCollisionAtCoords - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _0808BEF4 - bl PlayerGetZCoord - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _0808BEF4 - mov r0, sp - movs r1, 0 - ldrsh r0, [r0, r1] - movs r2, 0 - ldrsh r1, [r5, r2] - bl MapGridGetMetatileBehaviorAt - lsls r0, 24 - lsrs r0, 24 - bl MetatileBehavior_IsSurfableFishableWater - lsls r0, 24 - cmp r0, 0 - beq _0808BEF4 - movs r0, 0x1 - b _0808BEF6 - .pool -_0808BEF4: - movs r0, 0 -_0808BEF6: - add sp, 0x4 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end IsPlayerFacingSurfableFishableWater - - thumb_func_start ClearPlayerAvatarInfo -@ void ClearPlayerAvatarInfo() -ClearPlayerAvatarInfo: @ 808BF00 - push {lr} - ldr r0, =gPlayerAvatar - movs r1, 0 - movs r2, 0x24 - bl memset - pop {r0} - bx r0 - .pool - thumb_func_end ClearPlayerAvatarInfo - - thumb_func_start SetPlayerAvatarStateMask -@ void SetPlayerAvatarStateMask(u8 stateMask) -SetPlayerAvatarStateMask: @ 808BF14 - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gPlayerAvatar - ldrb r2, [r3] - movs r1, 0xE0 - ands r1, r2 - orrs r0, r1 - strb r0, [r3] - bx lr - .pool - thumb_func_end SetPlayerAvatarStateMask - - thumb_func_start GetPlayerAvatarStateTransitionByGraphicsId -@ u8 GetPlayerAvatarStateTransitionByGraphicsId(u8 graphicsId, u8 gender) -GetPlayerAvatarStateTransitionByGraphicsId: @ 808BF2C - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - lsls r1, 24 - lsrs r1, 24 - movs r2, 0 - ldr r3, =gUnknown_0849750C - lsls r0, r1, 2 - adds r0, r1 - lsls r4, r0, 1 - adds r6, r3, 0x1 -_0808BF42: - lsls r0, r2, 1 - adds r1, r0, r4 - adds r0, r1, r3 - ldrb r0, [r0] - cmp r0, r5 - bne _0808BF58 - adds r0, r1, r6 - ldrb r0, [r0] - b _0808BF64 - .pool -_0808BF58: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x4 - bls _0808BF42 - movs r0, 0x1 -_0808BF64: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end GetPlayerAvatarStateTransitionByGraphicsId - - thumb_func_start GetPlayerAvatarGraphicsIdByCurrentState -@ u8 GetPlayerAvatarGraphicsIdByCurrentState() -GetPlayerAvatarGraphicsIdByCurrentState: @ 808BF6C - push {r4-r6,lr} - ldr r0, =gPlayerAvatar - ldrb r5, [r0] - movs r2, 0 - ldr r3, =gUnknown_0849750C - ldrb r1, [r0, 0x7] - lsls r0, r1, 2 - adds r0, r1 - lsls r4, r0, 1 - adds r6, r3, 0x1 -_0808BF80: - lsls r0, r2, 1 - adds r1, r0, r4 - adds r0, r1, r6 - ldrb r0, [r0] - ands r0, r5 - cmp r0, 0 - beq _0808BF9C - adds r0, r1, r3 - ldrb r0, [r0] - b _0808BFA8 - .pool -_0808BF9C: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x4 - bls _0808BF80 - movs r0, 0 -_0808BFA8: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end GetPlayerAvatarGraphicsIdByCurrentState - - thumb_func_start SetPlayerAvatarExtraStateTransition -@ void SetPlayerAvatarExtraStateTransition(u8 graphicsId, u8 state) -SetPlayerAvatarExtraStateTransition: @ 808BFB0 - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gPlayerAvatar - ldrb r1, [r5, 0x7] - bl GetPlayerAvatarStateTransitionByGraphicsId - lsls r0, 24 - lsrs r0, 24 - orrs r0, r4 - ldrb r1, [r5, 0x1] - orrs r0, r1 - strb r0, [r5, 0x1] - bl DoPlayerAvatarTransition - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end SetPlayerAvatarExtraStateTransition - - thumb_func_start InitPlayerAvatar -@ void InitPlayerAvatar(u16 x, u16 y, u8 direction, u8 gender) -InitPlayerAvatar: @ 808BFE0 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0x18 - adds r4, r0, 0 - adds r5, r1, 0 - mov r9, r2 - mov r8, r3 - lsls r4, 16 - lsrs r4, 16 - lsls r5, 16 - lsrs r5, 16 - mov r0, r9 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - mov r1, r8 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - mov r1, sp - movs r0, 0xFF - strb r0, [r1] - movs r0, 0 - mov r1, r8 - bl GetPlayerAvatarGraphicsIdByStateIdAndGender - mov r1, sp - movs r3, 0 - strb r0, [r1, 0x1] - mov r0, sp - lsls r4, 16 - asrs r4, 16 - subs r4, 0x7 - movs r6, 0 - strh r4, [r0, 0x4] - lsls r5, 16 - asrs r5, 16 - subs r5, 0x7 - strh r5, [r0, 0x6] - strb r6, [r0, 0x8] - movs r0, 0xB - strb r0, [r1, 0x9] - mov r2, sp - ldrb r1, [r2, 0xA] - subs r0, 0x1B - ands r0, r1 - strb r0, [r2, 0xA] - mov r0, sp - strb r6, [r0, 0xA] - strh r3, [r0, 0xC] - strh r3, [r0, 0xE] - str r3, [sp, 0x10] - strh r3, [r0, 0x14] - bl SpawnSpecialEventObject - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - lsls r4, r5, 3 - adds r4, r5 - lsls r4, 2 - ldr r0, =gEventObjects - adds r4, r0 - ldrb r0, [r4, 0x2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r4, 0x2] - bl CreateWarpArrowSprite - strb r0, [r4, 0x1B] - adds r0, r4, 0 - mov r1, r9 - bl EventObjectTurn - bl ClearPlayerAvatarInfo - ldr r0, =gPlayerAvatar - strb r6, [r0, 0x2] - strb r6, [r0, 0x3] - strb r5, [r0, 0x5] - ldrb r1, [r4, 0x4] - strb r1, [r0, 0x4] - mov r1, r8 - strb r1, [r0, 0x7] - movs r0, 0x21 - bl SetPlayerAvatarStateMask - add sp, 0x18 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end InitPlayerAvatar - - thumb_func_start sub_808C0A8 -sub_808C0A8: @ 808C0A8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r6, =gEventObjects - ldr r5, =gPlayerAvatar - ldrb r0, [r5, 0x5] - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - movs r0, 0x1 - ands r4, r0 - lsls r3, r4, 5 - ldrb r2, [r1, 0x1] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - orrs r0, r3 - strb r0, [r1, 0x1] - movs r0, 0x8 - bl TestPlayerAvatarFlags - lsls r0, 24 - cmp r0, 0 - beq _0808C100 - ldr r2, =gSprites - ldrb r1, [r5, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r0, [r0, 0x1A] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - adds r1, 0x3E - lsls r3, r4, 2 - ldrb r2, [r1] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r3 - strb r0, [r1] -_0808C100: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808C0A8 - - thumb_func_start sub_808C114 -sub_808C114: @ 808C114 - push {r4,r5,lr} - ldr r5, =gPlayerAvatar - ldrb r0, [r5, 0x5] - lsls r4, r0, 3 - adds r4, r0 - lsls r4, 2 - ldr r0, =gEventObjects - adds r4, r0 - movs r0, 0x5 - bl GetPlayerAvatarGraphicsIdByStateId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetGraphicsId - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - movs r1, 0 - bl StartSpriteAnim - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808C114 - - thumb_func_start sub_808C15C -sub_808C15C: @ 808C15C - push {r4-r6,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r6, =gPlayerAvatar - ldrb r0, [r6, 0x5] - lsls r4, r0, 3 - adds r4, r0 - lsls r4, 2 - ldr r0, =gEventObjects - adds r4, r0 - movs r0, 0x6 - bl GetPlayerAvatarGraphicsIdByStateId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetGraphicsId - ldrb r0, [r6, 0x4] - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - adds r0, r5, 0 - bl GetFishingDirectionAnimNum - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808C15C - - thumb_func_start sub_808C1B4 -sub_808C1B4: @ 808C1B4 - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r6, =gPlayerAvatar - ldrb r0, [r6, 0x5] - lsls r4, r0, 3 - adds r4, r0 - lsls r4, 2 - ldr r0, =gEventObjects - adds r4, r0 - movs r0, 0x2 - bl GetPlayerAvatarGraphicsIdByStateId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetGraphicsId - ldrb r0, [r6, 0x4] - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - mov r8, r0 - add r4, r8 - adds r0, r5, 0 - bl GetAcroWheelieDirectionAnimNum - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - ldrb r1, [r6, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - movs r1, 0x1 - bl SeekSpriteAnim - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808C1B4 - - thumb_func_start sub_808C228 -sub_808C228: @ 808C228 - push {r4-r6,lr} - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r6, =gPlayerAvatar - ldrb r0, [r6, 0x5] - lsls r4, r0, 3 - adds r4, r0 - lsls r4, 2 - ldr r0, =gEventObjects - adds r4, r0 - movs r0, 0x7 - bl GetPlayerAvatarGraphicsIdByStateId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetGraphicsId - ldrb r0, [r6, 0x4] - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - adds r0, r5, 0 - bl GetFaceDirectionAnimNum - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808C228 - - thumb_func_start sub_808C280 -@ void sub_808C280(struct EventObject *playerEventObj); -sub_808C280: @ 808C280 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x4 - adds r5, r0, 0 - ldrb r0, [r5, 0x1E] - mov r8, r0 - movs r1, 0 - mov r0, sp - strh r1, [r0] - movs r6, 0x1 - ldr r1, =gUnknown_08497520 - mov r9, r1 - mov r4, sp - mov r7, sp - adds r7, 0x2 -_0808C2A2: - movs r1, 0 - ldrsh r0, [r4, r1] - lsls r0, 2 - add r0, r9 - ldr r1, [r0] - mov r0, r8 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - beq _0808C2E8 - ldrb r0, [r5, 0x18] - lsrs r0, 4 - cmp r6, r0 - bne _0808C2E8 - ldrh r0, [r5, 0x10] - strh r0, [r4] - ldrh r0, [r5, 0x12] - strh r0, [r7] - adds r0, r6, 0 - mov r1, sp - adds r2, r7, 0 - bl MoveCoords - ldrb r0, [r5, 0x1B] - movs r1, 0 - ldrsh r2, [r4, r1] - movs r1, 0 - ldrsh r3, [r7, r1] - adds r1, r6, 0 - bl ShowWarpArrowSprite - b _0808C302 - .pool -_0808C2E8: - ldrh r1, [r4] - adds r1, 0x1 - strh r1, [r4] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x3 - ble _0808C2A2 - ldrb r0, [r5, 0x1B] - bl SetSpriteInvisible -_0808C302: - add sp, 0x4 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_808C280 - - thumb_func_start task_add_bump_boulder -task_add_bump_boulder: @ 808C310 - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - ldr r6, =taskFF_bump_boulder - adds r0, r6, 0 - movs r1, 0xFF - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0xA] - strh r5, [r1, 0xC] - bl _call_via_r6 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end task_add_bump_boulder - - thumb_func_start taskFF_bump_boulder -taskFF_bump_boulder: @ 808C34C - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r6, =gUnknown_08497530 - ldr r2, =gTasks - ldr r5, =gEventObjects - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0808C360: - movs r0, 0x8 - ldrsh r3, [r4, r0] - lsls r3, 2 - adds r3, r6 - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x5] - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - movs r2, 0xA - ldrsh r0, [r4, r2] - lsls r2, r0, 3 - adds r2, r0 - lsls r2, 2 - adds r2, r5 - ldr r3, [r3] - adds r0, r4, 0 - bl _call_via_r3 - lsls r0, 24 - cmp r0, 0 - bne _0808C360 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end taskFF_bump_boulder - - thumb_func_start sub_808C3A4 -sub_808C3A4: @ 808C3A4 - push {r4,lr} - adds r4, r0, 0 - bl ScriptContext2_Enable - ldr r1, =gPlayerAvatar - movs r0, 0x1 - strb r0, [r1, 0x6] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_808C3A4 - - thumb_func_start do_boulder_dust -@ int do_boulder_dust(int a1, struct npc_state *a2, struct npc_state *a3) -do_boulder_dust: @ 808C3C4 - push {r4-r6,lr} - adds r6, r0, 0 - adds r5, r1, 0 - adds r4, r2, 0 - adds r0, r5, 0 - bl EventObjectIsHeldMovementActive - lsls r0, 24 - cmp r0, 0 - beq _0808C3DE - adds r0, r5, 0 - bl EventObjectClearHeldMovementIfFinished -_0808C3DE: - adds r0, r4, 0 - bl EventObjectIsHeldMovementActive - lsls r0, 24 - cmp r0, 0 - beq _0808C3F0 - adds r0, r4, 0 - bl EventObjectClearHeldMovementIfFinished -_0808C3F0: - adds r0, r5, 0 - bl EventObjectIsMovementOverridden - lsls r0, 24 - cmp r0, 0 - bne _0808C472 - adds r0, r4, 0 - bl EventObjectIsMovementOverridden - lsls r0, 24 - cmp r0, 0 - bne _0808C472 - adds r0, r5, 0 - bl EventObjectClearHeldMovementIfFinished - adds r0, r4, 0 - bl EventObjectClearHeldMovementIfFinished - ldrb r0, [r6, 0xC] - bl GetWalkInPlaceNormalMovementAction - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl EventObjectSetHeldMovement - ldrb r0, [r6, 0xC] - bl GetWalkSlowMovementAction - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetHeldMovement - ldr r2, =gFieldEffectArguments - movs r1, 0x10 - ldrsh r0, [r4, r1] - str r0, [r2] - movs r1, 0x12 - ldrsh r0, [r4, r1] - str r0, [r2, 0x4] - ldrb r0, [r4, 0xB] - lsrs r0, 4 - str r0, [r2, 0x8] - ldr r3, =gSprites - ldrb r1, [r4, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0, 0x5] - lsls r0, 28 - lsrs r0, 30 - str r0, [r2, 0xC] - movs r0, 0xA - bl FieldEffectStart - movs r0, 0xD6 - bl PlaySE - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] -_0808C472: - movs r0, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end do_boulder_dust - - thumb_func_start sub_808C484 -sub_808C484: @ 808C484 - push {r4,r5,lr} - adds r4, r1, 0 - adds r5, r2, 0 - adds r0, r4, 0 - bl EventObjectCheckHeldMovementStatus - lsls r0, 24 - cmp r0, 0 - beq _0808C4C6 - adds r0, r5, 0 - bl EventObjectCheckHeldMovementStatus - lsls r0, 24 - cmp r0, 0 - beq _0808C4C6 - adds r0, r4, 0 - bl EventObjectClearHeldMovementIfFinished - adds r0, r5, 0 - bl EventObjectClearHeldMovementIfFinished - ldr r1, =gPlayerAvatar - movs r0, 0 - strb r0, [r1, 0x6] - bl ScriptContext2_Disable - ldr r0, =taskFF_bump_boulder - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_0808C4C6: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_808C484 - - thumb_func_start sub_808C4D8 -sub_808C4D8: @ 808C4D8 - push {r4,lr} - ldr r4, =sub_808C4F8 - adds r0, r4, 0 - movs r1, 0xFF - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808C4D8 - - thumb_func_start sub_808C4F8 -sub_808C4F8: @ 808C4F8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_0849753C - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0808C50A: - movs r0, 0x8 - ldrsh r2, [r4, r0] - lsls r2, 2 - adds r2, r5 - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x5] - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, =gEventObjects - adds r1, r0 - ldr r2, [r2] - adds r0, r4, 0 - bl _call_via_r2 - lsls r0, 24 - cmp r0, 0 - bne _0808C50A - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808C4F8 - - thumb_func_start sub_808C544 -sub_808C544: @ 808C544 - push {r4-r6,lr} - adds r6, r0, 0 - adds r4, r1, 0 - ldr r5, =gPlayerAvatar - movs r0, 0x1 - strb r0, [r5, 0x6] - adds r0, r4, 0 - bl EventObjectClearHeldMovementIfFinished - lsls r0, 24 - cmp r0, 0 - beq _0808C5A0 - movs r0, 0xA - bl PlaySE - ldrb r0, [r4, 0x18] - lsls r0, 28 - lsrs r0, 28 - bl GetJumpInPlaceMovementAction - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetHeldMovement - ldrh r0, [r6, 0xA] - adds r0, 0x1 - strh r0, [r6, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _0808C5A0 - movs r0, 0 - strb r0, [r5, 0x6] - ldrb r0, [r5, 0x1] - movs r1, 0x20 - orrs r0, r1 - strb r0, [r5, 0x1] - ldr r0, =sub_808C4F8 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_0808C5A0: - movs r0, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_808C544 - - thumb_func_start sub_808C5B0 -sub_808C5B0: @ 808C5B0 - push {r4,lr} - ldr r4, =sub_808C5D0 - adds r0, r4, 0 - movs r1, 0xFF - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808C5B0 - - thumb_func_start sub_808C5D0 -sub_808C5D0: @ 808C5D0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_08497540 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0808C5E2: - movs r0, 0x8 - ldrsh r2, [r4, r0] - lsls r2, 2 - adds r2, r5 - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x5] - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - ldr r0, =gEventObjects - adds r1, r0 - ldr r2, [r2] - adds r0, r4, 0 - bl _call_via_r2 - lsls r0, 24 - cmp r0, 0 - bne _0808C5E2 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808C5D0 - - thumb_func_start sub_808C61C -sub_808C61C: @ 808C61C - push {lr} - ldrh r2, [r0, 0x8] - adds r2, 0x1 - strh r2, [r0, 0x8] - ldrb r1, [r1, 0x18] - lsrs r1, 4 - strh r1, [r0, 0xA] - ldr r1, =gPlayerAvatar - movs r0, 0x1 - strb r0, [r1, 0x6] - bl ScriptContext2_Enable - movs r0, 0x2D - bl PlaySE - movs r0, 0x1 - pop {r1} - bx r1 - .pool - thumb_func_end sub_808C61C - - thumb_func_start sub_808C644 -sub_808C644: @ 808C644 - push {r4-r6,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r5, r1, 0 - ldr r1, =gUnknown_08497550 - mov r0, sp - movs r2, 0x4 - bl memcpy - adds r0, r5, 0 - bl EventObjectClearHeldMovementIfFinished - lsls r0, 24 - cmp r0, 0 - beq _0808C6AC - ldrb r0, [r5, 0x18] - lsrs r0, 4 - subs r0, 0x1 - add r0, sp - ldrb r6, [r0] - adds r0, r6, 0 - bl GetFaceDirectionMovementAction - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl EventObjectSetHeldMovement - ldrb r0, [r4, 0xA] - cmp r6, r0 - bne _0808C68A - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] -_0808C68A: - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r1, 0xC - ldrsh r0, [r4, r1] - cmp r0, 0x3 - ble _0808C6AC - ldrb r0, [r4, 0xA] - bl GetOppositeDirection - lsls r0, 24 - lsrs r0, 24 - cmp r6, r0 - bne _0808C6AC - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_0808C6AC: - movs r0, 0 - add sp, 0x4 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_808C644 - - thumb_func_start sub_808C6BC -sub_808C6BC: @ 808C6BC - push {r4,r5,lr} - sub sp, 0x8 - adds r5, r0, 0 - adds r4, r1, 0 - ldr r1, =gUnknown_08497554 - mov r0, sp - movs r2, 0x5 - bl memcpy - adds r0, r4, 0 - bl EventObjectClearHeldMovementIfFinished - lsls r0, 24 - cmp r0, 0 - beq _0808C6EC - movs r1, 0xC - ldrsh r0, [r5, r1] - add r0, sp - ldrb r1, [r0] - adds r0, r4, 0 - bl EventObjectSetHeldMovement - movs r0, 0x1 - strh r0, [r5, 0x8] -_0808C6EC: - movs r0, 0 - add sp, 0x8 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_808C6BC - - thumb_func_start sub_808C6FC -sub_808C6FC: @ 808C6FC - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - adds r0, r5, 0 - bl EventObjectClearHeldMovementIfFinished - lsls r0, 24 - cmp r0, 0 - beq _0808C740 - ldrb r0, [r4, 0xA] - bl GetOppositeDirection - lsls r0, 24 - lsrs r0, 24 - bl GetWalkSlowMovementAction - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl EventObjectSetHeldMovement - bl ScriptContext2_Disable - ldr r1, =gPlayerAvatar - movs r0, 0 - strb r0, [r1, 0x6] - ldr r0, =sub_808C5D0 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_0808C740: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_808C6FC - - thumb_func_start sub_808C750 -sub_808C750: @ 808C750 - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl ScriptContext2_Enable - bl Overworld_ClearSavedMusic - bl Overworld_ChangeMusicToDefault - ldr r2, =gPlayerAvatar - ldrb r1, [r2] - movs r0, 0xF7 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2] - movs r0, 0x1 - strb r0, [r2, 0x6] - ldr r5, =taskFF_0805D1D4 - adds r0, r5, 0 - movs r1, 0xFF - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0x8] - bl _call_via_r5 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808C750 - - thumb_func_start taskFF_0805D1D4 -taskFF_0805D1D4: @ 808C7A8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r5, r0, r1 - adds r0, r5, 0 - bl EventObjectIsMovementOverridden - lsls r0, 24 - cmp r0, 0 - beq _0808C7D4 - adds r0, r5, 0 - bl EventObjectClearHeldMovementIfFinished - lsls r0, 24 - cmp r0, 0 - beq _0808C7FC -_0808C7D4: - ldrb r0, [r5, 0x1A] - movs r1, 0x2 - bl sub_81555AC - ldr r0, =gTasks - lsls r4, r6, 2 - adds r4, r6 - lsls r4, 3 - adds r4, r0 - ldrb r0, [r4, 0x8] - bl GetJumpSpecialMovementAction - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl EventObjectSetHeldMovement - ldr r0, =sub_808C814 - str r0, [r4] -_0808C7FC: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end taskFF_0805D1D4 - - thumb_func_start sub_808C814 -sub_808C814: @ 808C814 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r6, =gPlayerAvatar - ldrb r1, [r6, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r4, r0, r1 - adds r0, r4, 0 - bl EventObjectClearHeldMovementIfFinished - lsls r0, 24 - cmp r0, 0 - beq _0808C87A - movs r0, 0 - bl GetPlayerAvatarGraphicsIdByStateId - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetGraphicsId - ldrb r0, [r4, 0x18] - lsls r0, 28 - lsrs r0, 28 - bl GetFaceDirectionMovementAction - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetHeldMovement - movs r0, 0 - strb r0, [r6, 0x6] - bl ScriptContext2_Disable - ldrb r1, [r4, 0x1A] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - adds r0, r5, 0 - bl DestroyTask -_0808C87A: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808C814 - - thumb_func_start StartFishing -StartFishing: @ 808C88C - push {r4,r5,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =Task_Fish - adds r0, r5, 0 - movs r1, 0xFF - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0x26] - bl _call_via_r5 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end StartFishing - - thumb_func_start Task_Fish -Task_Fish: @ 808C8C0 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_0849755C - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_0808C8D2: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0808C8D2 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end Task_Fish - - thumb_func_start fish0 -fish0: @ 808C8F8 - push {r4,lr} - adds r4, r0, 0 - bl ScriptContext2_Enable - ldr r1, =gPlayerAvatar - movs r0, 0x1 - strb r0, [r1, 0x6] - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end fish0 - - thumb_func_start fish1 -fish1: @ 808C918 - push {r4-r6,lr} - sub sp, 0x10 - adds r5, r0, 0 - ldr r1, =gUnknown_0849759C - mov r0, sp - movs r2, 0x6 - bl memcpy - add r4, sp, 0x8 - ldr r1, =gUnknown_084975A2 - adds r0, r4, 0 - movs r2, 0x6 - bl memcpy - movs r0, 0 - strh r0, [r5, 0x20] - bl Random - movs r2, 0x26 - ldrsh r1, [r5, r2] - lsls r1, 1 - mov r2, sp - adds r6, r2, r1 - lsls r0, 16 - lsrs r0, 16 - adds r4, r1 - movs r2, 0 - ldrsh r1, [r4, r2] - bl __modsi3 - ldrh r1, [r6] - adds r1, r0 - strh r1, [r5, 0x22] - ldr r3, =gEventObjects - ldr r2, =gPlayerAvatar - ldrb r1, [r2, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0, 0x5] - strh r0, [r5, 0x24] - ldrb r0, [r2, 0x5] - lsls r4, r0, 3 - adds r4, r0 - lsls r4, 2 - adds r4, r3 - adds r0, r4, 0 - bl EventObjectClearHeldMovementIfActive - ldrb r0, [r4, 0x1] - movs r1, 0x8 - orrs r0, r1 - strb r0, [r4, 0x1] - ldrb r0, [r4, 0x18] - lsls r0, 28 - lsrs r0, 28 - bl sub_808C15C - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - movs r0, 0 - add sp, 0x10 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end fish1 - - thumb_func_start fish2 -fish2: @ 808C9B0 - push {r4,lr} - adds r4, r0, 0 - bl sub_808CF78 - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3B - ble _0808C9CC - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] -_0808C9CC: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end fish2 - - thumb_func_start fish3 -fish3: @ 808C9D4 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0 - movs r1, 0x1 - bl sub_819786C - ldrh r0, [r4, 0x8] - adds r0, 0x1 - movs r1, 0 - strh r0, [r4, 0x8] - strh r1, [r4, 0xA] - strh r1, [r4, 0xC] - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xA - bl __umodsi3 - adds r1, r0, 0 - adds r0, r1, 0x1 - strh r0, [r4, 0xE] - movs r2, 0x20 - ldrsh r0, [r4, r2] - cmp r0, 0 - bne _0808CA0C - adds r0, r1, 0x4 - strh r0, [r4, 0xE] -_0808CA0C: - movs r1, 0xE - ldrsh r0, [r4, r1] - cmp r0, 0x9 - ble _0808CA18 - movs r0, 0xA - strh r0, [r4, 0xE] -_0808CA18: - movs r0, 0x1 - pop {r4} - pop {r1} - bx r1 - thumb_func_end fish3 - - thumb_func_start fish4 -fish4: @ 808CA20 - push {r4,r5,lr} - sub sp, 0x10 - adds r4, r0, 0 - ldr r1, =gUnknown_084975A8 - add r0, sp, 0xC - movs r2, 0x2 - bl memcpy - bl sub_808CF78 - ldrh r0, [r4, 0xA] - adds r1, r0, 0x1 - strh r1, [r4, 0xA] - ldr r0, =gMain - ldrh r0, [r0, 0x2E] - movs r5, 0x1 - adds r2, r5, 0 - ands r2, r0 - cmp r2, 0 - beq _0808CA64 - movs r0, 0xB - strh r0, [r4, 0x8] - movs r1, 0x20 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0808CA58 - movs r0, 0xC - strh r0, [r4, 0x8] -_0808CA58: - movs r0, 0x1 - b _0808CAB4 - .pool -_0808CA64: - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _0808CAB2 - strh r2, [r4, 0xA] - movs r3, 0xC - ldrsh r1, [r4, r3] - movs r3, 0xE - ldrsh r0, [r4, r3] - cmp r1, r0 - blt _0808CA94 - ldrh r0, [r4, 0x8] - adds r1, r0, 0x1 - strh r1, [r4, 0x8] - ldrh r2, [r4, 0x20] - movs r3, 0x20 - ldrsh r0, [r4, r3] - cmp r0, 0 - beq _0808CA8E - adds r0, r1, 0x1 - strh r0, [r4, 0x8] -_0808CA8E: - adds r0, r2, 0x1 - strh r0, [r4, 0x20] - b _0808CAB2 -_0808CA94: - movs r0, 0xC - ldrsh r3, [r4, r0] - lsls r3, 27 - lsrs r3, 24 - str r5, [sp] - str r2, [sp, 0x4] - str r2, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - add r2, sp, 0xC - bl AddTextPrinterParameterized - ldrh r0, [r4, 0xC] - adds r0, 0x1 - strh r0, [r4, 0xC] -_0808CAB2: - movs r0, 0 -_0808CAB4: - add sp, 0x10 - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end fish4 - - thumb_func_start fish5 -fish5: @ 808CABC - push {r4-r6,lr} - adds r5, r0, 0 - bl sub_808CF78 - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - movs r6, 0 - bl DoesCurrentMapHaveFishingMons - lsls r0, 24 - cmp r0, 0 - bne _0808CADC - movs r0, 0xB - strh r0, [r5, 0x8] - b _0808CB5C -_0808CADC: - ldr r4, =gPlayerParty - adds r0, r4, 0 - movs r1, 0x6 - bl GetMonData - cmp r0, 0 - bne _0808CB14 - adds r0, r4, 0 - bl GetMonAbility - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x15 - beq _0808CAFC - cmp r0, 0x3C - bne _0808CB14 -_0808CAFC: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x64 - bl __umodsi3 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xE - bls _0808CB14 - movs r6, 0x1 -_0808CB14: - cmp r6, 0 - bne _0808CB32 - bl Random - movs r1, 0x1 - ands r1, r0 - cmp r1, 0 - beq _0808CB30 - movs r0, 0xB - strh r0, [r5, 0x8] - b _0808CB32 - .pool -_0808CB30: - movs r6, 0x1 -_0808CB32: - cmp r6, 0x1 - bne _0808CB5C - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x4] - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - bl GetPlayerFacingDirection - lsls r0, 24 - lsrs r0, 24 - bl GetFishingBiteDirectionAnimNum - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim -_0808CB5C: - movs r0, 0x1 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end fish5 - - thumb_func_start fish6 -fish6: @ 808CB6C - push {r4,r5,lr} - sub sp, 0xC - adds r5, r0, 0 - bl sub_808CF78 - ldr r2, =gText_OhABite - movs r0, 0x11 - str r0, [sp] - movs r4, 0 - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - strh r4, [r5, 0xA] - movs r0, 0 - add sp, 0xC - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end fish6 - - thumb_func_start fish7 -fish7: @ 808CBA4 - push {r4,lr} - sub sp, 0x8 - adds r4, r0, 0 - ldr r1, =gUnknown_084975AA - mov r0, sp - movs r2, 0x6 - bl memcpy - bl sub_808CF78 - ldrh r1, [r4, 0xA] - adds r1, 0x1 - strh r1, [r4, 0xA] - movs r2, 0x26 - ldrsh r0, [r4, r2] - lsls r0, 1 - add r0, sp - lsls r1, 16 - asrs r1, 16 - movs r2, 0 - ldrsh r0, [r0, r2] - cmp r1, r0 - blt _0808CBDC - movs r0, 0xC - b _0808CBEC - .pool -_0808CBDC: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0808CBEE - ldrh r0, [r4, 0x8] - adds r0, 0x1 -_0808CBEC: - strh r0, [r4, 0x8] -_0808CBEE: - movs r0, 0 - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end fish7 - - thumb_func_start fish8 -fish8: @ 808CBFC - push {r4,lr} - sub sp, 0xC - adds r4, r0, 0 - ldr r1, =gUnknown_084975B0 - mov r0, sp - movs r2, 0xC - bl memcpy - bl sub_808CF78 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0x20 - ldrsh r1, [r4, r0] - movs r2, 0x22 - ldrsh r0, [r4, r2] - cmp r1, r0 - blt _0808CC52 - cmp r1, 0x1 - bgt _0808CC56 - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x64 - bl __umodsi3 - movs r3, 0x20 - ldrsh r2, [r4, r3] - lsls r2, 1 - movs r3, 0x26 - ldrsh r1, [r4, r3] - lsls r1, 2 - adds r2, r1 - mov r3, sp - adds r1, r3, r2 - movs r2, 0 - ldrsh r1, [r1, r2] - lsls r0, 16 - asrs r0, 16 - cmp r1, r0 - ble _0808CC56 -_0808CC52: - movs r0, 0x3 - strh r0, [r4, 0x8] -_0808CC56: - movs r0, 0 - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end fish8 - - thumb_func_start fish9 -fish9: @ 808CC64 - push {r4,r5,lr} - sub sp, 0x10 - adds r4, r0, 0 - bl sub_808CF78 - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, =gText_PokemonOnHook - movs r5, 0 - str r5, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0x1 - bl AddTextPrinterParameterized2 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - strh r5, [r4, 0xA] - movs r0, 0 - add sp, 0x10 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end fish9 - - thumb_func_start fishA_wait_for_a_pressed -fishA_wait_for_a_pressed: @ 808CCA8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - movs r1, 0xA - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0808CCBC - bl sub_808CF78 -_0808CCBC: - bl RunTextPrinters - movs r1, 0xA - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0808CD58 - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0 - bne _0808CD50 - ldr r7, =gPlayerAvatar - ldrb r0, [r7, 0x5] - lsls r4, r0, 3 - adds r4, r0 - lsls r4, 2 - ldr r0, =gEventObjects - mov r8, r0 - add r4, r8 - ldrh r1, [r5, 0x24] - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetGraphicsId - ldrb r1, [r4, 0x18] - lsrs r1, 4 - adds r0, r4, 0 - bl EventObjectTurn - ldrb r1, [r7] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _0808CD1A - ldrb r0, [r7, 0x5] - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - add r1, r8 - ldrb r0, [r1, 0x1A] - movs r1, 0 - movs r2, 0 - bl sub_8155604 -_0808CD1A: - ldr r2, =gSprites - ldrb r1, [r7, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r6, [r0, 0x24] - ldrb r1, [r7, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r6, [r0, 0x26] - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - b _0808CD80 - .pool -_0808CD50: - movs r1, 0xA - ldrsh r0, [r5, r1] - cmp r0, 0 - beq _0808CD80 -_0808CD58: - ldr r1, =gPlayerAvatar - movs r0, 0 - strb r0, [r1, 0x6] - bl ScriptContext2_Disable - ldrh r0, [r5, 0x26] - lsls r0, 24 - lsrs r0, 24 - bl FishingWildEncounter - movs r0, 0x1 - bl sub_80ED950 - ldr r0, =Task_Fish - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_0808CD80: - movs r0, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end fishA_wait_for_a_pressed - - thumb_func_start fishB -fishB: @ 808CD94 - push {r4,r5,lr} - sub sp, 0x10 - adds r5, r0, 0 - bl sub_808CF78 - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x4] - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - bl GetPlayerFacingDirection - lsls r0, 24 - lsrs r0, 24 - bl GetFishingNoCatchDirectionAnimNum - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, =gText_NotEvenANibble - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0x1 - bl AddTextPrinterParameterized2 - movs r0, 0xD - strh r0, [r5, 0x8] - movs r0, 0x1 - add sp, 0x10 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end fishB - - thumb_func_start fishC -fishC: @ 808CE04 - push {r4,r5,lr} - sub sp, 0x10 - adds r5, r0, 0 - bl sub_808CF78 - ldr r0, =gPlayerAvatar - ldrb r0, [r0, 0x4] - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - bl GetPlayerFacingDirection - lsls r0, 24 - lsrs r0, 24 - bl GetFishingNoCatchDirectionAnimNum - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, =gText_ItGotAway - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x1 - str r0, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - movs r3, 0x1 - bl AddTextPrinterParameterized2 - ldrh r0, [r5, 0x8] - adds r0, 0x1 - strh r0, [r5, 0x8] - movs r0, 0x1 - add sp, 0x10 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end fishC - - thumb_func_start fishD -fishD: @ 808CE74 - push {r4,lr} - adds r4, r0, 0 - bl sub_808CF78 - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end fishD - - thumb_func_start fishE -fishE: @ 808CE8C - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - bl sub_808CF78 - ldr r7, =gSprites - ldr r5, =gPlayerAvatar - ldrb r0, [r5, 0x4] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - adds r1, 0x3F - ldrb r0, [r1] - lsls r0, 27 - cmp r0, 0 - bge _0808CF12 - ldrb r0, [r5, 0x5] - lsls r4, r0, 3 - adds r4, r0 - lsls r4, 2 - ldr r0, =gEventObjects - mov r8, r0 - add r4, r8 - ldrh r1, [r6, 0x24] - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectSetGraphicsId - ldrb r1, [r4, 0x18] - lsrs r1, 4 - adds r0, r4, 0 - bl EventObjectTurn - ldrb r1, [r5] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _0808CEF2 - ldrb r0, [r5, 0x5] - lsls r1, r0, 3 - adds r1, r0 - lsls r1, 2 - add r1, r8 - ldrb r0, [r1, 0x1A] - movs r1, 0 - movs r2, 0 - bl sub_8155604 -_0808CEF2: - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - movs r2, 0 - strh r2, [r0, 0x24] - ldrb r1, [r5, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - strh r2, [r0, 0x26] - ldrh r0, [r6, 0x8] - adds r0, 0x1 - strh r0, [r6, 0x8] -_0808CF12: - movs r0, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end fishE - - thumb_func_start fishF -fishF: @ 808CF2C - push {lr} - bl RunTextPrinters - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - lsrs r1, r0, 16 - cmp r1, 0 - bne _0808CF68 - ldr r0, =gPlayerAvatar - strb r1, [r0, 0x6] - bl ScriptContext2_Disable - bl UnfreezeEventObjects - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - movs r0, 0 - bl sub_80ED950 - ldr r0, =Task_Fish - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - bl DestroyTask -_0808CF68: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end fishF - - thumb_func_start sub_808CF78 -sub_808CF78: @ 808CF78 - push {r4-r7,lr} - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r4, r0, r1 - adds r0, r4, 0 - bl AnimateSprite - movs r0, 0 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - adds r0, r4, 0 - adds r0, 0x2B - ldrb r5, [r0] - movs r0, 0x2A - adds r0, r4 - mov r12, r0 - ldrb r0, [r0] - ldr r1, [r4, 0x8] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - lsls r6, r5, 2 - adds r0, r6, r0 - movs r1, 0 - ldrsh r0, [r0, r1] - movs r7, 0x1 - negs r7, r7 - cmp r0, r7 - beq _0808CFEA - adds r3, r4, 0 - adds r3, 0x2C - ldrb r2, [r3] - lsls r1, r2, 26 - lsrs r1, 26 - adds r1, 0x1 - movs r0, 0x3F - ands r1, r0 - movs r0, 0x40 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - mov r1, r12 - ldrb r0, [r1] - ldr r1, [r4, 0x8] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - adds r0, r6, r0 - movs r1, 0 - ldrsh r0, [r0, r1] - cmp r0, r7 - bne _0808CFF0 -_0808CFEA: - subs r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 -_0808CFF0: - adds r0, r4, 0 - adds r0, 0x2A - ldrb r0, [r0] - ldr r1, [r4, 0x8] - lsls r0, 2 - adds r0, r1 - ldr r1, [r0] - lsls r0, r5, 2 - adds r0, r1 - ldrb r5, [r0] - subs r0, r5, 0x1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - bhi _0808D022 - movs r0, 0x8 - strh r0, [r4, 0x24] - bl GetPlayerFacingDirection - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3 - bne _0808D022 - ldr r0, =0x0000fff8 - strh r0, [r4, 0x24] -_0808D022: - cmp r5, 0x5 - bne _0808D02A - ldr r0, =0x0000fff8 - strh r0, [r4, 0x26] -_0808D02A: - adds r0, r5, 0 - subs r0, 0xA - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bhi _0808D03A - movs r0, 0x8 - strh r0, [r4, 0x26] -_0808D03A: - ldr r3, =gPlayerAvatar - ldrb r1, [r3] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _0808D05E - ldr r2, =gEventObjects - ldrb r1, [r3, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldrb r0, [r0, 0x1A] - movs r1, 0x26 - ldrsh r2, [r4, r1] - movs r1, 0x1 - bl sub_8155604 -_0808D05E: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808CF78 - - thumb_func_start sub_808D074 -sub_808D074: @ 808D074 - ldr r1, =gUnknown_0203734C - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_808D074 - - thumb_func_start sub_808D080 -sub_808D080: @ 808D080 - push {lr} - ldr r1, =gUnknown_0203734C - ldrb r0, [r1] - cmp r0, 0 - bne _0808D08C - movs r0, 0x1 -_0808D08C: - pop {r1} - bx r1 - .pool - thumb_func_end sub_808D080 - - thumb_func_start sub_808D094 -sub_808D094: @ 808D094 - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - adds r2, r0, 0 - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r4, r0, r1 - ldrb r1, [r4, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r7, r0, r1 - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - movs r0, 0 - ldrsh r6, [r5, r0] - cmp r6, 0x1 - beq _0808D14A - cmp r6, 0x1 - bgt _0808D0E8 - cmp r6, 0 - beq _0808D0EE - b _0808D18A - .pool -_0808D0E8: - cmp r6, 0x2 - beq _0808D184 - b _0808D18A -_0808D0EE: - adds r0, r4, 0 - bl EventObjectClearHeldMovementIfFinished - lsls r0, 24 - cmp r0, 0 - beq _0808D18A - ldrb r0, [r4, 0x18] - lsls r0, 28 - lsrs r0, 28 - bl sub_808D074 - movs r1, 0 - mov r8, r1 - strh r6, [r5, 0x2] - movs r0, 0x1 - strh r0, [r5, 0x4] - ldrh r0, [r7, 0x26] - ldrh r2, [r7, 0x22] - adds r0, r2 - lsls r0, 4 - strh r0, [r5, 0x6] - strh r6, [r7, 0x26] - bl CameraObjectReset2 - ldrb r0, [r4, 0x3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r4, 0x3] - ldrb r1, [r7, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - strb r0, [r7, 0x5] - adds r0, r7, 0 - adds r0, 0x43 - mov r1, r8 - strb r1, [r0] - adds r2, r7, 0 - adds r2, 0x42 - ldrb r1, [r2] - movs r0, 0x3F - ands r0, r1 - strb r0, [r2] - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] -_0808D14A: - adds r1, r5, 0x2 - adds r0, r4, 0 - bl sub_808D38C - ldrh r0, [r5, 0x6] - ldrh r1, [r5, 0x4] - subs r0, r1 - strh r0, [r5, 0x6] - adds r1, 0x3 - strh r1, [r5, 0x4] - lsls r0, 16 - asrs r0, 20 - strh r0, [r7, 0x22] - movs r2, 0x22 - ldrsh r1, [r7, r2] - ldr r0, =gUnknown_03005DE8 - movs r2, 0 - ldrsh r0, [r0, r2] - adds r1, r0 - movs r0, 0x20 - negs r0, r0 - cmp r1, r0 - bge _0808D18A - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - b _0808D18A - .pool -_0808D184: - adds r0, r2, 0 - bl DestroyTask -_0808D18A: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_808D094 - - thumb_func_start sub_808D194 -sub_808D194: @ 808D194 - push {r4,lr} - ldr r4, =sub_808D1FC - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808D194 - - thumb_func_start sub_808D1B4 -sub_808D1B4: @ 808D1B4 - push {lr} - ldr r0, =sub_808D1FC - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_808D1B4 - - thumb_func_start sub_808D1C8 -sub_808D1C8: @ 808D1C8 - push {r4,lr} - ldr r4, =sub_808D094 - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_808D1C8 - - thumb_func_start sub_808D1E8 -sub_808D1E8: @ 808D1E8 - push {lr} - ldr r0, =sub_808D094 - bl FuncIsActiveTask - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_808D1E8 - - thumb_func_start sub_808D1FC -sub_808D1FC: @ 808D1FC - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r0, =gPlayerAvatar - ldrb r1, [r0, 0x5] - lsls r0, r1, 3 - adds r0, r1 - lsls r0, 2 - ldr r1, =gEventObjects - adds r4, r0, r1 - ldrb r1, [r4, 0x4] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r7, r0, r1 - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r5, r0, r1 - movs r2, 0 - ldrsh r6, [r5, r2] - cmp r6, 0x1 - beq _0808D2DE - cmp r6, 0x1 - bgt _0808D254 - cmp r6, 0 - beq _0808D25E - b _0808D37E - .pool -_0808D254: - cmp r6, 0x2 - beq _0808D31C - cmp r6, 0x3 - beq _0808D33A - b _0808D37E -_0808D25E: - bl sub_808D080 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0xA] - ldr r1, =gUnknown_084975BC - movs r3, 0xA - ldrsh r0, [r5, r3] - adds r0, r1 - ldrb r0, [r0] - bl GetFaceDirectionMovementAction - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl EventObjectForceSetHeldMovement - movs r0, 0 - mov r9, r0 - strh r6, [r5, 0x2] - movs r0, 0x74 - strh r0, [r5, 0x4] - ldrh r0, [r7, 0x22] - strh r0, [r5, 0x8] - ldrb r0, [r7, 0x5] - lsls r0, 28 - lsrs r0, 30 - strh r0, [r5, 0xC] - movs r1, 0x43 - adds r1, r7 - mov r8, r1 - ldrb r0, [r1] - strh r0, [r5, 0xE] - ldrh r0, [r7, 0x26] - adds r0, 0x20 - negs r0, r0 - lsls r0, 4 - strh r0, [r5, 0x6] - strh r6, [r7, 0x26] - bl CameraObjectReset2 - ldrb r0, [r4, 0x3] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r4, 0x3] - ldrb r1, [r7, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r1 - orrs r0, r2 - strb r0, [r7, 0x5] - mov r3, r9 - mov r2, r8 - strb r3, [r2] - adds r2, r7, 0 - adds r2, 0x42 - ldrb r1, [r2] - movs r0, 0x3F - ands r0, r1 - strb r0, [r2] - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] -_0808D2DE: - adds r1, r5, 0x2 - adds r0, r4, 0 - bl sub_808D38C - ldrh r0, [r5, 0x4] - ldrh r2, [r5, 0x6] - adds r1, r0, r2 - strh r1, [r5, 0x6] - subs r0, 0x3 - strh r0, [r5, 0x4] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x3 - bgt _0808D2FE - movs r0, 0x4 - strh r0, [r5, 0x4] -_0808D2FE: - ldrh r0, [r5, 0x6] - lsls r0, 16 - asrs r0, 20 - strh r0, [r7, 0x22] - ldrh r2, [r5, 0x8] - movs r3, 0x8 - ldrsh r1, [r5, r3] - cmp r0, r1 - blt _0808D37E - strh r2, [r7, 0x22] - movs r0, 0 - strh r0, [r5, 0x10] - b _0808D332 - .pool -_0808D31C: - adds r1, r5, 0x2 - adds r0, r4, 0 - bl sub_808D38C - ldrh r0, [r5, 0x10] - adds r0, 0x1 - strh r0, [r5, 0x10] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x8 - ble _0808D37E -_0808D332: - ldrh r0, [r5] - adds r0, 0x1 - strh r0, [r5] - b _0808D37E -_0808D33A: - movs r0, 0xA - ldrsh r6, [r5, r0] - adds r1, r5, 0x2 - adds r0, r4, 0 - bl sub_808D38C - lsls r0, 24 - lsrs r0, 24 - cmp r6, r0 - bne _0808D37E - ldrb r1, [r4, 0x3] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r4, 0x3] - movs r0, 0x3 - ldrb r1, [r5, 0xC] - ands r1, r0 - lsls r1, 2 - ldrb r2, [r7, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r7, 0x5] - ldrh r1, [r5, 0xE] - adds r0, r7, 0 - adds r0, 0x43 - strb r1, [r0] - bl CameraObjectReset1 - mov r0, r8 - bl DestroyTask -_0808D37E: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_808D1FC - - thumb_func_start sub_808D38C -sub_808D38C: @ 808D38C - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - ldrh r1, [r6] - movs r2, 0 - ldrsh r0, [r6, r2] - cmp r0, 0x7 - bgt _0808D3A8 - adds r0, r1, 0x1 - strh r0, [r6] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _0808D3E4 -_0808D3A8: - adds r0, r5, 0 - bl EventObjectCheckHeldMovementStatus - lsls r0, 24 - cmp r0, 0 - beq _0808D3E4 - ldr r4, =gUnknown_084975BC - ldrb r0, [r5, 0x18] - lsls r0, 28 - lsrs r0, 28 - adds r0, r4 - ldrb r0, [r0] - bl GetFaceDirectionMovementAction - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl EventObjectForceSetHeldMovement - movs r0, 0 - strh r0, [r6] - ldrb r0, [r5, 0x18] - lsls r0, 28 - lsrs r0, 28 - adds r0, r4 - ldrb r0, [r0] - b _0808D3EA - .pool -_0808D3E4: - ldrb r0, [r5, 0x18] - lsls r0, 28 - lsrs r0, 28 -_0808D3EA: - pop {r4-r6} - pop {r1} - bx r1 - thumb_func_end sub_808D38C - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/rom_8011DC0.s b/asm/rom_8011DC0.s index 33ace5757..415ebfc0c 100644 --- a/asm/rom_8011DC0.s +++ b/asm/rom_8011DC0.s @@ -8335,7 +8335,7 @@ _08019C5A: beq _08019CE6 mov r0, sp adds r1, r4, 0 - bl plaer_get_pos_including_state_based_drift + bl player_get_pos_including_state_based_drift mov r0, sp movs r1, 0 ldrsh r2, [r0, r1] @@ -8881,7 +8881,7 @@ sub_801A064: @ 801A064 adds r5, 0x6 adds r0, r4, 0 adds r1, r5, 0 - bl plaer_get_pos_including_state_based_drift + bl player_get_pos_including_state_based_drift lsls r0, r7, 2 adds r0, r7 subs r0, 0x38 diff --git a/include/event_object_movement.h b/include/event_object_movement.h index ddccfe39b..6d38d072d 100644 --- a/include/event_object_movement.h +++ b/include/event_object_movement.h @@ -143,9 +143,27 @@ u8 GetCollisionFlagsAtCoords(struct EventObject *eventObject, s16 x, s16 y, u8 d u8 GetFaceDirectionMovementAction(u32); u8 GetWalkNormalMovementAction(u32); u8 GetWalkFastMovementAction(u32); +u8 GetRideWaterCurrentMovementAction(u32); u8 GetWalkFastestMovementAction(u32); +u8 GetPlayerRunMovementAction(u32); u8 GetJumpInPlaceMovementAction(u32); +u8 GetAcroWheelieFaceDirectionMovementAction(u32); +u8 GetAcroPopWheelieFaceDirectionMovementAction(u32); +u8 GetAcroEndWheelieFaceDirectionMovementAction(u32); +u8 GetAcroWheelieHopFaceDirectionMovementAction(u32); +u8 GetAcroWheelieHopDirectionMovementAction(u32); +u8 GetAcroWheelieJumpDirectionMovementAction(u32); +u8 GetJumpInPlaceTurnAroundMovementAction(u32); +u8 GetAcroWheelieInPlaceDirectionMovementAction(u32); +u8 GetAcroPopWheelieMoveDirectionMovementAction(u32); +u8 GetAcroWheelieMoveDirectionMovementAction(u32); +u8 GetAcroEndWheelieMoveDirectionMovementAction(u32); +u8 GetFishingDirectionAnimNum(u8 direction); +u8 GetAcroWheelieDirectionAnimNum(u8 direction); +u8 GetFishingBiteDirectionAnimNum(u8 direction); +u8 GetFishingNoCatchDirectionAnimNum(u8 direction); bool8 EventObjectSetHeldMovement(struct EventObject *eventObject, u8 specialAnimId); +void EventObjectForceSetHeldMovement(struct EventObject *eventObject, u8 movementActionId); bool8 EventObjectIsMovementOverridden(struct EventObject *eventObject); u8 EventObjectCheckHeldMovementStatus(struct EventObject *eventObject); u8 EventObjectGetHeldMovementActionId(struct EventObject *eventObject); @@ -194,6 +212,7 @@ u16 GetObjectPaletteTag(u8 palSlot); void UpdateEventObjectSpriteVisibility(struct Sprite *sprite, bool8 invisible); s16 sub_809773C(s16 a1); s16 sub_8097728(s16 a1); +void CameraObjectReset2(void); void MovementType_None(struct Sprite *); void MovementType_LookAround(struct Sprite *); diff --git a/include/field_effect_helpers.h b/include/field_effect_helpers.h index 9c354159b..223350042 100644 --- a/include/field_effect_helpers.h +++ b/include/field_effect_helpers.h @@ -7,9 +7,10 @@ // Exported ROM declarations u8 CreateWarpArrowSprite(void); +u8 sub_8155800(u8 oldSpriteId); +void sub_81555AC(u8, u8); bool8 sub_8155DA0(struct EventObject *); void sub_8155D78(struct EventObject *); -void sub_81555AC(u8, u8); void StartAshFieldEffect(s16, s16, u16, s16); void SetUpReflection(struct EventObject*, struct Sprite*, u8); u32 StartFieldEffectForEventObject(u8, struct EventObject*); @@ -30,5 +31,8 @@ void UpdateShortGrassFieldEffect(struct Sprite*); void UpdateHotSpringsWaterFieldEffect(struct Sprite*); void UpdateBubblesFieldEffect(struct Sprite*); void UpdateSparkleFieldEffect(struct Sprite*); +void SetSpriteInvisible(u8 spriteId); +void ShowWarpArrowSprite(u8 spriteId, u8 direction, s16 x, s16 y); +void sub_8155604(u8 spriteId, u8 value, s16 data1); #endif //GUARD_FIELD_EFFECT_HELPERS_H diff --git a/include/field_player_avatar.h b/include/field_player_avatar.h index ee2cbb3c8..adb51f889 100644 --- a/include/field_player_avatar.h +++ b/include/field_player_avatar.h @@ -1,6 +1,17 @@ #ifndef GUARD_FIELD_PLAYER_AVATAR_H #define GUARD_FIELD_PLAYER_AVATAR_H +enum { + PLAYER_AVATAR_STATE_NORMAL, + PLAYER_AVATAR_STATE_MACH_BIKE, + PLAYER_AVATAR_STATE_ACRO_BIKE, + PLAYER_AVATAR_STATE_SURFING, + PLAYER_AVATAR_STATE_UNDERWATER, + PLAYER_AVATAR_STATE_FIELD_MOVE, + PLAYER_AVATAR_STATE_FISHING, + PLAYER_AVATAR_STATE_WATERING, +}; + void player_step(u8 a, u16 b, u16 c); void ClearPlayerAvatarInfo(void); void SetPlayerAvatarExtraStateTransition(u8, u8); @@ -13,7 +24,7 @@ u8 GetPlayerMovementDirection(void); u8 PlayerGetCopyableMovement(void); void PlayerGoSpeed1(u8); void PlayerGoSpeed2(u8); -void PlayerGoSpeed3(u8); +void PlayerRideWaterCurrent(u8); void PlayerGoSpeed4(u8); void PlayerOnBikeCollide(u8); void PlayerFaceDirection(u8 a); @@ -48,22 +59,4 @@ bool8 PartyHasMonWithSurf(void); bool8 IsPlayerFacingSurfableFishableWater(void); bool8 IsPlayerSurfingNorth(void); -bool8 ForcedMovement_None(void); -bool8 ForcedMovement_Slip(void); -bool8 ForcedMovement_WalkSouth(void); -bool8 ForcedMovement_WalkNorth(void); -bool8 ForcedMovement_WalkWest(void); -bool8 ForcedMovement_WalkEast(void); -bool8 ForcedMovement_PushedSouthByCurrent(void); -bool8 ForcedMovement_PushedNorthByCurrent(void); -bool8 ForcedMovement_PushedWestByCurrent(void); -bool8 ForcedMovement_PushedEastByCurrent(void); -bool8 ForcedMovement_SlideSouth(void); -bool8 ForcedMovement_SlideNorth(void); -bool8 ForcedMovement_SlideWest(void); -bool8 ForcedMovement_SlideEast(void); -bool8 ForcedMovement_0xBB(void); -bool8 ForcedMovement_0xBC(void); -bool8 ForcedMovement_MuddySlope(void); - #endif // GUARD_FIELD_PLAYER_AVATAR_H diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index 66d5b5e4c..bb120c62c 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -232,7 +232,7 @@ struct EventObjectGraphicsInfo #define PLAYER_AVATAR_FLAG_MACH_BIKE (1 << 1) #define PLAYER_AVATAR_FLAG_ACRO_BIKE (1 << 2) #define PLAYER_AVATAR_FLAG_SURFING (1 << 3) -#define PLAYER_AVATAR_FLAG_4 (1 << 4) +#define PLAYER_AVATAR_FLAG_UNDERWATER (1 << 4) #define PLAYER_AVATAR_FLAG_5 (1 << 5) #define PLAYER_AVATAR_FLAG_6 (1 << 6) #define PLAYER_AVATAR_FLAG_DASH (1 << 7) diff --git a/include/strings.h b/include/strings.h index 0b037287a..c563353ec 100644 --- a/include/strings.h +++ b/include/strings.h @@ -872,4 +872,9 @@ extern const u8 gText_ShopBuy[]; extern const u8 gText_ShopSell[]; extern const u8 gText_ShopQuit[]; +extern const u8 gText_OhABite[]; +extern const u8 gText_PokemonOnHook[]; +extern const u8 gText_NotEvenANibble[]; +extern const u8 gText_ItGotAway[]; + #endif //GUARD_STRINGS_H diff --git a/ld_script.txt b/ld_script.txt index 41a8d95c7..77f95e96f 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -92,7 +92,6 @@ SECTIONS { src/field_camera.o(.text); src/field_door.o(.text); src/field_player_avatar.o(.text); - asm/field_player_avatar.o(.text); src/event_object_movement.o(.text); src/field_message_box.o(.text); src/event_obj_lock.o(.text); diff --git a/src/bike.c b/src/bike.c index 6ffd479f7..8ad771f51 100644 --- a/src/bike.c +++ b/src/bike.c @@ -18,7 +18,7 @@ extern u8 sub_808B980(u8 direction); extern u8 sub_808B9BC(u8 direction); extern u8 sub_808B9A4(u8 direction); extern u8 sub_808C1B4(u8 direction); -extern u8 npc_use_some_d2s(u8 direction); +extern u8 sub_808B9D4(u8 direction); extern void Overworld_ClearSavedMusic(void); extern void Overworld_PlaySpecialMapMusic(void); @@ -575,7 +575,7 @@ static void AcroBikeTransition_Moving(u8 direction) } else { - PlayerGoSpeed3(direction); + PlayerRideWaterCurrent(direction); } } @@ -768,7 +768,7 @@ static void AcroBikeTransition_WheelieLoweringMoving(u8 direction) PlayerEndWheelie(direction); return; } - npc_use_some_d2s(direction); + sub_808B9D4(direction); } void Bike_TryAcroBikeHistoryUpdate(u16 newKeys, u16 heldKeys) @@ -968,7 +968,7 @@ bool8 IsBikingDisallowedByPlayer(void) s16 x, y; u8 tileBehavior; - if (!(gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_4))) + if (!(gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_UNDERWATER))) { PlayerGetDestCoords(&x, &y); tileBehavior = MapGridGetMetatileBehaviorAt(x, y); diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index b9cf7d102..cb2beacee 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -1,38 +1,64 @@ #include "global.h" +#include "main.h" #include "bike.h" #include "event_data.h" #include "event_object_movement.h" +#include "field_camera.h" #include "field_player_avatar.h" +#include "field_effect.h" +#include "field_effect_helpers.h" #include "fieldmap.h" #include "global.fieldmap.h" +#include "menu.h" #include "metatile_behavior.h" #include "overworld.h" +#include "party_menu.h" +#include "random.h" #include "rotating_gate.h" +#include "script.h" +#include "sound.h" #include "sprite.h" +#include "strings.h" #include "task.h" +#include "tv.h" +#include "wild_encounter.h" +#include "constants/abilities.h" #include "constants/event_objects.h" #include "constants/event_object_movement_constants.h" #include "constants/flags.h" +#include "constants/maps.h" +#include "constants/moves.h" +#include "constants/songs.h" +#include "constants/species.h" -extern void task_add_bump_boulder(u8, u8); +static EWRAM_DATA u8 gUnknown_0203734C = 0; +EWRAM_DATA struct EventObject gEventObjects[NUM_EVENT_OBJECTS] = {}; +EWRAM_DATA struct PlayerAvatar gPlayerAvatar = {}; + +static void StartStrengthAnim(u8, u8); static bool8 ShouldJumpLedge(s16, s16, u8); static bool8 sub_808B1BC(s16, s16, u8); static u8 sub_808B164(struct EventObject *, s16, s16, u8, u8); static u8 sub_808B238(s16, s16, u8); static void check_acro_bike_metatile(s16, s16, u8, u8 *); -extern void PlayerNotOnBikeCollide(u8); -extern void PlayerNotOnBikeCollideWithFarawayIslandMew(u8); -extern void PlayerRun(u8); +static void PlayerNotOnBikeCollide(u8); +static void PlayCollisionSoundIfNotFacingWarp(u8 a); +static void PlayerNotOnBikeCollideWithFarawayIslandMew(u8); +static void PlayerRun(u8); static void MovePlayerNotOnBike(u8, u16); static u8 CheckMovementInputNotOnBike(u8); -extern void sub_808C5B0(void); -extern void sub_808C4D8(void); +static void DoPlayerMatSpin(void); +static void DoPlayerMatJump(void); static u8 CheckForPlayerAvatarCollision(u8); static u8 EventObjectCB2_NoMovement2(); -extern void sub_808C280(struct EventObject *); +static void sub_808C280(struct EventObject *); static bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8); -void npc_clear_strange_bits(struct EventObject *); -extern void DoPlayerAvatarTransition(void); +static void npc_clear_strange_bits(struct EventObject *); +static void DoPlayerAvatarTransition(void); +static bool8 player_is_anim_in_certain_ranges(void); +static bool8 sub_808B618(void); +static bool8 PlayerIsAnimActive(void); +static bool8 PlayerCheckIfAnimFinishedOrInactive(void); static bool8 TryDoMetatileBehaviorForcedMovement(); static void MovePlayerAvatarUsingKeypadInput(u8, u16, u16); static void PlayerAllowForcedMovementIfMovingSameDirection(); @@ -41,43 +67,61 @@ static u8 GetForcedMovementByMetatileBehavior(); static void PlayerNotOnBikeNotMoving(u8, u16); static void PlayerNotOnBikeTurningInPlace(u8, u16); static void PlayerNotOnBikeMoving(u8, u16); -extern void sub_808C750(u8); +static void sub_808C750(u8); -extern void PlayerAvatarTransition_Normal(struct EventObject *a); -extern void PlayerAvatarTransition_MachBike(struct EventObject *a); -extern void PlayerAvatarTransition_AcroBike(struct EventObject *a); -extern void PlayerAvatarTransition_Surfing(struct EventObject *a); -extern void PlayerAvatarTransition_Underwater(struct EventObject *a); -extern void PlayerAvatarTransition_ReturnToField(struct EventObject *a); -extern void PlayerAvatarTransition_Dummy(struct EventObject *a); +static bool8 ForcedMovement_None(void); +static bool8 ForcedMovement_Slip(void); +static bool8 ForcedMovement_WalkSouth(void); +static bool8 ForcedMovement_WalkNorth(void); +static bool8 ForcedMovement_WalkWest(void); +static bool8 ForcedMovement_WalkEast(void); +static bool8 ForcedMovement_PushedSouthByCurrent(void); +static bool8 ForcedMovement_PushedNorthByCurrent(void); +static bool8 ForcedMovement_PushedWestByCurrent(void); +static bool8 ForcedMovement_PushedEastByCurrent(void); +static bool8 ForcedMovement_SlideSouth(void); +static bool8 ForcedMovement_SlideNorth(void); +static bool8 ForcedMovement_SlideWest(void); +static bool8 ForcedMovement_SlideEast(void); +static bool8 ForcedMovement_0xBB(void); +static bool8 ForcedMovement_0xBC(void); +static bool8 ForcedMovement_MuddySlope(void); -extern u8 sub_808C3A4(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject); -extern u8 do_boulder_dust(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject); -extern u8 sub_808C484(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject); +static void PlayerAvatarTransition_Normal(struct EventObject *a); +static void PlayerAvatarTransition_MachBike(struct EventObject *a); +static void PlayerAvatarTransition_AcroBike(struct EventObject *a); +static void PlayerAvatarTransition_Surfing(struct EventObject *a); +static void PlayerAvatarTransition_Underwater(struct EventObject *a); +static void PlayerAvatarTransition_ReturnToField(struct EventObject *a); +static void PlayerAvatarTransition_Dummy(struct EventObject *a); -extern u8 sub_808C544(struct Task *task, struct EventObject *eventObject); +static u8 sub_808C3A4(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject); +static u8 do_boulder_dust(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject); +static u8 sub_808C484(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject); -extern u8 sub_808C61C(struct Task *task, struct EventObject *eventObject); -extern u8 sub_808C644(struct Task *task, struct EventObject *eventObject); -extern u8 sub_808C6BC(struct Task *task, struct EventObject *eventObject); -extern u8 sub_808C6FC(struct Task *task, struct EventObject *eventObject); +static u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct EventObject *eventObject); -extern u8 fish0(struct Task *task); -extern u8 fish1(struct Task *task); -extern u8 fish2(struct Task *task); -extern u8 fish3(struct Task *task); -extern u8 fish4(struct Task *task); -extern u8 fish5(struct Task *task); -extern u8 fish6(struct Task *task); -extern u8 fish7(struct Task *task); -extern u8 fish8(struct Task *task); -extern u8 fish9(struct Task *task); -extern u8 fishA_wait_for_a_pressed(struct Task *task); -extern u8 fishB(struct Task *task); -extern u8 fishC(struct Task *task); -extern u8 fishD(struct Task *task); -extern u8 fishE(struct Task *task); -extern u8 fishF(struct Task *task); +static bool8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *task, struct EventObject *eventObject); +static bool8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct EventObject *eventObject); +static bool8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *task, struct EventObject *eventObject); +static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct EventObject *eventObject); + +static u8 Fishing1(struct Task *task); +static u8 Fishing2(struct Task *task); +static u8 Fishing3(struct Task *task); +static u8 Fishing4(struct Task *task); +static u8 Fishing5(struct Task *task); +static u8 Fishing6(struct Task *task); +static u8 Fishing7(struct Task *task); +static u8 Fishing8(struct Task *task); +static u8 Fishing9(struct Task *task); +static u8 Fishing10(struct Task *task); +static u8 Fishing11(struct Task *task); +static u8 Fishing12(struct Task *task); +static u8 Fishing13(struct Task *task); +static u8 Fishing14(struct Task *task); +static u8 Fishing15(struct Task *task); +static u8 Fishing16(struct Task *task); static bool8 (*const gUnknown_084973FC[])(u8) = { @@ -142,7 +186,7 @@ static bool8 (*const gUnknown_0849749C[])(u8) = static const u8 gUnknown_084974B0[] = {9, 10, 11, 12, 13, 0, 0, 0}; -void (*const gUnknown_084974B8[])(struct EventObject *) = +static void (*const gUnknown_084974B8[])(struct EventObject *) = { PlayerAvatarTransition_Normal, PlayerAvatarTransition_MachBike, @@ -154,7 +198,7 @@ void (*const gUnknown_084974B8[])(struct EventObject *) = PlayerAvatarTransition_Dummy, }; -bool8 (*const gUnknown_084974D8[])(u8) = +static bool8 (*const sArrowWarpMetatileBehaviorChecks[])(u8) = { MetatileBehavior_IsSouthArrowWarp, MetatileBehavior_IsNorthArrowWarp, @@ -162,7 +206,7 @@ bool8 (*const gUnknown_084974D8[])(u8) = MetatileBehavior_IsEastArrowWarp, }; -const u8 gUnknown_084974E8[][2] = +static const u8 sRivalAvatarGfxIds[][2] = { {EVENT_OBJ_GFX_RIVAL_BRENDAN_NORMAL, EVENT_OBJ_GFX_RIVAL_MAY_NORMAL}, {EVENT_OBJ_GFX_RIVAL_BRENDAN_MACH_BIKE, EVENT_OBJ_GFX_RIVAL_MAY_MACH_BIKE}, @@ -174,7 +218,7 @@ const u8 gUnknown_084974E8[][2] = {EVENT_OBJ_GFX_BRENDAN_WATERING, EVENT_OBJ_GFX_MAY_WATERING} }; -const u8 gUnknown_084974F8[][2] = +static const u8 sPlayerAvatarGfxIds[][2] = { {EVENT_OBJ_GFX_BRENDAN_NORMAL, EVENT_OBJ_GFX_MAY_NORMAL}, {EVENT_OBJ_GFX_BRENDAN_MACH_BIKE, EVENT_OBJ_GFX_MAY_MACH_BIKE}, @@ -186,11 +230,11 @@ const u8 gUnknown_084974F8[][2] = {EVENT_OBJ_GFX_BRENDAN_WATERING, EVENT_OBJ_GFX_MAY_WATERING}, }; -const u8 gUnknown_08497508[] = {EVENT_OBJ_GFX_RED, EVENT_OBJ_GFX_LEAF}; +static const u8 sFRLGAvatarGfxIds[] = {EVENT_OBJ_GFX_RED, EVENT_OBJ_GFX_LEAF}; -const u8 gUnknown_0849750A[] = {EVENT_OBJ_GFX_LINK_RS_BRENDAN, EVENT_OBJ_GFX_LINK_RS_MAY}; +static const u8 sRSAvatarGfxIds[] = {EVENT_OBJ_GFX_LINK_RS_BRENDAN, EVENT_OBJ_GFX_LINK_RS_MAY}; -const u8 gUnknown_0849750C[2][5][2] = +static const u8 gUnknown_0849750C[2][5][2] = { //male { @@ -210,7 +254,7 @@ const u8 gUnknown_0849750C[2][5][2] = } }; -bool8 (*const gUnknown_08497520[])(u8) = //Duplicate of sArrowWarpMetatileBehaviorChecks +static bool8 (*const sArrowWarpMetatileBehaviorChecks2[])(u8) = //Duplicate of sArrowWarpMetatileBehaviorChecks { MetatileBehavior_IsSouthArrowWarp, MetatileBehavior_IsNorthArrowWarp, @@ -218,67 +262,26 @@ bool8 (*const gUnknown_08497520[])(u8) = //Duplicate of sArrowWarpMetatileBehav MetatileBehavior_IsEastArrowWarp, }; -u8 (*const gUnknown_08497530[])(struct Task *, struct EventObject *, struct EventObject *) = +static bool8 (*const gUnknown_08497530[])(struct Task *, struct EventObject *, struct EventObject *) = { sub_808C3A4, do_boulder_dust, sub_808C484, }; -u8 (*const gUnknown_0849753C[])(struct Task *, struct EventObject *) = +static bool8 (*const sPlayerAvatarSecretBaseMatJump[])(struct Task *, struct EventObject *) = { - sub_808C544, + PlayerAvatar_DoSecretBaseMatJump, }; -u8 (*const gUnknown_08497540[])(struct Task *, struct EventObject *) = +static bool8 (*const sPlayerAvatarSecretBaseMatSpin[])(struct Task *, struct EventObject *) = { - sub_808C61C, - sub_808C644, - sub_808C6BC, - sub_808C6FC, + PlayerAvatar_SecretBaseMatSpinStep0, + PlayerAvatar_SecretBaseMatSpinStep1, + PlayerAvatar_SecretBaseMatSpinStep2, + PlayerAvatar_SecretBaseMatSpinStep3, }; -const u8 gUnknown_08497550[] = {3, 4, 2, 1}; - -const u8 gUnknown_08497554[] = {16, 16, 17, 18, 19}; - -u8 (*const gUnknown_0849755C[])(struct Task *) = -{ - fish0, - fish1, - fish2, - fish3, - fish4, - fish5, - fish6, - fish7, - fish8, - fish9, - fishA_wait_for_a_pressed, - fishB, - fishC, - fishD, - fishE, - fishF, -}; - -const u16 gUnknown_0849759C[] = {1, 1, 1}; - -const u16 gUnknown_084975A2[] = {1, 3, 6}; - -const u8 gUnknown_084975A8[] = _("·"); - -const u16 gUnknown_084975AA[] = {36, 33, 30}; - -const u16 gUnknown_084975B0[] = -{ - 0, 0, - 0x28, 10, - 0x46, 30, -}; - -const u8 gUnknown_084975BC[] = {0x01, 0x03, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00}; - // .text void MovementType_Player(struct Sprite *sprite) { @@ -352,7 +355,7 @@ static bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *playerEventO return FALSE; } -void npc_clear_strange_bits(struct EventObject *eventObj) +static void npc_clear_strange_bits(struct EventObject *eventObj) { eventObj->inanimate = 0; eventObj->disableAnim = 0; @@ -397,7 +400,7 @@ static u8 GetForcedMovementByMetatileBehavior(void) return 0; } -bool8 ForcedMovement_None(void) +static bool8 ForcedMovement_None(void) { if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_6) { @@ -441,7 +444,7 @@ static u8 DoForcedMovement(u8 direction, void (*b)(u8)) } } -u8 DoForcedMovementInCurrentDirection(void (*a)(u8)) +static u8 DoForcedMovementInCurrentDirection(void (*a)(u8)) { struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -449,49 +452,49 @@ u8 DoForcedMovementInCurrentDirection(void (*a)(u8)) return DoForcedMovement(playerEventObj->movementDirection, a); } -bool8 ForcedMovement_Slip(void) +static bool8 ForcedMovement_Slip(void) { return DoForcedMovementInCurrentDirection(PlayerGoSpeed2); } -bool8 ForcedMovement_WalkSouth(void) +static bool8 ForcedMovement_WalkSouth(void) { return DoForcedMovement(DIR_SOUTH, PlayerGoSpeed1); } -bool8 ForcedMovement_WalkNorth(void) +static bool8 ForcedMovement_WalkNorth(void) { return DoForcedMovement(DIR_NORTH, PlayerGoSpeed1); } -bool8 ForcedMovement_WalkWest(void) +static bool8 ForcedMovement_WalkWest(void) { return DoForcedMovement(DIR_WEST, PlayerGoSpeed1); } -bool8 ForcedMovement_WalkEast(void) +static bool8 ForcedMovement_WalkEast(void) { return DoForcedMovement(DIR_EAST, PlayerGoSpeed1); } -bool8 ForcedMovement_PushedSouthByCurrent(void) +static bool8 ForcedMovement_PushedSouthByCurrent(void) { - return DoForcedMovement(DIR_SOUTH, PlayerGoSpeed3); + return DoForcedMovement(DIR_SOUTH, PlayerRideWaterCurrent); } -bool8 ForcedMovement_PushedNorthByCurrent(void) +static bool8 ForcedMovement_PushedNorthByCurrent(void) { - return DoForcedMovement(DIR_NORTH, PlayerGoSpeed3); + return DoForcedMovement(DIR_NORTH, PlayerRideWaterCurrent); } -bool8 ForcedMovement_PushedWestByCurrent(void) +static bool8 ForcedMovement_PushedWestByCurrent(void) { - return DoForcedMovement(DIR_WEST, PlayerGoSpeed3); + return DoForcedMovement(DIR_WEST, PlayerRideWaterCurrent); } -bool8 ForcedMovement_PushedEastByCurrent(void) +static bool8 ForcedMovement_PushedEastByCurrent(void) { - return DoForcedMovement(DIR_EAST, PlayerGoSpeed3); + return DoForcedMovement(DIR_EAST, PlayerRideWaterCurrent); } u8 ForcedMovement_Slide(u8 direction, void (*b)(u8)) @@ -503,39 +506,39 @@ u8 ForcedMovement_Slide(u8 direction, void (*b)(u8)) return DoForcedMovement(direction, b); } -bool8 ForcedMovement_SlideSouth(void) +static bool8 ForcedMovement_SlideSouth(void) { return ForcedMovement_Slide(DIR_SOUTH, PlayerGoSpeed2); } -bool8 ForcedMovement_SlideNorth(void) +static bool8 ForcedMovement_SlideNorth(void) { return ForcedMovement_Slide(DIR_NORTH, PlayerGoSpeed2); } -bool8 ForcedMovement_SlideWest(void) +static bool8 ForcedMovement_SlideWest(void) { return ForcedMovement_Slide(DIR_WEST, PlayerGoSpeed2); } -bool8 ForcedMovement_SlideEast(void) +static bool8 ForcedMovement_SlideEast(void) { return ForcedMovement_Slide(DIR_EAST, PlayerGoSpeed2); } -bool8 ForcedMovement_0xBB(void) +static bool8 ForcedMovement_0xBB(void) { - sub_808C4D8(); + DoPlayerMatJump(); return TRUE; } -bool8 ForcedMovement_0xBC(void) +static bool8 ForcedMovement_0xBC(void) { - sub_808C5B0(); + DoPlayerMatSpin(); return TRUE; } -bool8 ForcedMovement_MuddySlope(void) +static bool8 ForcedMovement_MuddySlope(void) { struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -624,7 +627,7 @@ static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys) return; } - if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_4) && (heldKeys & B_BUTTON) && FlagGet(FLAG_SYS_B_DASH) + if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_UNDERWATER) && (heldKeys & B_BUTTON) && FlagGet(FLAG_SYS_B_DASH) && IsRunningDisallowed(gEventObjects[gPlayerAvatar.eventObjectId].currentMetatileBehavior) == 0) { PlayerRun(direction); @@ -733,7 +736,7 @@ static u8 sub_808B238(s16 x, s16 y, u8 direction) if (GetCollisionAtCoords(&gEventObjects[eventObjectId], x, y, direction) == 0 && MetatileBehavior_IsNonAnimDoor(MapGridGetMetatileBehaviorAt(x, y)) == 0) { - task_add_bump_boulder(eventObjectId, direction); + StartStrengthAnim(eventObjectId, direction); return 1; } } @@ -754,3 +757,1472 @@ static void check_acro_bike_metatile(s16 unused1, s16 unused2, u8 c, u8 *d) } } } + +bool8 IsPlayerCollidingWithFarawayIslandMew(u8 direction) +{ + u8 mewObjectId; + struct EventObject *object; + s16 playerX; + s16 playerY; + s16 mewPrevX; + + object = &gEventObjects[gPlayerAvatar.eventObjectId]; + playerX = object->currentCoords.x; + playerY = object->currentCoords.y; + + MoveCoords(direction, &playerX, &playerY); + mewObjectId = GetEventObjectIdByLocalIdAndMap(1, 0x39, 0x1A); + + if (mewObjectId == 16) + { + return FALSE; + } + + object = &gEventObjects[mewObjectId]; + mewPrevX = object->previousCoords.x; + + if (mewPrevX == playerX) + { + if (object->previousCoords.y != playerY + || object->currentCoords.x != mewPrevX + || object->currentCoords.y != object->previousCoords.y) + { + if (object->previousCoords.x == playerX && + object->previousCoords.y == playerY) + return TRUE; + } + } + return FALSE; +} + +void SetPlayerAvatarTransitionFlags(u16 transitionFlags) +{ + gPlayerAvatar.unk1 |= transitionFlags; + DoPlayerAvatarTransition(); +} + +static void DoPlayerAvatarTransition(void) +{ + u8 i; + u32 flags = gPlayerAvatar.unk1; + + if (flags != 0) + { + for (i = 0; i < 8; i++, flags >>= 1) + { +#ifdef NONMATCHING + if (flags & 1) + { + gUnknown_084974B8[i](&gEventObjects[gPlayerAvatar.eventObjectId]); + } +#else + if (flags & 1) + { + register void (*const *funcs)(struct EventObject *) asm("r0") = gUnknown_084974B8; + funcs[i](&gEventObjects[gPlayerAvatar.eventObjectId]); + } +#endif + } + gPlayerAvatar.unk1 = 0; + } +} + +static void PlayerAvatarTransition_Dummy(struct EventObject *eventObj) +{ + +} + +static void PlayerAvatarTransition_Normal(struct EventObject *eventObj) +{ + EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL)); + EventObjectTurn(eventObj, eventObj->movementDirection); + SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_ON_FOOT); +} + +static void PlayerAvatarTransition_MachBike(struct EventObject *eventObj) +{ + EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_MACH_BIKE)); + EventObjectTurn(eventObj, eventObj->movementDirection); + SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_MACH_BIKE); + BikeClearState(0, 0); +} + +static void PlayerAvatarTransition_AcroBike(struct EventObject *eventObj) +{ + EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_ACRO_BIKE)); + EventObjectTurn(eventObj, eventObj->movementDirection); + SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_ACRO_BIKE); + BikeClearState(0, 0); + Bike_HandleBumpySlopeJump(); +} + +static void PlayerAvatarTransition_Surfing(struct EventObject *eventObj) +{ + u8 spriteId; + + EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_SURFING)); + EventObjectTurn(eventObj, eventObj->movementDirection); + SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_SURFING); + gFieldEffectArguments[0] = eventObj->currentCoords.x; + gFieldEffectArguments[1] = eventObj->currentCoords.y; + gFieldEffectArguments[2] = gPlayerAvatar.eventObjectId; + spriteId = FieldEffectStart(FLDEFF_SURF_BLOB); + eventObj->fieldEffectSpriteId = spriteId; + sub_81555AC(spriteId, 1); +} + +static void PlayerAvatarTransition_Underwater(struct EventObject *eventObj) +{ + EventObjectSetGraphicsId(eventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_UNDERWATER)); + EventObjectTurn(eventObj, eventObj->movementDirection); + SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_UNDERWATER); + eventObj->fieldEffectSpriteId = sub_8155800(eventObj->spriteId); +} + +static void PlayerAvatarTransition_ReturnToField(struct EventObject *eventObj) +{ + gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_5; +} + +void sub_808B578(void) +{ + gPlayerAvatar.tileTransitionState = T_NOT_MOVING; + if (PlayerIsAnimActive()) + { + if (!PlayerCheckIfAnimFinishedOrInactive()) + { + if (!player_is_anim_in_certain_ranges()) + gPlayerAvatar.tileTransitionState = T_TILE_TRANSITION; + } + else + { + if (!sub_808B618()) + gPlayerAvatar.tileTransitionState = T_TILE_CENTER; + } + } +} + +static bool8 player_is_anim_in_certain_ranges(void) +{ + u8 movementActionId = gEventObjects[gPlayerAvatar.eventObjectId].movementActionId; + + if (movementActionId <= MOVEMENT_ACTION_FACE_RIGHT + || (movementActionId >= MOVEMENT_ACTION_DELAY_1 && movementActionId <= MOVEMENT_ACTION_DELAY_16) + || (movementActionId >= MOVEMENT_ACTION_WALK_IN_PLACE_SLOW_DOWN && movementActionId <= MOVEMENT_ACTION_WALK_IN_PLACE_FASTEST_RIGHT) + || (movementActionId >= MOVEMENT_ACTION_ACRO_WHEELIE_FACE_DOWN && movementActionId <= MOVEMENT_ACTION_ACRO_END_WHEELIE_FACE_RIGHT) + || (movementActionId >= MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_DOWN && movementActionId <= MOVEMENT_ACTION_ACRO_WHEELIE_IN_PLACE_RIGHT)) + return TRUE; + else + return FALSE; +} + +static bool8 sub_808B618(void) +{ + if (player_is_anim_in_certain_ranges() && gPlayerAvatar.runningState != TURN_DIRECTION) + return TRUE; + else + return FALSE; +} + +static bool8 PlayerIsAnimActive(void) +{ + return EventObjectIsMovementOverridden(&gEventObjects[gPlayerAvatar.eventObjectId]); +} + +static bool8 PlayerCheckIfAnimFinishedOrInactive(void) +{ + return EventObjectCheckHeldMovementStatus(&gEventObjects[gPlayerAvatar.eventObjectId]); +} + +static void PlayerSetCopyableMovement(u8 a) +{ + gEventObjects[gPlayerAvatar.eventObjectId].playerCopyableMovement = a; +} + +u8 PlayerGetCopyableMovement(void) +{ + return gEventObjects[gPlayerAvatar.eventObjectId].playerCopyableMovement; +} + +static void sub_808B6BC(u8 a) +{ + EventObjectForceSetHeldMovement(&gEventObjects[gPlayerAvatar.eventObjectId], a); +} + +void PlayerSetAnimId(u8 movementActionId, u8 copyableMovement) +{ + if (!PlayerIsAnimActive()) + { + PlayerSetCopyableMovement(copyableMovement); + EventObjectSetHeldMovement(&gEventObjects[gPlayerAvatar.eventObjectId], movementActionId); + } +} + +// normal speed (1 speed) +void PlayerGoSpeed1(u8 a) +{ + PlayerSetAnimId(GetWalkNormalMovementAction(a), 2); +} + +// fast speed (2 speed) +void PlayerGoSpeed2(u8 a) +{ + PlayerSetAnimId(GetWalkFastMovementAction(a), 2); +} + +void PlayerRideWaterCurrent(u8 a) +{ + PlayerSetAnimId(GetRideWaterCurrentMovementAction(a), 2); +} + +// fastest speed (4 speed) +void PlayerGoSpeed4(u8 a) +{ + PlayerSetAnimId(GetWalkFastestMovementAction(a), 2); +} + +void PlayerRun(u8 a) +{ + PlayerSetAnimId(GetPlayerRunMovementAction(a), 2); +} + +void PlayerOnBikeCollide(u8 a) +{ + PlayCollisionSoundIfNotFacingWarp(a); + PlayerSetAnimId(GetWalkInPlaceNormalMovementAction(a), 2); +} + +void PlayerOnBikeCollideWithFarawayIslandMew(u8 a) +{ + PlayerSetAnimId(GetWalkInPlaceNormalMovementAction(a), 2); +} + +void PlayerNotOnBikeCollide(u8 a) +{ + PlayCollisionSoundIfNotFacingWarp(a); + PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(a), 2); +} + +void PlayerNotOnBikeCollideWithFarawayIslandMew(u8 a) +{ + PlayerSetAnimId(GetWalkInPlaceSlowMovementAction(a), 2); +} + +void PlayerFaceDirection(u8 direction) +{ + PlayerSetAnimId(GetFaceDirectionMovementAction(direction), 1); +} + +void PlayerTurnInPlace(u8 direction) +{ + PlayerSetAnimId(GetWalkInPlaceFastMovementAction(direction), 1); +} + +void PlayerJumpLedge(u8 direction) +{ + PlaySE(SE_DANSA); + PlayerSetAnimId(GetJump2MovementAction(direction), 8); +} + +void sub_808B864(void) +{ + if (gPlayerAvatar.tileTransitionState == T_TILE_CENTER || gPlayerAvatar.tileTransitionState == T_NOT_MOVING) + { + if (player_should_look_direction_be_enforced_upon_movement()) + sub_808B6BC(GetFaceDirectionMovementAction(gEventObjects[gPlayerAvatar.eventObjectId].facingDirection)); + } +} + +// wheelie idle +void PlayerIdleWheelie(u8 direction) +{ + PlayerSetAnimId(GetAcroWheelieFaceDirectionMovementAction(direction), 1); +} + +// normal to wheelie +void PlayerStartWheelie(u8 direction) +{ + PlayerSetAnimId(GetAcroPopWheelieFaceDirectionMovementAction(direction), 1); +} + +// wheelie to normal +void PlayerEndWheelie(u8 direction) +{ + PlayerSetAnimId(GetAcroEndWheelieFaceDirectionMovementAction(direction), 1); +} + +// wheelie hopping standing +void PlayerStandingHoppingWheelie(u8 a) +{ + PlaySE(SE_JITE_PYOKO); + PlayerSetAnimId(GetAcroWheelieHopFaceDirectionMovementAction(a), 1); +} + +// wheelie hopping moving +void PlayerMovingHoppingWheelie(u8 a) +{ + PlaySE(SE_JITE_PYOKO); + PlayerSetAnimId(GetAcroWheelieHopDirectionMovementAction(a), 2); +} + +// wheelie hopping ledge +void PlayerLedgeHoppingWheelie(u8 a) +{ + PlaySE(SE_JITE_PYOKO); + PlayerSetAnimId(GetAcroWheelieJumpDirectionMovementAction(a), 8); +} + +// acro turn jump +void PlayerAcroTurnJump(u8 direction) +{ + PlaySE(SE_JITE_PYOKO); + PlayerSetAnimId(GetJumpInPlaceTurnAroundMovementAction(direction), 1); +} + +void sub_808B980(u8 direction) +{ + PlaySE(SE_WALL_HIT); + PlayerSetAnimId(GetAcroWheelieInPlaceDirectionMovementAction(direction), 2); +} + +void sub_808B9A4(u8 direction) +{ + PlayerSetAnimId(GetAcroPopWheelieMoveDirectionMovementAction(direction), 2); +} + +void sub_808B9BC(u8 direction) +{ + PlayerSetAnimId(GetAcroWheelieMoveDirectionMovementAction(direction), 2); +} + +void sub_808B9D4(u8 direction) +{ + PlayerSetAnimId(GetAcroEndWheelieMoveDirectionMovementAction(direction), 2); +} + +static void PlayCollisionSoundIfNotFacingWarp(u8 a) +{ + s16 x, y; + u8 metatileBehavior = gEventObjects[gPlayerAvatar.eventObjectId].currentMetatileBehavior; + + if (!sArrowWarpMetatileBehaviorChecks[a - 1](metatileBehavior)) + { + if (a == 2) + { + PlayerGetDestCoords(&x, &y); + MoveCoords(2, &x, &y); + if (MetatileBehavior_IsWarpDoor(MapGridGetMetatileBehaviorAt(x, y))) + return; + } + PlaySE(SE_WALL_HIT); + } +} + +void GetXYCoordsOneStepInFrontOfPlayer(s16 *x, s16 *y) +{ + *x = gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x; + *y = gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y; + MoveCoords(GetPlayerFacingDirection(), x, y); +} + +void PlayerGetDestCoords(s16 *x, s16 *y) +{ + *x = gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.x; + *y = gEventObjects[gPlayerAvatar.eventObjectId].currentCoords.y; +} + +u8 player_get_pos_including_state_based_drift(s16 *x, s16 *y) +{ + struct EventObject *object = &gEventObjects[gPlayerAvatar.eventObjectId]; + + if (object->heldMovementActive && !object->heldMovementFinished && !gSprites[object->spriteId].data[2]) + { + *x = object->currentCoords.x; + *y = object->currentCoords.y; + + switch (object->movementActionId) + { + case MOVEMENT_ACTION_WALK_NORMAL_DOWN: + case MOVEMENT_ACTION_PLAYER_RUN_DOWN: + (*y)++; + return TRUE; + case MOVEMENT_ACTION_WALK_NORMAL_UP: + case MOVEMENT_ACTION_PLAYER_RUN_UP: + (*y)--; + return TRUE; + case MOVEMENT_ACTION_WALK_NORMAL_LEFT: + case MOVEMENT_ACTION_PLAYER_RUN_LEFT: + (*x)--; + return TRUE; + case MOVEMENT_ACTION_WALK_NORMAL_RIGHT: + case MOVEMENT_ACTION_PLAYER_RUN_RIGHT: + (*x)++; + return TRUE; + } + } + + *x = -1; + *y = -1; + return FALSE; +} + +u8 GetPlayerFacingDirection(void) +{ + return gEventObjects[gPlayerAvatar.eventObjectId].facingDirection; +} + +u8 GetPlayerMovementDirection(void) +{ + return gEventObjects[gPlayerAvatar.eventObjectId].movementDirection; +} + +u8 PlayerGetZCoord(void) +{ + return gEventObjects[gPlayerAvatar.eventObjectId].previousElevation; +} + +void sub_808BC90(s16 a, s16 b) +{ + sub_808EB08(&gEventObjects[gPlayerAvatar.eventObjectId], a, b); +} + +u8 TestPlayerAvatarFlags(u8 a) +{ + return gPlayerAvatar.flags & a; +} + +u8 sub_808BCD0(void) +{ + return gPlayerAvatar.flags; +} + +u8 GetPlayerAvatarObjectId(void) +{ + return gPlayerAvatar.spriteId; +} + +void sub_808BCE8(void) +{ + ForcedMovement_None(); +} + +void sub_808BCF4(void) +{ + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + npc_clear_strange_bits(playerEventObj); + SetEventObjectDirection(playerEventObj, playerEventObj->facingDirection); + if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE)) + { + Bike_HandleBumpySlopeJump(); + Bike_UpdateBikeCounterSpeed(0); + } +} + +u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8 state, u8 gender) +{ + return sRivalAvatarGfxIds[state][gender]; +} + +u8 GetPlayerAvatarGraphicsIdByStateIdAndGender(u8 state, u8 gender) +{ + return sPlayerAvatarGfxIds[state][gender]; +} + +u8 GetFRLGAvatarGraphicsIdByGender(u8 gender) +{ + return sFRLGAvatarGfxIds[gender]; +} + +u8 GetRSAvatarGraphicsIdByGender(u8 gender) +{ + return sRSAvatarGfxIds[gender]; +} + +u8 GetPlayerAvatarGraphicsIdByStateId(u8 state) +{ + return GetPlayerAvatarGraphicsIdByStateIdAndGender(state, gPlayerAvatar.gender); +} + +u8 unref_GetRivalAvatarGenderByGraphicsId(u8 gfxId) +{ + switch (gfxId) + { + case EVENT_OBJ_GFX_RIVAL_MAY_NORMAL: + case EVENT_OBJ_GFX_RIVAL_MAY_MACH_BIKE: + case EVENT_OBJ_GFX_RIVAL_MAY_ACRO_BIKE: + case EVENT_OBJ_GFX_RIVAL_MAY_SURFING: + case EVENT_OBJ_GFX_RIVAL_MAY_FIELD_MOVE: + case EVENT_OBJ_GFX_MAY_UNDERWATER: + case EVENT_OBJ_GFX_MAY_FISHING: + case EVENT_OBJ_GFX_MAY_WATERING: + return FEMALE; + default: + return MALE; + } +} + +u8 GetPlayerAvatarGenderByGraphicsId(u8 gfxId) +{ + switch (gfxId) + { + case EVENT_OBJ_GFX_MAY_NORMAL: + case EVENT_OBJ_GFX_MAY_MACH_BIKE: + case EVENT_OBJ_GFX_MAY_ACRO_BIKE: + case EVENT_OBJ_GFX_MAY_SURFING: + case EVENT_OBJ_GFX_MAY_FIELD_MOVE: + case EVENT_OBJ_GFX_MAY_UNDERWATER: + case EVENT_OBJ_GFX_MAY_FISHING: + case EVENT_OBJ_GFX_MAY_WATERING: + return FEMALE; + default: + return MALE; + } +} + +bool8 PartyHasMonWithSurf(void) +{ + u8 i; + + if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) + { + for (i = 0; i < 6; i++) + { + if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE) + break; + if (pokemon_has_move(&gPlayerParty[i], MOVE_SURF)) + return TRUE; + } + } + return FALSE; +} + +bool8 IsPlayerSurfingNorth(void) +{ + if (GetPlayerMovementDirection() == DIR_NORTH && TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) + return TRUE; + else + return FALSE; +} + +bool8 IsPlayerFacingSurfableFishableWater(void) +{ + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + s16 x = playerEventObj->currentCoords.x; + s16 y = playerEventObj->currentCoords.y; + + MoveCoords(playerEventObj->facingDirection, &x, &y); + if (GetCollisionAtCoords(playerEventObj, x, y, playerEventObj->facingDirection) == 3 && PlayerGetZCoord() == 3 + && MetatileBehavior_IsSurfableFishableWater(MapGridGetMetatileBehaviorAt(x, y))) + return TRUE; + else + return FALSE; +} + +void ClearPlayerAvatarInfo(void) +{ + memset(&gPlayerAvatar, 0, sizeof(struct PlayerAvatar)); +} + +void SetPlayerAvatarStateMask(u8 flags) +{ + gPlayerAvatar.flags &= (PLAYER_AVATAR_FLAG_DASH | PLAYER_AVATAR_FLAG_6 | PLAYER_AVATAR_FLAG_5); + gPlayerAvatar.flags |= flags; +} + +static u8 GetPlayerAvatarStateTransitionByGraphicsId(u8 a, u8 gender) +{ + u8 i; + + for (i = 0; i < 5; i++) + { + if (gUnknown_0849750C[gender][i][0] == a) + return gUnknown_0849750C[gender][i][1]; + } + return 1; +} + +u8 GetPlayerAvatarGraphicsIdByCurrentState(void) +{ + u8 i; + u8 r5 = gPlayerAvatar.flags; + + for (i = 0; i < 5; i++) + { + if (gUnknown_0849750C[gPlayerAvatar.gender][i][1] & r5) + return gUnknown_0849750C[gPlayerAvatar.gender][i][0]; + } + return 0; +} + +void SetPlayerAvatarExtraStateTransition(u8 a, u8 b) +{ + u8 unk = GetPlayerAvatarStateTransitionByGraphicsId(a, gPlayerAvatar.gender); + + gPlayerAvatar.unk1 |= unk | b; + DoPlayerAvatarTransition(); +} + +void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender) +{ + struct EventObjectTemplate playerEventObjTemplate; + u8 eventObjectId; + struct EventObject *eventObject; + + playerEventObjTemplate.localId = 0xFF; + playerEventObjTemplate.graphicsId = GetPlayerAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, gender); + playerEventObjTemplate.x = x - 7; + playerEventObjTemplate.y = y - 7; + playerEventObjTemplate.elevation = 0; + playerEventObjTemplate.movementType = MOVEMENT_TYPE_PLAYER; + playerEventObjTemplate.movementRangeX = 0; + playerEventObjTemplate.movementRangeY = 0; + playerEventObjTemplate.trainerType = 0; + playerEventObjTemplate.trainerRange_berryTreeId = 0; + playerEventObjTemplate.script = NULL; + playerEventObjTemplate.flagId = 0; + eventObjectId = SpawnSpecialEventObject(&playerEventObjTemplate); + eventObject = &gEventObjects[eventObjectId]; + eventObject->isPlayer = 1; + eventObject->warpArrowSpriteId = CreateWarpArrowSprite(); + EventObjectTurn(eventObject, direction); + ClearPlayerAvatarInfo(); + gPlayerAvatar.runningState = NOT_MOVING; + gPlayerAvatar.tileTransitionState = T_NOT_MOVING; + gPlayerAvatar.eventObjectId = eventObjectId; + gPlayerAvatar.spriteId = eventObject->spriteId; + gPlayerAvatar.gender = gender; + SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_5 | PLAYER_AVATAR_FLAG_ON_FOOT); +} + +void sub_808C0A8(u8 a) +{ + gEventObjects[gPlayerAvatar.eventObjectId].invisible = a; + if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) + gSprites[gEventObjects[gPlayerAvatar.eventObjectId].fieldEffectSpriteId].invisible = a; +} + +void sub_808C114(void) +{ + EventObjectSetGraphicsId(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_FIELD_MOVE)); + StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], 0); +} + +void sub_808C15C(u8 direction) +{ + EventObjectSetGraphicsId(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_FISHING)); + StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingDirectionAnimNum(direction)); +} + +void sub_808C1B4(u8 direction) +{ + EventObjectSetGraphicsId(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_ACRO_BIKE)); + StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetAcroWheelieDirectionAnimNum(direction)); + SeekSpriteAnim(&gSprites[gPlayerAvatar.spriteId], 1); +} + +void sub_808C228(u8 direction) +{ + EventObjectSetGraphicsId(&gEventObjects[gPlayerAvatar.eventObjectId], GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_WATERING)); + StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFaceDirectionAnimNum(direction)); +} + +static void sub_808C280(struct EventObject *eventObject) +{ + s16 x; + s16 y; + u8 direction; + u8 metatileBehavior = eventObject->currentMetatileBehavior; + + for (x = 0, direction = DIR_SOUTH; x < 4; x++, direction++) + { + if (sArrowWarpMetatileBehaviorChecks2[x](metatileBehavior) && direction == eventObject->movementDirection) + { + x = eventObject->currentCoords.x; + y = eventObject->currentCoords.y; + MoveCoords(direction, &x, &y); + ShowWarpArrowSprite(eventObject->warpArrowSpriteId, direction, x, y); + return; + } + } + SetSpriteInvisible(eventObject->warpArrowSpriteId); +} + +/* Strength */ + +static void Task_BumpBoulder(u8 taskId); + +static void StartStrengthAnim(u8 a, u8 b) +{ + u8 taskId = CreateTask(Task_BumpBoulder, 0xFF); + + gTasks[taskId].data[1] = a; + gTasks[taskId].data[2] = b; + Task_BumpBoulder(taskId); +} + +static void Task_BumpBoulder(u8 taskId) +{ + while (gUnknown_08497530[gTasks[taskId].data[0]](&gTasks[taskId], + &gEventObjects[gPlayerAvatar.eventObjectId], + &gEventObjects[gTasks[taskId].data[1]])) + ; +} + +static bool8 sub_808C3A4(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject) +{ + ScriptContext2_Enable(); + gPlayerAvatar.preventStep = TRUE; + task->data[0]++; + return FALSE; +} + +static bool8 do_boulder_dust(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject) +{ + if (EventObjectIsHeldMovementActive(playerObject)) + { + EventObjectClearHeldMovementIfFinished(playerObject); + } + + if (EventObjectIsHeldMovementActive(strengthObject)) + { + EventObjectClearHeldMovementIfFinished(strengthObject); + } + + if (!EventObjectIsMovementOverridden(playerObject) + && !EventObjectIsMovementOverridden(strengthObject)) + { + EventObjectClearHeldMovementIfFinished(playerObject); + EventObjectClearHeldMovementIfFinished(strengthObject); + EventObjectSetHeldMovement(playerObject, GetWalkInPlaceNormalMovementAction((u8)task->data[2])); + EventObjectSetHeldMovement(strengthObject, GetWalkSlowMovementAction((u8)task->data[2])); + gFieldEffectArguments[0] = strengthObject->currentCoords.x; + gFieldEffectArguments[1] = strengthObject->currentCoords.y; + gFieldEffectArguments[2] = strengthObject->previousElevation; + gFieldEffectArguments[3] = gSprites[strengthObject->spriteId].oam.priority; + FieldEffectStart(FLDEFF_DUST); + PlaySE(SE_W070); + task->data[0]++; + } + return FALSE; +} + +static bool8 sub_808C484(struct Task *task, struct EventObject *playerObject, struct EventObject *strengthObject) +{ + if (EventObjectCheckHeldMovementStatus(playerObject) + && EventObjectCheckHeldMovementStatus(strengthObject)) + { + EventObjectClearHeldMovementIfFinished(playerObject); + EventObjectClearHeldMovementIfFinished(strengthObject); + gPlayerAvatar.preventStep = FALSE; + ScriptContext2_Disable(); + DestroyTask(FindTaskIdByFunc(Task_BumpBoulder)); + } + return FALSE; +} + +/* Some field effect */ + +static void DoPlayerAvatarSecretBaseMatJump(u8 taskId); + +static void DoPlayerMatJump(void) +{ + DoPlayerAvatarSecretBaseMatJump(CreateTask(DoPlayerAvatarSecretBaseMatJump, 0xFF)); +} + +static void DoPlayerAvatarSecretBaseMatJump(u8 taskId) +{ + while (sPlayerAvatarSecretBaseMatJump[gTasks[taskId].data[0]](&gTasks[taskId], &gEventObjects[gPlayerAvatar.eventObjectId])) + ; +} + +// because data[0] is used to call this, it can be inferred that there may have been multiple mat jump functions at one point, so the name for these groups of functions is appropriate in assuming the sole use of mat jump. +static u8 PlayerAvatar_DoSecretBaseMatJump(struct Task *task, struct EventObject *eventObject) +{ + gPlayerAvatar.preventStep = TRUE; + if (EventObjectClearHeldMovementIfFinished(eventObject)) + { + PlaySE(SE_DANSA); + EventObjectSetHeldMovement(eventObject, GetJumpInPlaceMovementAction(eventObject->facingDirection)); + task->data[1]++; + if (task->data[1] > 1) + { + gPlayerAvatar.preventStep = FALSE; + gPlayerAvatar.unk1 |= 0x20; + DestroyTask(FindTaskIdByFunc(DoPlayerAvatarSecretBaseMatJump)); + } + } + return FALSE; +} + +/* Some field effect */ + +static void PlayerAvatar_DoSecretBaseMatSpin(u8 taskId); + +static void DoPlayerMatSpin(void) +{ + u8 taskId = CreateTask(PlayerAvatar_DoSecretBaseMatSpin, 0xFF); + + PlayerAvatar_DoSecretBaseMatSpin(taskId); +} + +static void PlayerAvatar_DoSecretBaseMatSpin(u8 taskId) +{ + while (sPlayerAvatarSecretBaseMatSpin[gTasks[taskId].data[0]](&gTasks[taskId], &gEventObjects[gPlayerAvatar.eventObjectId])) + ; +} + +static bool8 PlayerAvatar_SecretBaseMatSpinStep0(struct Task *task, struct EventObject *eventObject) +{ + task->data[0]++; + task->data[1] = eventObject->movementDirection; + gPlayerAvatar.preventStep = TRUE; + ScriptContext2_Enable(); + PlaySE(SE_TK_WARPIN); + return TRUE; +} + +static bool8 PlayerAvatar_SecretBaseMatSpinStep1(struct Task *task, struct EventObject *eventObject) +{ + u8 directions[] = {DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; + + if (EventObjectClearHeldMovementIfFinished(eventObject)) + { + u8 direction; + + EventObjectSetHeldMovement(eventObject, GetFaceDirectionMovementAction(direction = directions[eventObject->movementDirection - 1])); + if (direction == (u8)task->data[1]) + task->data[2]++; + task->data[0]++; + if (task->data[2] > 3 && direction == GetOppositeDirection(task->data[1])) + task->data[0]++; + } + return FALSE; +} + +static bool8 PlayerAvatar_SecretBaseMatSpinStep2(struct Task *task, struct EventObject *eventObject) +{ + const u8 actions[] = { + MOVEMENT_ACTION_DELAY_1, + MOVEMENT_ACTION_DELAY_1, + MOVEMENT_ACTION_DELAY_2, + MOVEMENT_ACTION_DELAY_4, + MOVEMENT_ACTION_DELAY_8, + }; + + if (EventObjectClearHeldMovementIfFinished(eventObject)) + { + EventObjectSetHeldMovement(eventObject, actions[task->data[2]]); + task->data[0] = 1; + } + return FALSE; +} + +static bool8 PlayerAvatar_SecretBaseMatSpinStep3(struct Task *task, struct EventObject *eventObject) +{ + if (EventObjectClearHeldMovementIfFinished(eventObject)) + { + EventObjectSetHeldMovement(eventObject, GetWalkSlowMovementAction(GetOppositeDirection(task->data[1]))); + ScriptContext2_Disable(); + gPlayerAvatar.preventStep = FALSE; + DestroyTask(FindTaskIdByFunc(PlayerAvatar_DoSecretBaseMatSpin)); + } + return FALSE; +} + +/* Some Field effect */ + +static void taskFF_0805D1D4(u8 taskId); +static void sub_808C814(u8 taskId); + +static void sub_808C750(u8 a) +{ + u8 taskId; + + ScriptContext2_Enable(); + Overworld_ClearSavedMusic(); + Overworld_ChangeMusicToDefault(); + gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_SURFING; + gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_ON_FOOT; + gPlayerAvatar.preventStep = TRUE; + taskId = CreateTask(taskFF_0805D1D4, 0xFF); + gTasks[taskId].data[0] = a; + taskFF_0805D1D4(taskId); +} + +static void taskFF_0805D1D4(u8 taskId) +{ + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + if (EventObjectIsMovementOverridden(playerEventObj)) + { + if (!EventObjectClearHeldMovementIfFinished(playerEventObj)) + return; + } + sub_81555AC(playerEventObj->fieldEffectSpriteId, 2); + EventObjectSetHeldMovement(playerEventObj, GetJumpSpecialMovementAction((u8)gTasks[taskId].data[0])); + gTasks[taskId].func = sub_808C814; +} + +static void sub_808C814(u8 taskId) +{ + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + if (EventObjectClearHeldMovementIfFinished(playerEventObj)) + { + EventObjectSetGraphicsId(playerEventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL)); + EventObjectSetHeldMovement(playerEventObj, GetFaceDirectionMovementAction(playerEventObj->facingDirection)); + gPlayerAvatar.preventStep = FALSE; + ScriptContext2_Disable(); + DestroySprite(&gSprites[playerEventObj->fieldEffectSpriteId]); + DestroyTask(taskId); + } +} + +static bool8 (*const sFishingStateFuncs[])(struct Task *) = +{ + Fishing1, + Fishing2, + Fishing3, + Fishing4, + Fishing5, + Fishing6, + Fishing7, + Fishing8, + Fishing9, + Fishing10, + Fishing11, + Fishing12, + Fishing13, + Fishing14, + Fishing15, + Fishing16, +}; + +static void Task_Fishing(u8 taskId); +static void sub_808CF78(void); + +#define tStep data[0] +#define tFrameCounter data[1] +#define tNumDots data[2] +#define tDotsRequired data[3] +#define tRoundsPlayed data[12] +#define tMinRoundsRequired data[13] +#define tPlayerGfxId data[14] +#define tFishingRod data[15] + +#define FISHING_START_ROUND 3 +#define FISHING_GOT_BITE 6 +#define FISHING_ON_HOOK 9 +#define FISHING_NO_BITE 11 +#define FISHING_GOT_AWAY 12 +#define FISHING_SHOW_RESULT 13 + +void StartFishing(u8 rod) +{ + u8 taskId = CreateTask(Task_Fishing, 0xFF); + + gTasks[taskId].tFishingRod = rod; + Task_Fishing(taskId); +} + +static void Task_Fishing(u8 taskId) +{ + while (sFishingStateFuncs[gTasks[taskId].tStep](&gTasks[taskId])) + ; +} + +static bool8 Fishing1(struct Task *task) +{ + ScriptContext2_Enable(); + gPlayerAvatar.preventStep = TRUE; + task->tStep++; + return FALSE; +} + +static bool8 Fishing2(struct Task *task) +{ + struct EventObject *playerEventObj; + const s16 arr1[] = {1, 1, 1}; + const s16 arr2[] = {1, 3, 6}; + + task->tRoundsPlayed = 0; + task->tMinRoundsRequired = arr1[task->tFishingRod] + (Random() % arr2[task->tFishingRod]); + task->tPlayerGfxId = gEventObjects[gPlayerAvatar.eventObjectId].graphicsId; + playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + EventObjectClearHeldMovementIfActive(playerEventObj); + playerEventObj->enableAnim = 1; + sub_808C15C(playerEventObj->facingDirection); + task->tStep++; + return FALSE; +} + +static bool8 Fishing3(struct Task *task) +{ + sub_808CF78(); + + // Wait one second + task->tFrameCounter++; + if (task->tFrameCounter >= 60) + task->tStep++; + return FALSE; +} + +static bool8 Fishing4(struct Task *task) +{ + u32 randVal; + + sub_819786C(0, TRUE); + task->tStep++; + task->tFrameCounter = 0; + task->tNumDots = 0; + randVal = Random(); + randVal %= 10; + task->tDotsRequired = randVal + 1; + if (task->tRoundsPlayed == 0) + task->tDotsRequired = randVal + 4; + if (task->tDotsRequired >= 10) + task->tDotsRequired = 10; + return TRUE; +} + +// Play a round of the dot game +static bool8 Fishing5(struct Task *task) +{ + const u8 dot[] = _("·"); + + sub_808CF78(); + task->tFrameCounter++; + if (gMain.newKeys & A_BUTTON) + { + task->tStep = FISHING_NO_BITE; + if (task->tRoundsPlayed != 0) + task->tStep = FISHING_GOT_AWAY; + return TRUE; + } + else + { + if (task->tFrameCounter >= 20) + { + task->tFrameCounter = 0; + if (task->tNumDots >= task->tDotsRequired) + { + task->tStep++; + if (task->tRoundsPlayed != 0) + task->tStep++; + task->tRoundsPlayed++; + } + else + { + AddTextPrinterParameterized(0, 1, dot, task->tNumDots * 8, 1, 0, NULL); + task->tNumDots++; + } + } + return FALSE; + } +} + +// Determine if fish bites +static bool8 Fishing6(struct Task *task) +{ + bool8 bite; + + sub_808CF78(); + task->tStep++; + bite = FALSE; + + if (!DoesCurrentMapHaveFishingMons()) + { + task->tStep = FISHING_NO_BITE; + } + else + { + if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_BIT3)) + { + u8 ability = GetMonAbility(&gPlayerParty[0]); + if (ability == ABILITY_SUCTION_CUPS || ability == ABILITY_STICKY_HOLD) + { + if (Random() % 100 > 14) + { + bite = TRUE; + } + } + } + + if (!bite) + { + if (Random() & 1) + { + task->tStep = FISHING_NO_BITE; + } + else + { + bite = TRUE; + } + } + + if (bite == TRUE) + { + StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingBiteDirectionAnimNum(GetPlayerFacingDirection())); + } + } + return TRUE; +} + +// Oh! A Bite! +static bool8 Fishing7(struct Task *task) +{ + sub_808CF78(); + AddTextPrinterParameterized(0, 1, gText_OhABite, 0, 17, 0, NULL); + task->tStep++; + task->tFrameCounter = 0; + return FALSE; +} + +// We have a bite. Now, wait for the player to press A, or the timer to expire. +static bool8 Fishing8(struct Task *task) +{ + const s16 reelTimeouts[3] = {36, 33, 30}; + + sub_808CF78(); + task->tFrameCounter++; + if (task->tFrameCounter >= reelTimeouts[task->tFishingRod]) + task->tStep = FISHING_GOT_AWAY; + else if (gMain.newKeys & A_BUTTON) + task->tStep++; + return FALSE; +} + +// Determine if we're going to play the dot game again +static bool8 Fishing9(struct Task *task) +{ + const s16 arr[][2] = + { + {0, 0}, + {40, 10}, + {70, 30} + }; + + sub_808CF78(); + task->tStep++; + if (task->tRoundsPlayed < task->tMinRoundsRequired) + { + task->tStep = FISHING_START_ROUND; + } + else if (task->tRoundsPlayed < 2) + { + // probability of having to play another round + s16 probability = Random() % 100; + + if (arr[task->tFishingRod][task->tRoundsPlayed] > probability) + task->tStep = FISHING_START_ROUND; + } + return FALSE; +} + +static bool8 Fishing10(struct Task *task) +{ + sub_808CF78(); + FillWindowPixelBuffer(0, 0x11); + AddTextPrinterParameterized2(0, 1, gText_PokemonOnHook, 1, 0, 2, 1, 3); + task->tStep++; + task->tFrameCounter = 0; + return FALSE; +} + +static bool8 Fishing11(struct Task *task) +{ + if (task->tFrameCounter == 0) + sub_808CF78(); + + RunTextPrinters(); + + if (task->tFrameCounter == 0) + { + if (!IsTextPrinterActive(0)) + { + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + EventObjectSetGraphicsId(playerEventObj, task->tPlayerGfxId); + EventObjectTurn(playerEventObj, playerEventObj->movementDirection); + if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) + sub_8155604(gEventObjects[gPlayerAvatar.eventObjectId].fieldEffectSpriteId, 0, 0); + gSprites[gPlayerAvatar.spriteId].pos2.x = 0; + gSprites[gPlayerAvatar.spriteId].pos2.y = 0; + sub_8197434(0, TRUE); + task->tFrameCounter++; + return FALSE; + } + } + + if (task->tFrameCounter != 0) + { + gPlayerAvatar.preventStep = FALSE; + ScriptContext2_Disable(); + FishingWildEncounter(task->tFishingRod); + sub_80ED950(1); + DestroyTask(FindTaskIdByFunc(Task_Fishing)); + } + return FALSE; +} + +// Not even a nibble +static bool8 Fishing12(struct Task *task) +{ + sub_808CF78(); + StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingNoCatchDirectionAnimNum(GetPlayerFacingDirection())); + FillWindowPixelBuffer(0, 0x11); + AddTextPrinterParameterized2(0, 1, gText_NotEvenANibble, 1, 0, 2, 1, 3); + task->tStep = FISHING_SHOW_RESULT; + return TRUE; +} + +// It got away +static bool8 Fishing13(struct Task *task) +{ + sub_808CF78(); + StartSpriteAnim(&gSprites[gPlayerAvatar.spriteId], GetFishingNoCatchDirectionAnimNum(GetPlayerFacingDirection())); + FillWindowPixelBuffer(0, 0x11); + AddTextPrinterParameterized2(0, 1, gText_ItGotAway, 1, 0, 2, 1, 3); + task->tStep++; + return TRUE; +} + +// Wait one second +static bool8 Fishing14(struct Task *task) +{ + sub_808CF78(); + task->tStep++; + return FALSE; +} + +static bool8 Fishing15(struct Task *task) +{ + sub_808CF78(); + if (gSprites[gPlayerAvatar.spriteId].animEnded) + { + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + EventObjectSetGraphicsId(playerEventObj, task->tPlayerGfxId); + EventObjectTurn(playerEventObj, playerEventObj->movementDirection); + if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) + sub_8155604(gEventObjects[gPlayerAvatar.eventObjectId].fieldEffectSpriteId, 0, 0); + gSprites[gPlayerAvatar.spriteId].pos2.x = 0; + gSprites[gPlayerAvatar.spriteId].pos2.y = 0; + task->tStep++; + } + return FALSE; +} + +static bool8 Fishing16(struct Task *task) +{ + RunTextPrinters(); + if (!IsTextPrinterActive(0)) + { + gPlayerAvatar.preventStep = FALSE; + ScriptContext2_Disable(); + UnfreezeEventObjects(); + sub_8197434(0, TRUE); + sub_80ED950(0); + DestroyTask(FindTaskIdByFunc(Task_Fishing)); + } + return FALSE; +} + +#undef tStep +#undef tFrameCounter +#undef tFishingRod + +static void sub_808CF78(void) +{ + struct Sprite *playerSprite = &gSprites[gPlayerAvatar.spriteId]; + u8 animCmdIndex; + u8 animType; + + AnimateSprite(playerSprite); + playerSprite->pos2.x = 0; + playerSprite->pos2.y = 0; + animCmdIndex = playerSprite->animCmdIndex; + if (playerSprite->anims[playerSprite->animNum][animCmdIndex].type == -1) + { + animCmdIndex--; + } + else + { + playerSprite->animDelayCounter++; + if (playerSprite->anims[playerSprite->animNum][animCmdIndex].type == -1) + animCmdIndex--; + } + animType = playerSprite->anims[playerSprite->animNum][animCmdIndex].type; + if (animType == 1 || animType == 2 || animType == 3) + { + playerSprite->pos2.x = 8; + if (GetPlayerFacingDirection() == 3) + playerSprite->pos2.x = -8; + } + if (animType == 5) + playerSprite->pos2.y = -8; + if (animType == 10 || animType == 11) + playerSprite->pos2.y = 8; + if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) + sub_8155604(gEventObjects[gPlayerAvatar.eventObjectId].fieldEffectSpriteId, 1, playerSprite->pos2.y); +} + +void sub_808D074(u8 a0) +{ + gUnknown_0203734C = a0; +} + +static u8 sub_808D080(void) +{ + if (gUnknown_0203734C == 0) + { + return 1; + } + return gUnknown_0203734C; +} + +static u8 sub_808D38C(struct EventObject *object, s16 *a1); + +static void sub_808D094(u8 taskId) +{ + struct EventObject *object = &gEventObjects[gPlayerAvatar.eventObjectId]; + struct Sprite *sprite = &gSprites[object->spriteId]; + s16 *data = gTasks[taskId].data; + + switch (data[0]) + { + case 0: + if (!EventObjectClearHeldMovementIfFinished(object)) + { + return; + } + + sub_808D074(object->facingDirection); + data[1] = 0; + data[2] = 1; + data[3] = (u16)(sprite->pos1.y + sprite->pos2.y) * 16; + sprite->pos2.y = 0; + CameraObjectReset2(); + object->fixedPriority = TRUE; + sprite->oam.priority = 0; + sprite->subpriority = 0; + sprite->subspriteMode = 0; + data[0]++; + case 1: + sub_808D38C(object, &data[1]); + data[3] -= data[2]; + data[2] += 3; + sprite->pos1.y = data[3] >> 4; + if (sprite->pos1.y + (s16)gUnknown_03005DE8 < -32) + { + data[0]++; + } + break; + case 2: + DestroyTask(taskId); + break; + } +} + +static void sub_808D1FC(u8 taskId); + +void sub_808D194(void) +{ + sub_808D1FC(CreateTask(sub_808D1FC, 0)); +} + +bool8 sub_808D1B4(void) +{ + return FuncIsActiveTask(sub_808D1FC); +} + +void sub_808D1C8(void) +{ + sub_808D094(CreateTask(sub_808D094, 0)); +} + +bool8 sub_808D1E8(void) +{ + return FuncIsActiveTask(sub_808D094); +} + +static const u8 gUnknown_084975BC[] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH}; + +static void sub_808D1FC(u8 taskId) +{ + struct EventObject *object = &gEventObjects[gPlayerAvatar.eventObjectId]; + struct Sprite *sprite = &gSprites[object->spriteId]; + s16 *data = gTasks[taskId].data; + + switch (data[0]) + { + case 0: + data[5] = sub_808D080(); + EventObjectForceSetHeldMovement(object, GetFaceDirectionMovementAction(gUnknown_084975BC[data[5]])); + data[1] = 0; + data[2] = 116; + data[4] = sprite->pos1.y; + data[6] = sprite->oam.priority; + data[7] = sprite->subpriority; + data[3] = -((u16)sprite->pos2.y + 32) * 16; + sprite->pos2.y = 0; + CameraObjectReset2(); + object->fixedPriority = TRUE; + sprite->oam.priority = 1; + sprite->subpriority = 0; + sprite->subspriteMode = 0; + data[0]++; + case 1: + sub_808D38C(object, &data[1]); + data[3] += data[2]; + data[2] -= 3; + if (data[2] < 4) + { + data[2] = 4; + } + sprite->pos1.y = data[3] >> 4; + if (sprite->pos1.y >= data[4]) + { + sprite->pos1.y = data[4]; + data[8] = 0; + data[0]++; + } + break; + case 2: + sub_808D38C(object, &data[1]); + data[8]++; + if (data[8] > 8) + { + data[0]++; + } + break; + case 3: + if (data[5] == sub_808D38C(object, &data[1])) + { + object->fixedPriority = 0; + sprite->oam.priority = data[6]; + sprite->subpriority = data[7]; + CameraObjectReset1(); + DestroyTask(taskId); + } + break; + } +} + +static u8 sub_808D38C(struct EventObject *object, s16 *a1) +{ + if (*a1 < 8 && ++(*a1) < 8) + { + return object->facingDirection; + } + + if (!EventObjectCheckHeldMovementStatus(object)) + { + return object->facingDirection; + } + + EventObjectForceSetHeldMovement(object, GetFaceDirectionMovementAction(gUnknown_084975BC[object->facingDirection])); + *a1 = 0; + return gUnknown_084975BC[object->facingDirection]; +} diff --git a/src/item_use.c b/src/item_use.c index 633d975a8..2a1c7883c 100755 --- a/src/item_use.c +++ b/src/item_use.c @@ -260,7 +260,7 @@ bool32 CanFish(void) if (MetatileBehavior_IsWaterfall(tileBehavior)) return FALSE; - if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4)) + if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_UNDERWATER)) return FALSE; if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) diff --git a/src/overworld.c b/src/overworld.c index 94c3f8328..8d73a6680 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -166,8 +166,8 @@ extern u32 sub_800B4DC(void); extern bool32 sub_80B39D4(u8); extern const u8* GetInteractedLinkPlayerScript(struct MapPosition *a1, u8, u8); extern u8 *GetCoordEventScriptAtMapPosition(void*); -extern u8 sub_808BD6C(u8); -extern u8 sub_808BD7C(u8); +extern u8 GetFRLGAvatarGraphicsIdByGender(u8); +extern u8 GetRSAvatarGraphicsIdByGender(u8); extern void UpdateEventObjectSpriteVisibility(struct Sprite*, u8); // this file's functions @@ -919,7 +919,7 @@ void StoreInitialPlayerAvatarState(void) gInitialPlayerAvatarState.transitionFlags = 4; else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) gInitialPlayerAvatarState.transitionFlags = 8; - else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_4)) + else if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_UNDERWATER)) gInitialPlayerAvatarState.transitionFlags = 16; else gInitialPlayerAvatarState.transitionFlags = 1; @@ -3137,11 +3137,11 @@ static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion) { case VERSION_FIRE_RED: case VERSION_LEAF_GREEN: - eventObj->spriteId = AddPseudoEventObject(sub_808BD6C(eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0); + eventObj->spriteId = AddPseudoEventObject(GetFRLGAvatarGraphicsIdByGender(eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0); break; case VERSION_RUBY: case VERSION_SAPPHIRE: - eventObj->spriteId = AddPseudoEventObject(sub_808BD7C(eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0); + eventObj->spriteId = AddPseudoEventObject(GetRSAvatarGraphicsIdByGender(eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0); break; case VERSION_EMERALD: eventObj->spriteId = AddPseudoEventObject(GetRivalAvatarGraphicsIdByStateIdAndGender(0, eventObj->singleMovementActive), SpriteCB_LinkPlayer, 0, 0, 0); diff --git a/sym_ewram.txt b/sym_ewram.txt index db4f7935f..415d3882f 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -209,23 +209,7 @@ gUnknown_020322D5: @ 20322D5 .include "src/overworld.o" .include "src/fieldmap.o" .include "src/field_camera.o" - - .align 2 -gUnknown_0203734C: @ 203734C - .space 0x4 - -gEventObjects: @ 2037350 - .space 0x240 - -gPlayerAvatar: @ 2037590 - .space 0x14 - -gUnknown_020375A4: @ 20375A4 - .space 0x8 - -gUnknown_020375AC: @ 20375AC - .space 0x8 - + .include "src/field_player_avatar.o" .include "src/event_object_movement.o" .include "src/field_message_box.o"