summaryrefslogtreecommitdiff
path: root/constants/event_macros.asm
diff options
context:
space:
mode:
authorpikalaxalt <PikalaxALT@gmail.com>2016-05-29 20:52:05 -0400
committerpikalaxalt <PikalaxALT@gmail.com>2016-05-29 20:52:05 -0400
commitb8cced19fce2a212f5cb205039382a63821a3762 (patch)
tree6a01fb5bbe4e6558a25db77c76cf357e846e7590 /constants/event_macros.asm
parentf17f3f1a06ce8c28f044cdb04c1d6355efc01a8f (diff)
Mt Moon B2F
Diffstat (limited to 'constants/event_macros.asm')
-rw-r--r--constants/event_macros.asm32
1 files changed, 31 insertions, 1 deletions
diff --git a/constants/event_macros.asm b/constants/event_macros.asm
index 5eb73147..bf0a95b5 100644
--- a/constants/event_macros.asm
+++ b/constants/event_macros.asm
@@ -452,6 +452,36 @@ CheckEitherEventSet: MACRO
ENDC
ENDM
+CheckEitherEventSetReuseA: MACRO
+ IF event_byte != ((\1) / 8)
+event_byte = ((\1) / 8)
+ ld a, [wEventFlags + event_byte]
+ ENDC
+ IF ((\1) / 8) == ((\2) / 8)
+ ld a, [wEventFlags + ((\1) / 8)]
+ and (1 << ((\1) % 8)) | (1 << ((\2) % 8))
+ ELSE
+ ; This case doesn't happen in the original ROM.
+ IF ((\1) % 8) == ((\2) % 8)
+ push hl
+ ld a, [wEventFlags + ((\1) / 8)]
+ ld hl, wEventFlags + ((\2) / 8)
+ or [hl]
+ bit ((\1) % 8), a
+ pop hl
+ ELSE
+ push bc
+ ld a, [wEventFlags + ((\1) / 8)]
+ and (1 << ((\1) % 8))
+ ld b, a
+ ld a, [wEventFlags + ((\2) / 8)]
+ and (1 << ((\2) % 8))
+ or b
+ pop bc
+ ENDC
+ ENDC
+ ENDM
+
; for handling fixed event bits when events are inserted/removed
;\1 = event index
;\2 = fixed flag bit
@@ -459,4 +489,4 @@ AdjustEventBit: MACRO
IF ((\1) % 8) != (\2)
add ((\1) % 8) - (\2)
ENDC
- ENDM \ No newline at end of file
+ ENDM