diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index 289c71a..1fe6b70 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -318,6 +318,21 @@ static u8 ObjectEventCB2_NoMovement2(void) return 0; } +static void TryHidePlayerReflection(void) +{ + if (gObjectEvents[gPlayerAvatar.objectEventId].hasReflection) { + s16 x, y; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; + x = playerObjEvent->currentCoords.x; + y = playerObjEvent->currentCoords.y; + MoveCoords(DIR_SOUTH, &x, &y); + if (!MetatileBehavior_IsReflective(MapGridGetMetatileBehaviorAt(x, y))) + playerObjEvent->hideReflection = TRUE; + else + playerObjEvent->hideReflection = FALSE; + } +} + void PlayerStep(u8 direction, u16 newKeys, u16 heldKeys) { struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; @@ -325,6 +340,7 @@ void PlayerStep(u8 direction, u16 newKeys, u16 heldKeys) HideShowWarpArrow(playerObjEvent); if (gPlayerAvatar.preventStep == FALSE) { + TryHidePlayerReflection(); Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys); if (TryInterruptObjectEventSpecialAnim(playerObjEvent, direction) == 0) { @@ -335,6 +351,8 @@ void PlayerStep(u8 direction, u16 newKeys, u16 heldKeys) MovePlayerAvatarUsingKeypadInput(direction, newKeys, heldKeys); PlayerAllowForcedMovementIfMovingSameDirection(); } + + TryHidePlayerReflection(); } } }