Map Location Data (6) Pads, Triggers & Holes - HoraceAndTheSpider/Bloodwych-68k GitHub Wiki

A Pad / Floor Trap or Trigger 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 '6'.

To best understand the definition of each floor location, it is best to translate the two bytes (AB) and (CD) to binary, and consider which binary bits (right to left) contain defining information.

The Type of Floor Tile

Bits 0-1 of the (AB) byte are used to allocate the floor tile a number from 0-3. This number will define the type of floor tile in occurrence. 0 = Spell Fizzle 1 = Floor Hole / Pit 2 = Green Trigger Pad 3 = Invisible Trigger Pad

Ceiling Hole / Pit Above

All floor locations have the option of having a hole in the ceiling at the location. This is defined by bit 2 of the (AB) byte. If the bit is 'on' the hole in the ceiling will appear.

Spell Fizzle Zone

Where a location has been designated a Spell Fizzle area, there is only one parameter available, the appearance of a pit in the ceiling, as mentioned above.

All other values are redundant.

Floor Hole / Pit

Where a location has been designated a Floor Hole / Pit, there is only one parameter available, the appearance of a pit in the ceiling, as mentioned above.

All other values are redundant.

Trigger Pad

Where bit 1 of the (AB) byte is set, it is automatically designated a 'Trigger' pad, used to trigger some other in-game event, such as the removal of another wall, there are three parameters available.

By setting bit 0 of the (AB) byte, it will determine whether this 'Trigger' pad is visible (green) or invisible. The 'on' postion designates the pad as invisible.

The appearance of a pit in the ceiling can also be determined, as mentioned above, by setting bit 2 of the (AB) byte.

The remaining bits 3-7 of (AB) assigns the 'trigger' to a pre-defined function. These bits can be converted to a number, from 0-31, which will act as a reference to the action performed by the switch.

The action performed by a Trap / Trigger

The action performed by this reference number is defined in a separate data-block. For information on this see: Pad / Floor Traps & Triggers

Location Occupancy

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

How these features are drawn

The ceiling-hole bit is processed independently and before the floor subtype. A ceiling hole can therefore appear above a floor pit or above a visible/invisible trigger pad.

The extracted resource names describe their rendered purpose:

  • Ceiling_Hole.gfx supplies the ceiling-hole picture;
  • Trigger_Pad.gfx supplies the recolourable trigger-pad template;
  • Floor_Pit.gfx supplies the floor-pit picture.

Floor pits and trigger pads share FloorPit_TriggerPad.offsets and FloorPit_TriggerPad.positions. The ceiling-hole artwork has the separate Ceiling_Hole.offsets and Ceiling_Hole.positions tables.

The ordinary visible trigger pad uses colour mask $01050406, loaded by the routine proposed as Set_TriggerPad_ColourMask at $0094DC. Perspective picture selection and mirroring use the shared centred-component table described in Dungeon Graphics Renderer.

The final position in each type-6 graphic resource is the player's current square. The renderer directly selects source picture 11 for this case, so a floor pit or trigger pad can be visible beneath the player while the independent ceiling-hole bit draws the corresponding hole above.