Skip to main content

Turn the party or flying objects

SCRIPT_CHANGE_DIRECTION · opcode 0xe8 · 3 bytes

Script virtual machine · Opcode list · Script direction changes

Rotates the party, or the flying objects in the block that triggered the script, by a number of direction steps.

Encoding​

Offsets count from the opcode byte. The byte at offset 1 is a ScriptDirectionTarget.

OffsetTypeFieldMeaning
0u8opcode0xe8
1s8targetSCRIPT_DIRECTION_PARTY (0xf1) or SCRIPT_DIRECTION_MOVERS (0xf5).
2s8adjustmentSigned value added to the direction before keeping its low two bits.

Every selector, including unrecognized ones, occupies 3 bytes.

Example (constructed, not from a level): e8 f1 02 adds 2 to the party's direction.

Behavior​

new_direction = (direction + adjustment) & 3
  • Party. The party's facing is rotated, a scene update is requested and the keyboard pick-up cycle restarts.
  • Flying objects. The handler visits the ten moving records. Each active record in the block whose event started the current script is rotated the same way. Their position in the block does not change, and no redraw is requested.1

Edge cases and unknowns​

  • Directions are numbered clockwise from north (Direction), so a positive turn is to the right.
  • Unrecognized selectors are skipped without effect; whether they are valid is not established.

Observed use​

The reference scripts use SCRIPT_DIRECTION_PARTY 9 times and SCRIPT_DIRECTION_MOVERS 6 times.

Sources​

Footnotes​

  1. Handler for 0xe8, the party direction, the moving records, the event block and the scene-update flag. Comparative source: oeob_changeDirection in REF-SCUMM-003. Statistics come from decoding the scripts reachable in the 16 reference INF files. ↩