EarthBound/Map Data/Compressed Tile Arrangement Data: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
(→‎Format: Document format)
 
(5 intermediate revisions by one other user not shown)
Line 136: Line 136:
Tile arrangement data for each map tileset is individually compressed. See [[EarthBound:ASM:Decompression_Routine#CompressionFormat|Compression Format]].
Tile arrangement data for each map tileset is individually compressed. See [[EarthBound:ASM:Decompression_Routine#CompressionFormat|Compression Format]].


===Decompressed Format===
===Decompressed Format<span class="anchor" id="Decompressed_Format"></span>===


Each entry, once decompressed, consists of a variable number of tile arrangements (four-tile-by-four-tile chunks), each 32 bytes. Arrangements are found from an index using the formula <code>arrangement_offset = arrangement_index * 32</code>.
Each entry, once decompressed, consists of a variable number of tile arrangements (four-tile-by-four-tile chunks), each 32 bytes. Arrangements are found from an index using the formula <code>arrangement_offset = arrangement_index * 32</code>. The [[EarthBound:Decompressed_Tile_Arrangement_Data|decompression buffer]] has capacity for up to 960 arrangements (30720 bytes), but in an unmodified EarthBound ROM, no entry contains more than 935 arrangements.


Each arrangement contains 16 tilemap entries, each 2 bytes. The 16 tilemap entries represent a 4x4 grid of background tiles with each row in left-to-right order, followed by the next row, etc. Thus, within a tile arrangement, the tilemap entry for a given <tt>0-3/0-3</tt> x/y coordinate can be found using the formula <code>entry_offset = y * 8 + x % 8 * 2</code>.
Each arrangement contains 16 tilemap entries, each 2 bytes. The 16 tilemap entries represent a 4x4 grid of background tiles with each row in left-to-right order, followed by the next row, etc. Thus, within a tile arrangement, the tilemap entry for a given <tt>0-3/0-3</tt> x/y coordinate can be found using the formula <code>entry_offset = x * 2 + y * 8</code>.


===Tilemap Entry Format===
===Tilemap Entry Format===
Line 153: Line 153:
* <tt>0CCCCCCCCC</tt> (bits <tt>0x03FF</tt>): Tileset character selection. Character index into the currently loaded map tileset of a background tile. Always between 0 and 511 (inclusive) as those are the characters that EarthBound uses as background tiles. For characters paired with a foreground character, EarthBound will automatically generate the tilemap entry for the paired foreground tile. See [[EarthBound:Map_Data:Compressed_Tileset_Character_Data#DecompressedFormat|Tileset Character Data Decompressed Format]].
* <tt>0CCCCCCCCC</tt> (bits <tt>0x03FF</tt>): Tileset character selection. Character index into the currently loaded map tileset of a background tile. Always between 0 and 511 (inclusive) as those are the characters that EarthBound uses as background tiles. For characters paired with a foreground character, EarthBound will automatically generate the tilemap entry for the paired foreground tile. See [[EarthBound:Map_Data:Compressed_Tileset_Character_Data#DecompressedFormat|Tileset Character Data Decompressed Format]].


{{stub}}
[[Category:EarthBound:Map_Data|Compressed Tile Arrangement Data]]
[[Category:EarthBound:Map_Data|Compressed Tile Arrangement Data]]

Latest revision as of 02:41, 24 January 2024

This is a sub-page of EarthBound/Map Data.

Data blocks storing arrangements of four-tile-by-four-tile chunks for map tilesets. Data for a given map tileset is found using the Tile Arrangement Pointer Table.

Terminology note: In EarthBound modding, these four-tile-by-four-tile chunks are often referred to ambiguously as "tiles", while the individual 8x8 pixel tiles making up the tile chunks are often referred to as "minitiles".

Blocks

Block 1

Map Data: Compressed Tile Arrangement Data, Block 1
Game EarthBound
Start Address 0x17C800
End Address 0x17FDE7
# of Entries 1
Entry Length Varies
Total Length 13800 bytes (0x35E8), 26624 bytes (0x6800) after decompression
Back to the ROM map
Address Tileset name Tileset index Compressed length Decompressed length Num chunks
0x17C800 Lost Underworld 00 13800 bytes (0x35E8) 26624 bytes (0x6800) 832

Block 2

Map Data: Compressed Tile Arrangement Data, Block 2
Game EarthBound
Start Address 0x190200
End Address 0x19D051
# of Entries 4
Entry Length Varies
Total Length 52818 bytes (0xCE52), 100192 bytes (0x018760) after decompression
Back to the ROM map
Address Tileset name Tileset index Compressed length Decompressed length Num chunks
0x190200 Onett 01 13545 bytes (0x34E9) 27040 bytes (0x69A0) 845
0x1936E9 Twoson 02 13250 bytes (0x33C2) 26464 bytes (0x6760) 827
0x196AAB Threed 03 9514 bytes (0x252A) 16768 bytes (0x4180) 524
0x198FD5 Fourside 04 16509 bytes (0x407D) 29920 bytes (0x74E0) 935

Block 3

Map Data: Compressed Tile Arrangement Data, Block 3
Game EarthBound
Start Address 0x1A0200
End Address 0x1A7EA6
# of Entries 3
Entry Length Varies
Total Length 31911 bytes (0x7CA7), 61152 bytes (0xEEE0) after decompression
Back to the ROM map
Address Tileset name Tileset index Compressed length Decompressed length Num chunks
0x1A0200 Magicant 05 4930 bytes (0x1342) 9184 bytes (0x23E0) 287
0x1A1542 Outdoors 06 15201 bytes (0x3B61) 28000 bytes (0x6D60) 875
0x1A50A3 Summers 07 11780 bytes (0x2E04) 23968 bytes (0x5DA0) 749

Block 4

Map Data: Compressed Tile Arrangement Data, Block 4
Game EarthBound
Start Address 0x1B0200
End Address 0x1BF4EA
# of Entries 6
Entry Length Varies
Total Length 62187 bytes (0xF2EB), 124096 bytes (0x01E4C0) after decompression
Back to the ROM map
Address Tileset name Tileset index Compressed length Decompressed length Num chunks
0x1B0200 Dusty Dunes Desert 08 9921 bytes (0x26C1) 20096 bytes (0x4E80) 628
0x1B28C1 Dalaam 09 15038 bytes (0x3ABE) 29856 bytes (0x74A0) 933
0x1B637F Indoors 4 16 6819 bytes (0x1AA3) 12480 bytes (0x30C0) 390
0x1B7E22 Winters 17 5622 bytes (0x15F6) 10976 bytes (0x2AE0) 343
0x1B9418 Indoors 1 10 13492 bytes (0x34B4) 27872 bytes (0x6CE0) 871
0x1BC8CC Indoors 2 11 11295 bytes (0x2C1F) 22816 bytes (0x5920) 713

Block 5

Map Data: Compressed Tile Arrangement Data, Block 5
Game EarthBound
Start Address 0x1C0200
End Address 0x1CB222
# of Entries 6
Entry Length Varies
Total Length 45091 bytes (0xB023), 85472 bytes (0x014DE0) after decompression
Back to the ROM map
Address Tileset name Tileset index Compressed length Decompressed length Num chunks
0x1C0200 Stores 1 12 8138 bytes (0x1FCA) 14784 bytes (0x39C0) 462
0x1C21CA Caves 1 13 14706 bytes (0x3972) 28224 bytes (0x6E40) 882
0x1C5B3C Indoors 3 14 3903 bytes (0x0F3F) 6496 bytes (0x1960) 203
0x1C6A7B Stores 2 15 2629 bytes (0x0A45) 4576 bytes (0x11E0) 143
0x1C74C0 Scaraba 18 7050 bytes (0x1B8A) 14240 bytes (0x37A0) 445
0x1C904A Caves 2 19 8665 bytes (0x21D9) 17152 bytes (0x4300) 536

Format

Tile arrangement data for each map tileset is individually compressed. See Compression Format.

Decompressed Format

Each entry, once decompressed, consists of a variable number of tile arrangements (four-tile-by-four-tile chunks), each 32 bytes. Arrangements are found from an index using the formula arrangement_offset = arrangement_index * 32. The decompression buffer has capacity for up to 960 arrangements (30720 bytes), but in an unmodified EarthBound ROM, no entry contains more than 935 arrangements.

Each arrangement contains 16 tilemap entries, each 2 bytes. The 16 tilemap entries represent a 4x4 grid of background tiles with each row in left-to-right order, followed by the next row, etc. Thus, within a tile arrangement, the tilemap entry for a given 0-3/0-3 x/y coordinate can be found using the formula entry_offset = x * 2 + y * 8.

Tilemap Entry Format

See SNES Background Tilemap.

VH0PPP0CCCCCCCCC

  • V (bit 0x8000): Vertical flip. If set, tile will be flipped vertically from how it is stored in Tileset Character Data.
  • H (bit 0x4000): Horizontal flip. If set, tile will be flipped horizontally from how it is stored in Tileset Character Data.
  • 0 (bit 0x2000): Always zero in tile arrangement data loaded from ROM. This represents the BG Priority Bit once loaded into the tilemap, but the EarthBound engine sets it automatically when loading foreground/background paired tileset characters. See Tileset Character Data Decompressed Format.
  • PPP (bits 0x1C00): Palette selection. Always between 2 and 7 (inclusive), as those indices are where EarthBound loads map palettes into CGRAM. A palette selection value can be determined from an EarthBound map subpalette number using the formula palette_selection = subpalette_number + 2.
  • 0CCCCCCCCC (bits 0x03FF): Tileset character selection. Character index into the currently loaded map tileset of a background tile. Always between 0 and 511 (inclusive) as those are the characters that EarthBound uses as background tiles. For characters paired with a foreground character, EarthBound will automatically generate the tilemap entry for the paired foreground tile. See Tileset Character Data Decompressed Format.