Label dialog constants
kemenaran opened this issue · 0 comments
kemenaran commented
Dialogs used to be referenced with a raw numeric constant (like $123
). Since #438, however, we can use proper constants for those dialogs (like Dialog123
), which makes it easier to reference the places where a specific dialog is used in the code.
All code locations using the standard code structure were already labeled, using a call_open_dialog
macro:
; Open dialog $123
- ld a, $23
- call OpenDialogInTable1
+ call_open_dialog Dialog123
However, in many places, this macro can't be used directly, because the code is conditional:
ld e, $12 ; default dialog
ld a, [wHasSword]
jp nz, .swordEnd
ld e, $13 ; dialog when Link has no sword
.swordEnd
ld a, e
call OpenDialogInTable0
In that case, we can still reference the dialog constant, by using the ld_dialog_low
macro:
- ld e, $12 ; default dialog
+ ld_dialog_low e, Dialog012 ; default dialog
ld a, [wHasSword]
jp nz, .swordEnd
- ld e, $13 ; dialog when Link has no sword
+ ld_dialog_low e, Dialog013 ; dialog when Link has no sword
.swordEnd
ld a, e
call OpenDialogInTable0
We should use this macro in as many places as possible, to replace dialog raw constants by labels as much as we can.