From ae31cb71b2719390f11c97ae83c8929c30aa8eae Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Fri, 28 Apr 2023 07:33:26 -0600 Subject: [PATCH] Updated Set Metatile IDs From Another Map (markdown) --- Set-Metatile-IDs-From-Another-Map.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Set-Metatile-IDs-From-Another-Map.md b/Set-Metatile-IDs-From-Another-Map.md index 0bc03da..0dac735 100644 --- a/Set-Metatile-IDs-From-Another-Map.md +++ b/Set-Metatile-IDs-From-Another-Map.md @@ -6,20 +6,20 @@ credit to ghoulslash Open fieldmap.c and add this function somewhere: ```c extern void DrawWholeMapView(void); -void CopyMetatileIdsFromMapLayout(u16 mapGroup, u16 mapNum, const u8 pos[][2]) +void CopyMetatileIdsFromMapLayout(u16 mapGroup, u16 mapNum, const struct UCoords8 *pos) { u32 i, block, x, y; struct MapLayout const *layout = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum)->mapLayout; i = 0; do { - x = pos[i][0]; - y = pos[i][1]; + x = pos[i].x; + y = pos[i].y; block = layout->map[x + layout->width * y]; MapGridSetMetatileIdAt(x + MAP_OFFSET, y + MAP_OFFSET, block); i++; - } while (pos[i][0] != 0xFF); - + } while (pos[i].x != 0xFF); + DrawWholeMapView(); } ``` @@ -27,7 +27,7 @@ void CopyMetatileIdsFromMapLayout(u16 mapGroup, u16 mapNum, const u8 pos[][2]) It works by taking a map group and number and array of (x,y) positions and copies them into the current map from the given layout. An example of the `pos` argument: - If I want to copy the first 2 columns of a map from y positions 0 through 7: ```c -static const u8 sTestPositions[][2] = { +static const struct UCoords8 sTestPositions[] = { {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}, {1, 0}, {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 7}, {0xFF, 0xFF}, // to signify the end of the array