summaryrefslogtreecommitdiff
path: root/src/fieldmap.c
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2020-03-16 19:01:48 -0400
committerGriffinR <griffin.g.richards@gmail.com>2020-03-16 19:09:13 -0400
commitebf2f04d912497333455245bb503e6b2d109cfac (patch)
tree5bf4cedb3f4af3fdee411b903fba5e9f552a43b2 /src/fieldmap.c
parent2c7387951ba78349712d891ca71b55db4d0ec96e (diff)
Label used metatile attributes
Diffstat (limited to 'src/fieldmap.c')
-rw-r--r--src/fieldmap.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/fieldmap.c b/src/fieldmap.c
index 8b0beef34..53a97629f 100644
--- a/src/fieldmap.c
+++ b/src/fieldmap.c
@@ -36,26 +36,26 @@ EWRAM_DATA u8 gUnknown_2036E28 = 0;
static const struct ConnectionFlags sDummyConnectionFlags = {};
-static const u32 sMetatileAttrMasks[] = {
- 0x000001ff,
- 0x00003e00,
- 0x0003c000,
- 0x00fc0000,
- 0x07000000,
- 0x18000000,
- 0x60000000,
- 0x80000000
+static const u32 sMetatileAttrMasks[METATILE_ATTRIBUTE_COUNT] = {
+ [METATILE_ATTRIBUTE_BEHAVIOR] = 0x000001ff,
+ [METATILE_ATTRIBUTE_TERRAIN] = 0x00003e00,
+ [METATILE_ATTRIBUTE_2] = 0x0003c000,
+ [METATILE_ATTRIBUTE_3] = 0x00fc0000,
+ [METATILE_ATTRIBUTE_ENCOUNTER_TYPE] = 0x07000000,
+ [METATILE_ATTRIBUTE_5] = 0x18000000,
+ [METATILE_ATTRIBUTE_LAYER_TYPE] = 0x60000000,
+ [METATILE_ATTRIBUTE_7] = 0x80000000
};
-static const u8 sMetatileAttrShifts[] = {
- 0,
- 9,
- 14,
- 18,
- 24,
- 27,
- 29,
- 31
+static const u8 sMetatileAttrShifts[METATILE_ATTRIBUTE_COUNT] = {
+ [METATILE_ATTRIBUTE_BEHAVIOR] = 0,
+ [METATILE_ATTRIBUTE_TERRAIN] = 9,
+ [METATILE_ATTRIBUTE_2] = 14,
+ [METATILE_ATTRIBUTE_3] = 18,
+ [METATILE_ATTRIBUTE_ENCOUNTER_TYPE] = 24,
+ [METATILE_ATTRIBUTE_5] = 27,
+ [METATILE_ATTRIBUTE_LAYER_TYPE] = 29,
+ [METATILE_ATTRIBUTE_7] = 31
};
const struct MapHeader * mapconnection_get_mapheader(struct MapConnection * connection)
@@ -425,7 +425,7 @@ u32 MapGridGetMetatileIdAt(s32 x, s32 y)
u32 GetMetatileAttributeFromRawMetatileBehavior(u32 original, u8 bit)
{
- if (bit >= 8)
+ if (bit >= METATILE_ATTRIBUTE_COUNT)
return original;
return (original & sMetatileAttrMasks[bit]) >> sMetatileAttrShifts[bit];
@@ -439,12 +439,12 @@ u32 MapGridGetMetatileAttributeAt(s16 x, s16 y, u8 attr)
u32 MapGridGetMetatileBehaviorAt(s16 x, s16 y)
{
- return MapGridGetMetatileAttributeAt(x, y, 0);
+ return MapGridGetMetatileAttributeAt(x, y, METATILE_ATTRIBUTE_BEHAVIOR);
}
u8 MapGridGetMetatileLayerTypeAt(s16 x, s16 y)
{
- return MapGridGetMetatileAttributeAt(x, y, 6);
+ return MapGridGetMetatileAttributeAt(x, y, METATILE_ATTRIBUTE_LAYER_TYPE);
}
void MapGridSetMetatileIdAt(s32 x, s32 y, u16 metatile)