Blocks, directions and positions
The world · Moving the party ·
Direction · LevelBlockRuntime
In brief
A level is a grid of 32 × 32 blocks, numbered from 0 to 1,023. This site
writes a block's position [XX:YY], column then row, both counted from 00
from the north-west corner; its index is YY × 32 + XX. Directions are
numbered clockwise from north. Each block has four faces, one per direction,
and four floor positions where items lie.
Directions and coordinates
Each block has an index from 0 to 1,023. Its column is the index modulo 32
and its row the index divided by 32: index 65 is [01:02]. The map records
and the INF cell bindings both refer to this same array of blocks.1
Directions are numbered clockwise from north: 0 north, 1 east, 2 south,
3 west (Direction). North is the next row up
(index − 32) and east the next column (index + 1), so row 00 is the
northern edge of the level, column 00 its western edge and [00:00] its
north-west corner. Left of a facing is the facing − 1, right the facing + 1.
Side s of a block, wall_references[s] in
LevelBlockRuntime, is its face
turned towards direction s: side 0 is the north face, side 2 the south
face. A wall between two blocks is therefore stored twice, once in each
block, each copy describing the face seen from the other block.2
Floor positions
The floor of a block has four positions where items lie, numbered as in the figure: 0 and 1 along the north side, 2 and 3 along the south side, the western one first.
Clicking on the floor of the view drops or picks up an item at one of the
two front positions of the party's block (lower half of the view), or at one
of the two positions of the block ahead that are nearest to the party (upper
half); the left half of the view gives the position on the left. The block
ahead is reachable only if the face it turns towards the party lets the party
or small projectiles through, or carries WALL_RUNTIME_DOOR
(WallRuntimeFlags).3
Sources
Locations refer to the game executable reference; comparative sources are listed in the technical references.