ITEM.DAT field reference
File page · Format catalogue · Schema source
This page is generated from the Kaitai schema ITEM_DAT.ksy each time the site is built. The schema is the authoritative description; statements are established unless marked inferred or unknown, and the evidence is listed on the file page (see the reading guide).
- Schema: Eye of the Beholder II DOS item data
- Byte order: little-endian
- Schema license:
MIT
Description
ITEM.DAT holds the initial item records and the names used to describe items. It has two counted arrays: 14-byte item records, then 35-byte name slots. The game copies the item records unchanged into its runtime item table, where they then change as items are created, moved and removed; see ItemRuntime. See the format overview.
The game reads both counts and arrays together. The runtime item array has 600 slots. The records are used by item-name selection, item-chain links and searches by type and value.
In the original file, entries 0 to 10 and 16 to 99 have location 0 and level 0 and serve as the templates the game and scripts copy: every item the original data creates is a copy of one of them. Entries 11 to 15 have location 0xfffe and level 0: they are the free conjured-weapon entries. Entries 100 to 433 all lie on a level. See where an item is.
In the original file every link word is zero, flag bits 0x01 to 0x04 occur only on items of kind ITEM_KIND_WAND, where they count charges, and every name uses printable ASCII bytes 0x20 to 0x79 followed by zeros. See the fields for what the game does with them.
The text output treats bytes 1 to 31 as control codes and replaces a byte from 0x80 up by two characters from tables that are zero in the executable image, so such a byte gives no character: it is skipped after an ordinary character and otherwise ends the visible text. Only one ITEM.DAT exists, so array sizes in other versions are unknown.
File structure
| Field | Type | Size, repetition and constraints |
|---|---|---|
num_items | u2 | — |
items | item | repeated num_items times |
num_names | u2 | — |
names | item_name | repeated num_names times |
trailing_unknown | bytes to end of stream | — |
num_items
Number of 14-byte item records that follow; 434 in the original file. The game reads this many records without comparing the count with the 600 slots of its item table: a larger count overwrites the variables after the table. Compared as signed: a count from 0x8000 up reads no record.
items
Initial item records, copied into the runtime item array.
num_names
Number of 35-byte name slots that follow; 123 in the original file. The game reads this many slots without comparing the count with the 130 slots of its name storage: a larger count overwrites the data after the storage. Compared as signed: a count from 0x8000 up reads no name.
names
Fixed-size name slots, indexed by the name selectors of items.
trailing_unknown
Trailing data, unknown; none in the original file.
Type item
Copied byte for byte into ItemRuntime. Field names describe the established uses of each byte; the values change while the game runs.
| Field | Type | Size, repetition and constraints |
|---|---|---|
unidentified_name_index | u1 | — |
identified_name_index | u1 | — |
flags | u1 | — |
icon_raw | u1 | — |
type_raw | s1 | — |
position_raw | u1 | — |
location_raw | u2 | — |
previous_index | u2 | — |
next_index | u2 | — |
level_raw | u1 | — |
value_raw | s1 | — |
unidentified_name_index
Name shown while the item is not identified. Read as signed: a value from 0x80 up selects a 35-byte slot inside the game's working variables, so the text shown is whatever bytes lie there up to the first zero; 123 to 127 select unused, zero-filled slots and give an empty name.
identified_name_index
Name shown once the item is identified. Some names are further formatted from the item type and value. Read as signed, like unidentified_name_index: a value from 0x80 up shows the bytes of a 35-byte slot inside the game's working variables, and 123 to 127 give an empty name.
flags
Item state flags, described by ItemRuntimeFlags. For an item of kind ITEM_KIND_WAND the six low bits count its charges. No other code tests bits 0x01 to 0x04, so on other items they have no effect; in the original file only five items have them, all of kind ITEM_KIND_WAND: records 84 and 395 (type 0x32, flags 0xc4, value 5), 278 (type 0x30, flags 0x85), 297 (type 0x30, flags 0x82) and 376 (type 0x3e, flags 0x87). The values of the whole byte in the original file are listed with the items of the game.
icon_raw
Item icon, 0 to 111: one of the 112 16 × 16 icons of ITEMICN.CPS, 20 per row, which the game cuts in order (icon i at x = 16 × (i mod 20), y = 16 × (i div 20)). It also selects the item's floor and flight shape. Icon 0 is the mouse pointer; a held item with icon 0 is shown as the plain pointer, others with their centre on the pointer position. The game reads the byte sign-extended and does not check it: 112 and above, or a byte with bit 7 set, reads outside the icon tables. The original file uses icons 0 to 111 except 3, 37, 52, 67, 82 to 86, 102 and 103.
type_raw
Signed item type, an index into ITEMTYPE.DAT. Scroll copying uses type 0x22 with value_raw to find a mage scroll.
position_raw
0 to 3 a floor quarter of the block (0 north-west, 1 north-east, 2 south-west, 3 south-east), 4 to 7 the same quarter while the item flies, 8 a wall niche. Chain insertion writes it and the chain search can exclude values 4–7; the end of a flight and a script move to another level reduce values below 8 to their low two bits. Read as signed: a value of 0x80 or more counts as a floor position (below 4). Items 284, 329, 330 and 360 of the original file lie on a level with the value 4, although nothing flies them; how the game treats them until they move is unknown.
location_raw
The block where the item lies or flies; 0 for a carried item or a template; 0xfffe (-2) in a quiver or for a free conjured-weapon entry; 0xffff (-1) for an unused entry, which the game reuses for new items. Chain insertion writes the block, removal writes 0xffff and unlinking writes 0; the rebuild of a level's chains takes the items whose value, read as signed, is positive. In the original file: 0 in entries 0 to 10 and 16 to 99, 0xfffe in entries 11 to 15, a block from 2 to 1011 in entries 100 to 433.
previous_index
One of the two item indices updated together when an item leaves its circular chain; traversal follows the other link. Zero in every record of the original file. The game never reads the initial value: inserting an item into a chain writes both links, and loading a level clears every block's chain and inserts each item lying there, before any chain is walked; the links of carried items and templates are not read.
next_index
Next item in the circular chain. Zero in the original file; written before it is read, as previous_index.
level_raw
The item's level, read as signed. Chain insertion writes the current level, or 0xff for a negative location; script item moves compare it with a source level and write a destination level; one removal path clears it. It is 0 for a carried item and 0xff for an item in a quiver. In the original file: 0 in entries 0 to 99, including the free conjured-weapon entries, which get 0xff once freed; 1 to 16 in entries 100 to 433.
value_raw
Signed value whose meaning depends on the item's kind (ItemKind): the enchantment of a worn item or weapon, negative when cursed; the spell definition of a scroll; the potion; the wand's spell; the food points of a ration, -1 when rotten; the text or map part of a parchment; the ring's power. See using items.
Type item_name
| Field | Type | Size, repetition and constraints |
|---|---|---|
raw | 35 bytes | — |
raw
Fixed-size name storage. The game addresses a name at 35 × index from the start of the loaded names and reads it as a zero-terminated string with no limit of 35 bytes: the name display copies it into a 60-byte stack buffer and the script name tests into a 36-byte buffer, neither bounded. A slot without a zero would therefore continue into the next slot, up to the first zero. Every slot of the original file has one: names use the printable ASCII bytes 0x20 to 0x79, at most 29 of them, followed by zeros. The fonts FONT6.FNT and FONT8.FNT have 128 glyphs in ASCII order (the offset table of 128 words and the glyph sizes fill each file exactly); a byte above 0x7f has no glyph; the text output expands it through empty tables, so it is skipped after an ordinary character and otherwise ends the visible text. All 35 bytes are kept, including padding.