Monster decorations (DCR)
File formats · Field reference · Schema
In brief
Some monsters are drawn with extra pieces of graphics layered over their body. A DCR file describes those pieces: for each one, a rectangle to cut out of the monster's image and an offset from where the monster is drawn. It contains no pixels.
There are nine DCR files, each with the same name as a monster image, such as
BEHOLDER.DCR beside BEHOLDER.CPS, or GUARD1.DCR beside GUARD1.CPS.
The game builds the file name with the pattern %s.dcr from the name of a
monster image that a level loads, and loads it only when the level asks for
decorations with that image.1 Each group is a set of decorations that
a monster type can select, and each entry of a group belongs to one of the
monster's six frames: see monster images.
Organization
The file is a count of groups, followed by groups of six entries of six bytes each. An entry gives a source rectangle — column and width in steps of eight pixels, row and height in pixels — and a signed offset from the monster's drawing position. An entry with a zero width or height is skipped.2
Reading the file
The game loads a DCR file together with the monster image of the same name, when the level's sublevel record sets the decoration flag of that image; see monster images.3
The display driver cuts each rectangle out of the 320 × 200 image page the game has just loaded, and the result is the same in both display modes of the collection. It keeps up to 16 colours, in the order they first appear, row by row from the top left; any further colour is replaced by the first one. Nothing checks the rectangle against the image. A rectangle that passes column 39 continues on the next row of the image, and one that passes row 199 reads the memory that follows the image. Every rectangle of the nine original files lies inside the image, the largest reaching column 33 and row 193.4
What it becomes in memory
The prepared shapes are kept in
MonsterDecorationRuntime
entries, three groups of six for each of the two graphics slots.5
When the monster is drawn, the game reads the offsets as signed values,
scales them by 2/3 for distance, and adjusts the horizontal offset when the
monster is drawn mirrored.6
Monster images, groups and frames
A level names up to two monster images in each of its
sublevel records, as two graphics slots. For each one it gives
the image name, which of three built-in layouts cuts the six body shapes out
of the image (see unpacked images), the slot, and
a decoration flag. When the flag is set and a DCR file of the same name
exists, the game loads it into the slot.3 Each monster uses slot 1 when
the graphics_index of its monster slot
is nonzero and slot 0 otherwise; the slot is not tied to the monster type.
When the game draws a monster with frame f (1 to 6: front, the two side frames, back, and the two attack frames, as described in monsters in the view), it draws the body shape f of the monster's slot, then up to three decorations, one for each of the three decoration selectors of the monster's type, in order. A selector of 0 draws nothing; a selector v draws entry f of group v of the slot's DCR file, unless that entry is empty:7
for each selector v of the monster type (three, in order):
if v != 0:
draw entry f of group v of the slot's DCR, if present # groups and entries counted from 1
So the first entry of a group decorates the front view, the second and third the side views, the fourth the back view and the last two the attack frames. A decoration is drawn with the body's mirroring and scale, but never in the monster's colour variants. The game keeps decorations for 36 entries, three groups of six for each slot, and checks neither the group count nor the selectors; the original files never exceed three groups or a selector of 3. Which level loads each of the nine files is listed under monster decorations.
A selector can name a group that the slot does not have. In LEVEL13.INF,
the second monster type has selector 1, but its monsters use slot 1, whose
image (ASERVANT) has no decorations; the game clears all decorations when a
level is loaded, so nothing is drawn.3
Example
The first 14 bytes of BEHOLDER.DCR, a 38-byte file with one group:
offset bytes meaning
0000 01 00 1 group
0002 14 58 04 1f 1c 24 entry 1: rectangle 14 58 04 1f, offset +28, +36
0008 14 77 03 1a fc 27 entry 2: rectangle 14 77 03 1a, offset −4, +39
Entry 4 of the group is all zeros and is therefore skipped.
Related pages
MonsterDecorationRuntime: the in-memory form.- Monsters.
Sources
Locations refer to the game executable reference;
comparative sources are listed in the technical references
(REF-SCUMM-011).