From e3a82bd2c51054511da14e325cea104512e8a4ea Mon Sep 17 00:00:00 2001 From: MCboy Date: Thu, 19 Jul 2018 21:18:09 +0430 Subject: decompile player_field_avatar.s --- src/player_field_effect.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/player_field_effect.c (limited to 'src') diff --git a/src/player_field_effect.c b/src/player_field_effect.c new file mode 100644 index 000000000..b0d703e25 --- /dev/null +++ b/src/player_field_effect.c @@ -0,0 +1,46 @@ +#include "global.h" +#include "global.fieldmap.h" +#include "sprite.h" +#include "event_object_movement.h" +#include "bike.h" + +static u8 EventObjectCB2_NoMovement2(); +void sub_808C280(struct EventObject *); //struct EventObject *playerEventObj +bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8); +void npc_clear_strange_bits(struct EventObject *); +void DoPlayerAvatarTransition(void); +bool8 TryDoMetatileBehaviorForcedMovement(); +void MovePlayerAvatarUsingKeypadInput(u8, u16, u16); +void PlayerAllowForcedMovementIfMovingSameDirection(); + +void MovementType_Player(struct Sprite *sprite) +{ + // ((Sprite->data[0] << 3) + Sprite->data[0]) << 2 + UpdateEventObjectCurrentMovement(&gEventObjects[sprite->data[0]], sprite, EventObjectCB2_NoMovement2); +} + +static u8 EventObjectCB2_NoMovement2() +{ + return 0; +} + +void player_step(u8 direction, u16 newKeys, u16 heldKeys) +{ + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + sub_808C280(playerEventObj); + if (gPlayerAvatar.preventStep == FALSE) + { + Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys); + if (TryInterruptEventObjectSpecialAnim(playerEventObj, direction) == 0) + { + npc_clear_strange_bits(playerEventObj); + DoPlayerAvatarTransition(); + if (TryDoMetatileBehaviorForcedMovement() == 0) + { + MovePlayerAvatarUsingKeypadInput(direction, newKeys, heldKeys); + PlayerAllowForcedMovementIfMovingSameDirection(); + } + } + } +} -- cgit v1.2.3 From a8f9adeaf54c855f4afdd23257df75f6270733fb Mon Sep 17 00:00:00 2001 From: MCboy Date: Thu, 19 Jul 2018 21:22:35 +0430 Subject: decompile player_field_avatar --- src/field_player_avatar.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/field_player_avatar.c (limited to 'src') diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c new file mode 100644 index 000000000..b0d703e25 --- /dev/null +++ b/src/field_player_avatar.c @@ -0,0 +1,46 @@ +#include "global.h" +#include "global.fieldmap.h" +#include "sprite.h" +#include "event_object_movement.h" +#include "bike.h" + +static u8 EventObjectCB2_NoMovement2(); +void sub_808C280(struct EventObject *); //struct EventObject *playerEventObj +bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8); +void npc_clear_strange_bits(struct EventObject *); +void DoPlayerAvatarTransition(void); +bool8 TryDoMetatileBehaviorForcedMovement(); +void MovePlayerAvatarUsingKeypadInput(u8, u16, u16); +void PlayerAllowForcedMovementIfMovingSameDirection(); + +void MovementType_Player(struct Sprite *sprite) +{ + // ((Sprite->data[0] << 3) + Sprite->data[0]) << 2 + UpdateEventObjectCurrentMovement(&gEventObjects[sprite->data[0]], sprite, EventObjectCB2_NoMovement2); +} + +static u8 EventObjectCB2_NoMovement2() +{ + return 0; +} + +void player_step(u8 direction, u16 newKeys, u16 heldKeys) +{ + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + sub_808C280(playerEventObj); + if (gPlayerAvatar.preventStep == FALSE) + { + Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys); + if (TryInterruptEventObjectSpecialAnim(playerEventObj, direction) == 0) + { + npc_clear_strange_bits(playerEventObj); + DoPlayerAvatarTransition(); + if (TryDoMetatileBehaviorForcedMovement() == 0) + { + MovePlayerAvatarUsingKeypadInput(direction, newKeys, heldKeys); + PlayerAllowForcedMovementIfMovingSameDirection(); + } + } + } +} -- cgit v1.2.3 From 416db8e75106d6d7355e706904922a4248708de5 Mon Sep 17 00:00:00 2001 From: MCboy Date: Thu, 19 Jul 2018 21:23:45 +0430 Subject: oops --- src/player_field_effect.c | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 src/player_field_effect.c (limited to 'src') diff --git a/src/player_field_effect.c b/src/player_field_effect.c deleted file mode 100644 index b0d703e25..000000000 --- a/src/player_field_effect.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "global.h" -#include "global.fieldmap.h" -#include "sprite.h" -#include "event_object_movement.h" -#include "bike.h" - -static u8 EventObjectCB2_NoMovement2(); -void sub_808C280(struct EventObject *); //struct EventObject *playerEventObj -bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8); -void npc_clear_strange_bits(struct EventObject *); -void DoPlayerAvatarTransition(void); -bool8 TryDoMetatileBehaviorForcedMovement(); -void MovePlayerAvatarUsingKeypadInput(u8, u16, u16); -void PlayerAllowForcedMovementIfMovingSameDirection(); - -void MovementType_Player(struct Sprite *sprite) -{ - // ((Sprite->data[0] << 3) + Sprite->data[0]) << 2 - UpdateEventObjectCurrentMovement(&gEventObjects[sprite->data[0]], sprite, EventObjectCB2_NoMovement2); -} - -static u8 EventObjectCB2_NoMovement2() -{ - return 0; -} - -void player_step(u8 direction, u16 newKeys, u16 heldKeys) -{ - struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; - - sub_808C280(playerEventObj); - if (gPlayerAvatar.preventStep == FALSE) - { - Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys); - if (TryInterruptEventObjectSpecialAnim(playerEventObj, direction) == 0) - { - npc_clear_strange_bits(playerEventObj); - DoPlayerAvatarTransition(); - if (TryDoMetatileBehaviorForcedMovement() == 0) - { - MovePlayerAvatarUsingKeypadInput(direction, newKeys, heldKeys); - PlayerAllowForcedMovementIfMovingSameDirection(); - } - } - } -} -- cgit v1.2.3 From 43fa9da52a4a204d6e75640b17b2416648f1ddc0 Mon Sep 17 00:00:00 2001 From: MCboy Date: Fri, 20 Jul 2018 03:44:20 +0430 Subject: decompile more code 1 non matching need help --- src/field_player_avatar.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) (limited to 'src') diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index b0d703e25..191fc8aa4 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -8,10 +8,13 @@ static u8 EventObjectCB2_NoMovement2(); void sub_808C280(struct EventObject *); //struct EventObject *playerEventObj bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8); void npc_clear_strange_bits(struct EventObject *); +u8 EventObjectGetHeldMovementActionId(struct EventObject *); void DoPlayerAvatarTransition(void); bool8 TryDoMetatileBehaviorForcedMovement(); void MovePlayerAvatarUsingKeypadInput(u8, u16, u16); void PlayerAllowForcedMovementIfMovingSameDirection(); +void MovePlayerNotOnBike(u8 a, u16 b); +u8 sub_808B028(u8); void MovementType_Player(struct Sprite *sprite) { @@ -44,3 +47,81 @@ void player_step(u8 direction, u16 newKeys, u16 heldKeys) } } } + +NAKED +bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *eventObject, u8 direction) +{ + asm_unified("push {r4-r6,lr}\n\ + adds r4, r0, 0\n\ + lsls r1, 24\n\ + lsrs r5, r1, 24\n\ + adds r6, r5, 0\n\ + bl EventObjectIsMovementOverridden\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _0808AA92\n\ + adds r0, r4, 0\n\ + bl EventObjectClearHeldMovementIfFinished\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + bne _0808AA92\n\ + adds r0, r4, 0\n\ + bl EventObjectGetHeldMovementActionId\n\ + lsls r0, 24\n\ + movs r1, 0xE7\n\ + lsls r1, 24\n\ + adds r0, r1\n\ + lsrs r0, 24\n\ + cmp r0, 0x3\n\ + bhi _0808AA70\n\ + cmp r5, 0\n\ + bne _0808AA74\n\ +_0808AA70:\n\ + movs r0, 0x1\n\ + b _0808AA94\n\ +_0808AA74:\n\ + ldrb r0, [r4, 0x18]\n\ + lsrs r0, 4\n\ + cmp r0, r5\n\ + beq _0808AA84\n\ +_0808AA7C:\n\ + adds r0, r4, 0\n\ + bl EventObjectClearHeldMovement\n\ + b _0808AA92\n\ +_0808AA84:\n\ + adds r0, r6, 0\n\ + bl sub_808B028\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _0808AA7C\n\ + b _0808AA70\n\ +_0808AA92:\n\ + movs r0, 0\n\ +_0808AA94:\n\ + pop {r4-r6}\n\ + pop {r1}\n\ + bx r1"); +} + +void npc_clear_strange_bits(struct EventObject *eventObj) +{ + eventObj->inanimate = 0; + eventObj->disableAnim = 0; + eventObj->facingDirectionLocked = 0; + gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_DASH; +} + +void MovePlayerAvatarUsingKeypadInput(u8 direction, u16 newKeys, u16 heldKeys) +{ + if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE) + || (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE)) + MovePlayerOnBike(direction, newKeys, heldKeys); + else + MovePlayerNotOnBike(direction, heldKeys); +} + +void PlayerAllowForcedMovementIfMovingSameDirection(void) +{ + if (gPlayerAvatar.runningState == MOVING) + gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_5; +} -- cgit v1.2.3 From 201fb6f818e8c3a380bfc04edb62d6e9749b4c1b Mon Sep 17 00:00:00 2001 From: MCboy Date: Sat, 21 Jul 2018 03:06:40 +0430 Subject: ported code over from pokeruby --- src/field_player_avatar.c | 187 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) (limited to 'src') diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 191fc8aa4..81e797676 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -4,6 +4,16 @@ #include "event_object_movement.h" #include "bike.h" +extern bool8 (*const gUnknown_08497444[])(void); +extern bool8 (*const gUnknown_084973FC[])(u8); + +void sub_808C5B0(void); +void sub_808C4D8(void); +void PlayerJumpLedge(u8); +u8 CheckForPlayerAvatarCollision(u8); +void PlayerGoSpeed1(u8); +void PlayerGoSpeed2(u8); +void PlayerGoSpeed3(u8); static u8 EventObjectCB2_NoMovement2(); void sub_808C280(struct EventObject *); //struct EventObject *playerEventObj bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8); @@ -15,6 +25,7 @@ void MovePlayerAvatarUsingKeypadInput(u8, u16, u16); void PlayerAllowForcedMovementIfMovingSameDirection(); void MovePlayerNotOnBike(u8 a, u16 b); u8 sub_808B028(u8); +u8 GetForcedMovementByMetatileBehavior(); void MovementType_Player(struct Sprite *sprite) { @@ -125,3 +136,179 @@ void PlayerAllowForcedMovementIfMovingSameDirection(void) if (gPlayerAvatar.runningState == MOVING) gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_5; } + +bool8 TryDoMetatileBehaviorForcedMovement() +{ + return gUnknown_08497444[GetForcedMovementByMetatileBehavior()](); +} + +u8 GetForcedMovementByMetatileBehavior(void) +{ + u8 i; + + if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_5)) + { + u8 metatileBehavior = gEventObjects[gPlayerAvatar.eventObjectId].currentMetatileBehavior; + + for (i = 0; i < 18; i++) + { + if (gUnknown_084973FC[i](metatileBehavior)) + return i + 1; + } + } + return 0; +} + +bool8 ForcedMovement_None(void) +{ + if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_6) + { + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + playerEventObj->facingDirectionLocked = 0; + playerEventObj->enableAnim = 1; + SetEventObjectDirection(playerEventObj, playerEventObj->facingDirection); + gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_6; + } + return FALSE; +} + +static u8 DoForcedMovement(u8 direction, void (*b)(u8)) +{ + struct PlayerAvatar *playerAvatar = &gPlayerAvatar; + u8 collisionType = CheckForPlayerAvatarCollision(direction); + + playerAvatar->flags |= PLAYER_AVATAR_FLAG_6; + if (collisionType != 0) + { + ForcedMovement_None(); + if (collisionType <= 4) + { + return 0; + } + else + { + if (collisionType == COLLISION_LEDGE_JUMP) + PlayerJumpLedge(direction); + playerAvatar->flags |= PLAYER_AVATAR_FLAG_6; + playerAvatar->runningState = MOVING; + return 1; + } + } + else + { + playerAvatar->runningState = MOVING; + b(direction); + return 1; + } +} + +u8 DoForcedMovementInCurrentDirection(void (*a)(u8)) +{ + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + playerEventObj->disableAnim = 1; + return DoForcedMovement(playerEventObj->movementDirection, a); +} + +bool8 ForcedMovement_Slip(void) +{ + return DoForcedMovementInCurrentDirection(PlayerGoSpeed2); +} + +bool8 ForcedMovement_WalkSouth(void) +{ + return DoForcedMovement(DIR_SOUTH, PlayerGoSpeed1); +} + +bool8 ForcedMovement_WalkNorth(void) +{ + return DoForcedMovement(DIR_NORTH, PlayerGoSpeed1); +} + +bool8 ForcedMovement_WalkWest(void) +{ + return DoForcedMovement(DIR_WEST, PlayerGoSpeed1); +} + +bool8 ForcedMovement_WalkEast(void) +{ + return DoForcedMovement(DIR_EAST, PlayerGoSpeed1); +} + +bool8 ForcedMovement_PushedSouthByCurrent(void) +{ + return DoForcedMovement(DIR_SOUTH, PlayerGoSpeed3); +} + +bool8 ForcedMovement_PushedNorthByCurrent(void) +{ + return DoForcedMovement(DIR_NORTH, PlayerGoSpeed3); +} + +bool8 ForcedMovement_PushedWestByCurrent(void) +{ + return DoForcedMovement(DIR_WEST, PlayerGoSpeed3); +} + +bool8 ForcedMovement_PushedEastByCurrent(void) +{ + return DoForcedMovement(DIR_EAST, PlayerGoSpeed3); +} + +u8 ForcedMovement_Slide(u8 direction, void (*b)(u8)) +{ + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + playerEventObj->disableAnim = 1; + playerEventObj->facingDirectionLocked = 1; + return DoForcedMovement(direction, b); +} + +bool8 ForcedMovement_SlideSouth(void) +{ + return ForcedMovement_Slide(DIR_SOUTH, PlayerGoSpeed2); +} + +bool8 ForcedMovement_SlideNorth(void) +{ + return ForcedMovement_Slide(DIR_NORTH, PlayerGoSpeed2); +} + +bool8 ForcedMovement_SlideWest(void) +{ + return ForcedMovement_Slide(DIR_WEST, PlayerGoSpeed2); +} + +bool8 ForcedMovement_SlideEast(void) +{ + return ForcedMovement_Slide(DIR_EAST, PlayerGoSpeed2); +} + +bool8 ForcedMovement_0xBB(void) +{ + sub_808C4D8(); + return TRUE; +} + +bool8 ForcedMovement_0xBC(void) +{ + sub_808C5B0(); + return TRUE; +} + +bool8 ForcedMovement_MuddySlope(void) +{ + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + if (playerEventObj->movementDirection != DIR_NORTH || GetPlayerSpeed() <= 3) + { + Bike_UpdateBikeCounterSpeed(0); + playerEventObj->facingDirectionLocked = 1; + return DoForcedMovement(1, PlayerGoSpeed2); + } + else + { + return FALSE; + } +} -- cgit v1.2.3 From 82d88479ce94d79515c5152e669dbdc4acd5b9f4 Mon Sep 17 00:00:00 2001 From: MCboy Date: Tue, 24 Jul 2018 16:59:52 +0430 Subject: decompiled a bunch of functions i also made TryInterruptEventObjectSpecialAnim functionally equivalent tho its still nonmatching so i need help with that --- src/field_player_avatar.c | 363 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 355 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 81e797676..1be9ab73e 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -3,10 +3,51 @@ #include "sprite.h" #include "event_object_movement.h" #include "bike.h" - -extern bool8 (*const gUnknown_08497444[])(void); -extern bool8 (*const gUnknown_084973FC[])(u8); - +#include "metatile_behavior.h" +#include "metatile_behaviors.h" +#include "constants/flags.h" +#include "event_data.h" +#include "fieldmap.h" +#include "overworld.h" +#include "rotating_gate.h" + +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); + +void task_add_bump_boulder(u8, u8); +u8 GetLedgeJumpDirection(s16 x, s16 y, u8 z); +bool32 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8, s16, s16); // from rotating_gate.c +bool8 ShouldJumpLedge(s16, s16, u8); +bool8 sub_808B1BC(s16, s16, u8); +u8 sub_808B164(struct EventObject *, s16, s16, u8, u8); +u8 CheckForEventObjectCollision(struct EventObject *, s16, s16, u8, u8); +u8 sub_808B238(s16, s16, u8); +void check_acro_bike_metatile(s16, s16, u8, u8 *); +void PlayerNotOnBikeCollide(u8); +void PlayerNotOnBikeCollideWithFarawayIslandMew(u8); +bool8 IsPlayerCollidingWithFarawayIslandMew(u8); +void PlayerRun(u8); +void PlayerTurnInPlace(u8); +void PlayerFaceDirection(u8); +u8 GetPlayerFacingDirection(void); +void MovePlayerNotOnBike(u8, u16); +u8 CheckMovementInputNotOnBike(u8); +u8 GetPlayerMovementDirection(void); void sub_808C5B0(void); void sub_808C4D8(void); void PlayerJumpLedge(u8); @@ -26,10 +67,73 @@ void PlayerAllowForcedMovementIfMovingSameDirection(); void MovePlayerNotOnBike(u8 a, u16 b); u8 sub_808B028(u8); u8 GetForcedMovementByMetatileBehavior(); +void PlayerNotOnBikeNotMoving(u8, u16); +void PlayerNotOnBikeTurningInPlace(u8, u16); +void PlayerNotOnBikeMoving(u8, u16); +void sub_808C750(u8); + +static bool8 (*const gUnknown_084973FC[])(u8) = +{ + MetatileBehavior_IsTrickHouseSlipperyFloor, + MetatileBehavior_IsIce_2, + MetatileBehavior_IsWalkSouth, + MetatileBehavior_IsWalkNorth, + MetatileBehavior_IsWalkWest, + MetatileBehavior_IsWalkEast, + MetatileBehavior_IsSouthwardCurrent, + MetatileBehavior_IsNorthwardCurrent, + MetatileBehavior_IsWestwardCurrent, + MetatileBehavior_IsEastwardCurrent, + MetatileBehavior_IsSlideSouth, + MetatileBehavior_IsSlideNorth, + MetatileBehavior_IsSlideWest, + MetatileBehavior_IsSlideEast, + MetatileBehavior_IsWaterfall, + MetatileBehavior_IsSecretBaseJumpMat, + MetatileBehavior_IsSecretBaseSpinMat, + MetatileBehavior_IsMuddySlope, +}; +static bool8 (*const gUnknown_08497444[])(void) = +{ + ForcedMovement_None, + ForcedMovement_Slip, + ForcedMovement_Slip, + ForcedMovement_WalkSouth, + ForcedMovement_WalkNorth, + ForcedMovement_WalkWest, + ForcedMovement_WalkEast, + ForcedMovement_PushedSouthByCurrent, + ForcedMovement_PushedNorthByCurrent, + ForcedMovement_PushedWestByCurrent, + ForcedMovement_PushedEastByCurrent, + ForcedMovement_SlideSouth, + ForcedMovement_SlideNorth, + ForcedMovement_SlideWest, + ForcedMovement_SlideEast, + ForcedMovement_PushedSouthByCurrent, + ForcedMovement_0xBB, + ForcedMovement_0xBC, + ForcedMovement_MuddySlope, +}; +static void (*const gUnknown_08497490[])(u8, u16) = +{ + PlayerNotOnBikeNotMoving, + PlayerNotOnBikeTurningInPlace, + PlayerNotOnBikeMoving, +}; + +static bool8 (*const gUnknown_0849749C[])(u8) = +{ + MetatileBehavior_IsBumpySlope, + MetatileBehavior_IsIsolatedVerticalRail, + MetatileBehavior_IsIsolatedHorizontalRail, + MetatileBehavior_IsVerticalRail, + MetatileBehavior_IsHorizontalRail, +}; +static const u8 gUnknown_084974B0[] = {9, 10, 11, 12, 13, 0, 0, 0}; void MovementType_Player(struct Sprite *sprite) { - // ((Sprite->data[0] << 3) + Sprite->data[0]) << 2 UpdateEventObjectCurrentMovement(&gEventObjects[sprite->data[0]], sprite, EventObjectCB2_NoMovement2); } @@ -58,11 +162,46 @@ void player_step(u8 direction, u16 newKeys, u16 heldKeys) } } } - +#ifdef NONMATCHING +bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *playerEventObj, u8 direction) +{ + if (EventObjectIsMovementOverridden(playerEventObj) + && !EventObjectClearHeldMovementIfFinished(playerEventObj)) + { + u8 heldMovementActionId = EventObjectGetHeldMovementActionId(playerEventObj); + if (heldMovementActionId > 24 && heldMovementActionId < 29) + { + if(direction == DIR_NONE) + { + EventObjectClearHeldMovement(playerEventObj); + return FALSE; + } + else if(playerEventObj->movementDirection != direction) + { + return TRUE; + } + else if(sub_808B028(direction) == FALSE) + { + EventObjectClearHeldMovement(playerEventObj); + return FALSE; + } + else + { + return TRUE; + } + } + else + { + return TRUE; + } + } + return FALSE; +} +#else NAKED -bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *eventObject, u8 direction) +bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *playerEventObj, u8 direction) { - asm_unified("push {r4-r6,lr}\n\ + asm_unified("push {r4-r6,lr}\n\ adds r4, r0, 0\n\ lsls r1, 24\n\ lsrs r5, r1, 24\n\ @@ -113,6 +252,7 @@ _0808AA94:\n\ pop {r1}\n\ bx r1"); } +#endif void npc_clear_strange_bits(struct EventObject *eventObj) { @@ -312,3 +452,210 @@ bool8 ForcedMovement_MuddySlope(void) return FALSE; } } + +void MovePlayerNotOnBike(u8 direction, u16 heldKeys) +{ + gUnknown_08497490[CheckMovementInputNotOnBike(direction)](direction, heldKeys); +} + +u8 CheckMovementInputNotOnBike(u8 direction) +{ + if (direction == DIR_NONE) + { + gPlayerAvatar.runningState = NOT_MOVING; + return 0; + } + else if (direction != GetPlayerMovementDirection() && gPlayerAvatar.runningState != MOVING) + { + gPlayerAvatar.runningState = TURN_DIRECTION; + return 1; + } + else + { + gPlayerAvatar.runningState = MOVING; + return 2; + } +} + +void PlayerNotOnBikeNotMoving(u8 direction, u16 heldKeys) +{ + PlayerFaceDirection(GetPlayerFacingDirection()); +} + +void PlayerNotOnBikeTurningInPlace(u8 direction, u16 heldKeys) +{ + PlayerTurnInPlace(direction); +} + +void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys) +{ + u8 r0 = CheckForPlayerAvatarCollision(direction); + + if(r0 != 0) + { + if(r0 == 6) + { + PlayerJumpLedge(direction); + return; + } + else if(r0 == 4 && IsPlayerCollidingWithFarawayIslandMew(direction) != 0) + { + PlayerNotOnBikeCollideWithFarawayIslandMew(direction); + return; + } + else + { + u8 r4 = r0 - 5; + + if(r4 > 3) + { + PlayerNotOnBikeCollide(direction); + return; + } + else + { + return; + } + } + } + + if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) + { + // speed 2 is fast, same speed as running + PlayerGoSpeed2(direction); + return; + } + + if (!(gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_4) && (heldKeys & B_BUTTON) && FlagGet(FLAG_SYS_B_DASH) + && IsRunningDisallowed(gEventObjects[gPlayerAvatar.eventObjectId].currentMetatileBehavior) == 0) + { + PlayerRun(direction); + gPlayerAvatar.flags |= PLAYER_AVATAR_FLAG_DASH; + return; + } + else + { + PlayerGoSpeed1(direction); + } +} + +u8 CheckForPlayerAvatarCollision(u8 direction) +{ + s16 x, y; + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + x = playerEventObj->currentCoords.x; + y = playerEventObj->currentCoords.y; + MoveCoords(direction, &x, &y); + return CheckForEventObjectCollision(playerEventObj, x, y, direction, MapGridGetMetatileBehaviorAt(x, y)); +} + +u8 sub_808B028(u8 direction) +{ + s16 x, y; + struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; + + x = playerEventObj->currentCoords.x; + y = playerEventObj->currentCoords.y; + MoveCoords(direction, &x, &y); + return sub_808B164(playerEventObj, x, y, direction, MapGridGetMetatileBehaviorAt(x, y)); +} + +u8 CheckForEventObjectCollision(struct EventObject *a, s16 x, s16 y, u8 direction, u8 e) +{ + u8 collision; + + collision = GetCollisionAtCoords(a, x, y, direction); + if (collision == 3 && sub_808B1BC(x, y, direction)) + return 5; + if (ShouldJumpLedge(x, y, direction)) + { + IncrementGameStat(GAME_STAT_JUMPED_DOWN_LEDGES); + return COLLISION_LEDGE_JUMP; + } + if (collision == 4 && sub_808B238(x, y, direction)) + return 7; + + if (collision == 0) + { + if (CheckForRotatingGatePuzzleCollision(direction, x, y)) + return 8; + check_acro_bike_metatile(x, y, e, &collision); + } + return collision; +} + +u8 sub_808B164(struct EventObject *a, s16 x, s16 y, u8 direction, u8 e) +{ + u8 collision = GetCollisionAtCoords(a, x, y, direction); + + if (collision == 0) + { + if (CheckForRotatingGatePuzzleCollisionWithoutAnimation(direction, x, y) != 0) + return 8; + check_acro_bike_metatile(x, y, e, &collision); + } + return collision; +} + +bool8 sub_808B1BC(s16 x, s16 y, u8 direction) +{ + if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) + && MapGridGetZCoordAt(x, y) == 3 + && GetEventObjectIdByXYZ(x, y, 3) == 16) + { + sub_808C750(direction); + return 1; + } + else + { + return 0; + } +} + +bool8 ShouldJumpLedge(s16 x, s16 y, u8 z) +{ + if (GetLedgeJumpDirection(x, y, z) != 0) + return 1; + else + return 0; +} + +u8 sub_808B238(s16 x, s16 y, u8 direction) +{ + if (FlagGet(FLAG_SYS_USE_STRENGTH)) + { + u8 eventObjectId = GetEventObjectIdByXY(x, y); + + if (eventObjectId != 16) + { + if (gEventObjects[eventObjectId].graphicsId == 0x57) + { + x = gEventObjects[eventObjectId].currentCoords.x; + y = gEventObjects[eventObjectId].currentCoords.y; + MoveCoords(direction, &x, &y); + if (GetCollisionAtCoords(&gEventObjects[eventObjectId], x, y, direction) == 0 + && MetatileBehavior_IsNonAnimDoor(MapGridGetMetatileBehaviorAt(x, y)) == 0) + { + task_add_bump_boulder(eventObjectId, direction); + return 1; + } + } + } + } + return 0; +} + +void check_acro_bike_metatile(s16 unused1, s16 unused2, u8 c, u8 *d) +{ + u8 i; + + for (i = 0; i < 5; i++) + { + if (gUnknown_0849749C[i](c)) + { + *d = gUnknown_084974B0[i]; + return; + } + } +} -- cgit v1.2.3 From 94a5f8d5291eb42febbf689cea0e8dec357a0b90 Mon Sep 17 00:00:00 2001 From: MCboy Date: Wed, 25 Jul 2018 17:18:49 +0430 Subject: made file better ? --- src/field_player_avatar.c | 110 +++++++++++++--------------------------------- 1 file changed, 30 insertions(+), 80 deletions(-) (limited to 'src') diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 1be9ab73e..a8eb835a3 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -162,101 +162,51 @@ void player_step(u8 direction, u16 newKeys, u16 heldKeys) } } } -#ifdef NONMATCHING + bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *playerEventObj, u8 direction) { + #ifdef NONMATCHING + u8 r5 = direction; + u8 r6 = direction; + #else + u8 r5 = direction; + register u8 r6 asm("r6") = direction; + #endif + //a very bad HACK + if (EventObjectIsMovementOverridden(playerEventObj) && !EventObjectClearHeldMovementIfFinished(playerEventObj)) { u8 heldMovementActionId = EventObjectGetHeldMovementActionId(playerEventObj); if (heldMovementActionId > 24 && heldMovementActionId < 29) { - if(direction == DIR_NONE) - { - EventObjectClearHeldMovement(playerEventObj); - return FALSE; - } - else if(playerEventObj->movementDirection != direction) + if (direction == DIR_NONE) { return TRUE; } - else if(sub_808B028(direction) == FALSE) + + if (playerEventObj->movementDirection != r5) { EventObjectClearHeldMovement(playerEventObj); return FALSE; } - else + + if (!sub_808B028(r6)) { - return TRUE; + EventObjectClearHeldMovement(playerEventObj); + return FALSE; } } - else - { - return TRUE; - } + + return TRUE; } + return FALSE; } -#else -NAKED -bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *playerEventObj, u8 direction) -{ - asm_unified("push {r4-r6,lr}\n\ - adds r4, r0, 0\n\ - lsls r1, 24\n\ - lsrs r5, r1, 24\n\ - adds r6, r5, 0\n\ - bl EventObjectIsMovementOverridden\n\ - lsls r0, 24\n\ - cmp r0, 0\n\ - beq _0808AA92\n\ - adds r0, r4, 0\n\ - bl EventObjectClearHeldMovementIfFinished\n\ - lsls r0, 24\n\ - cmp r0, 0\n\ - bne _0808AA92\n\ - adds r0, r4, 0\n\ - bl EventObjectGetHeldMovementActionId\n\ - lsls r0, 24\n\ - movs r1, 0xE7\n\ - lsls r1, 24\n\ - adds r0, r1\n\ - lsrs r0, 24\n\ - cmp r0, 0x3\n\ - bhi _0808AA70\n\ - cmp r5, 0\n\ - bne _0808AA74\n\ -_0808AA70:\n\ - movs r0, 0x1\n\ - b _0808AA94\n\ -_0808AA74:\n\ - ldrb r0, [r4, 0x18]\n\ - lsrs r0, 4\n\ - cmp r0, r5\n\ - beq _0808AA84\n\ -_0808AA7C:\n\ - adds r0, r4, 0\n\ - bl EventObjectClearHeldMovement\n\ - b _0808AA92\n\ -_0808AA84:\n\ - adds r0, r6, 0\n\ - bl sub_808B028\n\ - lsls r0, 24\n\ - cmp r0, 0\n\ - beq _0808AA7C\n\ - b _0808AA70\n\ -_0808AA92:\n\ - movs r0, 0\n\ -_0808AA94:\n\ - pop {r4-r6}\n\ - pop {r1}\n\ - bx r1"); -} -#endif void npc_clear_strange_bits(struct EventObject *eventObj) { - eventObj->inanimate = 0; + eventObj->inanimate = 0; eventObj->disableAnim = 0; eventObj->facingDirectionLocked = 0; gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_DASH; @@ -491,14 +441,14 @@ void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys) { u8 r0 = CheckForPlayerAvatarCollision(direction); - if(r0 != 0) + if (r0 != 0) { - if(r0 == 6) + if (r0 == 6) { PlayerJumpLedge(direction); return; } - else if(r0 == 4 && IsPlayerCollidingWithFarawayIslandMew(direction) != 0) + else if (r0 == 4 && IsPlayerCollidingWithFarawayIslandMew(direction) != 0) { PlayerNotOnBikeCollideWithFarawayIslandMew(direction); return; @@ -507,7 +457,7 @@ void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys) { u8 r4 = r0 - 5; - if(r4 > 3) + if (r4 > 3) { PlayerNotOnBikeCollide(direction); return; @@ -521,7 +471,7 @@ void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys) if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) { - // speed 2 is fast, same speed as running + // speed 2 is fast, same speed as running PlayerGoSpeed2(direction); return; } @@ -605,20 +555,20 @@ bool8 sub_808B1BC(s16 x, s16 y, u8 direction) && GetEventObjectIdByXYZ(x, y, 3) == 16) { sub_808C750(direction); - return 1; + return TRUE; } else { - return 0; + return FALSE; } } bool8 ShouldJumpLedge(s16 x, s16 y, u8 z) { if (GetLedgeJumpDirection(x, y, z) != 0) - return 1; + return TRUE; else - return 0; + return FALSE; } u8 sub_808B238(s16 x, s16 y, u8 direction) -- cgit v1.2.3 From 3a15012085227ff5986c0e73d11c19b827794947 Mon Sep 17 00:00:00 2001 From: MCboy Date: Wed, 25 Jul 2018 17:28:25 +0430 Subject: Update field_player_avatar.c --- src/field_player_avatar.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index a8eb835a3..9cdbf9956 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -577,9 +577,7 @@ u8 sub_808B238(s16 x, s16 y, u8 direction) { u8 eventObjectId = GetEventObjectIdByXY(x, y); - if (eventObjectId != 16) - { - if (gEventObjects[eventObjectId].graphicsId == 0x57) + if (eventObjectId != 16 && gEventObjects[eventObjectId].graphicsId == 0x57) { x = gEventObjects[eventObjectId].currentCoords.x; y = gEventObjects[eventObjectId].currentCoords.y; @@ -591,7 +589,6 @@ u8 sub_808B238(s16 x, s16 y, u8 direction) return 1; } } - } } return 0; } -- cgit v1.2.3 From 6c365fdc94f0adca78ce3533745b75f389ccc9f2 Mon Sep 17 00:00:00 2001 From: MCboy Date: Wed, 25 Jul 2018 17:47:04 +0430 Subject: Update field_player_avatar.c --- src/field_player_avatar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 9cdbf9956..3289c1985 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -10,6 +10,7 @@ #include "fieldmap.h" #include "overworld.h" #include "rotating_gate.h" +#include "constants/event_object_movement_constants.h" bool8 ForcedMovement_None(void); bool8 ForcedMovement_Slip(void); @@ -178,7 +179,7 @@ bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *playerEventObj, u8 && !EventObjectClearHeldMovementIfFinished(playerEventObj)) { u8 heldMovementActionId = EventObjectGetHeldMovementActionId(playerEventObj); - if (heldMovementActionId > 24 && heldMovementActionId < 29) + if (heldMovementActionId > MOVEMENT_ACTION_WALK_FAST_RIGHT && heldMovementActionId < MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_DOWN) { if (direction == DIR_NONE) { -- cgit v1.2.3 From 2ddabca996047b0e6404b926f6455b9e73fc27b2 Mon Sep 17 00:00:00 2001 From: MCboy Date: Sun, 12 Aug 2018 22:31:58 +0430 Subject: apply some changes --- src/field_player_avatar.c | 124 ++++++++++++++++++---------------------------- 1 file changed, 48 insertions(+), 76 deletions(-) (limited to 'src') diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 3289c1985..6ab721643 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -11,67 +11,36 @@ #include "overworld.h" #include "rotating_gate.h" #include "constants/event_object_movement_constants.h" - -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); - -void task_add_bump_boulder(u8, u8); -u8 GetLedgeJumpDirection(s16 x, s16 y, u8 z); -bool32 CheckForRotatingGatePuzzleCollisionWithoutAnimation(u8, s16, s16); // from rotating_gate.c -bool8 ShouldJumpLedge(s16, s16, u8); -bool8 sub_808B1BC(s16, s16, u8); -u8 sub_808B164(struct EventObject *, s16, s16, u8, u8); -u8 CheckForEventObjectCollision(struct EventObject *, s16, s16, u8, u8); -u8 sub_808B238(s16, s16, u8); -void check_acro_bike_metatile(s16, s16, u8, u8 *); -void PlayerNotOnBikeCollide(u8); -void PlayerNotOnBikeCollideWithFarawayIslandMew(u8); -bool8 IsPlayerCollidingWithFarawayIslandMew(u8); -void PlayerRun(u8); -void PlayerTurnInPlace(u8); -void PlayerFaceDirection(u8); -u8 GetPlayerFacingDirection(void); -void MovePlayerNotOnBike(u8, u16); -u8 CheckMovementInputNotOnBike(u8); -u8 GetPlayerMovementDirection(void); -void sub_808C5B0(void); -void sub_808C4D8(void); -void PlayerJumpLedge(u8); -u8 CheckForPlayerAvatarCollision(u8); -void PlayerGoSpeed1(u8); -void PlayerGoSpeed2(u8); -void PlayerGoSpeed3(u8); +#include "field_player_avatar.h" + +extern void task_add_bump_boulder(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 MovePlayerNotOnBike(u8, u16); +static u8 CheckMovementInputNotOnBike(u8); +extern void sub_808C5B0(void); +extern void sub_808C4D8(void); +static u8 CheckForPlayerAvatarCollision(u8); static u8 EventObjectCB2_NoMovement2(); -void sub_808C280(struct EventObject *); //struct EventObject *playerEventObj -bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8); +extern void sub_808C280(struct EventObject *); +static bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8); void npc_clear_strange_bits(struct EventObject *); -u8 EventObjectGetHeldMovementActionId(struct EventObject *); -void DoPlayerAvatarTransition(void); -bool8 TryDoMetatileBehaviorForcedMovement(); -void MovePlayerAvatarUsingKeypadInput(u8, u16, u16); -void PlayerAllowForcedMovementIfMovingSameDirection(); -void MovePlayerNotOnBike(u8 a, u16 b); -u8 sub_808B028(u8); -u8 GetForcedMovementByMetatileBehavior(); -void PlayerNotOnBikeNotMoving(u8, u16); -void PlayerNotOnBikeTurningInPlace(u8, u16); -void PlayerNotOnBikeMoving(u8, u16); -void sub_808C750(u8); +extern void DoPlayerAvatarTransition(void); +static bool8 TryDoMetatileBehaviorForcedMovement(); +static void MovePlayerAvatarUsingKeypadInput(u8, u16, u16); +static void PlayerAllowForcedMovementIfMovingSameDirection(); +static u8 sub_808B028(u8); +static u8 GetForcedMovementByMetatileBehavior(); +static void PlayerNotOnBikeNotMoving(u8, u16); +static void PlayerNotOnBikeTurningInPlace(u8, u16); +static void PlayerNotOnBikeMoving(u8, u16); +extern void sub_808C750(u8); static bool8 (*const gUnknown_084973FC[])(u8) = { @@ -94,6 +63,7 @@ static bool8 (*const gUnknown_084973FC[])(u8) = MetatileBehavior_IsSecretBaseSpinMat, MetatileBehavior_IsMuddySlope, }; + static bool8 (*const gUnknown_08497444[])(void) = { ForcedMovement_None, @@ -116,6 +86,7 @@ static bool8 (*const gUnknown_08497444[])(void) = ForcedMovement_0xBC, ForcedMovement_MuddySlope, }; + static void (*const gUnknown_08497490[])(u8, u16) = { PlayerNotOnBikeNotMoving, @@ -131,6 +102,7 @@ static bool8 (*const gUnknown_0849749C[])(u8) = MetatileBehavior_IsVerticalRail, MetatileBehavior_IsHorizontalRail, }; + static const u8 gUnknown_084974B0[] = {9, 10, 11, 12, 13, 0, 0, 0}; void MovementType_Player(struct Sprite *sprite) @@ -164,7 +136,7 @@ void player_step(u8 direction, u16 newKeys, u16 heldKeys) } } -bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *playerEventObj, u8 direction) +static bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *playerEventObj, u8 direction) { #ifdef NONMATCHING u8 r5 = direction; @@ -213,7 +185,7 @@ void npc_clear_strange_bits(struct EventObject *eventObj) gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_DASH; } -void MovePlayerAvatarUsingKeypadInput(u8 direction, u16 newKeys, u16 heldKeys) +static void MovePlayerAvatarUsingKeypadInput(u8 direction, u16 newKeys, u16 heldKeys) { if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE) || (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE)) @@ -222,18 +194,18 @@ void MovePlayerAvatarUsingKeypadInput(u8 direction, u16 newKeys, u16 heldKeys) MovePlayerNotOnBike(direction, heldKeys); } -void PlayerAllowForcedMovementIfMovingSameDirection(void) +static void PlayerAllowForcedMovementIfMovingSameDirection(void) { if (gPlayerAvatar.runningState == MOVING) gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_5; } -bool8 TryDoMetatileBehaviorForcedMovement() +static bool8 TryDoMetatileBehaviorForcedMovement() { return gUnknown_08497444[GetForcedMovementByMetatileBehavior()](); } -u8 GetForcedMovementByMetatileBehavior(void) +static u8 GetForcedMovementByMetatileBehavior(void) { u8 i; @@ -404,12 +376,12 @@ bool8 ForcedMovement_MuddySlope(void) } } -void MovePlayerNotOnBike(u8 direction, u16 heldKeys) +static void MovePlayerNotOnBike(u8 direction, u16 heldKeys) { gUnknown_08497490[CheckMovementInputNotOnBike(direction)](direction, heldKeys); } -u8 CheckMovementInputNotOnBike(u8 direction) +static u8 CheckMovementInputNotOnBike(u8 direction) { if (direction == DIR_NONE) { @@ -428,17 +400,17 @@ u8 CheckMovementInputNotOnBike(u8 direction) } } -void PlayerNotOnBikeNotMoving(u8 direction, u16 heldKeys) +static void PlayerNotOnBikeNotMoving(u8 direction, u16 heldKeys) { PlayerFaceDirection(GetPlayerFacingDirection()); } -void PlayerNotOnBikeTurningInPlace(u8 direction, u16 heldKeys) +static void PlayerNotOnBikeTurningInPlace(u8 direction, u16 heldKeys) { PlayerTurnInPlace(direction); } -void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys) +static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys) { u8 r0 = CheckForPlayerAvatarCollision(direction); @@ -490,7 +462,7 @@ void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys) } } -u8 CheckForPlayerAvatarCollision(u8 direction) +static u8 CheckForPlayerAvatarCollision(u8 direction) { s16 x, y; struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -501,7 +473,7 @@ u8 CheckForPlayerAvatarCollision(u8 direction) return CheckForEventObjectCollision(playerEventObj, x, y, direction, MapGridGetMetatileBehaviorAt(x, y)); } -u8 sub_808B028(u8 direction) +static u8 sub_808B028(u8 direction) { s16 x, y; struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; @@ -536,7 +508,7 @@ u8 CheckForEventObjectCollision(struct EventObject *a, s16 x, s16 y, u8 directio return collision; } -u8 sub_808B164(struct EventObject *a, s16 x, s16 y, u8 direction, u8 e) +static u8 sub_808B164(struct EventObject *a, s16 x, s16 y, u8 direction, u8 e) { u8 collision = GetCollisionAtCoords(a, x, y, direction); @@ -549,7 +521,7 @@ u8 sub_808B164(struct EventObject *a, s16 x, s16 y, u8 direction, u8 e) return collision; } -bool8 sub_808B1BC(s16 x, s16 y, u8 direction) +static bool8 sub_808B1BC(s16 x, s16 y, u8 direction) { if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) && MapGridGetZCoordAt(x, y) == 3 @@ -564,7 +536,7 @@ bool8 sub_808B1BC(s16 x, s16 y, u8 direction) } } -bool8 ShouldJumpLedge(s16 x, s16 y, u8 z) +static bool8 ShouldJumpLedge(s16 x, s16 y, u8 z) { if (GetLedgeJumpDirection(x, y, z) != 0) return TRUE; @@ -572,7 +544,7 @@ bool8 ShouldJumpLedge(s16 x, s16 y, u8 z) return FALSE; } -u8 sub_808B238(s16 x, s16 y, u8 direction) +static u8 sub_808B238(s16 x, s16 y, u8 direction) { if (FlagGet(FLAG_SYS_USE_STRENGTH)) { @@ -594,7 +566,7 @@ u8 sub_808B238(s16 x, s16 y, u8 direction) return 0; } -void check_acro_bike_metatile(s16 unused1, s16 unused2, u8 c, u8 *d) +static void check_acro_bike_metatile(s16 unused1, s16 unused2, u8 c, u8 *d) { u8 i; -- cgit v1.2.3