summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcbt6 <91667135+cbt6@users.noreply.github.com>2021-11-03 02:51:30 +0800
committercbt6 <91667135+cbt6@users.noreply.github.com>2021-11-03 02:51:30 +0800
commit3556024a06b3d1c973cdd0ce64623652c5e0e5b8 (patch)
tree5d36d80bd31d41b690f38a43a57599dd9cc410bc /src
parent3f5f057ebeebc7330af453fbc445e021ac64cbe7 (diff)
Distinguish clearly the two enums related to speed
Diffstat (limited to 'src')
-rw-r--r--src/bike.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/bike.c b/src/bike.c
index 470b6412f..fd794a3c7 100644
--- a/src/bike.c
+++ b/src/bike.c
@@ -108,7 +108,7 @@ static u8 (*const sAcroBikeInputHandlers[])(u8 *, u16, u16) =
};
// used with bikeFrameCounter from mach bike
-static const u16 sMachBikeSpeeds[] = {SPEED_NORMAL, SPEED_FAST, SPEED_FASTEST};
+static const u16 sMachBikeSpeeds[] = {BIKE_SPEED_NORMAL, BIKE_SPEED_FAST, BIKE_SPEED_FASTEST};
// this is a list of timers to compare against later, terminated with 0. the only timer being compared against is 4 frames in this list.
static const u8 sAcroBikeJumpTimerList[] = {4, 0};
@@ -147,7 +147,7 @@ static u8 GetMachBikeTransition(u8 *dirTraveling)
if (*dirTraveling == 0)
{
*dirTraveling = direction; // update the direction, since below we either faced a direction or we started moving.
- if (gPlayerAvatar.bikeSpeed == SPEED_STANDING)
+ if (gPlayerAvatar.bikeSpeed == BIKE_SPEED_STANDING)
{
gPlayerAvatar.runningState = NOT_MOVING;
return MACH_TRANS_FACE_DIRECTION;
@@ -159,7 +159,7 @@ static u8 GetMachBikeTransition(u8 *dirTraveling)
// we need to check if the last traveled direction changed from the new direction as well as ensuring that we dont update the state while the player is moving: see the else check.
if (*dirTraveling != direction && gPlayerAvatar.runningState != MOVING)
{
- if (gPlayerAvatar.bikeSpeed != SPEED_STANDING)
+ if (gPlayerAvatar.bikeSpeed != BIKE_SPEED_STANDING)
{
*dirTraveling = direction; // implement the new direction
gPlayerAvatar.runningState = MOVING;
@@ -246,7 +246,7 @@ static void MachBikeTransition_TrySlowDown(u8 direction)
{
u8 collision;
- if (gPlayerAvatar.bikeSpeed != SPEED_STANDING)
+ if (gPlayerAvatar.bikeSpeed != BIKE_SPEED_STANDING)
gPlayerAvatar.bikeFrameCounter = --gPlayerAvatar.bikeSpeed;
collision = GetBikeCollision(direction);
@@ -306,7 +306,7 @@ static u8 AcroBikeHandleInputNormal(u8 *newDirection, u16 newKeys, u16 heldKeys)
return ACRO_TRANS_FACE_DIRECTION;
}
}
- if (*newDirection == direction && (heldKeys & B_BUTTON) && gPlayerAvatar.bikeSpeed == SPEED_STANDING)
+ if (*newDirection == direction && (heldKeys & B_BUTTON) && gPlayerAvatar.bikeSpeed == BIKE_SPEED_STANDING)
{
gPlayerAvatar.bikeSpeed++;
gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_MOVING;
@@ -342,7 +342,7 @@ static u8 AcroBikeHandleInputTurning(u8 *newDirection, u16 newKeys, u16 heldKeys
if (*newDirection == AcroBike_GetJumpDirection())
{
Bike_SetBikeStill(); // Bike_SetBikeStill sets speed to standing, but the next line immediately overrides it. could have just reset acroBikeState to 0 here instead of wasting a jump.
- gPlayerAvatar.bikeSpeed = SPEED_NORMAL;
+ gPlayerAvatar.bikeSpeed = BIKE_SPEED_NORMAL;
if (*newDirection == GetOppositeDirection(direction))
{
// do a turn jump.
@@ -775,7 +775,7 @@ static void AcroBike_TryHistoryUpdate(u16 newKeys, u16 heldKeys) // newKeys is u
else
{
Bike_UpdateDirTimerHistory(direction);
- gPlayerAvatar.bikeSpeed = SPEED_STANDING;
+ gPlayerAvatar.bikeSpeed = BIKE_SPEED_STANDING;
}
direction = heldKeys & (A_BUTTON | B_BUTTON | SELECT_BUTTON | START_BUTTON); // directions is reused for some reason.
@@ -787,7 +787,7 @@ static void AcroBike_TryHistoryUpdate(u16 newKeys, u16 heldKeys) // newKeys is u
else
{
Bike_UpdateABStartSelectHistory(direction);
- gPlayerAvatar.bikeSpeed = SPEED_STANDING;
+ gPlayerAvatar.bikeSpeed = BIKE_SPEED_STANDING;
}
}
@@ -994,7 +994,7 @@ void BikeClearState(int newDirHistory, int newAbStartHistory)
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
gPlayerAvatar.newDirBackup = DIR_NONE;
gPlayerAvatar.bikeFrameCounter = 0;
- gPlayerAvatar.bikeSpeed = SPEED_STANDING;
+ gPlayerAvatar.bikeSpeed = BIKE_SPEED_STANDING;
gPlayerAvatar.directionHistory = newDirHistory;
gPlayerAvatar.abStartSelectHistory = newAbStartHistory;
@@ -1014,7 +1014,7 @@ void Bike_UpdateBikeCounterSpeed(u8 counter)
static void Bike_SetBikeStill(void)
{
gPlayerAvatar.bikeFrameCounter = 0;
- gPlayerAvatar.bikeSpeed = SPEED_STANDING;
+ gPlayerAvatar.bikeSpeed = BIKE_SPEED_STANDING;
}
s16 GetPlayerSpeed(void)
@@ -1027,11 +1027,11 @@ s16 GetPlayerSpeed(void)
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE)
return machSpeeds[gPlayerAvatar.bikeFrameCounter];
else if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_ACRO_BIKE)
- return SPEED_FASTER;
+ return BIKE_SPEED_FASTER;
else if (gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_DASH))
- return SPEED_FAST;
+ return BIKE_SPEED_FAST;
else
- return SPEED_NORMAL;
+ return BIKE_SPEED_NORMAL;
}
void Bike_HandleBumpySlopeJump(void)