From 68ee99818a839c8bae5b94be3e35ff9ac1e08cc4 Mon Sep 17 00:00:00 2001 From: yenatch Date: Fri, 18 Jul 2014 10:26:15 -0700 Subject: [PATCH] Move cry functions out of home.asm. --- home.asm | 112 +-------------------------------------------------- home/cry.asm | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 111 deletions(-) create mode 100644 home/cry.asm diff --git a/home.asm b/home.asm index 2eaa889f5..2b7bbd495 100644 --- a/home.asm +++ b/home.asm @@ -1719,117 +1719,7 @@ Function378b:: ; 378b ; 37b6 -PlayStereoCry:: ; 37b6 - push af - ld a, 1 - ld [$c2bc], a - pop af - call _PlayCry - call WaitSFX - ret -; 37c4 - -PlayStereoCry2:: ; 37c4 -; Don't wait for the cry to end. -; Used during pic animations. - push af - ld a, 1 - ld [$c2bc], a - pop af - jp _PlayCry -; 37ce - -PlayCry:: ; 37ce - call PlayCry2 - call WaitSFX - ret -; 37d5 - -PlayCry2:: ; 37d5 -; Don't wait for the cry to end. - push af - xor a - ld [$c2bc], a - ld [CryTracks], a - pop af - call _PlayCry - ret -; 37e2 - -_PlayCry:: ; 37e2 - push hl - push de - push bc - - call GetCryIndex - jr c, .done - - ld e, c - ld d, b - call PlayCryHeader - -.done - pop bc - pop de - pop hl - ret -; 37f3 - -LoadCryHeader:: ; 37f3 -; Load cry header bc. - - call GetCryIndex - ret c - - ld a, [hROMBank] - push af - ld a, BANK(CryHeaders) - rst Bankswitch - - ld hl, CryHeaders - add hl, bc - add hl, bc - add hl, bc - add hl, bc - add hl, bc - add hl, bc - - ld e, [hl] - inc hl - ld d, [hl] - inc hl - - ld a, [hli] - ld [CryPitch], a - ld a, [hli] - ld [CryPitch + 1], a - ld a, [hli] - ld [CryLength], a - ld a, [hl] - ld [CryLength + 1], a - - pop af - rst Bankswitch - and a - ret -; 381e - -GetCryIndex:: ; 381e - and a - jr z, .no - cp NUM_POKEMON + 1 - jr nc, .no - - dec a - ld c, a - ld b, 0 - and a - ret - -.no - scf - ret -; 382d +INCLUDE "home/cry.asm" PrintLevel:: ; 382d diff --git a/home/cry.asm b/home/cry.asm new file mode 100644 index 000000000..19723643a --- /dev/null +++ b/home/cry.asm @@ -0,0 +1,111 @@ +PlayStereoCry:: ; 37b6 + push af + ld a, 1 + ld [$c2bc], a + pop af + call _PlayCry + call WaitSFX + ret +; 37c4 + +PlayStereoCry2:: ; 37c4 +; Don't wait for the cry to end. +; Used during pic animations. + push af + ld a, 1 + ld [$c2bc], a + pop af + jp _PlayCry +; 37ce + +PlayCry:: ; 37ce + call PlayCry2 + call WaitSFX + ret +; 37d5 + +PlayCry2:: ; 37d5 +; Don't wait for the cry to end. + push af + xor a + ld [$c2bc], a + ld [CryTracks], a + pop af + call _PlayCry + ret +; 37e2 + +_PlayCry:: ; 37e2 + push hl + push de + push bc + + call GetCryIndex + jr c, .done + + ld e, c + ld d, b + call PlayCryHeader + +.done + pop bc + pop de + pop hl + ret +; 37f3 + +LoadCryHeader:: ; 37f3 +; Load cry header bc. + + call GetCryIndex + ret c + + ld a, [hROMBank] + push af + ld a, BANK(CryHeaders) + rst Bankswitch + + ld hl, CryHeaders + add hl, bc + add hl, bc + add hl, bc + add hl, bc + add hl, bc + add hl, bc + + ld e, [hl] + inc hl + ld d, [hl] + inc hl + + ld a, [hli] + ld [CryPitch], a + ld a, [hli] + ld [CryPitch + 1], a + ld a, [hli] + ld [CryLength], a + ld a, [hl] + ld [CryLength + 1], a + + pop af + rst Bankswitch + and a + ret +; 381e + +GetCryIndex:: ; 381e + and a + jr z, .no + cp NUM_POKEMON + 1 + jr nc, .no + + dec a + ld c, a + ld b, 0 + and a + ret + +.no + scf + ret +; 382d