Skip to main content

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.

For a rising door three, two and one step ahead: the rows of its frame in the 120-row view (30 to 59, 24 to 71, 16 to 86), and the row of its bottom edge at each opening step, from closed (59, 71, 86) upward by 8, 12 or 18 rows per step. Parts outside the frame are not drawn.
A rising door climbs more rows per step the nearer it is, and is cut at the top of its frame.

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:

ReferencesDoor graphicOpening step
3 to 700 to 4
8 to 1200 to 4
13 to 1710 to 4
18 to 2210 to 4
5100
5210

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)
Distancebottomtopraisepartforce
three steps ahead5931851
two steps ahead71241283
one step ahead861518125

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

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.

Footnotes​

  1. The shape drawing routines, the door drawing, the decoration drawing, the monster drawing with its decorations, the shape reduction and the drivers' scale steps (VGA, EGA); the release routines for doors, monsters and decorations, called by the portal animation. ↩