Maps - ShiningForceCentral/SF2DISASM GitHub Wiki
A map is a dynamically-sized arrangement of blocks. Each map may use up to 5 pre-defined tilesets, and defines its own blocks.
Components
Tiles
A tile is an 8x8 arrangement of pixels. Tile pixel data is stored in VRAM. The first tileset of a map starts at tile index 0x100 in VRAM, and since each tileset is 128 tiles, that means tileset #2 is at 0x180, tileset #3 is at 0x200, etc. We will call this the VDP Tile Index.
Tileset
A tileset is a set of 128 tiles.
Block
A block is 3x3 arrangement of tiles, defined per map. Each block is 18 bytes (9 tiles * 2 bytes per tile), and each 2 bytes represents one VDP Tile Index. In addition to the VDP Tile Indexes, each tile index contains 2 bits -- one for horizontally flipped (0x0800), and one for vertically flipped (0x0400).
ROM
Byte 1 palette number to use
Byte 2 tileset number for ???
Byte 3 tileset number for above sprites layer ???
Byte 4 tileset number for background layer ???
Byte 5 tileset number for obstructed empty space ???
Byte 6 tileset numbre for decoration on background layer ???
Byte 7... 10 addresses
Address 1 compressed block definitions (tile indexes from 5 used tilesets)
Address 2 compressed map layout (block indexes from section 1)
Address 3 map properties (size, music, etc) -- different "rooms" go in order
Byte 00-01 X1 bound
Byte 02-03 Y1 bound
Byte 04-05 X2 bound
Byte 06-07 Y2 bound
Byte 08-09 X1 bound of layer 2
Byte 0a-0b Y1 bound of layer 2
...
Byte 10-11 X parallax of layer 2
Byte 12-13 Y parallax of layer 2
Byte 14-15 X parallax
Byte 16-17 Y parallax
Byte 18 X autoscroll of layer 2
Byte 19 Y autoscroll of layer 2
Byte 1a X autoscroll
Byte 1b Y autoscroll
Byte 1c
Byte 1d music to play
Address 4 flags and block changes if those flags are true
Byte 00-01 flag
Byte 02 top-left X coord of source
Byte 03 top-left Y coord of source
Byte 04 width to copy
Byte 05 height to copy
Byte 06 top-left X coord of dest
Byte 07 top-left Y coord of dest
Address 5 block changes triggered by stepping (same as address 6)
Address 6 hiding roof somehow (x trig coord, y trig coord, x copy coord, y copy coord, width, height, x dest, y dest) - copy tiles to hide roof?
Address 7 warp
Address 8 treasure list -- chests (4 bytes each (x, y, flag, item idx), terminated with FFFF)
Address 9 treasure list -- non-chests (4 bytes each (x, y, flag, item idx), terminated with FFFF)
Address 10 animated tiles data
RAM
- Map layout definition (block indexes) are loaded into RAM at 0xFF0000.
- Block definitions (VDP tile indexes) are loaded into RAM at 0xFF2000.