Skip to main content

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.

Left: the top-left corner of a level grid. Columns are counted from 00 eastward and rows from 00 southward, so [00:00] is the north-west corner; the block [01:02] has index 2 × 32 + 1 = 65. North is the row above (index − 32), east the next column (index + 1). Right: one block. Its four faces are numbered by direction, 0 north, 1 east, 2 south, 3 west; the face between two blocks is stored in each of them. Its floor has four item positions, 0 and 1 on the north side, 2 and 3 on the south side, west first.
Positions are [column:row] from the north-west corner; faces follow the directions; items lie on four floor positions.

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.

Footnotes​

  1. Map reader, INF scripts and cell bindings and distance between two blocks. ↩

  2. The neighbor routine with its direction steps; the compass shapes and compass drawing; the view setup and its view sides; the movement buttons. ↩

  3. Drop or pick up an item on the floor, its floor buttons and floor position table. ↩