Tile map file: Difference between revisions
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Tile maps store visual data for the [https://problemkaputt.de/gbatek-lcd-vram-bg-screen-data-format-bg-map.htm GBA's background layers]. Each tile map file contains: | Tile maps store visual data for the [https://problemkaputt.de/gbatek-lcd-vram-bg-screen-data-format-bg-map.htm GBA's background layers]. Each tile map file contains: | ||
* The tile set used by this tile map file, as an array of standard 8x8 px 4 bpp tiles. '''Optional''', if the tile map file does not contain tile set data, then they must be loaded by an external mechanism (generally a script). Tile maps for menus are usually storing the tile sets themselves, while normal overworld/dungeon maps depend on | * The tile set used by this tile map file, as an array of standard 8x8 px 4 bpp tiles. '''Optional''', if the tile map file does not contain tile set data, then they must be loaded by an external mechanism (generally a script). Tile maps for menus are usually storing the tile sets themselves, while normal overworld/dungeon maps depend on an external tile set. | ||
* An array of metatiles: Each metatile is 2x2 tiles in size. This serves as a compression mechanism. | * An array of metatiles: Each metatile is 2x2 tiles in size. This serves as a compression mechanism. | ||
* An array of layers: Each tile map file | * An array of layers: Each tile map file contains one or multiple different "layers". Most dungeon maps use only a single layer (or two, to create water/ice reflection effects), while tile map files for menus contain many layers (one or more per screen). All layers in a tile map file share the same tile set and metatile set. | ||
= Compression = | = Compression = | ||
Line 18: | Line 18: | ||
/* offset 0x06 */ u16 tileCount; // Number of tiles in this file's tileset (if it exists) | /* offset 0x06 */ u16 tileCount; // Number of tiles in this file's tileset (if it exists) | ||
/* offset 0x08 */ u16 metatileCount; // Number of metatiles in this file | /* offset 0x08 */ u16 metatileCount; // Number of metatiles in this file | ||
/* offset 0x0a */ u16 loadOffset; // Offset into VRAM at which the | /* offset 0x0a */ u16 loadOffset; // Offset into VRAM at which the tileset should be copied to, in tiles. | ||
// Byte offset from start of this struct to the layerDefinitions[] array | // Byte offset from start of this struct to the layerDefinitions[] array | ||
Line 37: | Line 37: | ||
// Each metatile contains four GBA BG screen entries: | // Each metatile contains four GBA BG screen entries: | ||
// https://problemkaputt.de/gbatek-lcd-vram-bg-screen-data-format-bg-map.htm | // https://problemkaputt.de/gbatek-lcd-vram-bg-screen-data-format-bg-map.htm | ||
// This includes the tile number | // This includes the tile number, the palette bank, and the flip flags. | ||
// For each metatile, element 0=top left, 1=top right, 2=bottom left, 3=bottom right. | // For each metatile, element 0=top left, 1=top right, 2=bottom left, 3=bottom right. | ||
u16 metatiles[][4]; | u16 metatiles[][4]; | ||
Line 71: | Line 71: | ||
As an example, let's look at a layer that's 32x32 metatiles in size. There are 4 blocks in this layer. First, the top left quarter of the layer is stored in its entirety in the tile map file, followed by the top right quarter, followed by the bottom left quarter, and finally the bottom right quarter. | As an example, let's look at a layer that's 32x32 metatiles in size. There are 4 blocks in this layer. First, the top left quarter of the layer is stored in its entirety in the tile map file, followed by the top right quarter, followed by the bottom left quarter, and finally the bottom right quarter. | ||
= See also = | |||
* [[Tile map files (Boktai 1)]] | |||
* [[Tile map files (Boktai 2)]] | |||
[[Category:Documentation]] [[Category:File formats]] | [[Category:Documentation]] [[Category:File formats]] | ||
[[Category:Boktai 1]] [[Category:Boktai 2]] [[Category:Boktai 3]] | [[Category:Boktai 1]] [[Category:Boktai 2]] [[Category:Boktai 3]] |