Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

Super Mario Bros. 2 (NES)/Level Data: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 3: Line 3:
Level data in the game is made up of two different object types: normal and special.  Normal objects includ clouds, hills, vines, etc.  Special objects typically dictate how to draw terrain like the ground or caves.  If the first byte of an object starts with and F, then it is a special object, otherwise it's a normal object.
Level data in the game is made up of two different object types: normal and special.  Normal objects includ clouds, hills, vines, etc.  Special objects typically dictate how to draw terrain like the ground or caves.  If the first byte of an object starts with and F, then it is a special object, otherwise it's a normal object.


Normal objects are stored as two bytes.  The first byte is the YX value (Y is the number of tiles down from the preceeding object and X is the number of tiles from the left edge of the page) and the second byte is the object type.  For example, the bytes "13 2A"  refer to an object type 2A which is located 1 tile down from the preceeding object (or top of the screen, if it's the first object) and 3 tiles from the left edge of the screen.   
Normal objects are stored as two bytes.  The first byte is the YX value (Y is the number of tiles down from the preceeding object and X is the number of tiles from the left edge of the page) and the second byte is the object type.  For example, the bytes "13 2A"  refer to an object type 2A which is located 1 tile down from the preceeding object (or top of the screen, if it's the first object) and 3 tiles from the left edge of the screen.  If the first part of the first byte is an F (e.g. F0, F1, F2, ..., FF), then the byte represents a special object instead of the YX coordinate of a normal object.


Special objects are stored a little differently.  The first byte is F? where ? is the special object number (0 thru F).  Special objects can have 1, 2, or no parameters.  The parameter bytes immediately follow the F? byte.
Special objects are stored a little differently.  The first byte is F? where ? is the special object number (0 thru F).  Special objects can have 1, 2, or no parameters.  The parameter bytes immediately follow the F? byte.

Revision as of 21:11, 2 June 2006

Explanation of Level Data

Level data in the game is made up of two different object types: normal and special. Normal objects includ clouds, hills, vines, etc. Special objects typically dictate how to draw terrain like the ground or caves. If the first byte of an object starts with and F, then it is a special object, otherwise it's a normal object.

Normal objects are stored as two bytes. The first byte is the YX value (Y is the number of tiles down from the preceeding object and X is the number of tiles from the left edge of the page) and the second byte is the object type. For example, the bytes "13 2A" refer to an object type 2A which is located 1 tile down from the preceeding object (or top of the screen, if it's the first object) and 3 tiles from the left edge of the screen. If the first part of the first byte is an F (e.g. F0, F1, F2, ..., FF), then the byte represents a special object instead of the YX coordinate of a normal object.

Special objects are stored a little differently. The first byte is F? where ? is the special object number (0 thru F). Special objects can have 1, 2, or no parameters. The parameter bytes immediately follow the F? byte.

The next object after a door object acts as its pointer and does not show up in the game. This "door pointer" tells the game where the door leads. The next object after a door should always be a regular object, but the special object F5 is also allowed to be a door pointer.

Explanation of Parameters

Door Pointers

For objects acting as door pointers, the first parameter (YX coordinate) is what world you go to (0 = World 1, 1 = World 2, etc...), and the second parameter (object type) is what area in the world you go to. I don't know what happens if the first parameter is greater than the number of worlds in the game (ie. greater than 6 since we start counting Worlds as 0 being the first).

Special objects

Special object F0 affects the ground setting (high, low, pits, etc.). It has one parameter. Different parameter values produce different terrain effects.

Special object F1 affects the ground setting (high, low, pits, etc.). It has one parameter. Different parameter values produce different terrain effects.

Special object F2 means the next object's X coordinate will be skipped forward one page. It has no parameters.

Special object F3 means the next object's X coordinate will be skipped forward two pages. It has no parameters.

Special object F4 means to start a new object layer. The next object will be placed as though it were the first object (i.e. it's YX coordinate byte's reference point will be the top left of the first page. It has no parameters.

Special object F5 is an area pointer. It has two parameters. These parameters act the same way as door parameters do: the first says what world to go to and the second tells what area in the world to go to.

Special object F6 affects the look of the ground (rock, sand, grass, etc.). It has one parameter that dictates which tiles to use to draw the ground.

Special objects F7 thru FE are unused(?)

Special object FF has no parameters. It marks the end of data for the current level.