From 86297398e693d081ab3b561e7b0316a4fd495d87 Mon Sep 17 00:00:00 2001 From: SphericalIce Date: Wed, 20 Jan 2021 10:34:33 +0000 Subject: [PATCH] Move the definition of RETURN_REFLECTION_TYPE_AT and make use of REFL_TYPE_NONE --- src/event_object_movement.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/event_object_movement.c b/src/event_object_movement.c index 910681241..fa7e5aa1f 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -7703,6 +7703,12 @@ static void GetGroundEffectFlags_JumpLanding(struct ObjectEvent *objEvent, u32 * } } +#define RETURN_REFLECTION_TYPE_AT(x, y) \ + b = MapGridGetMetatileBehaviorAt(x, y); \ + result = GetReflectionTypeByMetatileBehavior(b); \ + if (result != REFL_TYPE_NONE) \ + return result; + static u8 GetObjEventReflectionType(struct ObjectEvent *objEvent) { const struct ObjectEventGraphicsInfo *info = GetObjectEventGraphicsInfo(objEvent->graphicsId); @@ -7716,12 +7722,6 @@ static u8 GetObjEventReflectionType(struct ObjectEvent *objEvent) u8 b; s16 one; -#define RETURN_REFLECTION_TYPE_AT(x, y) \ - b = MapGridGetMetatileBehaviorAt(x, y); \ - result = GetReflectionTypeByMetatileBehavior(b); \ - if (result != 0) \ - return result; - for (i = 0, one = 1; i < height; i++) { RETURN_REFLECTION_TYPE_AT(objEvent->currentCoords.x, objEvent->currentCoords.y + one + i) @@ -7734,10 +7734,11 @@ static u8 GetObjEventReflectionType(struct ObjectEvent *objEvent) RETURN_REFLECTION_TYPE_AT(objEvent->previousCoords.x - j, objEvent->previousCoords.y + one + i) } } - return 0; + + return REFL_TYPE_NONE; +} #undef RETURN_REFLECTION_TYPE_AT -} static u8 GetReflectionTypeByMetatileBehavior(u32 behavior) {