Skip to main content

Drawing the dungeon view

Overlay 244 · image 0x3d6e0–0x3f810 (8,497 bytes) · 22 stub entries

All overlays · 245 · Creating a party →

In brief​

Overlay 244 draws the first-person view. From the party's block and facing it lists the 18 visible blocks, sets up the scene, has the resident code draw the walls, then draws what each visible block holds — decorations, items, doors, monsters, temporary walls, flying objects and teleporters — before copying the view and drawing the compass. The game loop calls its redraw once per pass, when the game state has changed. The player-visible result is described in the dungeon view.

Addresses

Every address on this page is a file offset in START.EXE; calls into resident code are given as analysis addresses. See how addresses are written.

How it fits together​

One redraw, in the order the scene redraw runs its steps. Dashed boxes are outside this overlay.

The object pass​

The object pass walks the visible blocks in the drawing order and, for each block, draws in this order:

StepWhat is drawnWhich blocksRoutine
1Drawing bounds of the blockevery visible block0x3d77c
2Wall decorationsevery visible block0x3e9c4
3Itemsblocks whose item chain is not empty0x3e230
4Doorsthe 15 blocks ahead, faces with WALL_RUNTIME_DOOR0x3ed4a
5Monstersthe 15 blocks ahead, occupied blocks0x3e50a
6Temporary wallsthe 15 blocks ahead, WALL_REFERENCE_TEMPORARY_WALL0x3f40a
7Flying objectsevery visible block0x3efbf
8Teleportersevery visible block, WALL_REFERENCE_TELEPORTER0x3f311

Entry points​

Stub entries whose target is resolved, from the stub bytes or another independent anchor, or through the portal reading.

Encoded entryTargetRole
0x7a0:0x3e, 0x2aba:0x3e0x3f65aCompass
0x7a0:0x48, 0x2aba:0x480x3f4ccLightning column
0x2aba:0x5c0x3f807Empty routine
0x7a0:0x7a, 0x2aba:0x7a0x3f6d4Scene redraw

The other 18 entries are reached only from inside the overlay.

Routines at a glance​

RoutineAddress
List the visible blocks0x3d6e0
Set a text window in 8-pixel units0x3d746
Clip a block's objects0x3d77c
Door frame rows0x3d982
Copy a VMP scene part0x3d9ec, 0x3dab1
Test for a solid wall0x3db7b
Set up the view0x3db9a
Near-front scene part0x3e153
Draw the items of a visible block0x3e230
Objects behind a wall0x3e269
Reduce a shape0x3e1e9
Draw the monsters of a visible block (frame meanings inferred)0x3e50a
Draw the decorations of a visible block0x3e9c4
Draw monster decorations0x3e8a8
Draw a monster shape0x3e49b
Draw a door0x3ed4a
Draw the flying objects of a visible block0x3efbf, 0x3efeb
Draw a teleporter0x3f311
Draw a temporary wall0x3f40a
Lightning column0x3f4cc
Draw the objects of the visible blocks0x3f524
Draw the compass0x3f65a
Redraw the scene0x3f6d4
Empty routine0x3f807

Routines​

List the visible blocks​

AddressRange
0x3d6e00x3d6e0–0x3d745

For a block and a Direction, stores the 18 visible blocks in the visible-block list, adding the view offsets of that direction and wrapping to 0–1,023, with a far pointer to each block entry.

Comparative source: REF-SCUMM-016, assignVisibleBlocks.

Used by: Directions, Moving the party › What the party sees, The dungeon view › The 18 visible blocks, Level maps (MAZ)

Set a text window in 8-pixel units​

AddressRange
0x3d7460x3d746–0x3d77b

