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 lowest three bits of the final digit (D) give the value '6'. The other bit in D is a flag and does not change the location type.

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 colour-setting routine at original adrCd0094DC. 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.

Further source details (SPS 439)

In SPS 439, original adrCd006FC0 masks first-byte bits 3–7 and shifts right once. This produces a byte offset of trigger_index * 4 into the current tower's 128-byte trigger table: 32 four-byte records. Tower selection is a separate tower * 128 displacement from TriggersData_1.

The word at original adrEA006FA8 is a sound selector, not a trigger-wait flag. Visible pads initialise it to 0, invisible pads to $FFFF (no sound). The dispatcher selects sound 5 for trigger opcodes $08, $0A and $2A; handlers may override the selection. After the handler returns, a nonnegative value is passed to PlaySound.

Pit landing and alignment

The player fall path at original adrCd004CB2 tests for type 6, subtype 1, after its party-condition check. It decrements the player's floor and converts X/Y by adding the old floor alignment and subtracting the new floor alignment. Unlike stairs, it adds no horizontal movement vector.

An ordinary pit and the ceiling hole below it therefore share the same tower/world X/Y, even if their local floor coordinates differ. The game does not test for a ceiling-hole flag on the landing cell. A pit can still drop the player onto a location without a ceiling hole.

Ceiling holes are independently rendered detail flags. Their presence alone does not cause a player to move upward.

Spell-fizzle tiles

The type-6 subtype-zero movement path calls original adrCd006F80. It scans the four party slots, skips dead or vacant slots, clears the worn-spell byte at champion-record +$11, and refreshes the party panel. This is not a team-avatar traversal loop.

These behaviours are verified in the original SPS 439 source, principally adrCd004CB2, adrCd006E90–adrCd006EA8, and adrCd006F80–adrJB007016.