Zones

Zones are used to demarcate 3D regions of space within scenes. There are various types of zones, each of which have different behaviours when Twinsen enters or interacts with them:

  • teleport zones transport Twinsen to a different scene when entered
  • camera zones change the camera position and angle when entered
  • sceneric zones define areas of the scene used for "is actor in zone?" queries in scripts
  • fragment zones define an area of the scene's terrain that can be dynamically shown or hidden
  • bonus zones dispense items when interacted with
  • text zones are used to implement signs and say dialogue when interacted with
  • ladder zones provide vertical movement
  • conveyor zones move actors which stand within them
  • spike zones deal damaged when entered (floor spikes, traps, etc)
  • rail zones are used to control minecart movement

All zones are cuboid in shape.

Zone File Format

Zones are stored as part of the scene containing the zone:

{
    i32         x0
    i32         y0
    i32         z0
    i32         x1
    i32         y1
    i32         z1
    i32         info0
    i32         info1
    i32         info2
    i32         info3
    i32         info4
    i32         info5
    i32         info6
    i32         info7
    i16         type
    i16         value
}
  • x0, y0, z0: first corner defining the zone cuboid
  • x1, y1, z1: opposite corner defining the zone cuboid
  • info0..7: zone parameters; interpretation depends on the zone type
  • type: the type of zone
  • value: zone parameter; interpretation depends on the zone type
Zone typeName
0Teleport
1Camera
2Sceneric
3Fragment
4Bonus
5Text
6Ladder
7Conveyor
8Spike
9Rail

The documentation below for each of the zone types describes how the flags are interpreted, as loaded from the scene. The LBA engine modifies some of these values at run-time in order to avoid allocating additional memory; these run-time uses and modifications are not documented here.

Teleport zones

ParameterDescription
paramDestination scene
info0Destination x
info1Destination y
info2Destination z
info3Destination angle
info4Zone scripting ID
info5Door flags: bit 0 - for exterior scenes, don’t activate zone until Twinsen collides with the door
info6Collision flags: bit 0 - don’t adjust Twinsen to fix collisions
info7Enable flags: bit 0 - zone is enabled

Teleport zones can be enabled or disabled from script by using the SET_TELEPORT_ZONE opcode.

Camera zones

ParameterDescription
paramZone scripting ID
info0Camera x
info1Camera y
info2Camera z
info3Camera alpha angle
info4Camera beta angle
info5Camera gamma angle
info6View distance
info7Enable flags: bit 0 - zone is enabled

Camera zones can be enabled or disabled from script by using the SET_CAMERA opcode.

Sceneric zones

ParameterDescription
paramZone scripting ID
info0-unused-
info1-unused-
info2-unused-
info3-unused-
info4-unused-
info5-unused-
info6-unused-
info7-unused-

Sceneric zones can be used from scripts by checking whether an actor is within them by using the ZONE and ZONE_OBJ conditions.

Fragment zones

ParameterDescription
paramZone scripting ID
info0Fragment number
info1-unused-
info2Enable flags: bit 0 - zone is enabled
info3-unused-
info4-unused-
info5-unused-
info6-unused-
info7-unused-

Fragment zones can be enabled or disabled from script by using the SET_FRAGMENT opcode.

Bonus zones

ParameterDescription
param-unused-
info0Bonus type
info1Bonus quantity
info2-unused-
info3-unused-
info4-unused-
info5-unused-
info6-unused-
info7-unused-

Bonus zones are not scriptable.

Text zones

ParameterDescription
paramMessage ID
info0Text colour
info1Associated camera zone (zero for none)
info2Direction
info3-unused-
info4-unused-
info5-unused-
info6-unused-
info7-unused-

Text zones are not scriptable.

The direction values seem appropriate for use as a bitmask but the LBA engine checks for equality, not a bit test, so each text zone can only face a single direction. Double-sided signs would require two sign zones, one on each side.

Zone directionDescription
1Sign faces North
2Sign faces South
4Sign faces East
8Sign faces West

Ladder zones

ParameterDescription
paramZone scripting ID
info0Enabled
info1-unused-
info2-unused-
info3-unused-
info4-unused-
info5-unused-
info6-unused-
info7-unused-

Ladder zones can be enabled or disabled from script using the SET_LADDER_ZONE opcode. Their enabled state can be queried using the LADDER condition.

Conveyor zones

ParameterDescription
paramZone scripting ID
info0-unused-
info1Enabled
info2Direction
info3-unused-
info4-unused-
info5-unused-
info6-unused-
info7-unused-

Conveyor zones can be enabled or disabled from script using the SET_CONVEYOR_ZONE opcode.

The direction values seem appropriate for use as a bitmask but the LBA engine checks for equality, not a bit test.

Zone directionDescription
1Conveyor travels North
2Conveyor travels South
4Conveyor travels East
8Conveyor travels West

Spike zones

ParameterDescription
paramZone scripting ID
info0-unused-
info1Damage
info2Rearm time
info3-unused-
info4-unused-
info5-unused-
info6-unused-
info7-unused-

The damage of spike zones can be controlled from script using the SET_SPIKE_ZONE opcode. Setting the damage to zero will disable the spike zone; setting it to a non-zero value will enable it.

Rail zones

ParameterDescription
paramZone scripting ID
info0Enabled
info1Switch set
info2-unused-
info3-unused-
info4-unused-
info5-unused-
info6-unused-
info7-unused-