summaryrefslogtreecommitdiff
path: root/src/bike.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bike.c')
-rw-r--r--src/bike.c124
1 files changed, 62 insertions, 62 deletions
diff --git a/src/bike.c b/src/bike.c
index 1f5d45418..c03926168 100644
--- a/src/bike.c
+++ b/src/bike.c
@@ -55,7 +55,7 @@ static void Bike_UpdateDirTimerHistory(u8);
static void Bike_UpdateABStartSelectHistory(u8);
static u8 Bike_DPadToDirection(u16);
static u8 get_some_collision(u8);
-static u8 Bike_CheckCollisionTryAdvanceCollisionCount(struct EventObject *, s16, s16, u8, u8);
+static u8 Bike_CheckCollisionTryAdvanceCollisionCount(struct ObjectEvent *, s16, s16, u8, u8);
static bool8 IsRunningDisallowedByMetatile(u8);
static void Bike_TryAdvanceCyclingRoadCollisions();
static u8 CanBikeFaceDirOnMetatile(u8, u8);
@@ -202,31 +202,31 @@ static void MachBikeTransition_FaceDirection(u8 direction)
static void MachBikeTransition_TurnDirection(u8 direction)
{
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior))
+ if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior))
{
PlayerTurnInPlace(direction);
Bike_SetBikeStill();
}
else
{
- MachBikeTransition_FaceDirection(playerEventObj->facingDirection);
+ MachBikeTransition_FaceDirection(playerObjEvent->facingDirection);
}
}
static void MachBikeTransition_TrySpeedUp(u8 direction)
{
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
u8 collision;
- if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == FALSE)
+ if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == FALSE)
{
// we cannot go forward, so either slow down or, if we are stopped, idle face direction.
if (gPlayerAvatar.bikeSpeed)
- MachBikeTransition_TrySlowDown(playerEventObj->movementDirection);
+ MachBikeTransition_TrySlowDown(playerObjEvent->movementDirection);
else
- MachBikeTransition_FaceDirection(playerEventObj->movementDirection);
+ MachBikeTransition_FaceDirection(playerObjEvent->movementDirection);
}
else
{
@@ -386,10 +386,10 @@ static u8 AcroBikeHandleInputTurning(u8 *newDirection, u16 newKeys, u16 heldKeys
static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16 heldKeys)
{
u8 direction;
- struct EventObject *playerEventObj;
+ struct ObjectEvent *playerObjEvent;
direction = GetPlayerMovementDirection();
- playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
gPlayerAvatar.runningState = NOT_MOVING;
if (heldKeys & B_BUTTON)
@@ -398,7 +398,7 @@ static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16
{
// B button was released.
gPlayerAvatar.bikeFrameCounter = 0;
- if (!MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior))
+ if (!MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior))
{
// Go back to normal on flat ground
*newDirection = direction;
@@ -433,15 +433,15 @@ static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16
static u8 AcroBikeHandleInputBunnyHop(u8 *newDirection, u16 newKeys, u16 heldKeys)
{
u8 direction;
- struct EventObject *playerEventObj;
+ struct ObjectEvent *playerObjEvent;
direction = GetPlayerMovementDirection();
- playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
if (!(heldKeys & B_BUTTON))
{
// B button was released
Bike_SetBikeStill();
- if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior))
+ if (MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior))
{
// even though B was released, dont undo the wheelie on the bumpy slope.
gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
@@ -480,15 +480,15 @@ static u8 AcroBikeHandleInputBunnyHop(u8 *newDirection, u16 newKeys, u16 heldKey
static u8 AcroBikeHandleInputWheelieMoving(u8 *newDirection, u16 newKeys, u16 heldKeys)
{
u8 direction;
- struct EventObject *playerEventObj;
+ struct ObjectEvent *playerObjEvent;
direction = GetPlayerFacingDirection();
- playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
if (!(heldKeys & B_BUTTON))
{
// we were moving on a wheelie, but we let go while moving. reset bike still status
Bike_SetBikeStill();
- if (!MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior))
+ if (!MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior))
{
// we let go of B and arent on a bumpy slope, set state to normal because now we need to handle this
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
@@ -534,10 +534,10 @@ static u8 AcroBikeHandleInputWheelieMoving(u8 *newDirection, u16 newKeys, u16 he
static u8 AcroBikeHandleInputSidewaysJump(u8 *ptr, u16 newKeys, u16 heldKeys)
{
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- playerEventObj->facingDirectionLocked = 0;
- SetEventObjectDirection(playerEventObj, playerEventObj->facingDirection);
+ playerObjEvent->facingDirectionLocked = 0;
+ SetObjectEventDirection(playerObjEvent, playerObjEvent->facingDirection);
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
return CheckMovementInputAcroBike(ptr, newKeys, heldKeys);
}
@@ -555,21 +555,21 @@ static void AcroBikeTransition_FaceDirection(u8 direction)
static void AcroBikeTransition_TurnDirection(u8 direction)
{
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
- direction = playerEventObj->movementDirection;
+ if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
+ direction = playerObjEvent->movementDirection;
PlayerFaceDirection(direction);
}
static void AcroBikeTransition_Moving(u8 direction)
{
u8 collision;
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
{
- AcroBikeTransition_FaceDirection(playerEventObj->movementDirection);
+ AcroBikeTransition_FaceDirection(playerObjEvent->movementDirection);
return;
}
collision = get_some_collision(direction);
@@ -588,48 +588,48 @@ static void AcroBikeTransition_Moving(u8 direction)
static void AcroBikeTransition_NormalToWheelie(u8 direction)
{
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
- direction = playerEventObj->movementDirection;
+ if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
+ direction = playerObjEvent->movementDirection;
PlayerStartWheelie(direction);
}
static void AcroBikeTransition_WheelieToNormal(u8 direction)
{
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
- direction = playerEventObj->movementDirection;
+ if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
+ direction = playerObjEvent->movementDirection;
PlayerEndWheelie(direction);
}
static void AcroBikeTransition_WheelieIdle(u8 direction)
{
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
- direction = playerEventObj->movementDirection;
+ if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
+ direction = playerObjEvent->movementDirection;
PlayerIdleWheelie(direction);
}
static void AcroBikeTransition_WheelieHoppingStanding(u8 direction)
{
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
- direction = playerEventObj->movementDirection;
+ if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
+ direction = playerObjEvent->movementDirection;
PlayerStandingHoppingWheelie(direction);
}
static void AcroBikeTransition_WheelieHoppingMoving(u8 direction)
{
u8 collision;
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
{
- AcroBikeTransition_WheelieHoppingStanding(playerEventObj->movementDirection);
+ AcroBikeTransition_WheelieHoppingStanding(playerObjEvent->movementDirection);
return;
}
collision = get_some_collision(direction);
@@ -659,7 +659,7 @@ static void AcroBikeTransition_WheelieHoppingMoving(u8 direction)
static void AcroBikeTransition_SideJump(u8 direction)
{
u8 collision;
- struct EventObject *playerEventObj;
+ struct ObjectEvent *playerObjEvent;
collision = get_some_collision(direction);
if (collision != 0)
@@ -677,9 +677,9 @@ static void AcroBikeTransition_SideJump(u8 direction)
return;
}
}
- playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
PlaySE(SE_JITE_PYOKO);
- playerEventObj->facingDirectionLocked = 1;
+ playerObjEvent->facingDirectionLocked = 1;
PlayerSetAnimId(GetJumpMovementAction(direction), 2);
}
@@ -691,11 +691,11 @@ static void AcroBikeTransition_TurnJump(u8 direction)
static void AcroBikeTransition_WheelieMoving(u8 direction)
{
u8 collision;
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
{
- PlayerIdleWheelie(playerEventObj->movementDirection);
+ PlayerIdleWheelie(playerObjEvent->movementDirection);
return;
}
collision = get_some_collision(direction);
@@ -711,7 +711,7 @@ static void AcroBikeTransition_WheelieMoving(u8 direction)
}
else if (collision <= 4)
{
- if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior))
+ if (MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior))
PlayerIdleWheelie(direction);
else
sub_80595DC(direction); //hit wall?
@@ -725,11 +725,11 @@ static void AcroBikeTransition_WheelieMoving(u8 direction)
static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
{
u8 collision;
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
{
- PlayerStartWheelie(playerEventObj->movementDirection);
+ PlayerStartWheelie(playerObjEvent->movementDirection);
return;
}
collision = get_some_collision(direction);
@@ -745,7 +745,7 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
}
else if (collision <= 4)
{
- if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior))
+ if (MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior))
PlayerIdleWheelie(direction);
else
sub_80595DC(direction); //hit wall?
@@ -759,11 +759,11 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
static void AcroBikeTransition_WheelieLoweringMoving(u8 direction)
{
u8 collision;
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
{
- PlayerEndWheelie(playerEventObj->movementDirection);
+ PlayerEndWheelie(playerObjEvent->movementDirection);
return;
}
collision = get_some_collision(direction);
@@ -888,18 +888,18 @@ static u8 get_some_collision(u8 direction)
s16 x;
s16 y;
u8 metatitleBehavior;
- struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId];
+ struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
- x = playerEventObj->currentCoords.x;
- y = playerEventObj->currentCoords.y;
+ x = playerObjEvent->currentCoords.x;
+ y = playerObjEvent->currentCoords.y;
MoveCoords(direction, &x, &y);
metatitleBehavior = MapGridGetMetatileBehaviorAt(x, y);
- return Bike_CheckCollisionTryAdvanceCollisionCount(playerEventObj, x, y, direction, metatitleBehavior);
+ return Bike_CheckCollisionTryAdvanceCollisionCount(playerObjEvent, x, y, direction, metatitleBehavior);
}
-static u8 Bike_CheckCollisionTryAdvanceCollisionCount(struct EventObject *eventObject, s16 x, s16 y, u8 direction, u8 metatitleBehavior)
+static u8 Bike_CheckCollisionTryAdvanceCollisionCount(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 direction, u8 metatitleBehavior)
{
- u8 collision = CheckForEventObjectCollision(eventObject, x, y, direction, metatitleBehavior);
+ u8 collision = CheckForObjectEventCollision(objectEvent, x, y, direction, metatitleBehavior);
if (collision > 4)
return collision;
@@ -987,7 +987,7 @@ bool8 IsBikingDisallowedByPlayer(void)
bool8 player_should_look_direction_be_enforced_upon_movement(void)
{
- if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE) != FALSE && MetatileBehavior_IsBumpySlope(gEventObjects[gPlayerAvatar.eventObjectId].currentMetatileBehavior) != FALSE)
+ if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE) != FALSE && MetatileBehavior_IsBumpySlope(gObjectEvents[gPlayerAvatar.objectEventId].currentMetatileBehavior) != FALSE)
return FALSE;
else
return TRUE;