mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-03-06 15:38:11 +01:00
apply some changes
This commit is contained in:
parent
f7c3151ef2
commit
2ddabca996
@ -11,67 +11,36 @@
|
|||||||
#include "overworld.h"
|
#include "overworld.h"
|
||||||
#include "rotating_gate.h"
|
#include "rotating_gate.h"
|
||||||
#include "constants/event_object_movement_constants.h"
|
#include "constants/event_object_movement_constants.h"
|
||||||
|
#include "field_player_avatar.h"
|
||||||
|
|
||||||
bool8 ForcedMovement_None(void);
|
extern void task_add_bump_boulder(u8, u8);
|
||||||
bool8 ForcedMovement_Slip(void);
|
static bool8 ShouldJumpLedge(s16, s16, u8);
|
||||||
bool8 ForcedMovement_WalkSouth(void);
|
static bool8 sub_808B1BC(s16, s16, u8);
|
||||||
bool8 ForcedMovement_WalkNorth(void);
|
static u8 sub_808B164(struct EventObject *, s16, s16, u8, u8);
|
||||||
bool8 ForcedMovement_WalkWest(void);
|
static u8 sub_808B238(s16, s16, u8);
|
||||||
bool8 ForcedMovement_WalkEast(void);
|
static void check_acro_bike_metatile(s16, s16, u8, u8 *);
|
||||||
bool8 ForcedMovement_PushedSouthByCurrent(void);
|
extern void PlayerNotOnBikeCollide(u8);
|
||||||
bool8 ForcedMovement_PushedNorthByCurrent(void);
|
extern void PlayerNotOnBikeCollideWithFarawayIslandMew(u8);
|
||||||
bool8 ForcedMovement_PushedWestByCurrent(void);
|
extern void PlayerRun(u8);
|
||||||
bool8 ForcedMovement_PushedEastByCurrent(void);
|
static void MovePlayerNotOnBike(u8, u16);
|
||||||
bool8 ForcedMovement_SlideSouth(void);
|
static u8 CheckMovementInputNotOnBike(u8);
|
||||||
bool8 ForcedMovement_SlideNorth(void);
|
extern void sub_808C5B0(void);
|
||||||
bool8 ForcedMovement_SlideWest(void);
|
extern void sub_808C4D8(void);
|
||||||
bool8 ForcedMovement_SlideEast(void);
|
static u8 CheckForPlayerAvatarCollision(u8);
|
||||||
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);
|
|
||||||
static u8 EventObjectCB2_NoMovement2();
|
static u8 EventObjectCB2_NoMovement2();
|
||||||
void sub_808C280(struct EventObject *); //struct EventObject *playerEventObj
|
extern void sub_808C280(struct EventObject *);
|
||||||
bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8);
|
static bool8 TryInterruptEventObjectSpecialAnim(struct EventObject *, u8);
|
||||||
void npc_clear_strange_bits(struct EventObject *);
|
void npc_clear_strange_bits(struct EventObject *);
|
||||||
u8 EventObjectGetHeldMovementActionId(struct EventObject *);
|
extern void DoPlayerAvatarTransition(void);
|
||||||
void DoPlayerAvatarTransition(void);
|
static bool8 TryDoMetatileBehaviorForcedMovement();
|
||||||
bool8 TryDoMetatileBehaviorForcedMovement();
|
static void MovePlayerAvatarUsingKeypadInput(u8, u16, u16);
|
||||||
void MovePlayerAvatarUsingKeypadInput(u8, u16, u16);
|
static void PlayerAllowForcedMovementIfMovingSameDirection();
|
||||||
void PlayerAllowForcedMovementIfMovingSameDirection();
|
static u8 sub_808B028(u8);
|
||||||
void MovePlayerNotOnBike(u8 a, u16 b);
|
static u8 GetForcedMovementByMetatileBehavior();
|
||||||
u8 sub_808B028(u8);
|
static void PlayerNotOnBikeNotMoving(u8, u16);
|
||||||
u8 GetForcedMovementByMetatileBehavior();
|
static void PlayerNotOnBikeTurningInPlace(u8, u16);
|
||||||
void PlayerNotOnBikeNotMoving(u8, u16);
|
static void PlayerNotOnBikeMoving(u8, u16);
|
||||||
void PlayerNotOnBikeTurningInPlace(u8, u16);
|
extern void sub_808C750(u8);
|
||||||
void PlayerNotOnBikeMoving(u8, u16);
|
|
||||||
void sub_808C750(u8);
|
|
||||||
|
|
||||||
static bool8 (*const gUnknown_084973FC[])(u8) =
|
static bool8 (*const gUnknown_084973FC[])(u8) =
|
||||||
{
|
{
|
||||||
@ -94,6 +63,7 @@ static bool8 (*const gUnknown_084973FC[])(u8) =
|
|||||||
MetatileBehavior_IsSecretBaseSpinMat,
|
MetatileBehavior_IsSecretBaseSpinMat,
|
||||||
MetatileBehavior_IsMuddySlope,
|
MetatileBehavior_IsMuddySlope,
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool8 (*const gUnknown_08497444[])(void) =
|
static bool8 (*const gUnknown_08497444[])(void) =
|
||||||
{
|
{
|
||||||
ForcedMovement_None,
|
ForcedMovement_None,
|
||||||
@ -116,6 +86,7 @@ static bool8 (*const gUnknown_08497444[])(void) =
|
|||||||
ForcedMovement_0xBC,
|
ForcedMovement_0xBC,
|
||||||
ForcedMovement_MuddySlope,
|
ForcedMovement_MuddySlope,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void (*const gUnknown_08497490[])(u8, u16) =
|
static void (*const gUnknown_08497490[])(u8, u16) =
|
||||||
{
|
{
|
||||||
PlayerNotOnBikeNotMoving,
|
PlayerNotOnBikeNotMoving,
|
||||||
@ -131,6 +102,7 @@ static bool8 (*const gUnknown_0849749C[])(u8) =
|
|||||||
MetatileBehavior_IsVerticalRail,
|
MetatileBehavior_IsVerticalRail,
|
||||||
MetatileBehavior_IsHorizontalRail,
|
MetatileBehavior_IsHorizontalRail,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 gUnknown_084974B0[] = {9, 10, 11, 12, 13, 0, 0, 0};
|
static const u8 gUnknown_084974B0[] = {9, 10, 11, 12, 13, 0, 0, 0};
|
||||||
|
|
||||||
void MovementType_Player(struct Sprite *sprite)
|
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
|
#ifdef NONMATCHING
|
||||||
u8 r5 = direction;
|
u8 r5 = direction;
|
||||||
@ -213,7 +185,7 @@ void npc_clear_strange_bits(struct EventObject *eventObj)
|
|||||||
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_DASH;
|
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)
|
if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE)
|
||||||
|| (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE))
|
|| (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE))
|
||||||
@ -222,18 +194,18 @@ void MovePlayerAvatarUsingKeypadInput(u8 direction, u16 newKeys, u16 heldKeys)
|
|||||||
MovePlayerNotOnBike(direction, heldKeys);
|
MovePlayerNotOnBike(direction, heldKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerAllowForcedMovementIfMovingSameDirection(void)
|
static void PlayerAllowForcedMovementIfMovingSameDirection(void)
|
||||||
{
|
{
|
||||||
if (gPlayerAvatar.runningState == MOVING)
|
if (gPlayerAvatar.runningState == MOVING)
|
||||||
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_5;
|
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_5;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 TryDoMetatileBehaviorForcedMovement()
|
static bool8 TryDoMetatileBehaviorForcedMovement()
|
||||||
{
|
{
|
||||||
return gUnknown_08497444[GetForcedMovementByMetatileBehavior()]();
|
return gUnknown_08497444[GetForcedMovementByMetatileBehavior()]();
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetForcedMovementByMetatileBehavior(void)
|
static u8 GetForcedMovementByMetatileBehavior(void)
|
||||||
{
|
{
|
||||||
u8 i;
|
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);
|
gUnknown_08497490[CheckMovementInputNotOnBike(direction)](direction, heldKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 CheckMovementInputNotOnBike(u8 direction)
|
static u8 CheckMovementInputNotOnBike(u8 direction)
|
||||||
{
|
{
|
||||||
if (direction == DIR_NONE)
|
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());
|
PlayerFaceDirection(GetPlayerFacingDirection());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerNotOnBikeTurningInPlace(u8 direction, u16 heldKeys)
|
static void PlayerNotOnBikeTurningInPlace(u8 direction, u16 heldKeys)
|
||||||
{
|
{
|
||||||
PlayerTurnInPlace(direction);
|
PlayerTurnInPlace(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys)
|
static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys)
|
||||||
{
|
{
|
||||||
u8 r0 = CheckForPlayerAvatarCollision(direction);
|
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;
|
s16 x, y;
|
||||||
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
|
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
|
||||||
@ -501,7 +473,7 @@ u8 CheckForPlayerAvatarCollision(u8 direction)
|
|||||||
return CheckForEventObjectCollision(playerEventObj, x, y, direction, MapGridGetMetatileBehaviorAt(x, y));
|
return CheckForEventObjectCollision(playerEventObj, x, y, direction, MapGridGetMetatileBehaviorAt(x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 sub_808B028(u8 direction)
|
static u8 sub_808B028(u8 direction)
|
||||||
{
|
{
|
||||||
s16 x, y;
|
s16 x, y;
|
||||||
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
|
struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
|
||||||
@ -536,7 +508,7 @@ u8 CheckForEventObjectCollision(struct EventObject *a, s16 x, s16 y, u8 directio
|
|||||||
return collision;
|
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);
|
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;
|
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)
|
if ((gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
|
||||||
&& MapGridGetZCoordAt(x, y) == 3
|
&& 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)
|
if (GetLedgeJumpDirection(x, y, z) != 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -572,7 +544,7 @@ bool8 ShouldJumpLedge(s16 x, s16 y, u8 z)
|
|||||||
return FALSE;
|
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))
|
if (FlagGet(FLAG_SYS_USE_STRENGTH))
|
||||||
{
|
{
|
||||||
@ -594,7 +566,7 @@ u8 sub_808B238(s16 x, s16 y, u8 direction)
|
|||||||
return 0;
|
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;
|
u8 i;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user