summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data/decoration/tilemaps.h171
-rw-r--r--src/data/decoration/tiles.h2
-rw-r--r--src/decoration.c16
3 files changed, 100 insertions, 89 deletions
diff --git a/src/data/decoration/tilemaps.h b/src/data/decoration/tilemaps.h
index 12fe31dc0..eebb3acb2 100644
--- a/src/data/decoration/tilemaps.h
+++ b/src/data/decoration/tilemaps.h
@@ -1,37 +1,37 @@
-const u8 Unknown_085A6FB0[] = {
+static const u8 sDecorTilemap_1x1_Tiles[] = {
0x00, 0x01, 0x02, 0x03
};
-const u8 Unknown_085A6FB4[] = {
+static const u8 sDecorTilemap_3x1_Tiles[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d
};
-const u8 Unknown_085A6FC0[] = {
+static const u8 sDecorTilemap_2x2_Tiles[] = {
0x00, 0x01, 0x02, 0x03,
0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b,
0x0c, 0x0d, 0x0e, 0x0f
};
-const u8 Unknown_085A6FD0[] = {
+static const u8 sDecorTilemap_1x3_Tiles[] = {
0x00, 0x01, 0x04, 0x05,
0x08, 0x09, 0x0c, 0x0d,
0x10, 0x11, 0x14, 0x15
};
-const u8 Unknown_085A6FDC[] = {
+static const u8 sDecorTilemap_2x1_Tiles[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
};
-const u8 Unknown_085A6FE4[] = {
+static const u8 sDecorTilemap_4x2_Tiles[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
};
-const u8 Unknown_085A7004[] = {
+static const u8 sDecorTilemap_3x3_Tiles[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
@@ -40,60 +40,60 @@ const u8 Unknown_085A7004[] = {
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d
};
-const u8 Unknown_085A7028[] = {
+static const u8 sDecorTilemap_3x2_Tiles[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d
};
-const u8 Unknown_085A7040[] = {
+static const u8 sDecorTilemap_1x1_Y[] = {
0x00, 0x00, 0x00, 0x00
};
-const u8 Unknown_085A7044[] = {
+static const u8 sDecorTilemap_2x1_Y[] = {
0x00, 0x00, 0x01, 0x01,
0x00, 0x00, 0x01, 0x01
};
-const u8 Unknown_085A704C[] = {
+static const u8 sDecorTilemap_3x1_Y[] = {
0x00, 0x00, 0x01, 0x01, 0x02, 0x02,
0x00, 0x00, 0x01, 0x01, 0x02, 0x02
};
-const u8 Unknown_085A7058[] = {
+static const u8 sDecorTilemap_4x2_Y[] = {
0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03,
0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03,
0x04, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07, 0x07,
0x04, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07, 0x07
};
-const u8 Unknown_085A7078[] = {
+static const u8 sDecorTilemap_2x2_Y[] = {
0x00, 0x00, 0x01, 0x01,
0x00, 0x00, 0x01, 0x01,
0x02, 0x02, 0x03, 0x03,
0x02, 0x02, 0x03, 0x03
};
-const u8 Unknown_085A7088[] = {
+static const u8 sDecorTilemap_1x2_Y[] = {
0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01
};
-const u8 Unknown_085A7090[] = {
+static const u8 sDecorTilemap_1x3_Y[] = {
0x00, 0x00, 0x00, 0x00,
0x01, 0x01, 0x01, 0x01,
0x02, 0x02, 0x02, 0x02
};
-const u8 Unknown_085A709C[] = {
+static const u8 sDecorTilemap_2x4_Y[] = {
0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01,
0x02, 0x02, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03,
0x04, 0x04, 0x05, 0x05, 0x04, 0x04, 0x05, 0x05,
0x06, 0x06, 0x07, 0x07, 0x06, 0x06, 0x07, 0x07
};
-const u8 Unknown_085A70BC[] = {
+static const u8 sDecorTilemap_3x3_Y[] = {
0x00, 0x00, 0x01, 0x01, 0x02, 0x02,
0x00, 0x00, 0x01, 0x01, 0x02, 0x02,
0x03, 0x03, 0x04, 0x04, 0x05, 0x05,
@@ -102,60 +102,60 @@ const u8 Unknown_085A70BC[] = {
0x06, 0x06, 0x07, 0x07, 0x08, 0x08
};
-const u8 Unknown_085A70E0[] = {
+static const u8 sDecorTilemap_3x2_Y[] = {
0x00, 0x00, 0x01, 0x01, 0x02, 0x02,
0x00, 0x00, 0x01, 0x01, 0x02, 0x02,
0x03, 0x03, 0x04, 0x04, 0x05, 0x05,
0x03, 0x03, 0x04, 0x04, 0x05, 0x05
};
-const u8 Unknown_085A70F8[] = {
+static const u8 sDecorTilemap_1x1_X[] = {
0x04, 0x05, 0x06, 0x07
};
-const u8 Unknown_085A70FC[] = {
+static const u8 sDecorTilemap_2x1_X[] = {
0x04, 0x05, 0x04, 0x05,
0x06, 0x07, 0x06, 0x07
};
-const u8 Unknown_085A7104[] = {
+static const u8 sDecorTilemap_3x1_X[] = {
0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
0x06, 0x07, 0x06, 0x07, 0x06, 0x07
};
-const u8 Unknown_085A7110[] = {
+static const u8 sDecorTilemap_4x2_X[] = {
0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
0x06, 0x07, 0x06, 0x07, 0x06, 0x07, 0x06, 0x07
};
-const u8 Unknown_085A7130[] = {
+static const u8 sDecorTilemap_2x2_X[] = {
0x04, 0x05, 0x04, 0x05,
0x06, 0x07, 0x06, 0x07,
0x04, 0x05, 0x04, 0x05,
0x06, 0x07, 0x06, 0x07
};
-const u8 Unknown_085A7140[] = {
+static const u8 sDecorTilemap_1x2_X[] = {
0x04, 0x05, 0x06, 0x07,
0x04, 0x05, 0x06, 0x07
};
-const u8 Unknown_085A7148[] = {
+static const u8 sDecorTilemap_1x3_X[] = {
0x04, 0x05, 0x06, 0x07,
0x04, 0x05, 0x06, 0x07,
0x04, 0x05, 0x06, 0x07
};
-const u8 Unknown_085A7154[] = {
+static const u8 sDecorTilemap_2x4_X[] = {
0x04, 0x05, 0x04, 0x05, 0x06, 0x07, 0x06, 0x07,
0x04, 0x05, 0x04, 0x05, 0x06, 0x07, 0x06, 0x07,
0x04, 0x05, 0x04, 0x05, 0x06, 0x07, 0x06, 0x07,
0x04, 0x05, 0x04, 0x05, 0x06, 0x07, 0x06, 0x07
};
-const u8 Unknown_085A7174[] = {
+static const u8 sDecorTilemap_3x3_X[] = {
0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
0x06, 0x07, 0x06, 0x07, 0x06, 0x07,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
@@ -164,67 +164,78 @@ const u8 Unknown_085A7174[] = {
0x06, 0x07, 0x06, 0x07, 0x06, 0x07
};
-const u8 Unknown_085A7198[] = {
+static const u8 sDecorTilemap_3x2_X[] = {
0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
0x06, 0x07, 0x06, 0x07, 0x06, 0x07,
0x04, 0x05, 0x04, 0x05, 0x04, 0x05,
0x06, 0x07, 0x06, 0x07, 0x06, 0x07
};
-const struct {
+#define DECORSIZE(width, height)((width) * (height) * 4)
+
+static const struct {
const u8 *tiles;
const u8 *y;
const u8 *x;
u8 size;
-} gUnknown_085A71B0[] = {
- {
- Unknown_085A6FB0,
- Unknown_085A7040,
- Unknown_085A70F8,
- 0x04
- }, {
- Unknown_085A6FDC,
- Unknown_085A7044,
- Unknown_085A70FC,
- 0x08
- }, {
- Unknown_085A6FB4,
- Unknown_085A704C,
- Unknown_085A7104,
- 0x0c
- }, {
- Unknown_085A6FE4,
- Unknown_085A7058,
- Unknown_085A7110,
- 0x20
- }, {
- Unknown_085A6FC0,
- Unknown_085A7078,
- Unknown_085A7130,
- 0x10
- }, {
- Unknown_085A6FDC,
- Unknown_085A7088,
- Unknown_085A7140,
- 0x08
- }, {
- Unknown_085A6FD0,
- Unknown_085A7090,
- Unknown_085A7148,
- 0x0c
- }, {
- Unknown_085A6FE4,
- Unknown_085A709C,
- Unknown_085A7154,
- 0x20
- }, {
- Unknown_085A7004,
- Unknown_085A70BC,
- Unknown_085A7174,
- 0x24
- }, {
- Unknown_085A7028,
- Unknown_085A70E0,
- Unknown_085A7198,
- 0x18
+} sDecorTilemaps[] = {
+ [DECORSHAPE_1x1] = {
+ .tiles = sDecorTilemap_1x1_Tiles,
+ .y = sDecorTilemap_1x1_Y,
+ .x = sDecorTilemap_1x1_X,
+ .size = DECORSIZE(1, 1)
+ },
+ [DECORSHAPE_2x1] = {
+ .tiles = sDecorTilemap_2x1_Tiles,
+ .y = sDecorTilemap_2x1_Y,
+ .x = sDecorTilemap_2x1_X,
+ .size = DECORSIZE(2, 1)
+ },
+ [DECORSHAPE_3x1] = {
+ .tiles = sDecorTilemap_3x1_Tiles,
+ .y = sDecorTilemap_3x1_Y,
+ .x = sDecorTilemap_3x1_X,
+ .size = DECORSIZE(3, 1)
+ },
+ [DECORSHAPE_4x2] = {
+ .tiles = sDecorTilemap_4x2_Tiles,
+ .y = sDecorTilemap_4x2_Y,
+ .x = sDecorTilemap_4x2_X,
+ .size = DECORSIZE(4, 2)
+ },
+ [DECORSHAPE_2x2] = {
+ .tiles = sDecorTilemap_2x2_Tiles,
+ .y = sDecorTilemap_2x2_Y,
+ .x = sDecorTilemap_2x2_X,
+ .size = DECORSIZE(2, 2)
+ },
+ [DECORSHAPE_1x2] = {
+ .tiles = sDecorTilemap_2x1_Tiles,
+ .y = sDecorTilemap_1x2_Y,
+ .x = sDecorTilemap_1x2_X,
+ .size = DECORSIZE(1, 2)
+ },
+ [DECORSHAPE_1x3] = {
+ .tiles = sDecorTilemap_1x3_Tiles,
+ .y = sDecorTilemap_1x3_Y,
+ .x = sDecorTilemap_1x3_X,
+ .size = DECORSIZE(1, 3)
+ },
+ [DECORSHAPE_2x4] = {
+ .tiles = sDecorTilemap_4x2_Tiles,
+ .y = sDecorTilemap_2x4_Y,
+ .x = sDecorTilemap_2x4_X,
+ .size = DECORSIZE(2, 4)
+ },
+ [DECORSHAPE_3x3] = {
+ .tiles = sDecorTilemap_3x3_Tiles,
+ .y = sDecorTilemap_3x3_Y,
+ .x = sDecorTilemap_3x3_X,
+ .size = DECORSIZE(3, 3)
+ },
+ [DECORSHAPE_3x2] = {
+ .tiles = sDecorTilemap_3x2_Tiles,
+ .y = sDecorTilemap_3x2_Y,
+ .x = sDecorTilemap_3x2_X,
+ .size = DECORSIZE(3, 2)
}};
diff --git a/src/data/decoration/tiles.h b/src/data/decoration/tiles.h
index de5c43575..1b25da3d4 100644
--- a/src/data/decoration/tiles.h
+++ b/src/data/decoration/tiles.h
@@ -1,4 +1,4 @@
-#define DECOR_TILE(name) (METATILE_SecretBase_##name - 0x200)
+#define DECOR_TILE(name) (METATILE_SecretBase_##name - NUM_TILES_IN_PRIMARY)
const u16 DecorGfx_SMALL_DESK[] = {
DECOR_TILE(SmallDesk)
diff --git a/src/decoration.c b/src/decoration.c
index 74dbacdf9..b97ab4321 100644
--- a/src/decoration.c
+++ b/src/decoration.c
@@ -1210,7 +1210,7 @@ static void ShowDecorationOnMap_(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight,
for (i = 0; i < decWidth; i++)
{
x = mapX + i;
- behavior = GetBehaviorByMetatileId(0x200 + gDecorations[decoration].tiles[j * decWidth + i]);
+ behavior = GetBehaviorByMetatileId(NUM_TILES_IN_PRIMARY + gDecorations[decoration].tiles[j * decWidth + i]);
if (MetatileBehavior_IsSecretBaseImpassable(behavior) == TRUE || (gDecorations[decoration].permission != DECORPERM_PASS_FLOOR && (behavior >> METATILE_ELEVATION_SHIFT)))
impassableFlag = METATILE_COLLISION_MASK;
else
@@ -1224,9 +1224,9 @@ static void ShowDecorationOnMap_(u16 mapX, u16 mapY, u8 decWidth, u8 decHeight,
elevation = GetDecorationElevation(gDecorations[decoration].id, j * decWidth + i);
if (elevation != 0xFFFF)
- MapGridSetMetatileEntryAt(x, y, (gDecorations[decoration].tiles[j * decWidth + i] + (0x200 | overlapsWall)) | impassableFlag | elevation);
+ MapGridSetMetatileEntryAt(x, y, (gDecorations[decoration].tiles[j * decWidth + i] + (NUM_TILES_IN_PRIMARY | overlapsWall)) | impassableFlag | elevation);
else
- MapGridSetMetatileIdAt(x, y, (gDecorations[decoration].tiles[j * decWidth + i] + (0x200 | overlapsWall)) | impassableFlag);
+ MapGridSetMetatileIdAt(x, y, (gDecorations[decoration].tiles[j * decWidth + i] + (NUM_TILES_IN_PRIMARY | overlapsWall)) | impassableFlag);
}
}
}
@@ -1524,7 +1524,7 @@ static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration)
{
curX = gTasks[taskId].tCursorX + j;
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
- behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ELEVATION_MASK;
+ behaviorBy = GetBehaviorByMetatileId(NUM_TILES_IN_PRIMARY + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ELEVATION_MASK;
if (!IsFloorOrBoardAndHole(behaviorAt, decoration))
return FALSE;
@@ -1545,7 +1545,7 @@ static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration)
{
curX = gTasks[taskId].tCursorX + j;
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
- behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ELEVATION_MASK;
+ behaviorBy = GetBehaviorByMetatileId(NUM_TILES_IN_PRIMARY + decoration->tiles[(mapY - 1 - i) * mapX + j]) & METATILE_ELEVATION_MASK;
if (!MetatileBehavior_IsNormal(behaviorAt) && !IsNonBlockNonElevated(behaviorAt, behaviorBy))
return FALSE;
@@ -1562,7 +1562,7 @@ static bool8 CanPlaceDecoration(u8 taskId, const struct Decoration *decoration)
{
curX = gTasks[taskId].tCursorX + j;
behaviorAt = MapGridGetMetatileBehaviorAt(curX, curY);
- behaviorBy = GetBehaviorByMetatileId(0x200 + decoration->tiles[j]) & METATILE_ELEVATION_MASK;
+ behaviorBy = GetBehaviorByMetatileId(NUM_TILES_IN_PRIMARY + decoration->tiles[j]) & METATILE_ELEVATION_MASK;
if (!MetatileBehavior_IsNormal(behaviorAt) && !MetatileBehavior_IsSecretBaseNorthWall(behaviorAt))
return FALSE;
@@ -1971,9 +1971,9 @@ static void SetDecorSelectionMetatiles(struct PlaceDecorationGraphicsDataBuffer
u8 shape;
shape = data->decoration->shape;
- for (i = 0; i < gUnknown_085A71B0[shape].size; i++)
+ for (i = 0; i < sDecorTilemaps[shape].size; i++)
{
- data->tiles[gUnknown_085A71B0[shape].tiles[i]] = GetMetatile(data->decoration->tiles[gUnknown_085A71B0[shape].y[i]] * 8 + gUnknown_085A71B0[shape].x[i]);
+ data->tiles[sDecorTilemaps[shape].tiles[i]] = GetMetatile(data->decoration->tiles[sDecorTilemaps[shape].y[i]] * 8 + sDecorTilemaps[shape].x[i]);
}
}