Skip to main content

Walls and doors

The world · Interacting with walls · WallRuntimeFlags · DoorKind

In brief​

Every face of a block holds a wall reference. What the face does (let the party, flying objects or monsters through, count as a door, show the objects behind it) depends only on the properties of that reference. References 0 to 24 are built into the executable; the levels map the others. A door is a group of five references, from closed to open: opening or closing a door moves both faces of its block one reference along at each door update.

Positions are written [XX:YY], column then row, both counted from 00; the block index is YY × 32 + XX.

A door is a group of five wall references, from closed to open. In the executable's table, references 3 to 7 are: 3, the closed endpoint, which nothing passes; 4, 5 and 6, partly open, which nothing passes; 7, the open endpoint, which the party, small projectiles and monsters pass. Opening advances the reference one step per door update until the open endpoint, closing moves it back to the closed endpoint. References 3 to 7 and 8 to 12 use the level's first door graphic, 13 to 17 and 18 to 22 its second; the other three groups have the same properties.
Only the open endpoint lets anything through; a door moves one reference per door update.

What a wall lets through​

What a wall does is given by its WallRuntimeFlags, looked up by wall reference. They decide the party's steps, the monster movement rules, the flight of thrown items and spells, ranged attacks, doors and parts of the view.1

References 0 to 24 are built into the executable: 0 is no wall, 1 and 2 two solid walls that behave alike, 3 to 22 the doors, 23 and 24 faces that the party and flying objects cross but monsters do not; see built-in references. A sublevel's INF wall mappings give the properties of the references it uses above them; the original files map references 25 to 74. The game never resets the table: a reference keeps its last mapping after the party leaves the level, until another level maps it again.1

How a door opens and closes​

A door changes state by changing the wall reference of its block's sides, among five successive references from closed to open:

  • Opening advances the reference until it reaches a wall with WALL_RUNTIME_DOOR_OPEN_ENDPOINT, the open door, which the party, monsters and flying objects pass.
  • Closing moves it the other way until a wall with WALL_RUNTIME_DOOR_CLOSED_ENDPOINT, the closed door.

A door switch or a closing request does nothing while monsters occupy the door's block or the party stands on it. Both sides of the door's block are updated. An operation already under way also stops at either endpoint, and a separate path can complete active operations at once. The same bits are used to draw doors and to resolve some projectile movement.1

A level has two door graphics, described by door records in its INF file: door references 3 to 12 use the first, 13 to 22 the second. Besides their look (doors), a record can make the closed and partly open doors of its graphic let small projectiles through; it does so for one door graphic of level 2 and of level 7.1

Faces that the level does not map​

Inferred

The mappings and the walls of each map are read from the files. Which faces the party can reach or see comes from a reachability analysis of the original maps and scripts, not from play.

Because the wall tables are never reset, a face whose reference the current sublevel record does not map takes the look and the properties left by whatever was loaded before. Several original maps contain such references, but almost never where the party can go or look:2

  • Levels sharing a map. Levels 5 and 6 use the same map, as do levels 12 and 14. Level 5 maps 15 references and level 6 maps 38, but the part of the map that the party can reach on level 5 uses only references that level 5 maps; the same holds for 12 and 14.
  • Second sublevel records. They map fewer references than the first ones, but on levels 1, 3, 7, 11 and 16 the faces in reach in either record use only references that this record maps.
  • Level 8. Its second record maps 6 references. In the part of the level reachable while it is current, 37 faces use 11 references that only the first record maps. The party enters the second record only from the first one, at [12:14], so in ordinary play these faces keep their wall graphics and properties, but not their decorations.

The analysis follows every arrival position through the faces the party can pass, counting every door as openable, every wall that a script of the level can set and every teleport that a reachable script performs; stairs and other blocks that change level are treated as dead ends. A face counts as seen when the block on its far side is reachable.

Anomaly

A game saved on level 8 after the party has passed [12:14] comes back with 37 faces unmapped (ANOMALY-63). Loading a saved game loads the saved level and sublevel, which applies only that record's mappings, and nothing restores or resets the wall tables. When the save was made while level 8's second record was current, the 11 references that only the first record maps keep whatever the tables held before the load. If no level has mapped them since the program started, as should be the case when the game is loaded from the start-up screen, they keep the executable's initial values, all 0: no wall graphics and no decoration are drawn, and nothing can pass those faces (inferred from these values). On level 8 with its second record current, 13 of the references used on the map are left so, on 69 faces. Loaded during play, they keep the last mapping any level gave them. A faithful reimplementation keeps the four wall tables across level loads, never rebuilds them when a game is loaded, and applies only the selected record's mappings.

Sources​

Locations refer to the game executable reference; comparative sources are listed in the technical references.

Footnotes​

  1. Door and wall step, stop door slots, complete door operations, assign a wall mapping and the INF section loop; the door records loader and the wall group toggle, with the door records of the level files read with the INF schema; the wall properties table, with its initial values and the complete list of its readers and writers. Comparative sources: REF-SCUMM-010, openCloseDoor and completeDoorOperations; REF-SCUMM-013, toggleWallState. ↩ ↩2 ↩3 ↩4

  2. The wall properties table and its three companion tables, written only when a wall mapping is assigned and by the wall group toggle; the saved-game reader. The reachability analysis covers the 16 INF and 15 MAZ files. ↩