Updated Set Metatile IDs From Another Map (markdown)

ghoulslash 2023-04-28 07:28:51 -06:00
parent 03b1801799
commit 2ba1f80ebf
1 changed files with 2 additions and 2 deletions

@ -6,7 +6,7 @@ credit to ghoulslash
Open fieldmap.c and add this function somewhere: Open fieldmap.c and add this function somewhere:
```c ```c
extern void DrawWholeMapView(void); extern void DrawWholeMapView(void);
void CopyMetatileIdsFromMapLayout(u16 mapGroup, u16 mapNum, const u16 pos[][2]) void CopyMetatileIdsFromMapLayout(u16 mapGroup, u16 mapNum, const u8 pos[][2])
{ {
u32 i, block, x, y; u32 i, block, x, y;
struct MapLayout const *layout = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum)->mapLayout; struct MapLayout const *layout = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum)->mapLayout;
@ -27,7 +27,7 @@ void CopyMetatileIdsFromMapLayout(u16 mapGroup, u16 mapNum, const u16 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: 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: - If I want to copy the first 2 columns of a map from y positions 0 through 7:
```c ```c
static const u16 sTestPositions[][2] = { static const u8 sTestPositions[][2] = {
{0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}, {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}, {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 {0xFF, 0xFF}, // to signify the end of the array