summaryrefslogtreecommitdiff
path: root/src/bike.c
diff options
context:
space:
mode:
authorMarcus Huderle <huderlem@gmail.com>2018-05-23 09:26:22 -0500
committerMarcus Huderle <huderlem@gmail.com>2018-05-23 09:26:22 -0500
commit22e6e3532900b2470d0134f1347981d77828b22c (patch)
treed8cea366e68eca40bac0a6c0edf0c85a27eda520 /src/bike.c
parent612f62725a2ed3be07f688f867aca3eb7579ab19 (diff)
Label all of MapObject struct members, and ground effect flags
Diffstat (limited to 'src/bike.c')
-rw-r--r--src/bike.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/bike.c b/src/bike.c
index 28439e6bb..25419c6cf 100644
--- a/src/bike.c
+++ b/src/bike.c
@@ -199,14 +199,14 @@ static void MachBikeTransition_TurnDirection(u8 direction)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E))
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior))
{
PlayerTurnInPlace(direction);
Bike_SetBikeStill();
}
else
{
- MachBikeTransition_FaceDirection(playerMapObj->mapobj_unk_18);
+ MachBikeTransition_FaceDirection(playerMapObj->facingDirection);
}
}
@@ -215,13 +215,13 @@ static void MachBikeTransition_TrySpeedUp(u8 direction)
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
u8 collision;
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == FALSE)
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == FALSE)
{
// we cannot go forward, so either slow down or, if we are stopped, idle face direction.
if (gPlayerAvatar.bikeSpeed)
- MachBikeTransition_TrySlowDown(playerMapObj->placeholder18);
+ MachBikeTransition_TrySlowDown(playerMapObj->movementDirection);
else
- MachBikeTransition_FaceDirection(playerMapObj->placeholder18);
+ MachBikeTransition_FaceDirection(playerMapObj->movementDirection);
}
else
{
@@ -393,7 +393,7 @@ static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16
{
// B button was released.
gPlayerAvatar.bikeFrameCounter = 0;
- if (!MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ if (!MetatileBehavior_IsBumpySlope(playerMapObj->currentMetatileBehavior))
{
// Go back to normal on flat ground
*newDirection = direction;
@@ -436,7 +436,7 @@ static u8 AcroBikeHandleInputBunnyHop(u8 *newDirection, u16 newKeys, u16 heldKey
{
// B button was released
Bike_SetBikeStill();
- if (MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ if (MetatileBehavior_IsBumpySlope(playerMapObj->currentMetatileBehavior))
{
// even though B was released, dont undo the wheelie on the bumpy slope.
gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
@@ -483,7 +483,7 @@ static u8 AcroBikeHandleInputWheelieMoving(u8 *newDirection, u16 newKeys, u16 he
{
// we were moving on a wheelie, but we let go while moving. reset bike still status
Bike_SetBikeStill();
- if (!MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ if (!MetatileBehavior_IsBumpySlope(playerMapObj->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;
@@ -531,8 +531,8 @@ static u8 AcroBikeHandleInputSidewaysJump(u8 *ptr, u16 newKeys, u16 heldKeys)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- playerMapObj->mapobj_bit_9 = 0;
- FieldObjectSetDirection(playerMapObj, playerMapObj->mapobj_unk_18);
+ playerMapObj->facingDirectionLocked = 0;
+ FieldObjectSetDirection(playerMapObj, playerMapObj->facingDirection);
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
return CheckMovementInputAcroBike(ptr, newKeys, heldKeys);
}
@@ -552,8 +552,8 @@ static void AcroBikeTransition_TurnDirection(u8 direction)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
- direction = playerMapObj->placeholder18;
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
+ direction = playerMapObj->movementDirection;
PlayerFaceDirection(direction);
}
@@ -562,9 +562,9 @@ static void AcroBikeTransition_Moving(u8 direction)
u8 collision;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
{
- AcroBikeTransition_FaceDirection(playerMapObj->placeholder18);
+ AcroBikeTransition_FaceDirection(playerMapObj->movementDirection);
return;
}
collision = get_some_collision(direction);
@@ -585,8 +585,8 @@ static void AcroBikeTransition_NormalToWheelie(u8 direction)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
- direction = playerMapObj->placeholder18;
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
+ direction = playerMapObj->movementDirection;
PlayerStartWheelie(direction);
}
@@ -594,8 +594,8 @@ static void AcroBikeTransition_WheelieToNormal(u8 direction)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
- direction = playerMapObj->placeholder18;
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
+ direction = playerMapObj->movementDirection;
PlayerEndWheelie(direction);
}
@@ -603,8 +603,8 @@ static void AcroBikeTransition_WheelieIdle(u8 direction)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
- direction = playerMapObj->placeholder18;
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
+ direction = playerMapObj->movementDirection;
PlayerIdleWheelie(direction);
}
@@ -612,8 +612,8 @@ static void AcroBikeTransition_WheelieHoppingStanding(u8 direction)
{
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
- direction = playerMapObj->placeholder18;
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
+ direction = playerMapObj->movementDirection;
PlayerStandingHoppingWheelie(direction);
}
@@ -622,9 +622,9 @@ static void AcroBikeTransition_WheelieHoppingMoving(u8 direction)
u8 var;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
{
- AcroBikeTransition_WheelieHoppingStanding(playerMapObj->placeholder18);
+ AcroBikeTransition_WheelieHoppingStanding(playerMapObj->movementDirection);
return;
}
var = get_some_collision(direction);
@@ -674,7 +674,7 @@ static void AcroBikeTransition_SideJump(u8 direction)
}
playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
PlaySE(SE_JITE_PYOKO);
- playerMapObj->mapobj_bit_9 = 1;
+ playerMapObj->facingDirectionLocked = 1;
PlayerSetAnimId(sub_80608A4(direction), 2);
}
@@ -688,9 +688,9 @@ static void AcroBikeTransition_WheelieMoving(u8 direction)
u8 var;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
{
- PlayerIdleWheelie(playerMapObj->placeholder18);
+ PlayerIdleWheelie(playerMapObj->movementDirection);
return;
}
var = get_some_collision(direction);
@@ -706,7 +706,7 @@ static void AcroBikeTransition_WheelieMoving(u8 direction)
}
else if (var <= 4)
{
- if (MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ if (MetatileBehavior_IsBumpySlope(playerMapObj->currentMetatileBehavior))
PlayerIdleWheelie(direction);
else
sub_80595DC(direction); //hit wall?
@@ -722,9 +722,9 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
u8 var;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
{
- PlayerStartWheelie(playerMapObj->placeholder18);
+ PlayerStartWheelie(playerMapObj->movementDirection);
return;
}
var = get_some_collision(direction);
@@ -740,7 +740,7 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
}
else if (var <= 4)
{
- if (MetatileBehavior_IsBumpySlope(playerMapObj->mapobj_unk_1E))
+ if (MetatileBehavior_IsBumpySlope(playerMapObj->currentMetatileBehavior))
PlayerIdleWheelie(direction);
else
sub_80595DC(direction); //hit wall?
@@ -756,9 +756,9 @@ static void AcroBikeTransition_WheelieLoweringMoving(u8 direction)
u8 var;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- if (CanBikeFaceDirOnMetatile(direction, playerMapObj->mapobj_unk_1E) == 0)
+ if (CanBikeFaceDirOnMetatile(direction, playerMapObj->currentMetatileBehavior) == 0)
{
- PlayerEndWheelie(playerMapObj->placeholder18);
+ PlayerEndWheelie(playerMapObj->movementDirection);
return;
}
var = get_some_collision(direction);
@@ -885,8 +885,8 @@ static u8 get_some_collision(u8 direction)
u8 metatitleBehavior;
struct MapObject *playerMapObj = &gMapObjects[gPlayerAvatar.mapObjectId];
- x = playerMapObj->coords2.x;
- y = playerMapObj->coords2.y;
+ x = playerMapObj->currentCoords.x;
+ y = playerMapObj->currentCoords.y;
MoveCoords(direction, &x, &y);
metatitleBehavior = MapGridGetMetatileBehaviorAt(x, y);
return Bike_CheckCollisionTryAdvanceCollisionCount(playerMapObj, x, y, direction, metatitleBehavior);
@@ -970,7 +970,7 @@ bool8 IsBikingDisallowedByPlayer(void)
s16 x, y;
u8 tileBehavior;
- if (!(gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_4)))
+ if (!(gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_SURFING | PLAYER_AVATAR_FLAG_UNDERWATER)))
{
PlayerGetDestCoords(&x, &y);
tileBehavior = MapGridGetMetatileBehaviorAt(x, y);
@@ -982,7 +982,7 @@ bool8 IsBikingDisallowedByPlayer(void)
bool8 player_should_look_direction_be_enforced_upon_movement(void)
{
- if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE) != FALSE && MetatileBehavior_IsBumpySlope(gMapObjects[gPlayerAvatar.mapObjectId].mapobj_unk_1E) != FALSE)
+ if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE) != FALSE && MetatileBehavior_IsBumpySlope(gMapObjects[gPlayerAvatar.mapObjectId].currentMetatileBehavior) != FALSE)
return FALSE;
else
return TRUE;