0x3d746(window, x1, y1, x2, y2) sets the bounds of a text window from coordinates in 8-pixel units: x = x1 and width x2 − x1 in columns, y = 8 × y1 and height 8 × (y2 − y1) in pixels (set a text window's bounds). All three callers set window 5, the window the view's shape drawing clips against, to rows 0–15 and a block's columns: the object clipping at 0x3d976, the door drawing at 0x3efb3 and the object pass at 0x3f624.

Used by: The object pass

Clip a block's objects​

AddressRange
0x3d77c0x3d77c–0x3d981

Computes, once per redraw and visible block, the columns where the block's objects may be drawn, from the front faces of the 18 visible blocks and the clipping tables; a door face that is not fully open also limits the rows through 0x3d982. The result is kept per block and applied as the drawing window.

Comparative source: REF-SCUMM-016, setLevelShapesDim.

Used by: Wall mapping flags › Doors, Wall properties › Where each bit is tested, Monsters in the view

Door frame rows​

AddressRange
0x3d9820x3d982–0x3d9eb

Gives the rows of a door frame from the door tables (0x45e, 0x462) for the depth class of a visible block, or for the next nearer class when called by the object clipping, and applies them to a drawing window.

Comparative source: REF-SCUMM-016, setDoorShapeDim.

Used by:

Copy a VMP scene part​

AddressRange
0x3d9ec, 0x3dab10x3d9ec–0x3dab0, 0x3dab1–0x3db7a

Copy a rectangle of VMP entries into the tile grid at a given tile position, normally (0x3d9ec) or mirrored (0x3dab1). Arguments: column, row, wall reference, area offset, width, height. When the wall-to-VMP mapping of the wall is 0 it draws nothing; otherwise it reads from entry (mapping − 1) × 431 + 330 + offset, skips zero entries and skips columns outside 0–21.

Comparative source: REF-SCUMM-016, generateVmpTileData and generateVmpTileDataFlipped.

Used by: Wall layouts (VMP) › What it becomes in memory, Where each face goes on the screen › Special cases, Where each face goes on the screen › The tile rectangles, Faces and drawing order › Which faces are drawn, Screen coordinates, pixel by pixel › From tiles to pixels

Test for a solid wall​

AddressRange
0x3db7b0x3db7b–0x3db99

Stub entry 0. Returns 0 for wall reference 0 and for a reference whose wall properties have WALL_RUNTIME_DOOR, 1 otherwise. Its eight callers are all in the view setup (0x3dcb6–0x3e012).

Used by:

Set up the view​

AddressRange
0x3db9a0x3db9a–0x3e1e8

Called by the scene redraw with the party's block and direction. It selects the three view sides for the direction, copies the floor and ceiling backdrop, mirrored when (row + column + direction) is odd, lists the visible blocks and copies their walls: the facing − 1 end of each row at the left of the view with its facing + 1 face, the other end mirrored at the right. Its "has wall" test (0x3db7b) rejects wall 0 and walls with WALL_RUNTIME_DOOR; a front face with that bit is copied into the neighboring side position. It makes 25 VMP area copies after the backdrop, farthest first; their positions are listed in where each face goes on the screen.

Comparative source: REF-SCUMM-016, generateBlockDrawingBuffer and hasWall.

Used by: Directions, Moving the party › What the party sees, Wall properties, Level maps (MAZ) › Organization, Blocks, directions and positions › Directions and coordinates, Wall properties › Where each bit is tested, Where each face goes on the screen › Special cases, Faces and drawing order › Which faces are drawn, Wall layouts (VMP) › What it becomes in memory, Screen coordinates, pixel by pixel

Near-front scene part​

AddressRange
0x3e1530x3e153–0x3e17d, inside 0x3db9a

The step of the view setup that copies the front face of view block 13, one step ahead of the party.

Used by:

Draw the items of a visible block​

AddressRange
0x3e2300x3e230–0x3e49a

Draws the items of a visible block's chain at positions 0–3 and 8 (niche): skips the block when its front face has VMP graphics without WALL_RUNTIME_SHOW_BLOCK_OBJECTS (block 16 excepted, 0x3e269); places each item at its spot or niche position, reduces it by the item scale steps and spreads items by item number. Shapes are reduced through 0x3e1e9.

Comparative source: REF-SCUMM-016, drawBlockItems.

Used by: Spots and wall decorations › Where objects are drawn

Objects behind a wall​

AddressRange
0x3e2690x3e269–0x3e285

Tests WALL_RUNTIME_SHOW_BLOCK_OBJECTS against the VMP wall mappings to decide whether the objects of a block are drawn.

Comparative source: REF-SCUMM-013, drawBlockItems.

Used by: Wall mapping flags › Drawing, Wall properties › Where each bit is tested

Reduce a shape​

AddressRange
0x3e1e90x3e1e9–0x3e22f

Hands the number of steps to the display driver as the level of the next shapes (slot 21 of the driver function table), then applies the driver's scale step (slot 43) the requested number of times; with 0 steps it returns the shape unchanged. It does not test the shape for null (0x3e1e9–0x3e22f).

Comparative source: REF-SCUMM-016, scaleShape.

Used by: Clipping, scaling and darkening › Scale steps, Doors, teleporters and temporary walls › Released shapes, Run a sequence › Without a level change

Draw the monsters of a visible block​

AddressRange
0x3e50a0x3e50a–0x3e9c3

Frame meanings are inferred.

Collects the monster slots standing on the block into five drawing slots, then draws each monster: frame from the frame tables, position from the spot table plus (88, 127), distance steps from the monster tables, idle offsets from monster byte +0x17 (idle_offset), the monster type's byte +0x1e (its occupancy class, tested at 0x3e79a), and up to three monster decorations whose offsets shrink by 2/3 per step. The body is monster shape base + f − 1, where base is 18 when the monster's graphics_index (+0x07) is nonzero and 0 otherwise (0x3e6b4–0x3e721); when slot_mod_3 (+0x1a) is nonzero it is drawn with that colour variant (0x3e6df–0x3e703), unless 0x3e49b, which draws the body and the decorations, applies a flash or stone colour table instead. The body shape is passed to the shape reduction at 0x3e708–0x3e726 without a null test, unlike the decorations (0x3e8b6–0x3e8be): with a released shape, one step ahead nothing is drawn, two or three steps ahead the driver reduces a shape read from address 0 (ANOMALY-88).

Anomaly: ANOMALY-156: the frame lookup adds the monster's direction byte (+0x05) with no mask, at 0x3e658–0x3e664 for the alternate table DS:0x4b1 and at 0x3e676–0x3e67e for the normal table DS:0x4d1. Direction 4 reads the next row; with the normal table, animation step 1 and the party facing west the index is 32, which is DS:0x4f1[0], the value 0. Frame 0 reads the far pointer at DS:0xa2cc + 4 × base (0x3e713–0x3e721): base 18 gives entry 17 of DS:0xa2d0, which is empty; base 0 gives the words DS:0xa2cc and DS:0xa2ce.

Comparative source: REF-SCUMM-016, drawMonsters.

Used by: Monster decorations (DCR) › Monster images, groups and frames, Compressed containers (CPS) › Unpacked images, Monsters in the view › Drawing a monster, Spots and wall decorations › Where objects are drawn, Lasting spell effects, Monster capabilities › Where it is used, Monster slot › Layout, Doors, teleporters and temporary walls › Released shapes, Run a sequence › Without a level change, Monsters in the view, Level data (INF), Anomalies and bugs

Draw a monster shape​

AddressRange
0x3e49b0x3e49b–0x3e509

Draws a monster body or decoration for the monster drawing (0x3e85d, 0x3e997). Arguments: the shape, x, y, a mirror flag (1 when the frame number is negative), the monster's MonsterRuntimeFlags and a colour variant offset (−1 for none; decorations always pass −1). With MONSTER_RUNTIME_REVEALED it installs, through driver slot 11 (DS:0x654e, replacement colour table), the table DS:0x23a8, which turns every nonzero colour into 15 (0x3e4a6–0x3e4c5); otherwise, with MONSTER_RUNTIME_TURNED_TO_STONE, the table DS:0x23b8 (both tables), which turns them into 13. Only when neither applies does it install the colour variant (0x3e4c6–0x3e4e2). It then draws the shape in window 5 through one of the four shape drawing routines listed at DS:0x049e: the mirror flag plus 2 when a table was installed (0x3e4e5–0x3e503). They reach driver slots 18, 39, 15 and 38, which draw the shape as it is, mirrored, through the installed table, or both (VGA, EGA).

Used by: Monsters in the view › Drawing a monster

Draw the decorations of a visible block​

AddressRange
0x3e9c40x3e9c4–0x3ed49

For the side face and then the front face selected by the decoration tables, follows the chain of decoration records of the face's wall reference and draws each decoration shape at its DEC placement, shifted and mirrored as described on the drawing page.

Comparative source: REF-SCUMM-016, drawDecorations.

Used by: Spots and wall decorations › Wall decorations, Wall decorations (DEC) › Organization, Spots and wall decorations › Where objects are drawn, Doors, teleporters and temporary walls › Released shapes, Run a sequence › Without a level change

Draw monster decorations​

AddressRange
0x3e8a80x3e869–0x3e9a6, inside 0x3e50a

For k = 0 to 2, reads the monster type's decoration selector v at type offset 0x2b + k (0x3e877); 0 skips that k; otherwise it draws decoration base + 6 (v − 1) + f − 1 (0x3e887–0x3e89b), skipping a null shape, scaling its offsets by 2/3 per step and mirroring it with the body, with no colour variant (0x3e973); see MonsterDecorationRuntime. Neither v nor the resulting index is checked.

Used by: Monster decoration entry › From the DCR file to memory, Monster decorations (DCR) › What it becomes in memory, Monster decorations (DCR) › Monster images, groups and frames, Doors, teleporters and temporary walls › Released shapes, Run a sequence › Without a level change, Level data (INF)

Draw a door​

AddressRange
0x3ed4a0x3ed4a–0x3efbe

For a visible block whose front face is a door, picks the door shape from the wall's door graphic and the block's distance, places it at the block's centre spot and raises or parts it according to the opening step and the door graphic's DoorKind, with the door tables; draws the door switch when the wall has no decoration and the level's door record does not hide it. With an unknown kind it draws no door shape, but still tests the switch.

Comparative source: REF-SCUMM-016, drawDoor and DarkMoonEngine::drawDoorIntern.

Used by: Doors, teleporters and temporary walls › Released shapes, How a door graphic moves, Doors, teleporters and temporary walls › Released shapes, Run a sequence › Without a level change

Draw the flying objects of a visible block​

AddressRange
0x3efbf, 0x3efeb0x3efbf–0x3f310; the wall test at 0x3efeb–0x3eff9

Skips the block when its front face has VMP graphics without WALL_RUNTIME_SHOW_BLOCK_OBJECTS (the same test as 0x3e269), orders the flying objects of the block with the flying-object tables and draws each at x = 88 + the x of its spot, y = 39, reduced by the scale steps of the block and spot. The shape is chosen at 0x3f121–0x3f25d with the flying-object shapes: for a thrown item (object byte 0 = 1), the thrown shape of its item shape when it flies along or against the party's facing, otherwise the item shape; for other objects the thrown shape of object byte +0x0a. Object flag 0x40 centres the object at y = 44.

Comparative source: REF-SCUMM-013, drawFlyingObjects.

Used by: Wall mapping flags › Drawing, Wall properties › Where each bit is tested, Spots and wall decorations › Where objects are drawn

Draw a teleporter​

AddressRange
0x3f3110x3f311–0x3f409

Draws two layers of 13 sparkle shapes for a block whose front face is WALL_REFERENCE_TELEPORTER, from the teleporter tables, the sparkle points and the animation pulse.

Comparative source: REF-SCUMM-016, drawTeleporter.

Used by: Wall references with built-in effects

Draw a temporary wall​

AddressRange
0x3f40a0x3f40a–0x3f4cb

Covers a block whose front face is WALL_REFERENCE_TEMPORARY_WALL with rows of shapes whose number, size and start depend on the distance, from the temporary-wall tables.

Comparative source: REF-SCUMM-016, drawWallOfForce.

Used by: Wall references with built-in effects

Lightning column​

AddressRange
0x3f4cc—

Draws the lightning column shape six times at x 72, stepping y by 64 and alternating the two shape drawing routines.

Used by: Run a special event › Lightning (event 0)

Draw the objects of the visible blocks​

AddressRange
0x3f5240x3f524–0x3f659

Walks the visible blocks in the drawing order: computes each block's bounds, draws its decorations and, when its item chain is not empty, its items. For the 15 blocks ahead of the party it then calls the door drawing for faces with WALL_RUNTIME_DOOR, the monsters of occupied blocks and the temporary-wall drawing for WALL_REFERENCE_TEMPORARY_WALL; for every block, the flying objects and the teleporter drawing for WALL_REFERENCE_TELEPORTER (SpecialWallReference). The monsters are gated only by the block word +4 & 7 (0x3f5ca–0x3f5d0), with no test of the block's walls.

Used by: Faces and drawing order › Drawing order, Wall references with built-in effects, Monsters in the view › Drawing a monster

Draw the compass​

AddressRange
0x3f65a0x3f65a–0x3f6d3

Stub entry 6. The routine starts at 0x3f65a; the anchor o-3f659 is kept for older links, but 0x3f659 is the last byte of the object pass. When the party's direction differs from the one last drawn, or when asked to, draws the three compass shapes of that direction at their positions and remembers the direction. The shapes for directions 0 to 3 show N, E, S and W. The scene redraw calls it without forcing (0x3f7da), and only when its own argument is nonzero, no dialogue screen is open (DS:0xee38) and the spell book is closed (DS:0xe441); closing the spell book (resident 0x22312) and overlay 250 (0x48f9f) force it.

Used by: Directions, Blocks, directions and positions › Directions and coordinates, Level maps (MAZ) › Organization

Redraw the scene​

AddressRange
0x3f6d40x3f6d4–0x3f806

Redraws the dungeon view from the party's block and facing, and clears the state-change flag at 0x3f7ff before returning. The game loop calls it once per pass when that flag is set. In order: view setup, tile drawing, object pass; then, at 0x3f7ac, a copy of 22 columns × 120 rows from (0, 0) of page 2 to (0, 0) of page 0, the screen, and the compass.

When the step pacing flag is set, the routine first waits (0x3f75c–0x3f776) until the free-running counter is no longer below the next step time; after the copy to the screen, 0x3f7df–0x3f7fb clears the flag and sets the next step time to the counter plus 4.

Comparative source: REF-SCUMM-016, EoBCoreEngine::drawScene.

Used by: The game loop › One pass of the game loop, Redraw the scene › Behavior, Run a special event › Lightning (event 0), Scripted characters, flags and messages › Messages, dialogue, sound and timing, Faces and drawing order › Drawing order, Screen coordinates, pixel by pixel › From tiles to pixels

Empty routine​

AddressRangeStatus
0x3f8070x3f807–0x3f810Purpose unknown

Stub entry 12. It returns without writing memory, calling anything or setting a result. It is called after a level is loaded: by the game start at 0x1cb32 and twice by the level-change command, at 0x272dd and 0x2734f.

Used by: Entry points

Sources​

The executable is identified in the file inventory; the overlay layout is described on the overlays page. Comparative sources are listed in the technical references.