Wall and door routines
Routines · Data · Address index
Doors and their switches, temporary walls, clicks on walls, and the walls that True Seeing and Disintegrate change. The routines page explains how the entries are written.
0x1e245 — Redraw if a block is in view
- Range:
0x1e245–0x1e27f - Role: Compares a block with the first 15 entries of the visible-block list, the blocks ahead of the party. On a match it sets the state-change flag, which makes the game loop redraw the scene, and returns 1. Wall-changing script instructions call it with the block they change.
- Used by: Where each face goes on the screen › Special cases, How a script runs › Scripts and the game's state, Scripted walls and doors › Walls, Set walls or a direction › Behavior, Toggle walls or a door › Behavior, Values passed on to other routines › The routines
0x24440, 0x243fc, 0x280ce — Temporary walls
- Role:
0x24440, the start routine of spell definition 25, Wall of Force, in the initial definition table, turns the block ahead of the party into a temporary wall: it requires the block's four wall bytes to be zero and bits 0–2 of its word+4clear, takes a free temporary-wall slot or, when none is free, frees the one that expires first (0x24519–0x2454e), sets the four wall bytes toWALL_REFERENCE_TEMPORARY_WALLand stores a deadline 546 + ((546 × mage level) >> 1) ticks ahead (0x24557–0x24576), that is 546 + 273 per level; when the block is not empty it prints "The spell fails" (DS:0x593b).0x280ce, called at the end of the timed callbacks, passes each slot whose deadline is strictly below the counter to0x243fc, which zeroes the four wall bytes, frees the slot and sets the state-change flag. The zero-fill (0x24403–0x24426) uses the slot's block number on the current level without looking at what the walls hold; with the INF level loader (0x48d45–0x48f68) and its map reader (0x4839c–0x4847a), which never reset the slots for a level without a record, this is the location of ANOMALY-71. - Comparative source: REF-SCUMM-014,
updateWallOfForceTimers,destroyWallOfForce. - Used by: Timed updates › The table of timed updates, Loading, failures and the end of the game › Details and edge cases, Loading, failures and the end of the game, Wall references with built-in effects, Anomalies and bugs, Level 15: reference tables › Insal
0x2467d, 0x2468c — Start and end True Seeing: switch wall-to-VMP entry 46
- Addresses:
0x2467d,0x2468c(file offsets0x1787d,0x1788c) - Role: The start and end routines of spell definitions 29 and 57, the
mage and cleric True Seeing, in the
initial definition table. They write 0 or 1 to entry 46,
WALL_REFERENCE_ILLUSION(SpecialWallReference), of the wall-to-VMP mapping and set the state-change flag. - Used by: Wall references with built-in effects, Screen coordinates, pixel by pixel, Wall layouts (VMP)
0x24595 — Start Disintegrate
- Range:
0x24595–0x245fd - Role: The start routine of spell definition 26, Disintegrate, in the
initial definition table. Finds the
first monster in line within one block and gives it
effect 4, category 4; then, when the front face of view block
13 (the block ahead) is
WALL_REFERENCE_TEMPORARY_WALL, sets that block's four walls to 0 and marks the view for redrawing. The temporary-wall slot is not freed. - Used by: Wall references with built-in effects, Anomalies and bugs, Level 15: reference tables › Insal
0x24fc8 — Hit test of a wall click
- Range:
0x24fc8–0x250aa(file offsets0x181c8–0x182aa) - Role: Used by the wall-click handlers. It returns true at once for
event masks other than
0x40; for0x40it walks the 52-byte decoration records of the wall's chain and checks whether the click falls inside their rectangles: the position-2 placement minus 3 and the cut shape of the position-2 rectangle plus 6, mirrored as 176 − x − width when flag0x01is set (0x25058). It follows the link at0x2508euntil a hit or a link ≤ 0. - Anomaly:
ANOMALY-79: the routine (0x24fe5–0x2509f) tests flag0x01only, not0x02, and reads the rectangle number at0x25014and its shape at0x25024without skipping0xff. - Used by: Wall decorations (DEC) › Flags and links, Wall decorations (DEC), Interacting with walls › Decorations and interactions, Events that start scripts › Activating walls, Wall interaction types › How a handler runs, Anomalies and bugs
0x250c9 — Door and wall step
- Range:
0x250c9–0x252e4(file offsets0x182c9–0x184e4) - Anomaly:
ANOMALY-148: the slot scan comparesslot.blockwith the requested block at0x2513ebefore the free test at0x25152, so block 0 matches the first free slot.ANOMALY-150: the leading face is chosen at0x250edwith no check that it is a door. - Role: Shared routine of door operations. A signed direction selects a mask through the door mask table; a wall already matching it ends the request. Otherwise the routine uses one of the three door operation slots, or, when none is free, steps through wall indices to the matching endpoint and updates the opposite wall bytes.
- Details: the face used for the tests is face 0 when its wall has
WALL_RUNTIME_DOOR, otherwise face 1 (0x250ed); a wall already at the requested endpoint returns at0x2512e. With no free slot, the walk0x251bb–0x251dawrites the same wall reference at0x251e8and0x25201for both faces (ANOMALY-127). With a slot, the first step is applied and the view redraw requested at0x25285and0x252b6without testing whether the door is in view (ANOMALY-128); the sound is queued through the environmental sound at0x252c9and timer entry 12 is re-armed at0x252d8. - Comparative source: REF-SCUMM-010,
openCloseDoor. - Used by: Close a door › Behavior, Walls and doors › What a wall lets through, Open a door › Behavior, Scripted walls and doors › Doors, Toggle walls or a door › Behavior, Wall mapping flags › Doors, Wall properties › Where each bit is tested, Values passed on to other routines › The routines, Sound effects, Scripted walls and doors, Open a door, The world, Anomalies and bugs
0x252e6, 0x252f9, 0x25326 — Door operation wrappers
- Ranges:
0x252e6–0x252f8;0x252f9–0x25325;0x25326–0x25383 - Role: Open, guarded close and toggle requests, each forwarding to the
door and wall step. The close and toggle requests do nothing while
monsters occupy the block or the party stands on it (
0x25309,0x25311,0x25339,0x25344). A toggle reverses an operation already under way on the block; otherwise it closes a door that lets the party through and opens any other (0x25394–0x253bd). - Used by: Close a door › Behavior, Obstacles and other monsters › The move check, Open a door › Behavior, Toggle walls or a door › Behavior, Values passed on to other routines › The routines, The world, Level 3: reference tables, Level 6: reference tables
0x25384 — Door side test
- Range:
0x25384–0x253a2 - Role: Part of the door path: tests
WALL_RUNTIME_DOORin the wall properties of the block's first wall reference to choose which side to examine. - Used by: Wall properties › Where each bit is tested, The world
0x253dc — Force a door
- Range:
0x253dc–0x25567 - Role: The handler of
INF_WALL_SPECIAL_FORCE_DOOR, cell 4 of the handler cells (DS:0x5a85). Arguments: block and face. It tests the click against the rectangle (40, 16)–(136, 88) (0x253f3) and returns 0 when the click falls outside and the record gate is the click value0x40(0x253ff). It keeps one of the slots 0–5 that pass the eligibility test with mask0x0d(0x25415): the one with the higheststrength, the last on a tie, because the comparison at0x25425–0x25469reads the exceptional strength of the kept character on both sides (0x2543d,0x2545e,ANOMALY-141). With no such slot it only formats "You are not capable of forcing the door." (DS:0x5b2b) intoDS:0xf16e(0x25486) and never prints it (ANOMALY-140). Otherwise it capsstrengthat 18 (0x254a2) and rolls 1d20 (0x254b6): the door gives way when the roll is at most the chance of that strength (0x254c3). On success it prints "You force the door." (DS:0x5b55,0x254d1), sets the face and the opposite face to reference 8 when the face holds 51, to 18 otherwise (0x254e6–0x2553e), and requests the opening (0x25547). On failure it prints "You try to force the door but fail." (DS:0x5b6c,0x25553). Both return 1. - Used by: Interacting with walls › Forcing a door, Texts, The world, Anomalies and bugs
0x25568 — Operate a door switch
- Range:
0x25568–0x25648 - Role: The handler of
INF_WALL_SPECIAL_DOOR_SWITCH, cell 0 of the handler cells. It computes the switch rectangle of the door graphic and tests the click against it (0x25609). When the click falls on the switch, or when the record gate is not the click value0x40(a key or a flying object), it toggles the door (0x25621), plays sound 6 (0x2562b) and returns 1. A click elsewhere on the door goes to the door that cannot be forced handler instead (0x2563b). - Used by: Sound effects › Doors and walls, The world
0x25649, 0x25693, 0x256f1, 0x2574f, 0x258cd, 0x25924 — Wall-click dispatchers
- Role: Handlers selected by a wall's special type when the player clicks
it: decoration (block event
0x40), levers, niche and script wall. The decoration and lever handlers read the decoration selector and run the hit test. The lever handlers then move the clicked face to the next wall reference (0x25693,incbat0x256ce) or the previous one (0x256f1,decbat0x2572c) before sending the event, so a level script sees the lever's new position. The niche handler (0x2574f–0x258c7) keeps niche items in the chain of the block that holds the niche wall, at position 8: it takes the top one when nothing is held (block event 8, then the item becomes the held item), and puts a held item in unless its shape is large, "The item is too large to fit." (block event 4). In keyboard control with the quiver selected, a taken arrow joins the quiver without a block event and any other item is appended back; from an empty niche it prints "You can't put that item there." after reading item 0 (branch at0x2582f). The handler ofINF_WALL_SPECIAL_DOOR_NO_FORCE,0x258cd–0x25923(cell 5 of the handler cells), runs a hit test and, when the clicked face hasWALL_RUNTIME_DOOR_CLOSED_ENDPOINT(0x25907), prints "No one is able to pry this door open." (DS:0x5bd2) and returns 1. - Used by: Wall properties › Where each bit is tested, On the floor and in the air › Items on the floor, Block events › Wall activation and the 0xffff mask, Block events › Who sends each event, The engine › How the systems connect, Interacting with walls › Decorations and interactions, Events that start scripts › Activating walls, Events that start scripts, Wall interaction types › How a handler runs, The world, Level 3: reference tables, Level 6: reference tables, Item types, Anomalies and bugs, Level 8: reference tables › Dran Draggore, Level 9: reference tables › Level data, Level 10: reference tables › Level data, Level 13: reference tables › The guardian of the labyrinth
0x27f68 — Advance door operations
- Range:
0x27f68–0x2807d(file offsets0x1b168–0x1b27d); the slot loop starts at0x27f75. - Anomaly: the loop skips a slot with block 0 at
0x27f93(ANOMALY-148). It stops only when the new leading face has bit0x20or0x10(0x28052–0x2805e) and reads the properties atDS:0x2268+ signed reference (0x2801d–0x28020), below the table for a negative reference (ANOMALY-150). - Role: Entry 12 of the timed-callback table. For each
active door operation slot, adds the slot's step to the
door's wall bytes, queues an environmental sound (5 at mask
0x20, otherwise 4 when closing and 3 when opening) and frees the slot when the new wall carries mask0x10or0x20. Each face is advanced from its own current value (0x27fe4,0x28009); the sound is placed at the party's block, pushed at0x2804b. - Used by: Walls and doors › What a wall lets through, Timed updates › The table of timed updates, Wall mapping flags › Doors, Values passed on to other routines › The routines, Sound effects, Scripted walls and doors, Open a door, The world, Wall properties