Skip to main content

Open a door

SCRIPT_OPEN_DOOR · opcode 0xfd · 3 bytes

Script virtual machine · Opcode list · Scripted doors

Starts opening the door of a block.

Encoding​

Offsets count from the opcode byte. Words are little-endian.

OffsetTypeFieldMeaning
0u8opcode0xfd
1u16leblockBlock that contains the door.

Behavior​

The handler passes the block and the opening direction to the shared door routine, which Close a door and Toggle walls or a door also use. Unlike closing, opening is not refused when the block is occupied or holds the party.1

The shared routine leaves a door that is already in the requested state unchanged; otherwise it records an operation for the block or, when no operation entry is free, rewrites the door's wall references directly. See scripted doors.2

Edge cases​

  • A door already open is left as it is. A door already moving is turned round, or continues, without a new sound.
  • The request ends at once; see timing for the steps that follow, and the no-slot anomaly.
  • The routine assumes a door: on a block whose north face is not a door it works on the east and west faces, whatever they hold (anomaly). The reference scripts only name door blocks.

Anomaly

ANOMALY-150 — The door routine never checks that the faces it steps are door faces. On a block with no door on its north or east face, a request records an operation with no first step, and the timed steps add to the east and west references until the east face's properties have an endpoint bit, WALL_RUNTIME_DOOR_OPEN_ENDPOINT or WALL_RUNTIME_DOOR_CLOSED_ENDPOINT. Opening a passage (reference 0) takes these faces through references 1 and 2 and stops at 3, a closed door. Closing it steps down to −1, read as a signed byte, and the test then reads below the wall properties: first the wall special types, which have neither bit, then the table below them, until a byte happens to have one. The faces hold these out-of-range references meanwhile; what that does to the view and to movement is unknown. This is latent: all 153 door instructions of the reference scripts name door blocks. A faithful reimplementation steps the faces this way for references in the table; the closing walk has no meaning beyond it.2

Sources​

Footnotes​

  1. Handler for 0xfd and the door wrappers. Comparative source: oeob_openDoor in REF-SCUMM-003. ↩

  2. Shared door routine and advance door operations. ↩ ↩2