summaryrefslogtreecommitdiff
path: root/include/global.fieldmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/global.fieldmap.h')
-rw-r--r--include/global.fieldmap.h43
1 files changed, 24 insertions, 19 deletions
diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h
index 33be942c8..974fa3382 100644
--- a/include/global.fieldmap.h
+++ b/include/global.fieldmap.h
@@ -1,13 +1,30 @@
#ifndef GUARD_GLOBAL_FIELDMAP_H
#define GUARD_GLOBAL_FIELDMAP_H
-#define METATILE_BEHAVIOR_MASK 0x00FF
-#define METATILE_COLLISION_MASK 0x0C00
-#define METATILE_ID_MASK 0x03FF
-#define METATILE_ID_UNDEFINED 0x03FF
-#define METATILE_ELEVATION_SHIFT 12
-#define METATILE_COLLISION_SHIFT 10
-#define METATILE_ELEVATION_MASK 0xF000
+// Masks/shifts for blocks in the map grid
+// Map grid blocks consist of a 10 bit metatile id, a 2 bit collision value, and a 4 bit elevation value
+// This is the data stored in each data/layouts/*/map.bin file
+#define MAPGRID_METATILE_ID_MASK 0x03FF // Bits 1-10
+#define MAPGRID_COLLISION_MASK 0x0C00 // Bits 11-12
+#define MAPGRID_ELEVATION_MASK 0xF000 // Bits 13-16
+#define MAPGRID_COLLISION_SHIFT 10
+#define MAPGRID_ELEVATION_SHIFT 12
+
+// An undefined map grid block has all metatile id bits set and nothing else
+#define MAPGRID_UNDEFINED MAPGRID_METATILE_ID_MASK
+
+// Masks/shifts for metatile attributes
+// Metatile attributes consist of an 8 bit behavior value, 4 unused bits, and a 4 bit layer type value
+// This is the data stored in each data/tilesets/*/*/metatile_attributes.bin file
+#define METATILE_ATTR_BEHAVIOR_MASK 0x00FF // Bits 1-8
+#define METATILE_ATTR_LAYER_MASK 0xF000 // Bits 13-16
+#define METATILE_ATTR_LAYER_SHIFT 12
+
+enum {
+ METATILE_LAYER_TYPE_NORMAL, // Metatile uses middle and top bg layers
+ METATILE_LAYER_TYPE_COVERED, // Metatile uses bottom and middle bg layers
+ METATILE_LAYER_TYPE_SPLIT, // Metatile uses bottom and top bg layers
+};
#define METATILE_ID(tileset, name) (METATILE_##tileset##_##name)
@@ -16,18 +33,6 @@
// for constructing large tiles, such as the Battle Pike's curtain tile.
#define METATILE_ROW_WIDTH 8
-enum
-{
- CONNECTION_INVALID = -1,
- CONNECTION_NONE,
- CONNECTION_SOUTH,
- CONNECTION_NORTH,
- CONNECTION_WEST,
- CONNECTION_EAST,
- CONNECTION_DIVE,
- CONNECTION_EMERGE
-};
-
typedef void (*TilesetCB)(void);
struct Tileset