Save data structure (Generation II): Difference between revisions

→‎Item lists: more minor fies
m (More of my "world-famous" making articles sound less clumsy.)
(→‎Item lists: more minor fies)
Line 14: Line 14:


==Item lists==
==Item lists==
Lists of items in the save data follow a particular format.
Item lists in the save data follow a specific format.


Lists have entries of 2 bytes each, and a capacity. The total size of the list data, in bytes, is <code>Capacity * 2 + 2</code>.
Lists have entries of 2 bytes each as well as a capacity. The total size of the list data in bytes, is <code>Capacity * 2 + 2</code>.


For example, the player's pocket inventory can hold 20 item entries, so the size of that list is 20 * 2 + 2 = 42 bytes.
For example, the player's pocket inventory can hold 20 item entries, so the size of the list is <code>20 * 2 + 2 = 42</code> bytes.


{| class="roundy" cellpadding="2" style="text-align: center; background: #c1e3ff; padding: 3px; border: 2px solid #88c8ff; margin-bottom: 10px; border-spacing: 1px"
{| class="roundy" cellpadding="2" style="text-align: center; background: #c1e3ff; padding: 3px; border: 2px solid #88c8ff; margin-bottom: 10px; border-spacing: 1px"
Line 40: Line 40:


===Count===
===Count===
The number of item entries actually being represented in the list. Note that count and capacity are not the same thing.
The number of item entries actually being represented in the list. Note that count and capacity are separate.  


===Entries===
===Entries===
The exact data for each item entry in the list. For more information, see below.
The exact data for each item entry in the list.


===Terminator===
===Terminator===
The byte following the last item entry, according to ''Count'', must always be a terminator, which is byte value <code>0xFF</code>.
The byte following the last item entry, according to ''Count'', must always be a terminator, which is byte value <code>0xFF</code>.


This spare byte is present at the end of the list data for the event when the list is filled to capacity.
This spare byte is present at the end of the list data to handle the list being filled to capacity.


===Entry format===
===Entry format===
Line 69: Line 69:


====Count====
====Count====
The amount of that particular item. Must be between 1 and 99, inclusive.
The amount of that particular item. This value must be between 1 and 99 inclusive.


====Index====
====Index====
8

edits