summaryrefslogtreecommitdiff
path: root/macros/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'macros/scripts')
-rw-r--r--macros/scripts/events.asm61
-rw-r--r--macros/scripts/gfx_anims.asm37
-rw-r--r--macros/scripts/text.asm6
3 files changed, 101 insertions, 3 deletions
diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm
index c7fdb484..a5f7113d 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)
@@ -438,6 +469,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/gfx_anims.asm b/macros/scripts/gfx_anims.asm
new file mode 100644
index 00000000..f475ad8d
--- /dev/null
+++ b/macros/scripts/gfx_anims.asm
@@ -0,0 +1,37 @@
+; pic + oam animations
+
+frame: MACRO
+ db \1
+x = \2
+IF _NARG > 2
+REPT _NARG - 2
+x = x | (\3 << 1)
+ shift
+ENDR
+ENDC
+ db x
+ENDM
+
+ const_def -1, -1
+
+ const endanim_command ; $ff
+endanim: MACRO
+ db endanim_command
+ENDM
+
+ const dorestart_command ; $fe
+dorestart: MACRO
+ db dorestart_command
+ENDM
+
+ const dorepeat_command ; $fd
+dorepeat: MACRO
+ db dorepeat_command
+ db \1 ; command offset to jump to
+ENDM
+
+ const delanim_command ; $fc
+delanim: MACRO
+; Removes the object from the screen, as opposed to `endanim` which just stops all motion
+ db delanim_command
+ENDM
diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm
index c446c6c7..38e56b77 100644
--- 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