The current URL is datacrystal.tcrf.net.
Metroid/Item data format: Difference between revisions
(→Item Types (<tt>T</tt>): - added to list of item types) |
No edit summary |
||
(5 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{subpage}} | |||
{{Infobox table|name=Item data format | {{Infobox table|name=Item data format | ||
|game=Metroid | |game=Metroid | ||
Line 8: | Line 10: | ||
|totallength=Varies. See [[Metroid:ROM map|ROM Map]] | |totallength=Varies. See [[Metroid:ROM map|ROM Map]] | ||
}} | }} | ||
The following describes the format of the data for items in the Metroid ROM. | The following describes the format of the data for items in the Metroid ROM. For each level there is a '''set''' of entries. Each entry defines all of the items on a single horizontal row of the map. Each entry can define any number of items. | ||
In this article, the term "item" is used as a generic term to refer to a variety of in-game objects such as elevators, enemies, and power-ups. This article contains a mixture of formal and informal information to compromise between clarity, brevity, and ease of understanding. | |||
== About Item Data == | |||
Item data is defined for each level. Item data is in the form of a linked list of "item data entries," each of which define all of the items on a single horizontal map row for a single level. Each item data entry contains a number of screen entries, each of which contains zero or more (usually one) item entries that define all of the items in that screen. | |||
When a level is loaded into RAM, the location of the item data varies, but the offset of the item table can always be found at the RAM address 0x9598. To calculate the ROM address, see [[Metroid:Pointer format|Pointer Format]]. | |||
== Item Data Entries == | |||
Each item entry can define multiple items in multiple screens. The linked list of item data entries must be logically ordered by their vertical map coordinate (though they aren't required to appear in order in memory). | |||
The binary format of an "item data entry" (not to be confused with a simple "item entry") is defined below. Italicized words refer to data where the format is defined elsewhere. Each pair of letters represents a byte, where the first letter represents the high nibble and the second letter represents the low nibble. | |||
The following is the formal definition of an item data entry. | |||
The following is the | |||
''itemDataEntry'' := YY ''pointer'' ''screenEntries'' | |||
:* YY: Map Y coordinate for all items in the item data entry. | |||
:* ''pointer'': This is a pointer to the RAM address of the next item data entry. To convert to a ROM pointer, see [[Metroid:Pointer format]]. The pointer is a two byte pointer, ''low byte first''. A hexadecimal value of FFFF denotes the end of a level's item data. The formal definition for the pointer is: | |||
::* <tt>pointer := BB AA</tt> | |||
:* ''screenEntries'': zero or more entries that define item data for screens. See Screen Entries below for the format of this information. | |||
== Screen Entries == | |||
Item data entries tend to contain multiple screen entries, although they do sometimes contain only one and it would be valid for them to contain zero. A screen entry can define multiple items in the same map screen, but they typically contain one. Screen entries must be ordered by horizontal map position. | |||
====Power- | The formal definition of a screen entry is as follows: | ||
''screenEntry'' := XX SS ''itemEntries'' 00 | |||
:*0: | :*XX: The map x-coordinate of the screen. | ||
:*SS: The size, in bytes, of this screen entry, or the value of FF (hexadecimal) to indicate that this is the last screen entry in the containing item data entry. | |||
:*''itemEntries'': zero or more item entries defining the items in this room. | |||
:*00: Literal value (zero). Terminates this screen data. | |||
== Item Entries == | |||
An item entry defines a single item. The format and size of an item entry depends on the type of item being defined (i.e. elevator, power-up, enemy, etc.). The type of item is defined by the lower nibble of the first byte of the item entry. This value corresponds to the following types (hexadecimal is used). Values not listed are '''undefined''' (not to be confused with unknown). | |||
:*0 - This value is reserved as a terminator for a screen entry. | |||
:*1 - Some Squeepts. The ones next to tall walls. Behind the high jump boots, for example. (These are enemies that jump out of the lava in Norfair) | |||
:*2 - Power up items | |||
:*3 - Mellows, Melias and Memus (small flying enemies) | |||
:*4 - Elevators | |||
:*5 - Mother brain room cannons | |||
:*6 - Mother brain | |||
:*7 - Zeebetites (Column-like structures in mother brain's room) | |||
:*8 - Rinkas (Cheerio-like enemies from Tourain) | |||
:*9 - Some doors | |||
:*A - Palette switch | |||
The mella (3), palette switch (A), and rinkas (8) are single-byte items, requiring only the byte that specifies the item type and no other data. | |||
==== Elevator Entry ==== | |||
An elevator item entry is two bytes: the item type and a byte indicating which elevator is being defined. The formal definition is: | |||
''elevatorEntry'' := TT EE | |||
:*TT: Item type (4), specifies an elevator | |||
:*EE: Elevator type. | |||
The elevator type can have the following values (hexadecimal): | |||
:*1: to Norfair | |||
:*2: to Kraid | |||
:*3: to Tourain | |||
:*4: to Ridley | |||
:*80: Norfair exit (to Brinstar) | |||
:*81: Kraid exit (to Brinstar) | |||
:*82: Tourain exit (to Brinstar) | |||
:*83: Ridley exit (to Norfair) | |||
:*8F: Game end | |||
==== Enemy Entry ==== | |||
An enemy entry is three bytes. The format is as follows: | |||
''enemyEntry'' := SI DT YX | |||
:*S: "Sprite Slot" (en enemy will not be loaded if there is already another enemy loaded into the same sprite slot) | |||
:*I: Item type (1), specifies an enemy | |||
:*D: Difficulty. Has a value of 8 (adding 0x80 to the total value of the byte) if the enemy is of a harder difficulty than normal, otherwise 0. | |||
:*T: Enemy type. The types available vary between levels. | |||
:*Y: Screen y-coordinate of the enemy. | |||
:*X: Screen x-coordinate of the enemy. | |||
Note that enemy data is generally incorporated into Metroid's screen data rather than item data. Adding enemies via item data is only used in unusual circumstances. | |||
==== Power-Up Entry ==== | |||
A power-up entry has three bytes. The format is as follows: | |||
''powerupEntry'' := II TT YX | |||
:*II: Item type (2), specifies a power-up. | |||
:*TT: Power-up type. See below: | |||
:*Y: Screen y-coordinate. | |||
:*X: Screen x-coordinate. | |||
The following are defined power-up types (using hexadecimal): | |||
:*0: Bombs | |||
:*1: High Jump Boots | :*1: High Jump Boots | ||
:*2: Long Beam | :*2: Long Beam | ||
Line 60: | Line 116: | ||
:*8: Energy Tank | :*8: Energy Tank | ||
:*9: Missile | :*9: Missile | ||
:*A: | :*A: "Dot missile": Appears as a dot. Gives the player five missiles, but this item won't be saved in the password. | ||
:*B: | :*B: "Arrow Missile": Appears as an arrow. Behaves just like the "dot missile." | ||
: | |||
== Passwords == | |||
The way that inventory is saved to the password is unusual and un-intuitive, and employs highly redundant data. See [[Metroid:Password data]]. | |||
==== | |||
== Examples == | |||
[[Metroid: | ==== Long Beam/Bombs ==== | ||
==Examples== | The following data defines the long beam and bombs found in Brinstar. | ||
====Long Beam/Bombs==== | |||
The following defines the long beam and bombs | | 05 02 A4 07 06 02 02 37 00 19 FF 02 00 37 00 | ||
| | |||
05 02 A4 07 06 02 02 37 00 | | --''itemDataEntry''------------------------------------------ | ||
| --''screenEntry1''------- --''screenEntry2''------- | |||
| -''itemEntry1''- -''itemEntry2''- | |||
| | |||
| | |||
| ''itemDataEntry'' | |||
| '''05''': Map Y position is 5 | |||
| '''02 A4''': RAM address of next entry is A402. | |||
| ''screenEntry1'' | |||
| '''07''': Map X position is 7 | |||
| '''06''': Six bytes in screen entry. | |||
| ''itemEntry1'' | |||
| '''02''': Item type 2: Power-up. | |||
| '''02''': Power-up type 2: Long beam. | |||
| '''37''': Screen position is three down and seven over. | |||
====Elevator==== | | '''00''': End of this screen's data. | ||
The following | | ''screenEntry2'' | ||
| '''19''': Map X position for second item is 19 (hex). | |||
| '''FF''': This is the last item in the entry. | |||
| ''itemEntry2'' | |||
| '''02''': Item type 2: Item. | |||
| '''00''': Power-up type 0: Bombs. | |||
| '''37''': Screen position is three down and seven over. | |||
| '''00''': End of this screen's data. | |||
==== Elevator ==== | |||
The following defines the elevator from Brinstar to Kraid. | |||
| 12 FF FF 07 FF 04 02 00 | |||
| | |||
| -''itemDataEntry''------------------- | |||
| -''screenEntry''---------- | |||
| -''itemEntry''- | |||
| | |||
| ''itemDataEntry'' | |||
| '''12''': Map Y position is 12 (hex). | |||
| '''FF FF''': This is the last entry for Brinstar item data. | |||
| ''screenEntry'' | |||
| '''07''': Map X position is 7. | |||
| '''FF''': This is the last screen in this item data entry. | |||
| ''itemEntry'' | |||
| '''04''': Object type 4: Elevator. | |||
| '''02''': Destination is level 2: Kraid's hideout. | |||
| '''00''': The end. | |||
=See Also= | =See Also= | ||
[[ | *[[Metroid:Password data|Password Data]] | ||
*[[Metroid:ROM map|Metroid Rom Map]] | |||
*[[Metroid]] |
Latest revision as of 14:59, 24 January 2024
This is a sub-page of Metroid.
Item data format | |
Game | Metroid |
Start Address | Varies by bank. See ROM Map |
End Address | Varies by bank. See ROM Map |
# of Entries | Varies by bank. See ROM Map |
Entry Length | Varies. |
Total Length | Varies. See ROM Map |
Back to the ROM map |
The following describes the format of the data for items in the Metroid ROM. For each level there is a set of entries. Each entry defines all of the items on a single horizontal row of the map. Each entry can define any number of items.
In this article, the term "item" is used as a generic term to refer to a variety of in-game objects such as elevators, enemies, and power-ups. This article contains a mixture of formal and informal information to compromise between clarity, brevity, and ease of understanding.
About Item Data
Item data is defined for each level. Item data is in the form of a linked list of "item data entries," each of which define all of the items on a single horizontal map row for a single level. Each item data entry contains a number of screen entries, each of which contains zero or more (usually one) item entries that define all of the items in that screen.
When a level is loaded into RAM, the location of the item data varies, but the offset of the item table can always be found at the RAM address 0x9598. To calculate the ROM address, see Pointer Format.
Item Data Entries
Each item entry can define multiple items in multiple screens. The linked list of item data entries must be logically ordered by their vertical map coordinate (though they aren't required to appear in order in memory).
The binary format of an "item data entry" (not to be confused with a simple "item entry") is defined below. Italicized words refer to data where the format is defined elsewhere. Each pair of letters represents a byte, where the first letter represents the high nibble and the second letter represents the low nibble.
The following is the formal definition of an item data entry.
itemDataEntry := YY pointer screenEntries
- YY: Map Y coordinate for all items in the item data entry.
- pointer: This is a pointer to the RAM address of the next item data entry. To convert to a ROM pointer, see Metroid:Pointer format. The pointer is a two byte pointer, low byte first. A hexadecimal value of FFFF denotes the end of a level's item data. The formal definition for the pointer is:
- pointer := BB AA
- screenEntries: zero or more entries that define item data for screens. See Screen Entries below for the format of this information.
Screen Entries
Item data entries tend to contain multiple screen entries, although they do sometimes contain only one and it would be valid for them to contain zero. A screen entry can define multiple items in the same map screen, but they typically contain one. Screen entries must be ordered by horizontal map position.
The formal definition of a screen entry is as follows:
screenEntry := XX SS itemEntries 00
- XX: The map x-coordinate of the screen.
- SS: The size, in bytes, of this screen entry, or the value of FF (hexadecimal) to indicate that this is the last screen entry in the containing item data entry.
- itemEntries: zero or more item entries defining the items in this room.
- 00: Literal value (zero). Terminates this screen data.
Item Entries
An item entry defines a single item. The format and size of an item entry depends on the type of item being defined (i.e. elevator, power-up, enemy, etc.). The type of item is defined by the lower nibble of the first byte of the item entry. This value corresponds to the following types (hexadecimal is used). Values not listed are undefined (not to be confused with unknown).
- 0 - This value is reserved as a terminator for a screen entry.
- 1 - Some Squeepts. The ones next to tall walls. Behind the high jump boots, for example. (These are enemies that jump out of the lava in Norfair)
- 2 - Power up items
- 3 - Mellows, Melias and Memus (small flying enemies)
- 4 - Elevators
- 5 - Mother brain room cannons
- 6 - Mother brain
- 7 - Zeebetites (Column-like structures in mother brain's room)
- 8 - Rinkas (Cheerio-like enemies from Tourain)
- 9 - Some doors
- A - Palette switch
The mella (3), palette switch (A), and rinkas (8) are single-byte items, requiring only the byte that specifies the item type and no other data.
Elevator Entry
An elevator item entry is two bytes: the item type and a byte indicating which elevator is being defined. The formal definition is:
elevatorEntry := TT EE
- TT: Item type (4), specifies an elevator
- EE: Elevator type.
The elevator type can have the following values (hexadecimal):
- 1: to Norfair
- 2: to Kraid
- 3: to Tourain
- 4: to Ridley
- 80: Norfair exit (to Brinstar)
- 81: Kraid exit (to Brinstar)
- 82: Tourain exit (to Brinstar)
- 83: Ridley exit (to Norfair)
- 8F: Game end
Enemy Entry
An enemy entry is three bytes. The format is as follows:
enemyEntry := SI DT YX
- S: "Sprite Slot" (en enemy will not be loaded if there is already another enemy loaded into the same sprite slot)
- I: Item type (1), specifies an enemy
- D: Difficulty. Has a value of 8 (adding 0x80 to the total value of the byte) if the enemy is of a harder difficulty than normal, otherwise 0.
- T: Enemy type. The types available vary between levels.
- Y: Screen y-coordinate of the enemy.
- X: Screen x-coordinate of the enemy.
Note that enemy data is generally incorporated into Metroid's screen data rather than item data. Adding enemies via item data is only used in unusual circumstances.
Power-Up Entry
A power-up entry has three bytes. The format is as follows:
powerupEntry := II TT YX
- II: Item type (2), specifies a power-up.
- TT: Power-up type. See below:
- Y: Screen y-coordinate.
- X: Screen x-coordinate.
The following are defined power-up types (using hexadecimal):
- 0: Bombs
- 1: High Jump Boots
- 2: Long Beam
- 3: Screw Attack
- 4: Maru Mari
- 5: Varia
- 6: Wave Beam
- 7: Ice Beam
- 8: Energy Tank
- 9: Missile
- A: "Dot missile": Appears as a dot. Gives the player five missiles, but this item won't be saved in the password.
- B: "Arrow Missile": Appears as an arrow. Behaves just like the "dot missile."
Passwords
The way that inventory is saved to the password is unusual and un-intuitive, and employs highly redundant data. See Metroid:Password data.
Examples
Long Beam/Bombs
The following data defines the long beam and bombs found in Brinstar.
| 05 02 A4 07 06 02 02 37 00 19 FF 02 00 37 00 | | --itemDataEntry------------------------------------------ | --screenEntry1------- --screenEntry2------- | -itemEntry1- -itemEntry2- | | | itemDataEntry | 05: Map Y position is 5 | 02 A4: RAM address of next entry is A402. | screenEntry1 | 07: Map X position is 7 | 06: Six bytes in screen entry. | itemEntry1 | 02: Item type 2: Power-up. | 02: Power-up type 2: Long beam. | 37: Screen position is three down and seven over. | 00: End of this screen's data. | screenEntry2 | 19: Map X position for second item is 19 (hex). | FF: This is the last item in the entry. | itemEntry2 | 02: Item type 2: Item. | 00: Power-up type 0: Bombs. | 37: Screen position is three down and seven over. | 00: End of this screen's data.
Elevator
The following defines the elevator from Brinstar to Kraid.
| 12 FF FF 07 FF 04 02 00 | | -itemDataEntry------------------- | -screenEntry---------- | -itemEntry- | | itemDataEntry | 12: Map Y position is 12 (hex). | FF FF: This is the last entry for Brinstar item data. | screenEntry | 07: Map X position is 7. | FF: This is the last screen in this item data entry. | itemEntry | 04: Object type 4: Elevator. | 02: Destination is level 2: Kraid's hideout. | 00: The end.