Overworld Data Format

From SMWiki
Jump to: navigation, search

This article contains information about how levels are stored in Super Mario World. (Note: All the addresses are in SNES Hex format. If the addresses start with 0x instead, they're in PC hex format (headered))

Contents

Warping data

The only elements which uses this data are the pipes and star warps. The warping data starts from SNES $04:8431 and goes until $04:8508. The routine which handles warping is located at SNES $04:8509, while the routine which handles the "arrival" after warping is located at SNES $04:853B. Here's a small ROM Map:

 Tables:
 $04:8431 - 54 bytes - X positions of warp points, aligned to a 16x16 grid. Word values.
 $04:8467 - 54 bytes - Y positions of warp points, aligned to a 16x16 grid. Word values.
 $04:849D - 54 bytes - X arrival of warp points, by pixels. Word values.
 $04:84D3 - 54 bytes - Y arrival of warp points, by pixels. Word values.

For example, the first word value of $04:8431 and $04:8467 take you to the position specified in the first word value of $04:849D and $04:84D3. Keep in mind that editing these tables will not alter the position of pipes and star warps; They simply alter the warp's position.

The format of the first table is as following (every byte, not word):

 $XPosition16x16, $Submap, $XPosition16x16, $Submap, $...

The format of the second table is as following (every byte, not word):

 $YPosition16x16, $00, $YPosition16x16, $00, $...

The format of the third table is actually a little bit more complicated:

 $Xpos, $SubMap+Xpos, $Xpos, $SubMap+Xpos, $...

The SubMap+Xpos uses this byte format:

 ---- MMMX

Where - is unused, M is the submap, and X is the Xpos. The game gets the true submap number by taking the whole byte, shifting it to the right 1 time, then XBA it. Then the result gets AND by 0x0F.

The format of the last table is

 $YposLo, $YposHi, $YposLo, $YposHi, ...

YPosLo is the low byte of the destination Y position, while the YposHi is the high byte of the destination Y position. These bytes do not contain anything else.

Just for reference, here's a list of submaps:

 $00 = Overworld
 $01 = Yoshi's Island
 $02 = Vanilla Dome
 $03 = Forest Of Illusion
 $04 = Bowser's Valley
 $05 = Special World
 $06 = Star World

Overworld Sprite Data

At $04F625-$04F665, there's a small block of data which handles the position of the sprites, and the number of the sprites. ($00-$0A). These values are stored in the overworld sprite tables, but not in the first three slots. These slots are reserved for the moving clouds (sprite $05). It was probably intended to make the first three slots usable for these tables, since $04F616 is the base address that is being read (LDA $F616,y). However, the Y index is always high enough (between $0F and $4B) to not read the data below $04F625.

The data comes in groups of 5 bytes per slot (there are $0C slots). They're arranged in the following format:

 Byte 1 - Sprite number (see list below)
 Byte 2 - XPos, low
 Byte 3 - XPos, high
 Byte 4 - YPos, low
 Byte 5 - YPos, high

For reference, here's a list of the overworld sprites:

 $00 - Free slot (taken up by sprite number 05 usually)
 $01 - Lakitu
 $02 - Blue Bird
 $03 - Fish x3
 $04 - Piranha Plant
 $05 - Moving Cloud
 $06 - Koopa Kid x3
 $07 - Smoke x2
 $08 - Bowser Sign
 $09 - Bowser
 $0A - Boo x2

Overworld map music

 $04:8D8A - 7 bytes - Overworld musics depending on current player's submap.

The small table contains the music which needs to be played in the overworld.

It is indexed by the player's overworld (see list of submaps and their values), which again is indexed by the current player.

This means the first byte is the music number for Overworld, second byte is for Yoshi's Island, and so on.

Overworld layer 2 tilemap

 $04:A533 - 6904 bytes - Layer 2 data's tilemap data: Tile numbers, compressed in LC_RLE2 format. This is table 1.
 $04:A533 - 5709 bytes - Layer 2 data's tilemap data: Tile properties (YXPCCCTT), compressed in LC_RLE2 format. This is table 2.

The tilemap is laid out simple. The tiles all are 8x8. The data start from the upper left corner of the overworld, and goes to the upper right of the overworld. Then it goes one down, and starts from the left again and goes to the right. The table is decompressed into RAM $7F:4000.

Overworld layer 2 event tilemap

 $0C:8000 - 3328 bytes - Tile numbers data for all Layer 2 event tiles (pages 0-A, also including the blank tiles).
 $0C:8D00 - 1642 bytes - Tile properties data for all Layer 2 event tiles. Compressed in LC_RLE1 format. 

For the tile numbers data: for pages 0-7, each 6 bytes form a horizontal line of 6 tiles. The next 6 bytes are used for the 6 tiles below that row, etc. The same applies for pages 8-A, but there, the tiles are 2x2 instead (each 2 bytes from a horizontal row of 2 tiles).

The tile properties data format (decompressed) is as following: go from the upper left corner of the event tilemap to the upper right. Then one line down, from the left to the right. One line down again, left to right and so on. The data gets decompressed into RAM $7F:0000.

Tiles are in 8x8.

Other misc. data

 $04:EB40 - 1 byte - Which submap should reveal it's event tiles slower. Default: Forest of Illusion.
Personal tools