Doors, teleporters and temporary walls
The dungeon view · Walls and doors · Level data (INF)
In brief
Doors are drawn as shapes over the wall layer, from one of the level's two door graphics: a rising door moves up by a fixed number of rows per opening step, a parting door opens in two halves. Teleporters are drawn as sparkles and temporary walls as a grid of shimmering shapes, both animated by the periodic wall animation. Shapes released before a level loads are not drawn.
Doors
A door is drawn for each of the 15 blocks ahead of the party whose front
face is a door reference (WALL_RUNTIME_DOOR). Door references come in
groups of five consecutive values, from closed to fully open; each group uses
one of two door graphics, and the opening step is the distance from the
first reference of the group:
| References | Door graphic | Opening step |
|---|---|---|
| 3 to 7 | 0 | 0 to 4 |
| 8 to 12 | 0 | 0 to 4 |
| 13 to 17 | 1 | 0 to 4 |
| 18 to 22 | 1 | 0 to 4 |
| 51 | 0 | 0 |
| 52 | 1 | 0 |
The level's INF file describes its two door graphics,
each in a door record of its selected sublevel: the CPS image holding the
graphic, which door graphic it fills, its
DoorKind, whether it shows a switch, the
rectangles of its three shapes, for one, two and three steps ahead, and the
rectangles and positions of two switch shapes, for one and two steps ahead.
A record can also, through its marker, let small projectiles through the
closed and partly open doors of that graphic. A
missing record leaves the graphic without shapes.
With n the opening step and the block's centre spot giving x:
shape = door shape (graphic, distance); x = 88 + centre_x − 4 × width
DOOR_KIND_RISING or DOOR_KIND_RISING_OVER_FIXED:
y = bottom[d] − height
if DOOR_KIND_RISING_OVER_FIXED: draw shape at (x, y); shape = door shape (graphic + 1, distance)
y = y − n × raise[d]
if the wall's special type is INF_WALL_SPECIAL_FORCE_DOOR: y = y − force[d]
draw shape at (x, y)
DOOR_KIND_PARTING: # two halves that part
y = top[d] − n × part[d]; draw shape at (x, y)
shape = door shape (graphic + 1, distance)
y = bottom[d] − height + (n × part[d]) / 2 − 1; draw shape at (x, y)
| Distance | bottom | top | raise | part | force |
|---|---|---|---|---|---|
| three steps ahead | 59 | 31 | 8 | 5 | 1 |
| two steps ahead | 71 | 24 | 12 | 8 | 3 |
| one step ahead | 86 | 15 | 18 | 12 | 5 |
When the door's wall has no decoration (decoration selector −1) and the level's door record does not hide the switch, a switch shape is also drawn, at the position given by the record (its x counted from the centre spot's x without the 88); three steps ahead there is no switch shape. Doors are drawn only within the rows of their frame: 30 to 59 three steps ahead, 24 to 71 two steps ahead, 16 to 86 one step ahead.
Teleporters
A block whose front face is WALL_REFERENCE_TELEPORTER
(SpecialWallReference) is drawn as
sparkles, for every block except the party's row. Let t be 0 one step
ahead, 1 two steps ahead and 2 three steps ahead:
x0 = niche_x[block] − (40, 28, 18)[t]; y0 = (13, 21, 26)[t]
for layer in 0, 1:
set = 2 × t + layer
shift = (−4, −4) if set == 0 else (0, 0)
shape = sparkle shape [set XOR pulse]
for each of the 13 points (px, py) of the set:
draw shape at (x0 + shift.x + px, y0 + shift.y + py)
niche_x is the table of items on the floor. The six sets of
13 points are stored in the executable; the periodic wall animation flips
pulse between 0 and 1, which swaps the two sparkle shapes. The six sparkle
shapes are cut from DECORATE.CPS when the game starts, at rectangles
stored in the executable: 16 × 14 and 8 × 7 pixels one step ahead, 8 × 7
and 8 × 5 two steps ahead, 8 × 5 and 8 × 3 three steps ahead.
Temporary walls
A block among the 15 ahead whose front face is
WALL_REFERENCE_TEMPORARY_WALL is covered with a grid of shimmering shapes:
rows, per_row, y = (2, 1, 32), (6, 2, 24) or (9, 3, 16) # three, two, one step ahead
shape = (4, 2, 0)[distance] + pulse
repeat rows times:
x = start_x[block]
repeat per_row times: draw shape at (x, y); x += 8 × width
y += height; shape = shape XOR 1 # rows alternate
start_x, by block 00 to 14: −52, −12, 28, 68, 108, 148, 188, −72, −8, 56,
120, 184, −56, 40, 136. The six shapes are also cut from DECORATE.CPS
when the game starts: shapes 0 to 3 are 32 × 8 pixels, shapes 4 and 5 are
40 × 16.
Released shapes
The level's door, monster and decoration shapes are released and their pointers emptied before a level is loaded, and also by the portal animation, which returns without loading them again. While a shape is released, the routine that draws shapes on the screen draws nothing for it, so:
- a door and its switch are not drawn, although the door's wall reference still selects the door drawing;
- wall decorations are not drawn, although their records are kept;
- monster decorations are skipped;
- a monster one step ahead is not drawn;
- a monster two or three steps ahead is reduced from address zero, see the anomaly below.
Walls, floor and ceiling, items, flying objects, teleporters and temporary walls use shapes that stay loaded and are drawn as usual.1
ANOMALY-88 — The monster drawing reduces a monster's picture for the scale steps without checking that the picture is loaded, whereas the same routine skips a missing decoration and the drawing routine skips any missing shape. When the picture is released, the display driver's scale step reads its "shape" from address zero, in real mode the processor's interrupt table, and the reduced copy, whose size comes from two bytes of that table, is drawn where the monster stands, in its colour variant if it has one. The result is a block of meaningless pixels (inferred: what the start of memory holds depends on the computer), and a large size could overrun the work area the copy is written to (inferred). With the original data, the portal is always followed by a level change, so it never leaves monsters without their pictures; the other ways known to reach this case are frame 0 of a monster of graphics slot 1 and the gas spores kept by the second record of level 8. A faithful reimplementation may draw nothing for a monster whose picture is missing; reproducing the stray pixels is not meaningful.
Sources
Locations refer to the game executable reference;
comparative sources are listed in the technical references.
The figures are drawn from the values listed on these pages, with no game
graphics, by make_view_figures.py.