Map Object Header

From Terranigma Wiki
Revision as of 11:30, 20 July 2016 by Crediar (talk | contribs) (Map title is optional)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The Map Object Header declares the objects (and sprites) that are initially present on a map. It also contains the Map Flags as first two bytes.

The address of the header can be found either at [28000 + 2*map_id] or at [38000 + 2*map_id], only one of these is allowed to be not null. The header is stored in the same 0x8000 bank as the pointer, either 0x82 or 0x83.

After the 2 byte Map Flags, the header consists of a sequence of commands, which is terminated by 0xFF and the map's title.


If a command declares an Object, it gets assigned a handle in sequential order (starting from 0x1000) and is appended to the end of the object list.

The first object usually is the Ark Sprite, created by command FD and has the handle 0x1000.

Command Size Description
FF 1 End of header, can be followed by map title, which then is terminated by 0xD4 (see Message Format)
FE 5 Declare Object with Script
FD 7 Declare Object with Position and Script
FC ?? ??
FB 5 ??
FA 3+2*x Conditional Jump
F0 7 ??
other 10 or 16 Declare Sprite with Flags3, Position, Script and optional Death Handler.

If (Extension Flags & 0xC0) == 0xC0, then the command length is 16 and the death handler is specified, else the length is 10.

Offset 0 1 2 3 4 7 10 13
Value Flags3 =
(value & 0xC1) << 8
X Position Y Position Extension Flag Script ?? Death Handler ??