Map Location Data (4) Stairs - HoraceAndTheSpider/Bloodwych-68k GitHub Wiki

A staircase is identified within the map data, in the second byte within the location's map data word (AB CD), whereby the final digit (D) is equal to '4'.

To best understand the definition of the staircase, we can translate the two bytes (AB) and (CD) to binary, and consider which binary bits (right to left) contain defining information.

The type of Staircase

The type of staircase, is changeable between the 'up' type staircase, and the 'down' type stair case. This is defined in bit 0 of the (AB) byte. If the bit is 'off' the staircase goes upwards, and if the bit is 'on' the staircase goes downwards.

The Direction of the Staircase

A Staircase can face N/E/S/W, and this is defined by bits 1-2 of the (AB) byte, which should be translated into a value from 0-3.

0 = North
1 = East
2 = South
3 = West

Additional Considerations

Although a staircase will appear the same regardless of it's direction set, it should be allocated the correct direction in order to ensure correct operation.

When leaving a floor by a staircase, the player is moved an additional space forward in the given direction. This therefore requires all maps to align staircases on each floor with one space between them in their operating direction.

As such, staircases are always surrounded by walls. If the space behind the staircase is not solid, it is possible to move backwards whilst standing on the staircase, and move into the unoccupied space. There is one occurrence of this in Bloodwych, on the staircase closest to the Chaos Tower entrance, within the Keep.

Location Occupancy

The value of C determines the current occupancy of this location, as previously defined in: Map-Location Data - (0) Spaces