Skip to content
AuriRex edited this page Sep 10, 2019 · 5 revisions

Map2D

Map2D files are stored in the games root/Map2D/ folder. Almost every Map in the game has its own Map2D files for each individual Area.

The files are saved in a folder that is named the same as the Map that the Map2D belongs to as either map[AreaCode].bin or mapwd.bin.

Examples:

  • map00.bin
  • map01.bin
  • map15.bin
  • mapwd.bin

mapwd.bin

A Map (Island / Dungeon) can consist of multiple Areas connected together to create a bigger Map. Each Area contains its own sized Map2D however there is a seperate Map2D called mapwd.bin that displays the entire island at once.

For example the first island the player spawns at (Mercury Island / isle_main) displays the whole island instead of each Area on its own. (Most islands display mapwd.bin, TODO: confirm)

Map2D File Format

The Map2D file format consists of one lz10 compressed NARC File that contains three files always named the same:

  • map2d.nbfp (Palette file)
  • map2d.nbfc (Tiles file)
  • map2d.nbfs (Screen file)

.nbfp / Palette File

This file contains every color used in the map.

The file contains 256 colors and stores each one in 2 Bytes in the BGR555 format as little endian.

BGR555

X = Nothing / Unused

B = Blue bits

G = Green Bits

R = Red bits

XBBBBBGG GGGRRRRR

Little Endian

The actuall bits are saved like this:

GGGRRRRR XBBBBBGG [... + other 255 colors]

.nbfc / Tiles File

This file defines multiple tiles that will be assembled to create the final image.

One Tile is 8x8 Pixels and every Pixel is stored as a 1 Byte index referencing a color from the palette file (1 Tile = 64 Byte).

To get the number of Tiles in a file, divide the filesize (in Byte) by 64.

.nbfs / Screen File

This file tells the game how to arrange the tiles on the screen.

It contains 32 x 24 instructions (NDS Screen Resolution 256x192px) for a total of 768 entrys.

Each entry is 2 Bytes long and saved as little endian like the palette information.

Every Tile can be fliped horizontally and vertically when the correct bits are set.

The Tile number is an index refencing the tiles from the .nbfc / Tiles file.

.nbfs Format

P = palette number (always zero in this case)

Y = Flip Tile on Y axis

X = Flip Tile on X axis

N = Tile number / index from .nbfc file

PPPPYXNN NNNNNNNN


Thanks to the creator of this document: romhacking.net NDS File Formats

Clone this wiki locally