Essence warps
This page describes how to modify the warps that occur after obtaining an essence.
Code for the essence object is located in object_code/common/interactions/essence.s#L341. The data which defines the warp destinations is in that file and looks as follows:
; Each row is warp data for getting an essence.
; b0: wWarpDestGroup
; b1: wWarpDestRoom
; b2: wWarpDestPos
; b3: wWarpTransition
@essenceWarps:
.ifdef ROM_AGES
.db $80, $8d, $26, TRANSITION_DEST_SET_RESPAWN
.db $81, $83, $25, TRANSITION_DEST_SET_RESPAWN
.db $80, $ba, $55, TRANSITION_DEST_SET_RESPAWN
.db $80, $03, $35, TRANSITION_DEST_X_SHIFTED
.db $80, $0a, $17, TRANSITION_DEST_SET_RESPAWN
.db $83, $0f, $16, TRANSITION_DEST_SET_RESPAWN
.db $82, $90, $45, TRANSITION_DEST_X_SHIFTED
.db $81, $5c, $15, TRANSITION_DEST_X_SHIFTED
.else
.db $80, $96, $44, TRANSITION_DEST_SET_RESPAWN
.db $80, $8d, $24, TRANSITION_DEST_SET_RESPAWN
.db $80, $60, $25, TRANSITION_DEST_SET_RESPAWN
.db $80, $1d, $13, TRANSITION_DEST_SET_RESPAWN
.db $80, $8a, $25, TRANSITION_DEST_SET_RESPAWN
.db $80, $00, $34, TRANSITION_DEST_SET_RESPAWN
.db $80, $d0, $34, TRANSITION_DEST_SET_RESPAWN
.db $81, $00, $33, TRANSITION_DEST_SET_RESPAWN
.endif
The first part is for Ages, while the second part (after the .else
) is for Seasons. Each row corresponds to one dungeon. (Note that there is no entry for dungeon 0 / maku path, unlike with miniboss warps.)
Let's break down the first row for Ages, which is the warp data for the Spirit's Grave essence:
.db $80, $8d, $26, TRANSITION_DEST_SET_RESPAWN
.db
stands for "define byte", which simply inserts a byte (or a list of bytes) into the ROM. So, all of the values here are byte values.
$80
Is the group number to send Link to. Actually, it's the group number with a bitwise OR of $80
applied to it. It's not obvious why this is, but it's not important - we can just ignore the first digit. So, value $80
means Link should be sent to group 0.
$8d
is the room index to send Link to. So, combined with the group number, the full room index in LynnaLab is $08d
.
$26
is the position Link should spawn at in the room. When the position is specified as a single byte like this, it always has format $YX
, where Y and X are his position measured in tiles. So, $26
gives him Y-position $2
and X-position $6
. This can be confirmed in LynnaLab.
Finally, TRANSITION_DEST_SET_RESPAWN
is the transition type, as defined in constants/common/transitions.s
. Typically it is TRANSITION_DEST_SET_RESPAWN
. But in certain cases, when the doorway is not centered on a tile, the game also uses TRANSITION_DEST_X_SHIFTED
, which places Link in between two tiles horizontally.