summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSphericalIce <sphericalice@outlook.com>2021-01-20 22:32:04 +0000
committerSphericalIce <sphericalice@outlook.com>2021-01-20 22:32:04 +0000
commitc0489199c064ec4596c5bdfb20b27e00eed5f2cd (patch)
tree547c5a072be9fae2c077bfbf4c246051e187b52d /src
parent86297398e693d081ab3b561e7b0316a4fd495d87 (diff)
Rename GetObjEventReflectionType & fix fakematch in GetGroundEffectFlags_Reflection
Diffstat (limited to 'src')
-rw-r--r--src/event_object_movement.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/event_object_movement.c b/src/event_object_movement.c
index fa7e5aa1f..0cb4124a8 100644
--- a/src/event_object_movement.c
+++ b/src/event_object_movement.c
@@ -87,7 +87,7 @@ static void GetGroundEffectFlags_Puddle(struct ObjectEvent*, u32*);
static void GetGroundEffectFlags_Ripple(struct ObjectEvent*, u32*);
static void GetGroundEffectFlags_Seaweed(struct ObjectEvent*, u32*);
static void GetGroundEffectFlags_JumpLanding(struct ObjectEvent*, u32*);
-static u8 GetObjEventReflectionType(struct ObjectEvent*);
+static u8 ObjectEventGetNearbyReflectionType(struct ObjectEvent*);
static u8 GetReflectionTypeByMetatileBehavior(u32);
static void InitObjectPriorityByZCoord(struct Sprite *sprite, u8 z);
static void ObjectEventUpdateSubpriority(struct ObjectEvent*, struct Sprite*);
@@ -7518,13 +7518,13 @@ static void GetGroundEffectFlags_Reflection(struct ObjectEvent *objEvent, u32 *f
[REFL_TYPE_ICE - 1] = GROUND_EFFECT_FLAG_ICE_REFLECTION,
[REFL_TYPE_WATER - 1] = GROUND_EFFECT_FLAG_WATER_REFLECTION
};
- u8 reflType = GetObjEventReflectionType(objEvent);
+ u8 reflType = ObjectEventGetNearbyReflectionType(objEvent);
if (reflType)
{
- if (!objEvent->hasReflection)
+ if (objEvent->hasReflection == 0)
{
- objEvent->hasReflection |= TRUE;
+ objEvent->hasReflection++;
*flags |= reflectionFlags[reflType - 1];
}
}
@@ -7709,20 +7709,18 @@ static void GetGroundEffectFlags_JumpLanding(struct ObjectEvent *objEvent, u32 *
if (result != REFL_TYPE_NONE) \
return result;
-static u8 GetObjEventReflectionType(struct ObjectEvent *objEvent)
+static u8 ObjectEventGetNearbyReflectionType(struct ObjectEvent *objEvent)
{
const struct ObjectEventGraphicsInfo *info = GetObjectEventGraphicsInfo(objEvent->graphicsId);
// ceil div by tile width?
s16 width = (info->width + 8) >> 4;
s16 height = (info->height + 8) >> 4;
- s16 i;
- s16 j;
- u8 result;
- u8 b;
- s16 one;
+ s16 i, j;
+ u8 result, b; // used by RETURN_REFLECTION_TYPE_AT
+ s16 one = 1;
- for (i = 0, one = 1; i < height; i++)
+ for (i = 0; i < height; i++)
{
RETURN_REFLECTION_TYPE_AT(objEvent->currentCoords.x, objEvent->currentCoords.y + one + i)
RETURN_REFLECTION_TYPE_AT(objEvent->previousCoords.x, objEvent->previousCoords.y + one + i)