diff options
Diffstat (limited to 'macros')
-rw-r--r-- | macros/farcall.asm | 6 | ||||
-rw-r--r-- | macros/predef.asm | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | macros/scripts/events.asm | 61 | ||||
-rwxr-xr-x | macros/scripts/text.asm | 6 |
4 files changed, 70 insertions, 7 deletions
diff --git a/macros/farcall.asm b/macros/farcall.asm index 122e5207..b4af8b2d 100644 --- a/macros/farcall.asm +++ b/macros/farcall.asm @@ -26,10 +26,8 @@ homecall: MACRO ldh a, [hLoadedROMBank] push af ld a, BANK(\1) - ldh [hLoadedROMBank], a - ld [MBC1RomBank], a + call BankswitchCommon call \1 pop af - ldh [hLoadedROMBank], a - ld [MBC1RomBank], a + call BankswitchCommon ENDM diff --git a/macros/predef.asm b/macros/predef.asm index d86582d1..f4e7f609 100644 --- a/macros/predef.asm +++ b/macros/predef.asm @@ -30,3 +30,7 @@ ENDM db_tx_pre: MACRO db (\1_id - TextPredefs) / 2 + 1 ENDM + +predef_const: MACRO + const \1PredefID +ENDM diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm index 8087c5c2..266ffdd1 100755..100644 --- a/macros/scripts/events.asm +++ b/macros/scripts/events.asm @@ -62,6 +62,16 @@ event_byte = ((\2) / 8) ENDM +EventFlagAddressa: MACRO +event_byte = ((\1) / 8) + ld [wEventFlags + event_byte], a + ENDM + +aEventFlagAddress: MACRO +event_byte = ((\1) / 8) + ld a, [wEventFlags + event_byte] + ENDM + ;\1 = event index CheckEventHL: MACRO event_byte = ((\1) / 8) @@ -138,6 +148,27 @@ CheckAndResetEventA: MACRO ENDM +CheckAndSetEventReuseHL: MACRO + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + bit (\1) % 8, [hl] + set (\1) % 8, [hl] + ENDM + +CheckAndResetEventReuseHL: MACRO + IF event_byte != ((\1) / 8) +event_byte = ((\1) / 8) + ld hl, wEventFlags + event_byte + ENDC + + bit (\1) % 8, [hl] + res (\1) % 8, [hl] + ENDM + + ;\1 = event index SetEvent: MACRO event_byte = ((\1) / 8) @@ -460,6 +491,36 @@ CheckEitherEventSet: MACRO 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 diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm index a947ca2f..2ec1de43 100755 --- a/macros/scripts/text.asm +++ b/macros/scripts/text.asm @@ -127,9 +127,9 @@ sound_dex_page_added: MACRO db TX_SOUND_DEX_PAGE_ADDED ENDM - const TX_SOUND_CRY_NIDORINA ; $14 -sound_cry_nidorina: MACRO - db TX_SOUND_CRY_NIDORINA + const TX_SOUND_CRY_PIKACHU ; $14 +sound_cry_pikachu: MACRO + db TX_SOUND_CRY_PIKACHU ENDM const TX_SOUND_CRY_PIDGEOT ; $15 |