Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…rald into develop
  • Loading branch information
laserXdolphin committed Jul 17, 2024
2 parents 7ef137f + 754991e commit 6adc0a4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/field_control_avatar.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct FieldInput
bool8 input_field_1_6:1;
bool8 input_field_1_7:1;
u8 dpadDirection;
bool8 pressedRButton:1;
};

void FieldClearPlayerInput(struct FieldInput *pStruct);
Expand Down
23 changes: 23 additions & 0 deletions src/field_control_avatar.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ void FieldClearPlayerInput(struct FieldInput *input)
input->input_field_1_2 = FALSE;
input->input_field_1_3 = FALSE;
input->dpadDirection = 0;
input->pressedRButton = FALSE;
}

void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys)
Expand Down Expand Up @@ -115,6 +116,9 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys)
input->heldDirection = TRUE;
input->heldDirection2 = TRUE;
}

if (newKeys & R_BUTTON)
input->pressedRButton = TRUE;
}

if (forcedMove == FALSE)
Expand Down Expand Up @@ -210,6 +214,25 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
}
#endif

if (input->pressedRButton && TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
{
ObjectEventClearHeldMovementIfActive(&gObjectEvents[gPlayerAvatar.objectEventId]);
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_MACH_BIKE)
{
gPlayerAvatar.flags -= PLAYER_AVATAR_FLAG_MACH_BIKE;
gPlayerAvatar.flags += PLAYER_AVATAR_FLAG_ACRO_BIKE;
SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_ACRO_BIKE);
PlaySE(SE_BIKE_HOP);
}
else
{
gPlayerAvatar.flags -= PLAYER_AVATAR_FLAG_ACRO_BIKE;
gPlayerAvatar.flags += PLAYER_AVATAR_FLAG_MACH_BIKE;
SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_MACH_BIKE);
PlaySE(SE_BIKE_BELL);
}
}

return FALSE;
}

Expand Down

0 comments on commit 6adc0a4

Please sign in to comment.