Level: Difference between revisions
Piranhaplant (talk | contribs) No edit summary |
Piranhaplant (talk | contribs) No edit summary |
||
Line 21: | Line 21: | ||
| 0x14 || 4 || pointer24 || Pointer to the sprite palette |
| 0x14 || 4 || pointer24 || Pointer to the sprite palette |
||
|- |
|- |
||
| 0x18 || 4 || pointer24 || Pointer to the palette animation entity |
| 0x18 || 4 || optional pointer24 || Pointer to the palette animation entity |
||
|- |
|- |
||
| 0x1C || 2 || pointer16 || Pointer to the respawning monster data |
| 0x1C || 2 || pointer16 || Pointer to the [[#Respawning monster data|respawning monster data]] |
||
|- |
|- |
||
| 0x1E || 2 || pointer16 || Pointer to the |
| 0x1E || 2 || pointer16 || Pointer to the [[#Victim/one-shot monster data|victim/one-shot monster data]] |
||
|- |
|- |
||
| 0x20 || 2 || pointer16 || Pointer to the item pickup data |
| 0x20 || 2 || pointer16 || Pointer to the [[#Item pickup data|item pickup data]] |
||
|- |
|- |
||
| 0x22 || 2 || uint16 || Level background width |
| 0x22 || 2 || uint16 || Level background width |
||
Line 49: | Line 49: | ||
| 0x34 || 2 || uint16 || Extra sounds ID |
| 0x34 || 2 || uint16 || Extra sounds ID |
||
|- |
|- |
||
| 0x36 || 2 || pointer16 || Pointer to the first level title page data |
| 0x36 || 2 || pointer16 || Pointer to the first [[#Level title page data|level title page data]] |
||
|- |
|- |
||
| 0x38 || 2 || pointer16 || Pointer to the second level title page data |
| 0x38 || 2 || pointer16 || Pointer to the second level title page data |
||
|- |
|- |
||
| 0x3A || 2 || optional pointer16 || Pointer to the bonus data |
| 0x3A || 2 || optional pointer16 || Pointer to the [[#Bonus data|bonus data]] |
||
|- |
|- |
||
| 0x3C || 2 || pointer16 || Necrofy ROMs only. Pointer to the [[secret item]] bonus subroutine |
| 0x3C || 2 || pointer16 || Necrofy ROMs only. Pointer to the [[secret item]] bonus subroutine |
||
Line 182: | Line 182: | ||
|} |
|} |
||
This is repeated until the continue value is zero. |
This is repeated until the continue value is zero. This value is typically set to 0xFF otherwise. |
||
Page is set to 0x01 on the first title page, and 0x00 on the second title page. Palette is generally set to a multiple of two since level title palettes use two palette rows each. |
Page is set to 0x01 on the first title page, and 0x00 on the second title page. Palette is generally set to a multiple of two since level title palettes use two palette rows each. |
Revision as of 21:04, 20 October 2023
The number of regular levels is located at $9F:8000. This count includes level 0 and the credit level, but not any of the bonus levels. The level data pointers are located at $9F:8002. In a regular ROM, these are 16-bit pointers relative to bank $9F. In a Necrofy built ROM, these are 24-bit pointers padded to 4 bytes each.
Level data structure
Header
Offset | Length | Type | Description |
---|---|---|---|
0x00 | 4 | pointer24 | Pointer to the tileset tilemap |
0x04 | 4 | pointer24 | Pointer to the level background data |
0x08 | 4 | pointer24 | Pointer to the tileset collision data |
0x0C | 4 | pointer24 | Pointer to the tileset graphics |
0x10 | 4 | pointer24 | Pointer to the tileset palette |
0x14 | 4 | pointer24 | Pointer to the sprite palette |
0x18 | 4 | optional pointer24 | Pointer to the palette animation entity |
0x1C | 2 | pointer16 | Pointer to the respawning monster data |
0x1E | 2 | pointer16 | Pointer to the victim/one-shot monster data |
0x20 | 2 | pointer16 | Pointer to the item pickup data |
0x22 | 2 | uint16 | Level background width |
0x24 | 2 | uint16 | Level background height |
0x26 | 2 | uint16 | Priority tile count |
0x28 | 2 | uint16 | Visible tiles end |
0x2A | 2 | int16 | Player 1 start X position |
0x2C | 2 | int16 | Player 1 start Y position |
0x2E | 2 | int16 | Player 2 start X position |
0x30 | 2 | int16 | Player 2 start Y position |
0x32 | 2 | uint16 | Music ID |
0x34 | 2 | uint16 | Extra sounds ID |
0x36 | 2 | pointer16 | Pointer to the first level title page data |
0x38 | 2 | pointer16 | Pointer to the second level title page data |
0x3A | 2 | optional pointer16 | Pointer to the bonus data |
0x3C | 2 | pointer16 | Necrofy ROMs only. Pointer to the secret item bonus subroutine |
0x3E | 2 | uint16 | Necrofy ROMs only. Bonus level number |
Immediately following the header is the boss monster data
Boss monster data
Offset | Length | Type | Description |
---|---|---|---|
0x00 | 4 | pointer24 | Boss monster entity pointer |
0x04 | 4 | byte[4] | Properties |
This data is repeated for each boss monster. The list is terminated with four consecutive zero bytes.
The format of "Properties depends on the type of boss monster. For UFO, giant baby, snakeoid, giant spider, and giant head, it is:
Offset | Length | Type | Description |
---|---|---|---|
0x00 | 2 | int16 | X position |
0x02 | 2 | int16 | Y position |
For palette fade and tile animator, it is:
Offset | Length | Type | Description |
---|---|---|---|
0x00 | 4 | pointer24 | Pointer to additional data |
For the format of the additional data, see the page for the given boss monster.
Respawning monster data
Offset | Length | Type | Description |
---|---|---|---|
0x00 | 1 | byte | Respawn delay |
0x01 | 2 | int16 | X position |
0x03 | 2 | int16 | Y position |
0x05 | 1 | byte | Respawn area size |
0x06 | 4 | pointer24 | Respawning monster entity pointer |
This data is repeated for each respawning monster. The list is terminated with two consecutive zero bytes.
Victim/one-shot monster data
Offset | Length | Type | Description |
---|---|---|---|
0x00 | 2 | int16 | X position |
0x02 | 2 | int16 | Y position |
0x04 | 2 | byte[2] | Extra data |
0x06 | 2 | uint16 bcd | Victim number |
0x08 | 4 | pointer24 | Entity pointer |
This data is repeated for each victim and one-shot monster. The list is terminated with two consecutive zero bytes.
Typically the victims are all listed first, in order from 1 to 10, then all of one-shot monsters, but this is not required. "Extra data" provides 2 bytes of arbitrary data that can be used by the entity for any purpose. In the original game, this is only used by the developer credit. Victim number is 0 for one-shot monsters.
Item pickup data
Offset | Length | Type | Description |
---|---|---|---|
0x00 | 2 | int16 | X position |
0x02 | 2 | int16 | Y position |
0x04 | 1 | byte | Item pickup ID |
This data is repeated for each item pickup. The list is terminated with two consecutive zero bytes.
Bonus data
Offset | Length | Type | Description |
---|---|---|---|
0x00 | 2 | uint16 | Bonus ID |
This data is repeated for each bonus. The list is terminated with two consecutive zero bytes.
Level title page data
Offset | Length | Type | Description |
---|---|---|---|
0x00 | 1 | byte | X position (in 8x8 tiles) |
0x01 | 1 | byte | Y position (in 8x8 tiles) |
0x02 | 1 | byte | Palette |
0x03 | 1 | byte | Page |
0x04 | X | byte[X] | Characters |
X+4 | 1 | byte | Continue |
This is repeated until the continue value is zero. This value is typically set to 0xFF otherwise.
Page is set to 0x01 on the first title page, and 0x00 on the second title page. Palette is generally set to a multiple of two since level title palettes use two palette rows each.