Merge pull request #407 from PikalaxALT/doc_bike
Document bike.c and fix weird goto
This commit is contained in:
+19
-5
@@ -13,6 +13,20 @@ enum
|
||||
SPEED_FASTEST,
|
||||
};
|
||||
|
||||
enum {
|
||||
BIKE_TRANS_FACE_DIRECTION,
|
||||
BIKE_TRANS_TURNING,
|
||||
BIKE_TRANS_MOVE,
|
||||
BIKE_TRANS_DOWNHILL,
|
||||
BIKE_TRANS_UPHILL
|
||||
};
|
||||
|
||||
enum {
|
||||
BIKE_STATE_NORMAL,
|
||||
BIKE_STATE_TURNING,
|
||||
BIKE_STATE_SLOPE
|
||||
};
|
||||
|
||||
// Acro bike states
|
||||
enum
|
||||
{
|
||||
@@ -25,15 +39,15 @@ enum
|
||||
ACRO_STATE_TURN_JUMP,
|
||||
};
|
||||
|
||||
void InitPlayerAvatarBikeState(u32 directionHistory, u32 abStartSelectHistory);
|
||||
bool8 MetatileAtPlayerPositionForbidsBiking(void);
|
||||
void StartTransitionToFlipBikeState(u8 flags);
|
||||
void BikeClearState(u32 directionHistory, u32 abStartSelectHistory);
|
||||
bool8 IsBikingDisallowedByPlayer(void);
|
||||
void GetOnOffBike(u8 flags);
|
||||
s16 GetPlayerSpeed(void);
|
||||
bool8 sub_80BD460(u8);
|
||||
bool8 RS_IsRunningDisallowed(u8 r0);
|
||||
void MovePlayerOnBike(u8 direction, u16 newKeys, u16 heldKeys);
|
||||
bool32 IsRunningDisallowed(u8 metatileBehavior);
|
||||
void Bike_HandleBumpySlopeJump(void);
|
||||
void Bike_UpdateBikeCounterSpeed(u8 counter);
|
||||
bool8 player_should_look_direction_be_enforced_upon_movement(void);
|
||||
bool8 IsPlayerNotUsingAcroBikeOnBumpySlope(void);
|
||||
|
||||
#endif //GUARD_BIKE_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#define MB_01 0x01
|
||||
#define MB_TALL_GRASS 0x02
|
||||
#define MB_CAVE 0x08
|
||||
#define MB_0A 0x0A
|
||||
#define MB_RUNNING_DISALLOWED 0x0A
|
||||
#define MB_0B 0x0B
|
||||
#define MB_0C 0x0C
|
||||
#define MB_POND_WATER 0x10
|
||||
|
||||
@@ -61,7 +61,7 @@ void player_step(u8 direction, u16 newKeys, u16 heldKeys);
|
||||
bool32 PlayerIsMovingOnRockStairs(u8 direction);
|
||||
void UpdatePlayerAvatarTransitionState(void);
|
||||
void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender);
|
||||
void nullsub_24(u8 direction);
|
||||
void PlayerUseAcroBikeOnBumpySlope(u8 direction);
|
||||
u8 GetRSAvatarGraphicsIdByGender(u8 gender);
|
||||
|
||||
#endif //GUARD_FIELD_PLAYER_AVATAR_H
|
||||
|
||||
@@ -77,7 +77,7 @@ bool8 MetatileBehavior_IsSouthBlocked(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsShortGrass(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsHotSprings(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsWaterfall(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_ReturnFalse_9(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsFortreeBridge(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_UnusedReturnFalse(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_UnusedReturnFalse_2(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_UnusedReturnFalse_3(u8 metatileBehavior);
|
||||
@@ -104,7 +104,7 @@ bool8 MetatileBehavior_IsIsolatedHorizontalRail(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsVerticalRail(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsHorizontalRail(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsSeaweed(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsMB0A(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsRunningDisallowed(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_UnusedReturnFalse_9(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsBookshelf(u8 metatileBehavior);
|
||||
bool8 MetatileBehavior_IsPokeMartShelf(u8 metatileBehavior);
|
||||
|
||||
+101
-112
@@ -9,48 +9,48 @@
|
||||
#include "constants/map_types.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
static u8 GetMovePlayerOnBikeFuncId(u8 *, u16, u16);
|
||||
static void sub_80BD664(void);
|
||||
static u8 BikeCanFaceDIrectionOnRail(u8, u8);
|
||||
static u8 CheckNextTileForBikingCollision(u8);
|
||||
static u8 AdjustCollisionForBiking(struct ObjectEvent *, s16, s16, u8, u8);
|
||||
static u8 GetBikeTransitionId(u8 *, u16, u16);
|
||||
static void Bike_SetBikeStill(void);
|
||||
static u8 CanBikeFaceDirectionOnRail(u8 direction, u8 metatileBehavior);
|
||||
static u8 GetBikeCollision(u8);
|
||||
static u8 GetBikeCollisionAt(struct ObjectEvent *playerObjEvent, s16 x, s16 y, u8 direction, u8 metatileBehavior);
|
||||
static bool8 MetatileBehaviorForbidsBiking(u8);
|
||||
static void BikeFaceDirection(u8);
|
||||
static void BikeFaceDirectionAccountForRail(u8);
|
||||
static void BikeTryMoveFastInDirection(u8);
|
||||
static void BikeLetGravityTakeTheWheel(u8);
|
||||
static void BikeTryMoveInDirection(u8);
|
||||
static u8 GetBikeMoveCmd_0(u8 *, u16, u16);
|
||||
static u8 GetBikeMoveCmd_1(u8 *, u16, u16);
|
||||
static u8 GetBikeMoveCmd_2(u8 *, u16, u16);
|
||||
static void BikeTransition_FaceDirection(u8);
|
||||
static void BikeTransition_TurnDirection(u8);
|
||||
static void BikeTransition_MoveDirection(u8);
|
||||
static void BikeTransition_Downhill(u8);
|
||||
static void BikeTransition_Uphill(u8);
|
||||
static u8 BikeInputHandler_Normal(u8 *, u16, u16);
|
||||
static u8 BikeInputHandler_Turning(u8 *, u16, u16);
|
||||
static u8 BikeInputHandler_Slope(u8 *, u16, u16);
|
||||
|
||||
static void (*const sMovePlayerOnBikeFuncs[])(u8) =
|
||||
static void (*const sBikeTransitions[])(u8) =
|
||||
{
|
||||
BikeFaceDirection,
|
||||
BikeFaceDirectionAccountForRail,
|
||||
BikeTryMoveFastInDirection,
|
||||
BikeLetGravityTakeTheWheel,
|
||||
BikeTryMoveInDirection,
|
||||
[BIKE_TRANS_FACE_DIRECTION] = BikeTransition_FaceDirection,
|
||||
[BIKE_TRANS_TURNING] = BikeTransition_TurnDirection,
|
||||
[BIKE_TRANS_MOVE] = BikeTransition_MoveDirection,
|
||||
[BIKE_TRANS_DOWNHILL] = BikeTransition_Downhill,
|
||||
[BIKE_TRANS_UPHILL] = BikeTransition_Uphill,
|
||||
};
|
||||
|
||||
static u8 (*const sGetMovePlayerOnBikeFuncIdFuncs[])(u8 *, u16, u16) =
|
||||
static u8 (*const sBikeInputHandlers[])(u8 *, u16, u16) =
|
||||
{
|
||||
GetBikeMoveCmd_0,
|
||||
GetBikeMoveCmd_1,
|
||||
GetBikeMoveCmd_2,
|
||||
[BIKE_STATE_NORMAL] = BikeInputHandler_Normal,
|
||||
[BIKE_STATE_TURNING] = BikeInputHandler_Turning,
|
||||
[BIKE_STATE_SLOPE] = BikeInputHandler_Slope,
|
||||
};
|
||||
|
||||
void MovePlayerOnBike(u8 direction, u16 newKeys, u16 heldKeys)
|
||||
{
|
||||
sMovePlayerOnBikeFuncs[GetMovePlayerOnBikeFuncId(&direction, newKeys, heldKeys)](direction);
|
||||
sBikeTransitions[GetBikeTransitionId(&direction, newKeys, heldKeys)](direction);
|
||||
}
|
||||
|
||||
static u8 GetMovePlayerOnBikeFuncId(u8 *direction, u16 newKeys, u16 heldKeys)
|
||||
static u8 GetBikeTransitionId(u8 *direction, u16 newKeys, u16 heldKeys)
|
||||
{
|
||||
return sGetMovePlayerOnBikeFuncIdFuncs[gPlayerAvatar.acroBikeState](direction, newKeys, heldKeys);
|
||||
return sBikeInputHandlers[gPlayerAvatar.acroBikeState](direction, newKeys, heldKeys);
|
||||
}
|
||||
|
||||
static u8 GetBikeMoveCmd_0(u8 *direction_p, u16 newKeys, u16 heldKeys)
|
||||
static u8 BikeInputHandler_Normal(u8 *direction_p, u16 newKeys, u16 heldKeys)
|
||||
{
|
||||
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||
u8 direction = GetPlayerMovementDirection();
|
||||
@@ -60,64 +60,56 @@ static u8 GetBikeMoveCmd_0(u8 *direction_p, u16 newKeys, u16 heldKeys)
|
||||
{
|
||||
if (!JOY_HELD(B_BUTTON))
|
||||
{
|
||||
gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
|
||||
gPlayerAvatar.runningState = 2;
|
||||
gPlayerAvatar.acroBikeState = BIKE_STATE_SLOPE;
|
||||
gPlayerAvatar.runningState = MOVING;
|
||||
if (*direction_p < DIR_NORTH)
|
||||
return 3;
|
||||
return BIKE_TRANS_DOWNHILL;
|
||||
else
|
||||
return 4;
|
||||
return BIKE_TRANS_UPHILL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*direction_p != DIR_NONE)
|
||||
{
|
||||
gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
|
||||
gPlayerAvatar.runningState = 2;
|
||||
return 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto _080BD17E; // for matching purpose
|
||||
gPlayerAvatar.acroBikeState = BIKE_STATE_SLOPE;
|
||||
gPlayerAvatar.runningState = MOVING;
|
||||
return BIKE_TRANS_UPHILL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*direction_p == DIR_NONE)
|
||||
{
|
||||
*direction_p = direction;
|
||||
gPlayerAvatar.runningState = NOT_MOVING;
|
||||
return BIKE_TRANS_FACE_DIRECTION;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*direction_p == DIR_NONE)
|
||||
if (*direction_p != direction && gPlayerAvatar.runningState != MOVING)
|
||||
{
|
||||
_080BD17E:
|
||||
*direction_p = direction;
|
||||
gPlayerAvatar.runningState = 0;
|
||||
return 0;
|
||||
gPlayerAvatar.acroBikeState = BIKE_STATE_TURNING;
|
||||
gPlayerAvatar.newDirBackup = *direction_p;
|
||||
gPlayerAvatar.runningState = NOT_MOVING;
|
||||
return GetBikeTransitionId(direction_p, newKeys, heldKeys);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (*direction_p != direction && gPlayerAvatar.runningState != 2)
|
||||
{
|
||||
gPlayerAvatar.acroBikeState = ACRO_STATE_TURNING;
|
||||
gPlayerAvatar.newDirBackup = *direction_p;
|
||||
gPlayerAvatar.runningState = 0;
|
||||
return GetMovePlayerOnBikeFuncId(direction_p, newKeys, heldKeys);
|
||||
}
|
||||
else
|
||||
{
|
||||
gPlayerAvatar.runningState = 2;
|
||||
return 2;
|
||||
}
|
||||
gPlayerAvatar.runningState = MOVING;
|
||||
return BIKE_TRANS_MOVE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static u8 GetBikeMoveCmd_1(u8 *direction_p, UNUSED u16 newKeys, UNUSED u16 heldKeys)
|
||||
static u8 BikeInputHandler_Turning(u8 *direction_p, UNUSED u16 newKeys, UNUSED u16 heldKeys)
|
||||
{
|
||||
*direction_p = gPlayerAvatar.newDirBackup;
|
||||
gPlayerAvatar.runningState = 1;
|
||||
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
|
||||
sub_80BD664();
|
||||
return 1;
|
||||
gPlayerAvatar.runningState = TURN_DIRECTION;
|
||||
gPlayerAvatar.acroBikeState = BIKE_STATE_NORMAL;
|
||||
Bike_SetBikeStill();
|
||||
return BIKE_TRANS_TURNING;
|
||||
}
|
||||
|
||||
static u8 GetBikeMoveCmd_2(u8 *direction_p, u16 newKeys, u16 heldKeys)
|
||||
static u8 BikeInputHandler_Slope(u8 *direction_p, u16 newKeys, u16 heldKeys)
|
||||
{
|
||||
u8 direction = GetPlayerMovementDirection();
|
||||
u8 playerObjEventId = gPlayerAvatar.objectEventId;
|
||||
@@ -125,64 +117,61 @@ static u8 GetBikeMoveCmd_2(u8 *direction_p, u16 newKeys, u16 heldKeys)
|
||||
{
|
||||
if (*direction_p != direction)
|
||||
{
|
||||
gPlayerAvatar.acroBikeState = ACRO_STATE_TURNING;
|
||||
gPlayerAvatar.acroBikeState = BIKE_STATE_TURNING;
|
||||
gPlayerAvatar.newDirBackup = *direction_p;
|
||||
gPlayerAvatar.runningState = 0;
|
||||
return GetMovePlayerOnBikeFuncId(direction_p, newKeys, heldKeys);
|
||||
gPlayerAvatar.runningState = NOT_MOVING;
|
||||
return GetBikeTransitionId(direction_p, newKeys, heldKeys);
|
||||
}
|
||||
else
|
||||
{
|
||||
gPlayerAvatar.runningState = 2;
|
||||
gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
|
||||
gPlayerAvatar.runningState = MOVING;
|
||||
gPlayerAvatar.acroBikeState = BIKE_STATE_SLOPE;
|
||||
if (*direction_p < DIR_NORTH)
|
||||
return 3;
|
||||
return BIKE_TRANS_DOWNHILL;
|
||||
else
|
||||
return 4;
|
||||
return BIKE_TRANS_UPHILL;
|
||||
}
|
||||
}
|
||||
gPlayerAvatar.acroBikeState = BIKE_STATE_NORMAL;
|
||||
if (*direction_p == DIR_NONE)
|
||||
{
|
||||
*direction_p = direction;
|
||||
gPlayerAvatar.runningState = NOT_MOVING;
|
||||
return BIKE_TRANS_FACE_DIRECTION;
|
||||
}
|
||||
else
|
||||
{
|
||||
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
|
||||
if (*direction_p == DIR_NONE)
|
||||
{
|
||||
*direction_p = direction;
|
||||
gPlayerAvatar.runningState = 0;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
gPlayerAvatar.runningState = 2;
|
||||
return 2;
|
||||
}
|
||||
gPlayerAvatar.runningState = MOVING;
|
||||
return BIKE_TRANS_MOVE;
|
||||
}
|
||||
}
|
||||
|
||||
static void BikeFaceDirection(u8 direction)
|
||||
static void BikeTransition_FaceDirection(u8 direction)
|
||||
{
|
||||
PlayerFaceDirection(direction);
|
||||
}
|
||||
|
||||
static void BikeFaceDirectionAccountForRail(u8 direction)
|
||||
static void BikeTransition_TurnDirection(u8 direction)
|
||||
{
|
||||
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||
|
||||
if (!BikeCanFaceDIrectionOnRail(direction, playerObjEvent->currentMetatileBehavior))
|
||||
if (!CanBikeFaceDirectionOnRail(direction, playerObjEvent->currentMetatileBehavior))
|
||||
direction = playerObjEvent->movementDirection;
|
||||
PlayerFaceDirection(direction);
|
||||
}
|
||||
|
||||
static void BikeTryMoveFastInDirection(u8 direction)
|
||||
static void BikeTransition_MoveDirection(u8 direction)
|
||||
{
|
||||
struct ObjectEvent *playerObjEvent;
|
||||
|
||||
playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||
if (!BikeCanFaceDIrectionOnRail(direction, playerObjEvent->currentMetatileBehavior))
|
||||
if (!CanBikeFaceDirectionOnRail(direction, playerObjEvent->currentMetatileBehavior))
|
||||
{
|
||||
BikeFaceDirection(playerObjEvent->movementDirection);
|
||||
BikeTransition_FaceDirection(playerObjEvent->movementDirection);
|
||||
}
|
||||
else
|
||||
{
|
||||
u8 collision = CheckNextTileForBikingCollision(direction);
|
||||
u8 collision = GetBikeCollision(direction);
|
||||
|
||||
if (collision > COLLISION_NONE && collision <= COLLISION_ISOLATED_HORIZONTAL_RAIL)
|
||||
{
|
||||
@@ -204,9 +193,9 @@ static void BikeTryMoveFastInDirection(u8 direction)
|
||||
}
|
||||
}
|
||||
|
||||
static void BikeLetGravityTakeTheWheel(UNUSED u8 v)
|
||||
static void BikeTransition_Downhill(UNUSED u8 v)
|
||||
{
|
||||
u8 collision = CheckNextTileForBikingCollision(DIR_SOUTH);
|
||||
u8 collision = GetBikeCollision(DIR_SOUTH);
|
||||
|
||||
if (collision == COLLISION_NONE)
|
||||
sub_805C164(DIR_SOUTH);
|
||||
@@ -214,13 +203,13 @@ static void BikeLetGravityTakeTheWheel(UNUSED u8 v)
|
||||
PlayerJumpLedge(DIR_SOUTH);
|
||||
}
|
||||
|
||||
static void BikeTryMoveInDirection(u8 direction)
|
||||
static void BikeTransition_Uphill(u8 direction)
|
||||
{
|
||||
if (CheckNextTileForBikingCollision(direction) == COLLISION_NONE)
|
||||
if (GetBikeCollision(direction) == COLLISION_NONE)
|
||||
PlayerGoSpeed1(direction);
|
||||
}
|
||||
|
||||
static u8 CheckNextTileForBikingCollision(u8 direction)
|
||||
static u8 GetBikeCollision(u8 direction)
|
||||
{
|
||||
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||
s16 x, y;
|
||||
@@ -230,10 +219,10 @@ static u8 CheckNextTileForBikingCollision(u8 direction)
|
||||
y = playerObjEvent->currentCoords.y;
|
||||
MoveCoords(direction, &x, &y);
|
||||
metatileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||
return AdjustCollisionForBiking(playerObjEvent, x, y, direction, metatileBehavior);
|
||||
return GetBikeCollisionAt(playerObjEvent, x, y, direction, metatileBehavior);
|
||||
}
|
||||
|
||||
static u8 AdjustCollisionForBiking(struct ObjectEvent *playerObjEvent, s16 x, s16 y, u8 direction, u8 metatileBehavior)
|
||||
static u8 GetBikeCollisionAt(struct ObjectEvent *playerObjEvent, s16 x, s16 y, u8 direction, u8 metatileBehavior)
|
||||
{
|
||||
u8 retVal = CheckForObjectEventCollision(playerObjEvent, x, y, direction, metatileBehavior);
|
||||
|
||||
@@ -248,7 +237,7 @@ static u8 AdjustCollisionForBiking(struct ObjectEvent *playerObjEvent, s16 x, s1
|
||||
return retVal;
|
||||
}
|
||||
|
||||
bool8 sub_80BD460(u8 r0)
|
||||
bool8 RS_IsRunningDisallowed(u8 r0)
|
||||
{
|
||||
if (MetatileBehaviorForbidsBiking(r0))
|
||||
return TRUE;
|
||||
@@ -270,16 +259,16 @@ bool32 IsRunningDisallowed(u8 metatileBehavior)
|
||||
|
||||
static bool8 MetatileBehaviorForbidsBiking(u8 metatileBehavior)
|
||||
{
|
||||
if (MetatileBehavior_IsMB0A(metatileBehavior))
|
||||
if (MetatileBehavior_IsRunningDisallowed(metatileBehavior))
|
||||
return TRUE;
|
||||
if (!MetatileBehavior_ReturnFalse_9(metatileBehavior))
|
||||
if (!MetatileBehavior_IsFortreeBridge(metatileBehavior))
|
||||
return FALSE;
|
||||
if (PlayerGetZCoord() & 1)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool8 BikeCanFaceDIrectionOnRail(u8 direction, u8 metatileBehavior)
|
||||
static bool8 CanBikeFaceDirectionOnRail(u8 direction, u8 metatileBehavior)
|
||||
{
|
||||
if (direction == DIR_EAST || direction == DIR_WEST)
|
||||
{
|
||||
@@ -294,7 +283,7 @@ static bool8 BikeCanFaceDIrectionOnRail(u8 direction, u8 metatileBehavior)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 MetatileAtPlayerPositionForbidsBiking(void)
|
||||
bool8 IsBikingDisallowedByPlayer(void)
|
||||
{
|
||||
s16 x, y;
|
||||
u8 metatileBehavior;
|
||||
@@ -309,9 +298,9 @@ bool8 MetatileAtPlayerPositionForbidsBiking(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool8 player_should_look_direction_be_enforced_upon_movement(void)
|
||||
bool8 IsPlayerNotUsingAcroBikeOnBumpySlope(void)
|
||||
{
|
||||
if (TestPlayerAvatarFlags(PLAYER_AVATAR_STATE_UNDERWATER))
|
||||
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE))
|
||||
{
|
||||
if (MetatileBehavior_IsBumpySlope(gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior))
|
||||
return FALSE;
|
||||
@@ -319,7 +308,7 @@ bool8 player_should_look_direction_be_enforced_upon_movement(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void StartTransitionToFlipBikeState(u8 flags)
|
||||
void GetOnOffBike(u8 flags)
|
||||
{
|
||||
gBikeCameraAheadPanback = FALSE;
|
||||
if (gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
|
||||
@@ -339,11 +328,11 @@ void StartTransitionToFlipBikeState(u8 flags)
|
||||
}
|
||||
}
|
||||
|
||||
void InitPlayerAvatarBikeState(u32 directionHistory, u32 abStartSelectHistory)
|
||||
void BikeClearState(u32 directionHistory, u32 abStartSelectHistory)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
|
||||
gPlayerAvatar.acroBikeState = BIKE_STATE_NORMAL;
|
||||
gPlayerAvatar.newDirBackup = 0;
|
||||
gPlayerAvatar.bikeFrameCounter = 0;
|
||||
gPlayerAvatar.bikeSpeed = SPEED_STANDING;
|
||||
@@ -360,7 +349,7 @@ void Bike_UpdateBikeCounterSpeed(u8 counter)
|
||||
gPlayerAvatar.bikeSpeed = counter + (gPlayerAvatar.bikeFrameCounter >> 1);
|
||||
}
|
||||
|
||||
static void sub_80BD664(void)
|
||||
static void Bike_SetBikeStill(void)
|
||||
{
|
||||
gPlayerAvatar.bikeFrameCounter = 0;
|
||||
gPlayerAvatar.bikeSpeed = SPEED_STANDING;
|
||||
@@ -368,16 +357,16 @@ static void sub_80BD664(void)
|
||||
|
||||
s16 GetPlayerSpeed(void)
|
||||
{
|
||||
s16 exp[] = { 1, 2, 4 };
|
||||
s16 machBikeSpeeds[] = { SPEED_NORMAL, SPEED_FAST, SPEED_FASTEST };
|
||||
|
||||
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE)
|
||||
return exp[gPlayerAvatar.bikeFrameCounter];
|
||||
return machBikeSpeeds[gPlayerAvatar.bikeFrameCounter];
|
||||
else if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE)
|
||||
return 3;
|
||||
return SPEED_FASTER;
|
||||
else if (gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_DASH))
|
||||
return 2;
|
||||
return SPEED_FAST;
|
||||
else
|
||||
return 1;
|
||||
return SPEED_NORMAL;
|
||||
}
|
||||
|
||||
void Bike_HandleBumpySlopeJump(void)
|
||||
@@ -391,8 +380,8 @@ void Bike_HandleBumpySlopeJump(void)
|
||||
tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||
if (MetatileBehavior_IsBumpySlope(tileBehavior))
|
||||
{
|
||||
gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
|
||||
nullsub_24(GetPlayerMovementDirection());
|
||||
gPlayerAvatar.acroBikeState = BIKE_STATE_SLOPE;
|
||||
PlayerUseAcroBikeOnBumpySlope(GetPlayerMovementDirection());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -720,7 +720,7 @@ static void PlayerAvatarTransition_Bike(struct ObjectEvent * playerObjEvent)
|
||||
{
|
||||
QuestLogTryRecordPlayerAvatarGfxTransition(QL_PLAYER_GFX_BIKE);
|
||||
QuestLogCallUpdatePlayerSprite(QL_PLAYER_GFX_BIKE);
|
||||
InitPlayerAvatarBikeState(0, 0);
|
||||
BikeClearState(0, 0);
|
||||
}
|
||||
|
||||
static void PlayerAvatarTransition_Surfing(struct ObjectEvent * playerObjEvent)
|
||||
@@ -913,7 +913,7 @@ void HandleEnforcedLookDirectionOnPlayerStopMoving(void)
|
||||
{
|
||||
if (gPlayerAvatar.tileTransitionState == T_TILE_CENTER || gPlayerAvatar.tileTransitionState == T_NOT_MOVING)
|
||||
{
|
||||
if (player_should_look_direction_be_enforced_upon_movement())
|
||||
if (IsPlayerNotUsingAcroBikeOnBumpySlope())
|
||||
PlayerForceSetHeldMovement(GetFaceDirectionMovementAction(gObjectEvents[gPlayerAvatar.objectEventId].facingDirection));
|
||||
}
|
||||
}
|
||||
@@ -1346,12 +1346,13 @@ void StartPlayerAvatarFishAnim(u8 direction)
|
||||
QuestLogCallUpdatePlayerSprite(QL_PLAYER_GFX_FISH);
|
||||
}
|
||||
|
||||
void nullsub_24(u8 direction)
|
||||
// Stubbed from R/S
|
||||
void PlayerUseAcroBikeOnBumpySlope(u8 direction)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void nullsub_25(void)
|
||||
static void SetPlayerAvatarWatering(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -263,7 +263,7 @@ void FieldUseFunc_MachBike(u8 taskId)
|
||||
|| MetatileBehavior_IsIsolatedVerticalRail(behavior) == TRUE
|
||||
|| MetatileBehavior_IsIsolatedHorizontalRail(behavior) == TRUE)
|
||||
DisplayItemMessageInCurrentContext(taskId, gTasks[taskId].data[3], 2, gUnknown_8416451);
|
||||
else if (Overworld_IsBikingAllowed() == TRUE && !MetatileAtPlayerPositionForbidsBiking())
|
||||
else if (Overworld_IsBikingAllowed() == TRUE && !IsBikingDisallowedByPlayer())
|
||||
{
|
||||
sItemUseOnFieldCB = ItemUseOnFieldCB_Bicycle;
|
||||
sub_80A103C(taskId);
|
||||
@@ -276,7 +276,7 @@ static void ItemUseOnFieldCB_Bicycle(u8 taskId)
|
||||
{
|
||||
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
|
||||
PlaySE(SE_BIKE_BELL);
|
||||
StartTransitionToFlipBikeState(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE);
|
||||
GetOnOffBike(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE);
|
||||
ClearPlayerHeldMovementAndUnfreezeObjectEvents();
|
||||
ScriptContext2_Disable();
|
||||
DestroyTask(taskId);
|
||||
|
||||
@@ -598,7 +598,7 @@ bool8 MetatileBehavior_IsWaterfall(u8 metatileBehavior)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MetatileBehavior_ReturnFalse_9(u8 metatileBehavior) { return FALSE; }
|
||||
bool8 MetatileBehavior_IsFortreeBridge(u8 metatileBehavior) { return FALSE; }
|
||||
bool8 MetatileBehavior_UnusedReturnFalse(u8 metatileBehavior){ return FALSE; }
|
||||
bool8 MetatileBehavior_UnusedReturnFalse_2(u8 metatileBehavior) { return FALSE; }
|
||||
bool8 MetatileBehavior_UnusedReturnFalse_3(u8 metatileBehavior) { return FALSE; }
|
||||
@@ -691,9 +691,9 @@ bool8 MetatileBehavior_IsSeaweed(u8 metatileBehavior)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 MetatileBehavior_IsMB0A(u8 metatileBehavior)
|
||||
bool8 MetatileBehavior_IsRunningDisallowed(u8 metatileBehavior)
|
||||
{
|
||||
if(metatileBehavior == MB_0A)
|
||||
if(metatileBehavior == MB_RUNNING_DISALLOWED)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
@@ -69,7 +69,7 @@ static void QL_GfxTransition_Bike(void)
|
||||
QL_SetObjectGraphicsId(objectEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_GFX_BIKE));
|
||||
ObjectEventTurn(objectEvent, objectEvent->movementDirection);
|
||||
SetPlayerAvatarStateMask(PLAYER_AVATAR_FLAG_MACH_BIKE);
|
||||
InitPlayerAvatarBikeState(0, 0);
|
||||
BikeClearState(0, 0);
|
||||
}
|
||||
|
||||
static void QL_GfxTransition_Fish(void)
|
||||
|
||||
Reference in New Issue
Block a user