Merge branch 'reflections' into 'main'
feat: better reflection code See merge request tbld/game!6
This commit is contained in:
commit
7e1b759681
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user