Split more code out of home.asm.

This commit is contained in:
yenatch 2014-05-31 01:22:15 -07:00
parent d424eb4438
commit 6d8c6055b5
9 changed files with 1624 additions and 1619 deletions

73
home/fade.asm Normal file
View file

@ -0,0 +1,73 @@
; These routines manage gradual fading
; (e.g., entering a doorway)
LoadGBPal::
ld a, [wd35d] ;tells if cur.map is dark (requires HM5_FLASH?)
ld b, a
ld hl, FadePal4
ld a, l
sub b
ld l, a
jr nc, .ok
dec h
.ok
ld a, [hli]
ld [rBGP], a
ld a, [hli]
ld [rOBP0], a
ld a, [hli]
ld [rOBP1], a
ret
GBFadeOut1::
ld hl, FadePal1
ld b, 4
jr GBFadeOutCommon
GBFadeOut2::
ld hl, FadePal6
ld b, 3
GBFadeOutCommon::
ld a, [hli]
ld [rBGP], a
ld a, [hli]
ld [rOBP0], a
ld a, [hli]
ld [rOBP1], a
ld c, 8
call DelayFrames
dec b
jr nz, GBFadeOutCommon
ret
GBFadeIn1::
ld hl, FadePal4 + 2
ld b, 4
jr GBFadeInCommon
GBFadeIn2::
ld hl, FadePal7 + 2
ld b, 3
GBFadeInCommon::
ld a, [hld]
ld [rOBP1], a
ld a, [hld]
ld [rOBP0], a
ld a, [hld]
ld [rBGP], a
ld c, 8
call DelayFrames
dec b
jr nz, GBFadeInCommon
ret
FadePal1:: db %11111111, %11111111, %11111111
FadePal2:: db %11111110, %11111110, %11111000
FadePal3:: db %11111001, %11100100, %11100100
FadePal4:: db %11100100, %11010000, %11100000
; rBGP rOBP0 rOBP1
FadePal5:: db %11100100, %11010000, %11100000
FadePal6:: db %10010000, %10000000, %10010000
FadePal7:: db %01000000, %01000000, %01000000
FadePal8:: db %00000000, %00000000, %00000000