Author: HobbitDur

  • Opcode: 0x02A
  • Short name: MAPJUMP3
  • Long name: Jump to map

Argument

Destination walkmesh triangle ID (16-bit; stored to wm2field_FieldZ).

Stack

Destination Field Map ID

XCoord

YCoord

(extra parameter)

Facing direction

MAPJUMP3

Description

Same as MAPJUMP but pops one extra value. The five stack values are, from the top: facing direction (wm2field_FieldTarget), an extra parameter stored to wm2field_UnusedJumpParam, the Y then X spawn coordinates (wm2field_FieldY/wm2field_FieldX), and last the destination field map ID (MenuState_opcode_menu_id). The inline 16-bit argument is the walkmesh triangle to spawn on, in the destination field’s .id (wm2field_FieldZ). It sets the low byte of globalFieldNextModuleID to 1 to request the field change next frame. The handler only acts on the first frame it runs: the ready-mask test (ready_bit_index / opcode_ready_mask) lets it pop its values once, and returning 1 never advances the script, so the script stays on this opcode until the field unloads. Nothing placed after it runs.

The field ID is a 0-based line of maplist, so values below 102 are valid: see Field IDs below 102. The opcode always asks for the field module, so an ID below 72 does not reach the world map the way a gateway does.

The extra value was historically guessed to be a facing angle (never above 360, usually a multiple of 4). On PC, wm2field_UnusedJumpParam is only written (by MAPJUMP3 and DISCJUMP) and never read, so the value has no effect.

PC handler: SCRIPT_MAPJUMP3.

Function addresses

Function Address Description
SCRIPT_MAPJUMP3 0x521AC0 Field script opcode handler (verified IDA function)