diff options
author | Marcus Huderle <huderlem@gmail.com> | 2018-06-20 17:47:33 -0500 |
---|---|---|
committer | Marcus Huderle <huderlem@gmail.com> | 2018-06-20 17:47:33 -0500 |
commit | c80206e701bc8a290cb2c01afb12cb2e03bf473a (patch) | |
tree | e0c27c40b4d45a7227760c46df2d28de8965468a | |
parent | 9d9aef1b42f3ff6923824daf3fe07c562a661ac0 (diff) |
Rename map attribute structs to MapLayout
-rw-r--r-- | data/layouts_table.inc | 2 | ||||
-rw-r--r-- | include/fieldmap.h | 8 | ||||
-rw-r--r-- | include/global.fieldmap.h | 8 | ||||
-rw-r--r-- | include/global.h | 2 | ||||
-rw-r--r-- | include/overworld.h | 1 | ||||
-rw-r--r-- | src/debug/nakamura_debug_menu.c | 8 | ||||
-rw-r--r-- | src/decoration.c | 14 | ||||
-rw-r--r-- | src/field_camera.c | 52 | ||||
-rw-r--r-- | src/field_tasks.c | 4 | ||||
-rw-r--r-- | src/fieldmap.c | 108 | ||||
-rw-r--r-- | src/item_use.c | 12 | ||||
-rw-r--r-- | src/overworld.c | 52 | ||||
-rw-r--r-- | src/region_map.c | 20 | ||||
-rw-r--r-- | src/secret_base.c | 6 | ||||
-rw-r--r-- | src/shop.c | 8 | ||||
-rw-r--r-- | src/tileset_anim.c | 12 | ||||
-rw-r--r-- | src/wild_encounter.c | 2 |
17 files changed, 159 insertions, 160 deletions
diff --git a/data/layouts_table.inc b/data/layouts_table.inc index b1a15d7ef..cda6e5423 100644 --- a/data/layouts_table.inc +++ b/data/layouts_table.inc @@ -1,5 +1,5 @@ .align 2 -gMapAttributes:: @ 8304F18 +gMapLayouts:: @ 8304F18 .4byte PetalburgCity_Layout .4byte SlateportCity_Layout .4byte MauvilleCity_Layout diff --git a/include/fieldmap.h b/include/fieldmap.h index a85f5b101..e77342b72 100644 --- a/include/fieldmap.h +++ b/include/fieldmap.h @@ -2,7 +2,7 @@ #define GUARD_FIELDMAP2_H #include "event_object_movement.h" -extern struct BackupMapData gUnknown_03004870; +extern struct BackupMapLayout gUnknown_03004870; struct MapHeader *mapconnection_get_mapheader(struct MapConnection *connection); int GetMapBorderIdAt(int x, int y); int CanCameraMoveInDirection(int direction); @@ -35,9 +35,9 @@ struct MapConnection *sub_8056BA0(s16 x, s16 y); // fieldmap.c void sub_8056C50(u16, u16); void sav1_camera_get_focus_coords(u16 *x, u16 *y); void GetCameraCoords(u16*, u16*); -void sub_8056D28(struct MapData *pData); -void sub_8056D38(struct MapData *pData); -void apply_map_tileset2_palette(struct MapData *pData); +void sub_8056D28(struct MapLayout *pData); +void sub_8056D38(struct MapLayout *pData); +void apply_map_tileset2_palette(struct MapLayout *pData); void copy_map_tileset1_tileset2_to_vram(/*TODO: arg types*/); void apply_map_tileset1_tileset2_palette(/*TODO: arg types*/); diff --git a/include/global.fieldmap.h b/include/global.fieldmap.h index dc8558146..799a12a19 100644 --- a/include/global.fieldmap.h +++ b/include/global.fieldmap.h @@ -53,7 +53,7 @@ struct Tileset /*0x14*/ TilesetCB callback; }; -struct MapData +struct MapLayout { /*0x00*/ s32 width; /*0x04*/ s32 height; @@ -63,7 +63,7 @@ struct MapData /*0x14*/ struct Tileset *secondaryTileset; }; -struct BackupMapData +struct BackupMapLayout { s32 width; s32 height; @@ -157,12 +157,12 @@ struct MapConnections struct MapHeader { - /* 0x00 */ struct MapData *mapData; + /* 0x00 */ struct MapLayout *mapLayout; /* 0x04 */ struct MapEvents *events; /* 0x08 */ u8 *mapScripts; /* 0x0C */ struct MapConnections *connections; /* 0x10 */ u16 music; - /* 0x12 */ u16 mapDataId; + /* 0x12 */ u16 mapLayoutId; /* 0x14 */ u8 regionMapSectionId; /* 0x15 */ u8 cave; /* 0x16 */ u8 weather; diff --git a/include/global.h b/include/global.h index 0f015745b..3c0169606 100644 --- a/include/global.h +++ b/include/global.h @@ -649,7 +649,7 @@ struct SaveBlock1 /* 0x02025734 */ /*0x2E*/ u8 weather; /*0x2F*/ u8 weatherCycleStage; /*0x30*/ u8 flashLevel; // flash level on current map, 0 being normal and 4 being the darkest - /*0x32*/ u16 mapDataId; + /*0x32*/ u16 mapLayoutId; /*0x34*/ u16 mapView[0x100]; /*0x234*/ u8 playerPartyCount; /*0x238*/ struct Pokemon playerParty[6]; diff --git a/include/overworld.h b/include/overworld.h index de817e8e0..b499f55aa 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -42,7 +42,6 @@ void SetGameStat(u8, u32); void Overworld_SetEventObjTemplateCoords(u8, s16, s16); void Overworld_SetEventObjTemplateMovementType(u8, u8); // mapdata_load_assets_to_gpu_and_full_redraw -// get_mapdata_header // ApplyCurrentWarp // SetWarpData // warp_data_is_not_neg_1 diff --git a/src/debug/nakamura_debug_menu.c b/src/debug/nakamura_debug_menu.c index a20d58319..508dc048e 100644 --- a/src/debug/nakamura_debug_menu.c +++ b/src/debug/nakamura_debug_menu.c @@ -752,14 +752,14 @@ static const u8 Str_843E58D[] = _( static u16 FishingPoints_CountFishingTilesInMapThird(u8 a0) { u16 retval = 0; - u16 height = gMapHeader.mapData->height / 3; + u16 height = gMapHeader.mapLayout->height / 3; u16 y; u16 x; u16 start = height * a0; for (y = start; y < start + height; y++) { - for (x = 0; x < gMapHeader.mapData->width; x++) + for (x = 0; x < gMapHeader.mapLayout->width; x++) { if (MetatileBehavior_IsFeebasEncounterable(MapGridGetMetatileBehaviorAt(x + 7, y + 7)) == TRUE) { @@ -783,9 +783,9 @@ static u16 FishingPoints_GetIndexOfCurrentFishingSpot(void) x -= 7; y -= 7; - for (yy = 0; yy < gMapHeader.mapData->height; yy++) + for (yy = 0; yy < gMapHeader.mapLayout->height; yy++) { - for (xx = 0; xx < gMapHeader.mapData->width; xx++) + for (xx = 0; xx < gMapHeader.mapLayout->width; xx++) { if (MetatileBehavior_IsFeebasEncounterable(MapGridGetMetatileBehaviorAt(xx + 7, yy + 7)) == TRUE) { diff --git a/src/decoration.c b/src/decoration.c index e31624540..2a70a3835 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -2271,7 +2271,7 @@ void AddDecorationIconObjectFromEventObject(struct UnkStruct_02038900 * unk_0203 sub_81008BC(unk_02038900); sub_8100930(unk_02038900->decoration->shape); sub_8100874(unk_02038900); - sub_810070C(unk_02038900->palette, ((u16 *)gMapHeader.mapData->secondaryTileset->metatiles + 8 * unk_02038900->decoration->tiles[0])[7] >> 12); + sub_810070C(unk_02038900->palette, ((u16 *)gMapHeader.mapLayout->secondaryTileset->metatiles + 8 * unk_02038900->decoration->tiles[0])[7] >> 12); LoadSpritePalette(&gUnknown_083EC954); gUnknown_020391A8 = gSprites[gFieldCamera.trackedSpriteId].data[0]; gFieldCamera.trackedSpriteId = CreateSprite(&gSpriteTemplate_83EC93C, gUnknown_083EC900[unk_02038900->decoration->shape].x, gUnknown_083EC900[unk_02038900->decoration->shape].y, 0); @@ -3206,7 +3206,7 @@ bool8 sub_810038C(u8 taskId) { data[1]++; return FALSE; - } else if (gUnknown_020391AA == DIR_NORTH && data[1] - 7 >= gMapHeader.mapData->height) + } else if (gUnknown_020391AA == DIR_NORTH && data[1] - 7 >= gMapHeader.mapLayout->height) { data[1]--; return FALSE; @@ -3214,7 +3214,7 @@ bool8 sub_810038C(u8 taskId) { data[0]++; return FALSE; - } else if (gUnknown_020391AA == DIR_EAST && data[0] + data[5] - 8 >= gMapHeader.mapData->width) + } else if (gUnknown_020391AA == DIR_EAST && data[0] + data[5] - 8 >= gMapHeader.mapLayout->width) { data[0]--; return FALSE; @@ -3336,7 +3336,7 @@ void sub_810070C(u16 *a0, u16 a1) u16 i; for (i=0; i<16; i++) { - a0[i] = ((u16 *)gMapHeader.mapData->primaryTileset->palettes)[16 * a1 + i]; + a0[i] = ((u16 *)gMapHeader.mapLayout->primaryTileset->palettes)[16 * a1 + i]; } } @@ -3352,7 +3352,7 @@ void sub_8100740(u8 *dest, u16 flags) } for (i=0; i<32; i++) { - buffer[i] = ((u8 *)gMapHeader.mapData->primaryTileset->tiles)[flags * 32 + i]; + buffer[i] = ((u8 *)gMapHeader.mapLayout->primaryTileset->tiles)[flags * 32 + i]; } switch (mode) { @@ -3398,7 +3398,7 @@ void sub_8100874(struct UnkStruct_02038900 *unk_02038900) u16 sub_810089C(u16 a0) { - return ((u16 *)gMapHeader.mapData->secondaryTileset->metatiles)[a0] & 0xfff; + return ((u16 *)gMapHeader.mapLayout->secondaryTileset->metatiles)[a0] & 0xfff; } const u8 Unknown_3EC660[] = {0, 1, 2, 3}; @@ -3665,7 +3665,7 @@ void sub_8100B6C(void) { for (k=0; k<gUnknown_020391B4[i].width; k++) { - MapGridSetMetatileEntryAt(x + 7 + k, y + 7 - j, ((u16 *)gMapHeader.mapData->map)[(x + k) + gMapHeader.mapData->width * (y - j)] | 0x3000); + MapGridSetMetatileEntryAt(x + 7 + k, y + 7 - j, ((u16 *)gMapHeader.mapLayout->map)[(x + k) + gMapHeader.mapLayout->width * (y - j)] | 0x3000); } } sub_8100A60(gUnknown_020391B4[i].decorId); diff --git a/src/field_camera.c b/src/field_camera.c index fa8f1a582..3765107fd 100644 --- a/src/field_camera.c +++ b/src/field_camera.c @@ -28,14 +28,14 @@ struct FieldCamera gFieldCamera; u16 gTotalCameraPixelOffsetY; u16 gTotalCameraPixelOffsetX; -static void RedrawMapSliceNorth(struct FieldCameraOffset*, struct MapData*); -static void RedrawMapSliceSouth(struct FieldCameraOffset*, struct MapData*); -static void RedrawMapSliceEast(struct FieldCameraOffset*, struct MapData*); -static void RedrawMapSliceWest(struct FieldCameraOffset*, struct MapData*); +static void RedrawMapSliceNorth(struct FieldCameraOffset*, struct MapLayout*); +static void RedrawMapSliceSouth(struct FieldCameraOffset*, struct MapLayout*); +static void RedrawMapSliceEast(struct FieldCameraOffset*, struct MapLayout*); +static void RedrawMapSliceWest(struct FieldCameraOffset*, struct MapLayout*); static s32 MapPosToBgTilemapOffset(struct FieldCameraOffset*, s32, s32); -static void DrawWholeMapViewInternal(int x, int y, struct MapData*); -static void DrawMetatileAt(struct MapData*, u16, int, int); +static void DrawWholeMapViewInternal(int x, int y, struct MapLayout*); +static void DrawMetatileAt(struct MapLayout*, u16, int, int); static void DrawMetatile(s32, u16*, u16); static void CameraPanningCB_PanAhead(void); @@ -96,11 +96,11 @@ void sub_8057B14(u16 *a, u16 *b) void DrawWholeMapView(void) { - DrawWholeMapViewInternal(gSaveBlock1.pos.x, gSaveBlock1.pos.y, gMapHeader.mapData); + DrawWholeMapViewInternal(gSaveBlock1.pos.x, gSaveBlock1.pos.y, gMapHeader.mapLayout); sFieldCameraOffset.copyBGToVRAM = TRUE; } -static void DrawWholeMapViewInternal(int x, int y, struct MapData *mapData) +static void DrawWholeMapViewInternal(int x, int y, struct MapLayout *mapLayout) { u8 i; u8 j; @@ -118,27 +118,27 @@ static void DrawWholeMapViewInternal(int x, int y, struct MapData *mapData) temp = sFieldCameraOffset.xTileOffset + j; if (temp >= 32) temp -= 32; - DrawMetatileAt(mapData, r6 + temp, x + j / 2, y + i / 2); + DrawMetatileAt(mapLayout, r6 + temp, x + j / 2, y + i / 2); } } } static void RedrawMapSlicesForCameraUpdate(struct FieldCameraOffset *cameraOffset, int x, int y) { - struct MapData *mapData = gMapHeader.mapData; + struct MapLayout *mapLayout = gMapHeader.mapLayout; if (x > 0) - RedrawMapSliceWest(cameraOffset, mapData); + RedrawMapSliceWest(cameraOffset, mapLayout); if (x < 0) - RedrawMapSliceEast(cameraOffset, mapData); + RedrawMapSliceEast(cameraOffset, mapLayout); if (y > 0) - RedrawMapSliceNorth(cameraOffset, mapData); + RedrawMapSliceNorth(cameraOffset, mapLayout); if (y < 0) - RedrawMapSliceSouth(cameraOffset, mapData); + RedrawMapSliceSouth(cameraOffset, mapLayout); cameraOffset->copyBGToVRAM = TRUE; } -static void RedrawMapSliceNorth(struct FieldCameraOffset *cameraOffset, struct MapData *mapData) +static void RedrawMapSliceNorth(struct FieldCameraOffset *cameraOffset, struct MapLayout *mapLayout) { u8 i; u8 temp; @@ -153,11 +153,11 @@ static void RedrawMapSliceNorth(struct FieldCameraOffset *cameraOffset, struct M temp = cameraOffset->xTileOffset + i; if (temp >= 32) temp -= 32; - DrawMetatileAt(mapData, r7 + temp, gSaveBlock1.pos.x + i / 2, gSaveBlock1.pos.y + 14); + DrawMetatileAt(mapLayout, r7 + temp, gSaveBlock1.pos.x + i / 2, gSaveBlock1.pos.y + 14); } } -static void RedrawMapSliceSouth(struct FieldCameraOffset *cameraOffset, struct MapData *mapData) +static void RedrawMapSliceSouth(struct FieldCameraOffset *cameraOffset, struct MapLayout *mapLayout) { u8 i; u8 temp; @@ -168,11 +168,11 @@ static void RedrawMapSliceSouth(struct FieldCameraOffset *cameraOffset, struct M temp = cameraOffset->xTileOffset + i; if (temp >= 32) temp -= 32; - DrawMetatileAt(mapData, r7 + temp, gSaveBlock1.pos.x + i / 2, gSaveBlock1.pos.y); + DrawMetatileAt(mapLayout, r7 + temp, gSaveBlock1.pos.x + i / 2, gSaveBlock1.pos.y); } } -static void RedrawMapSliceEast(struct FieldCameraOffset *cameraOffset, struct MapData *mapData) +static void RedrawMapSliceEast(struct FieldCameraOffset *cameraOffset, struct MapLayout *mapLayout) { u8 i; u8 temp; @@ -183,11 +183,11 @@ static void RedrawMapSliceEast(struct FieldCameraOffset *cameraOffset, struct Ma temp = cameraOffset->yTileOffset + i; if (temp >= 32) temp -= 32; - DrawMetatileAt(mapData, temp * 32 + r6, gSaveBlock1.pos.x, gSaveBlock1.pos.y + i / 2); + DrawMetatileAt(mapLayout, temp * 32 + r6, gSaveBlock1.pos.x, gSaveBlock1.pos.y + i / 2); } } -static void RedrawMapSliceWest(struct FieldCameraOffset *cameraOffset, struct MapData *mapData) +static void RedrawMapSliceWest(struct FieldCameraOffset *cameraOffset, struct MapLayout *mapLayout) { u8 i; u8 temp; @@ -200,7 +200,7 @@ static void RedrawMapSliceWest(struct FieldCameraOffset *cameraOffset, struct Ma temp = cameraOffset->yTileOffset + i; if (temp >= 32) temp -= 32; - DrawMetatileAt(mapData, temp * 32 + r5, gSaveBlock1.pos.x + 14, gSaveBlock1.pos.y + i / 2); + DrawMetatileAt(mapLayout, temp * 32 + r5, gSaveBlock1.pos.x + 14, gSaveBlock1.pos.y + i / 2); } } @@ -210,7 +210,7 @@ void CurrentMapDrawMetatileAt(int x, int y) if (offset >= 0) { - DrawMetatileAt(gMapHeader.mapData, offset, x, y); + DrawMetatileAt(gMapHeader.mapLayout, offset, x, y); sFieldCameraOffset.copyBGToVRAM = TRUE; } } @@ -226,7 +226,7 @@ void DrawDoorMetatileAt(int x, int y, u16 *arr) } } -static void DrawMetatileAt(struct MapData *mapData, u16 offset, int x, int y) +static void DrawMetatileAt(struct MapLayout *mapLayout, u16 offset, int x, int y) { u16 *metatiles; u16 metatileId = MapGridGetMetatileIdAt(x, y); @@ -236,11 +236,11 @@ static void DrawMetatileAt(struct MapData *mapData, u16 offset, int x, int y) if (metatileId < 0x200) { - metatiles = mapData->primaryTileset->metatiles; + metatiles = mapLayout->primaryTileset->metatiles; } else { - metatiles = mapData->secondaryTileset->metatiles; + metatiles = mapLayout->secondaryTileset->metatiles; metatileId -= 0x200; } diff --git a/src/field_tasks.c b/src/field_tasks.c index 25a4efc58..ea2058965 100644 --- a/src/field_tasks.c +++ b/src/field_tasks.c @@ -611,8 +611,8 @@ bool32 sub_8069D34(s16 x, s16 y) void SetSootopolisGymCrackedIceMetatiles(void) { s32 x, y; - s32 width = gMapHeader.mapData->width; - s32 height = gMapHeader.mapData->height; + s32 width = gMapHeader.mapLayout->width; + s32 height = gMapHeader.mapLayout->height; for (x = 0; x < width; x++) { for (y = 0; y < height; y++) diff --git a/src/fieldmap.c b/src/fieldmap.c index 7383bb174..7d0aaf2f8 100644 --- a/src/fieldmap.c +++ b/src/fieldmap.c @@ -25,7 +25,7 @@ EWRAM_DATA struct MapHeader gMapHeader = {0}; EWRAM_DATA struct Camera gCamera = {0}; EWRAM_DATA static struct ConnectionFlags gUnknown_0202E850 = {0}; -struct BackupMapData gUnknown_03004870; +struct BackupMapLayout gUnknown_03004870; static const struct ConnectionFlags sDummyConnectionFlags = {0}; @@ -53,19 +53,19 @@ void sub_8055FC0(void) void mapheader_copy_mapdata_with_padding(struct MapHeader *mapHeader) { - struct MapData *mapData; + struct MapLayout *mapLayout; int width; int height; - mapData = mapHeader->mapData; + mapLayout = mapHeader->mapLayout; CpuFastFill16(0x03ff, gUnknown_02029828, sizeof(gUnknown_02029828)); gUnknown_03004870.map = gUnknown_02029828; - width = mapData->width + 15; + width = mapLayout->width + 15; gUnknown_03004870.width = width; - height = mapData->height + 14; + height = mapLayout->height + 14; gUnknown_03004870.height = height; if (width * height <= 0x2800) { - map_copy_with_padding(mapData->map, mapData->width, mapData->height); + map_copy_with_padding(mapLayout->map, mapLayout->width, mapLayout->height); sub_80560AC(mapHeader); } } @@ -129,8 +129,8 @@ void sub_8056134(int x, int y, struct MapHeader *mapHeader, int x2, int y2, int u16 *dest; int mapWidth; - mapWidth = mapHeader->mapData->width; - src = &mapHeader->mapData->map[mapWidth * y2 + x2]; + mapWidth = mapHeader->mapLayout->width; + src = &mapHeader->mapLayout->map[mapWidth * y2 + x2]; dest = &gUnknown_03004870.map[gUnknown_03004870.width * y + x]; for (i = 0; i < height; i++) @@ -150,9 +150,9 @@ void fillSouthConnection(struct MapHeader *mapHeader, struct MapHeader *connecte if (connectedMapHeader) { - cWidth = connectedMapHeader->mapData->width; + cWidth = connectedMapHeader->mapLayout->width; x = offset + 7; - y = mapHeader->mapData->height + 7; + y = mapHeader->mapLayout->height + 7; if (x < 0) { x2 = -x; @@ -196,8 +196,8 @@ void fillNorthConnection(struct MapHeader *mapHeader, struct MapHeader *connecte if (connectedMapHeader) { - cWidth = connectedMapHeader->mapData->width; - cHeight = connectedMapHeader->mapData->height; + cWidth = connectedMapHeader->mapLayout->width; + cHeight = connectedMapHeader->mapLayout->height; x = offset + 7; y2 = cHeight - 7; if (x < 0) @@ -245,8 +245,8 @@ void fillWestConnection(struct MapHeader *mapHeader, struct MapHeader *connected int cWidth, cHeight; if (connectedMapHeader) { - cWidth = connectedMapHeader->mapData->width; - cHeight = connectedMapHeader->mapData->height; + cWidth = connectedMapHeader->mapLayout->width; + cHeight = connectedMapHeader->mapLayout->height; y = offset + 7; x2 = cWidth - 7; if (y < 0) @@ -291,8 +291,8 @@ void fillEastConnection(struct MapHeader *mapHeader, struct MapHeader *connected int cHeight; if (connectedMapHeader) { - cHeight = connectedMapHeader->mapData->height; - x = mapHeader->mapData->width + 7; + cHeight = connectedMapHeader->mapLayout->height; + x = mapHeader->mapLayout->width + 7; y = offset + 7; if (y < 0) { @@ -352,10 +352,10 @@ u8 MapGridGetZCoordAt(int x, int y) } else { - border = gMapHeader.mapData->border; + border = gMapHeader.mapLayout->border; i = (x + 1) & 1; i += ((y + 1) & 1) * 2; - block = gMapHeader.mapData->border[i]; + block = gMapHeader.mapLayout->border[i]; block |= 0xc00; } if (block == 0x3ff) @@ -378,10 +378,10 @@ u8 MapGridIsImpassableAt(int x, int y) } else { - border = gMapHeader.mapData->border; + border = gMapHeader.mapLayout->border; i = (x + 1) & 1; i += ((y + 1) & 1) * 2; - block = gMapHeader.mapData->border[i]; + block = gMapHeader.mapLayout->border[i]; block |= 0xc00; } if (block == 0x3ff) @@ -396,7 +396,7 @@ u32 MapGridGetMetatileIdAt(int x, int y) u16 block; int i; int j; - struct MapData *mapData; + struct MapLayout *mapLayout; u16 *border; u16 block2; @@ -407,17 +407,17 @@ u32 MapGridGetMetatileIdAt(int x, int y) } else { - mapData = gMapHeader.mapData; + mapLayout = gMapHeader.mapLayout; i = (x + 1) & 1; i += ((y + 1) & 1) * 2; - block = mapData->border[i] | 0xc00; + block = mapLayout->border[i] | 0xc00; } if (block == 0x3ff) { - border = gMapHeader.mapData->border; + border = gMapHeader.mapLayout->border; j = (x + 1) & 1; j += ((y + 1) & 1) * 2; - block2 = gMapHeader.mapData->border[j]; + block2 = gMapHeader.mapLayout->border[j]; block2 |= 0xc00; return block2 & block; } @@ -465,12 +465,12 @@ u32 GetBehaviorByMetatileId(u16 metatile) u16 *attributes; if (metatile <= 0x1ff) { - attributes = gMapHeader.mapData->primaryTileset->metatileAttributes; + attributes = gMapHeader.mapLayout->primaryTileset->metatileAttributes; return attributes[metatile]; } else if (metatile <= 0x3ff) { - attributes = gMapHeader.mapData->secondaryTileset->metatileAttributes; + attributes = gMapHeader.mapLayout->secondaryTileset->metatileAttributes; return attributes[metatile - 0x200]; } else @@ -600,7 +600,7 @@ void sub_80566F0(u8 a1) int GetMapBorderIdAt(int x, int y) { - struct MapData *mapData; + struct MapLayout *mapLayout; u16 block, block2; int i, j; if (x >= 0 && x < gUnknown_03004870.width @@ -616,10 +616,10 @@ int GetMapBorderIdAt(int x, int y) } else { - mapData = gMapHeader.mapData; + mapLayout = gMapHeader.mapLayout; j = (x + 1) & 1; j += ((y + 1) & 1) * 2; - block2 = 0xc00 | mapData->border[j]; + block2 = 0xc00 | mapLayout->border[j]; if (block2 == 0x3ff) { goto fail; @@ -696,7 +696,7 @@ void sub_8056918(struct MapConnection *connection, int direction, int x, int y) gSaveBlock1.pos.y -= connection->offset; break; case CONNECTION_WEST: - gSaveBlock1.pos.x = mapHeader->mapData->width; + gSaveBlock1.pos.x = mapHeader->mapLayout->width; gSaveBlock1.pos.y -= connection->offset; break; case CONNECTION_SOUTH: @@ -705,7 +705,7 @@ void sub_8056918(struct MapConnection *connection, int direction, int x, int y) break; case CONNECTION_NORTH: gSaveBlock1.pos.x -= connection->offset; - gSaveBlock1.pos.y = mapHeader->mapData->height; + gSaveBlock1.pos.y = mapHeader->mapLayout->height; break; } } @@ -768,10 +768,10 @@ bool8 sub_8056ABC(u8 direction, int x, int y, struct MapConnection *connection) { case CONNECTION_SOUTH: case CONNECTION_NORTH: - return sub_8056B20(x, gMapHeader.mapData->width, mapHeader->mapData->width, connection->offset); + return sub_8056B20(x, gMapHeader.mapLayout->width, mapHeader->mapLayout->width, connection->offset); case CONNECTION_WEST: case CONNECTION_EAST: - return sub_8056B20(y, gMapHeader.mapData->height, mapHeader->mapData->height, connection->offset); + return sub_8056B20(y, gMapHeader.mapLayout->height, mapHeader->mapLayout->height, connection->offset); } return FALSE; } @@ -812,10 +812,10 @@ int sub_8056B60(struct MapConnection *connection, int x, int y) { case CONNECTION_SOUTH: case CONNECTION_NORTH: - return sub_8056B4C(x - connection->offset, mapHeader->mapData->width); + return sub_8056B4C(x - connection->offset, mapHeader->mapLayout->width); case CONNECTION_WEST: case CONNECTION_EAST: - return sub_8056B4C(y - connection->offset, mapHeader->mapData->height); + return sub_8056B4C(y - connection->offset, mapHeader->mapLayout->height); } return FALSE; } @@ -839,9 +839,9 @@ struct MapConnection *sub_8056BA0(s16 x, s16 y) direction = connection->direction; if ((direction == CONNECTION_DIVE || direction == CONNECTION_EMERGE) || (direction == CONNECTION_NORTH && y > 6) - || (direction == CONNECTION_SOUTH && y < gMapHeader.mapData->height + 7) + || (direction == CONNECTION_SOUTH && y < gMapHeader.mapLayout->height + 7) || (direction == CONNECTION_WEST && x > 6) - || (direction == CONNECTION_EAST && x < gMapHeader.mapData->width + 7)) + || (direction == CONNECTION_EAST && x < gMapHeader.mapLayout->width + 7)) { continue; } @@ -916,42 +916,42 @@ void sub_8056CBC(struct Tileset *tileset, int offset, int size) } } -void sub_8056D28(struct MapData *mapData) +void sub_8056D28(struct MapLayout *mapLayout) { void *src = (void*)(BG_VRAM); - sub_8056C98(mapData->primaryTileset, src); + sub_8056C98(mapLayout->primaryTileset, src); } -void sub_8056D38(struct MapData *mapData) +void sub_8056D38(struct MapLayout *mapLayout) { void *src = (void*)(BG_VRAM + 0x4000); - sub_8056C98(mapData->secondaryTileset, src); + sub_8056C98(mapLayout->secondaryTileset, src); } -void apply_map_tileset1_palette(struct MapData *mapData) +void apply_map_tileset1_palette(struct MapLayout *mapLayout) { - sub_8056CBC(mapData->primaryTileset, 0, 0xc0); + sub_8056CBC(mapLayout->primaryTileset, 0, 0xc0); } -void apply_map_tileset2_palette(struct MapData *mapData) +void apply_map_tileset2_palette(struct MapLayout *mapLayout) { - sub_8056CBC(mapData->secondaryTileset, 0x60, 0xc0); + sub_8056CBC(mapLayout->secondaryTileset, 0x60, 0xc0); } -void copy_map_tileset1_tileset2_to_vram(struct MapData *mapData) +void copy_map_tileset1_tileset2_to_vram(struct MapLayout *mapLayout) { - if (mapData) + if (mapLayout) { - sub_8056D28(mapData); - sub_8056D38(mapData); + sub_8056D28(mapLayout); + sub_8056D38(mapLayout); } } -void apply_map_tileset1_tileset2_palette(struct MapData *mapData) +void apply_map_tileset1_tileset2_palette(struct MapLayout *mapLayout) { - if (mapData) + if (mapLayout) { - apply_map_tileset1_palette(mapData); - apply_map_tileset2_palette(mapData); + apply_map_tileset1_palette(mapLayout); + apply_map_tileset2_palette(mapLayout); } } diff --git a/src/item_use.c b/src/item_use.c index 69fcd51de..e6087d1f9 100644 --- a/src/item_use.c +++ b/src/item_use.c @@ -384,23 +384,23 @@ bool8 sub_80C9688(struct MapConnection *connection, int x, int y) case 2: localOffset = connection->offset + 7; localX = x - localOffset; - localLength = mapHeader->mapData->height - 7; + localLength = mapHeader->mapLayout->height - 7; localY = localLength + y; // additions are reversed for some reason break; case 1: localOffset = connection->offset + 7; localX = x - localOffset; - localLength = gMapHeader.mapData->height + 7; + localLength = gMapHeader.mapLayout->height + 7; localY = y - localLength; break; case 3: - localLength = mapHeader->mapData->width - 7; + localLength = mapHeader->mapLayout->width - 7; localX = localLength + x; // additions are reversed for some reason localOffset = connection->offset + 7; localY = y - localOffset; break; case 4: - localLength = gMapHeader.mapData->width + 7; + localLength = gMapHeader.mapLayout->width + 7; localX = x - localLength; localOffset = connection->offset + 7; localY = y - localOffset; @@ -417,8 +417,8 @@ void sub_80C9720(u8 taskId) { s16 x, y; s16 curX, curY; - s16 width = gMapHeader.mapData->width + 7; - s16 height = gMapHeader.mapData->height + 7; + s16 width = gMapHeader.mapLayout->width + 7; + s16 height = gMapHeader.mapLayout->height + 7; PlayerGetDestCoords(&x, &y); diff --git a/src/overworld.c b/src/overworld.c index 47e23ad35..6a44afb04 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -86,7 +86,7 @@ extern u8 TradeRoom_PromptToCancelLink[]; extern u8 TradeRoom_TerminateLink[]; extern u8 gUnknown_081A4508[]; -extern struct MapData * const gMapAttributes[]; +extern struct MapLayout * const gMapLayouts[]; extern struct MapHeader * const * const gMapGroups[]; extern s32 gMaxFlashLevel; @@ -336,17 +336,17 @@ void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType) static void mapdata_load_assets_to_gpu_and_full_redraw(void) { move_tilemap_camera_to_upper_left_corner(); - copy_map_tileset1_tileset2_to_vram(gMapHeader.mapData); - apply_map_tileset1_tileset2_palette(gMapHeader.mapData); + copy_map_tileset1_tileset2_to_vram(gMapHeader.mapLayout); + apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout); DrawWholeMapView(); cur_mapheader_run_tileset_funcs_after_some_cpuset(); } -static struct MapData *get_mapdata_header(void) +static struct MapLayout *GetMapLayout(void) { - u16 mapDataId = gSaveBlock1.mapDataId; - if (mapDataId) - return gMapAttributes[mapDataId - 1]; + u16 mapLayoutId = gSaveBlock1.mapLayoutId; + if (mapLayoutId) + return gMapLayouts[mapLayoutId - 1]; return NULL; } @@ -395,14 +395,14 @@ struct MapHeader *const warp1_get_mapheader(void) static void set_current_map_header_from_sav1_save_old_name(void) { gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum); - gSaveBlock1.mapDataId = gMapHeader.mapDataId; - gMapHeader.mapData = get_mapdata_header(); + gSaveBlock1.mapLayoutId = gMapHeader.mapLayoutId; + gMapHeader.mapLayout = GetMapLayout(); } static void LoadSaveblockMapHeader(void) { gMapHeader = *Overworld_GetMapHeaderByGroupAndId(gSaveBlock1.location.mapGroup, gSaveBlock1.location.mapNum); - gMapHeader.mapData = get_mapdata_header(); + gMapHeader.mapLayout = GetMapLayout(); } void sub_80533CC(void) @@ -419,8 +419,8 @@ void sub_80533CC(void) } else { - gSaveBlock1.pos.x = gMapHeader.mapData->width / 2; - gSaveBlock1.pos.y = gMapHeader.mapData->height / 2; + gSaveBlock1.pos.x = gMapHeader.mapLayout->width / 2; + gSaveBlock1.pos.y = gMapHeader.mapLayout->height / 2; } } @@ -608,8 +608,8 @@ void sub_80538F0(u8 mapGroup, u8 mapNum) Overworld_ClearSavedMusic(); mapheader_run_script_with_tag_x3(); not_trainer_hill_battle_pyramid(); - sub_8056D38(gMapHeader.mapData); - apply_map_tileset2_palette(gMapHeader.mapData); + sub_8056D38(gMapHeader.mapLayout); + apply_map_tileset2_palette(gMapHeader.mapLayout); for (paletteIndex = 6; paletteIndex < 12; paletteIndex++) ApplyWeatherGammaShiftToPal(paletteIndex); @@ -784,10 +784,10 @@ u8 Overworld_GetFlashLevel(void) return gSaveBlock1.flashLevel; } -void sub_8053D14(u16 mapDataId) +void sub_8053D14(u16 mapLayoutId) { - gSaveBlock1.mapDataId = mapDataId; - gMapHeader.mapData = get_mapdata_header(); + gSaveBlock1.mapLayoutId = mapLayoutId; + gMapHeader.mapLayout = GetMapLayout(); } static bool16 ShouldLegendaryMusicPlayAtLocation(struct WarpData *warp) @@ -1558,15 +1558,15 @@ bool32 sub_805483C(u8 *a1) (*a1)++; break; case 6: - sub_8056D28(gMapHeader.mapData); + sub_8056D28(gMapHeader.mapLayout); (*a1)++; break; case 7: - sub_8056D38(gMapHeader.mapData); + sub_8056D38(gMapHeader.mapLayout); (*a1)++; break; case 8: - apply_map_tileset1_tileset2_palette(gMapHeader.mapData); + apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout); (*a1)++; break; case 9: @@ -1624,15 +1624,15 @@ bool32 sub_805493C(u8 *a1, u32 a2) (*a1)++; break; case 6: - sub_8056D28(gMapHeader.mapData); + sub_8056D28(gMapHeader.mapLayout); (*a1)++; break; case 7: - sub_8056D38(gMapHeader.mapData); + sub_8056D38(gMapHeader.mapLayout); (*a1)++; break; case 8: - apply_map_tileset1_tileset2_palette(gMapHeader.mapData); + apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout); (*a1)++; break; case 9: @@ -1714,15 +1714,15 @@ bool32 sub_8054A9C(u8 *a1) (*a1)++; break; case 5: - sub_8056D28(gMapHeader.mapData); + sub_8056D28(gMapHeader.mapLayout); (*a1)++; break; case 6: - sub_8056D38(gMapHeader.mapData); + sub_8056D38(gMapHeader.mapLayout); (*a1)++; break; case 7: - apply_map_tileset1_tileset2_palette(gMapHeader.mapData); + apply_map_tileset1_tileset2_palette(gMapHeader.mapLayout); (*a1)++; break; case 8: diff --git a/src/region_map.c b/src/region_map.c index 81ecd7c1b..74062f435 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -628,8 +628,8 @@ static void InitializeCursorPosition(void) case 5: gRegionMap->mapSectionId = gMapHeader.regionMapSectionId; gRegionMap->playerIsInCave = FALSE; - mapWidth = gMapHeader.mapData->width; - mapHeight = gMapHeader.mapData->height; + mapWidth = gMapHeader.mapLayout->width; + mapHeight = gMapHeader.mapLayout->height; x = gSaveBlock1.pos.x; y = gSaveBlock1.pos.y; if (gRegionMap->mapSectionId == MAPSEC_UNDERWATER_128) @@ -640,8 +640,8 @@ static void InitializeCursorPosition(void) mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1.warp4.mapGroup, gSaveBlock1.warp4.mapNum); gRegionMap->mapSectionId = mapHeader->regionMapSectionId; gRegionMap->playerIsInCave = TRUE; - mapWidth = mapHeader->mapData->width; - mapHeight = mapHeader->mapData->height; + mapWidth = mapHeader->mapLayout->width; + mapHeight = mapHeader->mapLayout->height; x = gSaveBlock1.warp4.x; y = gSaveBlock1.warp4.y; break; @@ -649,8 +649,8 @@ static void InitializeCursorPosition(void) mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1.warp2.mapGroup, gSaveBlock1.warp2.mapNum); gRegionMap->mapSectionId = mapHeader->regionMapSectionId; gRegionMap->playerIsInCave = TRUE; - mapWidth = mapHeader->mapData->width; - mapHeight = mapHeader->mapData->height; + mapWidth = mapHeader->mapLayout->width; + mapHeight = mapHeader->mapLayout->height; x = gSaveBlock1.warp2.x; y = gSaveBlock1.warp2.y; break; @@ -671,8 +671,8 @@ static void InitializeCursorPosition(void) gRegionMap->mapSectionId = mapHeader->regionMapSectionId; } gRegionMap->playerIsInCave = FALSE; - mapWidth = mapHeader->mapData->width; - mapHeight = mapHeader->mapData->height; + mapWidth = mapHeader->mapLayout->width; + mapHeight = mapHeader->mapLayout->height; x = r4->x; y = r4->y; } @@ -758,14 +758,14 @@ static void sub_80FB600(void) u16 r1; gRegionMap->mapSectionId = mapHeader->regionMapSectionId; - r1 = mapHeader->mapData->width / gRegionMapLocations[gRegionMap->mapSectionId].width; + r1 = mapHeader->mapLayout->width / gRegionMapLocations[gRegionMap->mapSectionId].width; if (r1 == 0) r1 = 1; x = sp2 / r1; if (x >= gRegionMapLocations[gRegionMap->mapSectionId].width) x = gRegionMapLocations[gRegionMap->mapSectionId].width - 1; - r1 = mapHeader->mapData->height / gRegionMapLocations[gRegionMap->mapSectionId].height; + r1 = mapHeader->mapLayout->height / gRegionMapLocations[gRegionMap->mapSectionId].height; if (r1 == 0) r1 = 1; y = sp4 / r1; diff --git a/src/secret_base.c b/src/secret_base.c index 60ce80af5..0812d2ac6 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -241,11 +241,11 @@ void sub_80BB764(s16 *arg1, s16 *arg2, u16 arg3) { s16 x, y; - for (y=0; y<gMapHeader.mapData->height; y++) + for (y=0; y<gMapHeader.mapLayout->height; y++) { - for (x=0; x<gMapHeader.mapData->width; x++) + for (x=0; x<gMapHeader.mapLayout->width; x++) { - if ((gMapHeader.mapData->map[y * gMapHeader.mapData->width + x] & 0x3ff) == arg3) + if ((gMapHeader.mapLayout->map[y * gMapHeader.mapLayout->width + x] & 0x3ff) == arg3) { *arg1 = x; *arg2 = y; diff --git a/src/shop.c b/src/shop.c index 88719e25e..8a5da1117 100644 --- a/src/shop.c +++ b/src/shop.c @@ -409,16 +409,16 @@ static void Shop_DrawViewportTiles(void) s32 r3 = MapGridGetMetatileLayerTypeAt(facingX + x, facingY + y); if (metatileId < 512) - BuyMenuDrawMapMetatile(x, y, (u16 *)gMapHeader.mapData->primaryTileset->metatiles + metatileId * 8, r3); + BuyMenuDrawMapMetatile(x, y, (u16 *)gMapHeader.mapLayout->primaryTileset->metatiles + metatileId * 8, r3); else - BuyMenuDrawMapMetatile(x, y, (u16 *)gMapHeader.mapData->secondaryTileset->metatiles + (metatileId - 512) * 8, r3); + BuyMenuDrawMapMetatile(x, y, (u16 *)gMapHeader.mapLayout->secondaryTileset->metatiles + (metatileId - 512) * 8, r3); } else { if (metatileId < 512) - BuyMenuDrawMapPartialMetatile(x, y, (u16 *)gMapHeader.mapData->primaryTileset->metatiles + metatileId * 8); + BuyMenuDrawMapPartialMetatile(x, y, (u16 *)gMapHeader.mapLayout->primaryTileset->metatiles + metatileId * 8); else - BuyMenuDrawMapPartialMetatile(x, y, (u16 *)gMapHeader.mapData->secondaryTileset->metatiles + (metatileId - 512) * 8); + BuyMenuDrawMapPartialMetatile(x, y, (u16 *)gMapHeader.mapLayout->secondaryTileset->metatiles + (metatileId - 512) * 8); } if (y == 0 && x != 0 && x != 6) diff --git a/src/tileset_anim.c b/src/tileset_anim.c index abd38edad..25f561c96 100644 --- a/src/tileset_anim.c +++ b/src/tileset_anim.c @@ -518,11 +518,11 @@ static void StartTileset1Animation(void) gTileset1AnimFrame = 0; gTileset1AnimLength = 0; gTileset1AnimCallback = 0; - if (gMapHeader.mapData->primaryTileset) + if (gMapHeader.mapLayout->primaryTileset) { - if (gMapHeader.mapData->primaryTileset->callback) + if (gMapHeader.mapLayout->primaryTileset->callback) { - gMapHeader.mapData->primaryTileset->callback(); + gMapHeader.mapLayout->primaryTileset->callback(); } } } @@ -532,11 +532,11 @@ static void StartTileset2Animation(void) gTileset2AnimFrame = 0; gTileset2AnimLength = 0; gTileset2AnimCallback = 0; - if (gMapHeader.mapData->secondaryTileset) + if (gMapHeader.mapLayout->secondaryTileset) { - if (gMapHeader.mapData->secondaryTileset->callback) + if (gMapHeader.mapLayout->secondaryTileset->callback) { - gMapHeader.mapData->secondaryTileset->callback(); + gMapHeader.mapLayout->secondaryTileset->callback(); } } } diff --git a/src/wild_encounter.c b/src/wild_encounter.c index ad11bf566..133f8b3aa 100644 --- a/src/wild_encounter.c +++ b/src/wild_encounter.c @@ -3725,7 +3725,7 @@ static u16 GetRoute119WaterTileNum(s16 x, s16 y, u8 section) for (yCur = yMin; yCur <= yMax; yCur++) { - for (xCur = 0; xCur < gMapHeader.mapData->width; xCur++) + for (xCur = 0; xCur < gMapHeader.mapLayout->width; xCur++) { if (MetatileBehavior_IsFeebasEncounterable(MapGridGetMetatileBehaviorAt(xCur + 7, yCur + 7)) == TRUE) { |