DEC field reference
File page · Format catalogue · Schema source
This page is generated from the Kaitai schema DEC.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 decoration data
- Byte order: little-endian
- Schema license:
MIT
Description
A DEC file describes wall decorations for one dungeon style: which rectangles of the decoration image to use, and where to place them for each position in the view. INF wall mappings select these decorations by index, and a decoration's link chains it to the next one drawn on the same wall. It holds a count of 52-byte decoration records, then a count of eight-byte rectangle records. See the format overview.
All six original files follow this layout with nothing left over; counts differ between files.
The game reads a two-byte count and the 52-byte records, then a second count and the rectangles, four words each. A level names a decoration image and a DEC file together in its INF data: the game loads the image as <name>.CPS and opens the DEC file by its full name.
Drawing: the ten entries of a decoration are ten places in the dungeon view. Position 1 is the party's own block, 2, 3 and 4 the front faces one, two and three steps ahead, 5 to 10 the side faces from the party's row outwards; a table of the game gives the position for each face of each visible block, negative for faces drawn mirrored on the right. Placements are pixels from the top-left corner of the 176 × 120 view; a mirrored decoration is drawn at x = 176 − placement − 8 × width. Rectangles are cut from the decoration image with the shape encoder, which takes x and width in 8-pixel columns and y and height in pixels. See drawing the dungeon view.
Placement signedness: placements are signed; the drawing clips negative positions to the view. SILVER.DEC holds fa ff (−6) at file offset 0x04fe in a horizontal placement, the only placement with the high bit set in the six original files.
Rectangle words: the game compares the four rectangle words as signed values; the schema keeps the raw words.
File structure
| Field | Type | Size, repetition and constraints |
|---|---|---|
decoration_count | u2 | — |
decorations | decoration | repeated decoration_count times |
rectangle_count | u2 | — |
rectangles | rectangle | repeated rectangle_count times |
trailing_unknown | bytes to end of stream | — |
decoration_count
Number of decoration records that follow.
decorations
Rectangle selections and placements for each view position.
rectangle_count
Number of eight-byte rectangle records that follow.
rectangles
Rectangular regions of the associated decoration image.
trailing_unknown
Trailing bytes, unknown; none in the six original files.
Type decoration
| Field | Type | Size, repetition and constraints |
|---|---|---|
rectangle_indices | 10 bytes | — |
next_index | u1 | — |
flags | u1 | — |
x_positions | s2 | repeated 10 times |
y_positions | s2 | repeated 10 times |
rectangle_indices
Rectangle selection for the ten view positions, in order: party's block; front faces one, two, three steps ahead; side faces of the party's row, one step ahead, two steps ahead (inner), three steps ahead (inner), two steps ahead (outer), three steps ahead (outer). 0xff selects nothing: the loader and the drawing code skip it. Every other value is used as a rectangle index; the loader checks it against its 301-entry shape table only at the tenth position, after use (see the anomaly). The original files use indices up to 241, each below its file's rectangle count.
next_index
0-based index, in this file, of the next decoration in a chain; zero ends the chain, so record 0 never follows another. The loader copies each chained record into the game's runtime decoration table and rewrites the copied link as a 1-based runtime index. It reads the byte sign-extended and does not check it against the decoration count: 0x80 to 0xfe would copy a record from before the file data and 0xff would stop the copy while leaving a link to the next runtime record. No such value, no out-of-range link and no loop occurs in the six original files (links 0 to 76). See the format overview.
flags
Drawing flags, applied to the party's block and the front faces only: bit 0x01 always draws the decoration mirrored; bit 0x02 mirrors it when the floor and ceiling backdrop is mirrored; bit 0x04 shifts it by the centre-spot offset of the block instead of the block-width offset. The wall-click hit test tests 0x01 only. Bits 0x08 to 0x80 have no known effect and are clear in all six original files, whose values are 0, 1, 4 and 5; bit 0x02 is clear in all of them. See the format overview.
x_positions
Horizontal position, in pixels from the left edge of the view, for each view position; front-face positions are further shifted per visible block (see the drawing page).
y_positions
Vertical position, in pixels from the top of the view, for each view position.
Type rectangle
| Field | Type | Size, repetition and constraints |
|---|---|---|
x | u2 | — |
y | u2 | — |
width | u2 | — |
height | u2 | — |
x
Left edge in the decoration image, in 8-pixel columns. Raw word kept.
y
Top edge in the decoration image, in pixels. Raw word kept.
width
Width in 8-pixel columns. Raw word kept.
height
Height in pixels. Raw word kept.