diff options
Diffstat (limited to 'src/bike.c')
-rw-r--r-- | src/bike.c | 132 |
1 files changed, 66 insertions, 66 deletions
diff --git a/src/bike.c b/src/bike.c index fad61ffab..b265a31bb 100644 --- a/src/bike.c +++ b/src/bike.c @@ -46,7 +46,7 @@ static void Bike_UpdateDirTimerHistory(u8); static void Bike_UpdateABStartSelectHistory(u8); static u8 Bike_DPadToDirection(u16); static u8 GetBikeCollision(u8); -static u8 GetBikeCollisionAt(struct EventObject *, s16, s16, u8, u8); +static u8 GetBikeCollisionAt(struct ObjectEvent *, s16, s16, u8, u8); static bool8 IsRunningDisallowedByMetatile(u8); static void Bike_TryAdvanceCyclingRoadCollisions(); static u8 CanBikeFaceDirOnMetatile(u8, u8); @@ -186,31 +186,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 { @@ -226,7 +226,7 @@ static void MachBikeTransition_TrySpeedUp(u8 direction) { // we hit a solid object that is not a ledge, so perform the collision. Bike_SetBikeStill(); - if (collision == COLLISION_EVENT_OBJECT && IsPlayerCollidingWithFarawayIslandMew(direction)) + if (collision == COLLISION_OBJECT_EVENT && IsPlayerCollidingWithFarawayIslandMew(direction)) PlayerOnBikeCollideWithFarawayIslandMew(direction); else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE) PlayerOnBikeCollide(direction); @@ -261,7 +261,7 @@ static void MachBikeTransition_TrySlowDown(u8 direction) else { Bike_SetBikeStill(); - if (collision == COLLISION_EVENT_OBJECT && IsPlayerCollidingWithFarawayIslandMew(direction)) + if (collision == COLLISION_OBJECT_EVENT && IsPlayerCollidingWithFarawayIslandMew(direction)) PlayerOnBikeCollideWithFarawayIslandMew(direction); else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE) PlayerOnBikeCollide(direction); @@ -366,10 +366,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) @@ -378,7 +378,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; @@ -413,15 +413,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; @@ -460,15 +460,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; @@ -514,10 +514,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); } @@ -535,21 +535,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 = GetBikeCollision(direction); @@ -557,7 +557,7 @@ static void AcroBikeTransition_Moving(u8 direction) { if (collision == COLLISION_LEDGE_JUMP) PlayerJumpLedge(direction); - else if (collision == COLLISION_EVENT_OBJECT && IsPlayerCollidingWithFarawayIslandMew(direction)) + else if (collision == COLLISION_OBJECT_EVENT && IsPlayerCollidingWithFarawayIslandMew(direction)) PlayerOnBikeCollideWithFarawayIslandMew(direction); else if (collision < COLLISION_STOP_SURFING || collision > COLLISION_ROTATING_GATE) PlayerOnBikeCollide(direction); @@ -570,48 +570,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 = GetBikeCollision(direction); @@ -641,7 +641,7 @@ static void AcroBikeTransition_WheelieHoppingMoving(u8 direction) static void AcroBikeTransition_SideJump(u8 direction) { u8 collision; - struct EventObject *playerEventObj; + struct ObjectEvent *playerObjEvent; collision = GetBikeCollision(direction); if (collision) @@ -659,9 +659,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); } @@ -673,11 +673,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 = GetBikeCollision(direction); @@ -693,7 +693,7 @@ static void AcroBikeTransition_WheelieMoving(u8 direction) } else if (collision < COLLISION_STOP_SURFING) { - if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior)) + if (MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior)) PlayerIdleWheelie(direction); else sub_808B980(direction); //hit wall? @@ -707,11 +707,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 = GetBikeCollision(direction); @@ -727,7 +727,7 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction) } else if (collision < COLLISION_STOP_SURFING) { - if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior)) + if (MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior)) PlayerIdleWheelie(direction); else sub_808B980(direction); //hit wall? @@ -741,11 +741,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 = GetBikeCollision(direction); @@ -868,19 +868,19 @@ static u8 Bike_DPadToDirection(u16 heldKeys) static u8 GetBikeCollision(u8 direction) { u8 metatitleBehavior; - struct EventObject *playerEventObj = &gEventObjects[gPlayerAvatar.eventObjectId]; - s16 x = playerEventObj->currentCoords.x; - s16 y = playerEventObj->currentCoords.y; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; + s16 x = playerObjEvent->currentCoords.x; + s16 y = playerObjEvent->currentCoords.y; MoveCoords(direction, &x, &y); metatitleBehavior = MapGridGetMetatileBehaviorAt(x, y); - return GetBikeCollisionAt(playerEventObj, x, y, direction, metatitleBehavior); + return GetBikeCollisionAt(playerObjEvent, x, y, direction, metatitleBehavior); } -static u8 GetBikeCollisionAt(struct EventObject *eventObject, s16 x, s16 y, u8 direction, u8 metatitleBehavior) +static u8 GetBikeCollisionAt(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 > COLLISION_EVENT_OBJECT) + if (collision > COLLISION_OBJECT_EVENT) return collision; if (collision == COLLISION_NONE && IsRunningDisallowedByMetatile(metatitleBehavior)) @@ -966,7 +966,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; |