pokecrystal/home/fade.asm

128 lines
2.5 KiB
NASM
Raw Normal View History

2013-08-29 22:50:59 +00:00
; Functions to fade the screen in and out.
2018-06-24 14:09:41 +00:00
Unreferenced_Function48c::
; TimeOfDayFade
2018-01-23 22:39:09 +00:00
ld a, [wTimeOfDayPal]
2013-08-29 22:50:59 +00:00
ld b, a
ld hl, IncGradGBPalTable_11
ld a, l
sub b
ld l, a
2015-11-20 16:47:52 +00:00
jr nc, .okay
2013-08-29 22:50:59 +00:00
dec h
2015-11-20 16:47:52 +00:00
.okay
2013-08-29 22:50:59 +00:00
ld a, [hli]
ldh [rBGP], a
2013-08-29 22:50:59 +00:00
ld a, [hli]
ldh [rOBP0], a
2013-08-29 22:50:59 +00:00
ld a, [hli]
ldh [rOBP1], a
2013-08-29 22:50:59 +00:00
ret
2018-06-24 14:09:41 +00:00
RotateFourPalettesRight::
ldh a, [hCGB]
2013-08-29 22:50:59 +00:00
and a
2015-11-20 16:47:52 +00:00
jr z, .dmg
2013-08-29 22:50:59 +00:00
ld hl, IncGradGBPalTable_00
ld b, 4
2015-11-20 16:47:52 +00:00
jr RotatePalettesRight
2013-08-29 22:50:59 +00:00
2015-11-20 16:47:52 +00:00
.dmg
2013-08-29 22:50:59 +00:00
ld hl, IncGradGBPalTable_08
ld b, 4
2015-11-20 16:47:52 +00:00
jr RotatePalettesRight
2013-08-29 22:50:59 +00:00
2018-06-24 14:09:41 +00:00
RotateThreePalettesRight::
ldh a, [hCGB]
2013-08-29 22:50:59 +00:00
and a
2015-11-20 16:47:52 +00:00
jr z, .dmg
2013-08-29 22:50:59 +00:00
ld hl, IncGradGBPalTable_05
ld b, 3
2015-11-20 16:47:52 +00:00
jr RotatePalettesRight
2013-08-29 22:50:59 +00:00
2015-11-20 16:47:52 +00:00
.dmg
2013-08-29 22:50:59 +00:00
ld hl, IncGradGBPalTable_13
ld b, 3
2018-06-24 14:09:41 +00:00
RotatePalettesRight::
2015-11-20 16:47:52 +00:00
; Rotate palettes to the right and fill with loaded colors from the left
; If we're already at the leftmost color, fill with the leftmost color
2013-08-29 22:50:59 +00:00
push de
ld a, [hli]
call DmgToCgbBGPals
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
call DmgToCgbObjPals
ld c, 8
call DelayFrames
pop de
dec b
2015-11-20 16:47:52 +00:00
jr nz, RotatePalettesRight
2013-08-29 22:50:59 +00:00
ret
2018-06-24 14:09:41 +00:00
RotateFourPalettesLeft::
ldh a, [hCGB]
2013-08-29 22:50:59 +00:00
and a
2015-11-20 16:47:52 +00:00
jr z, .dmg
2013-08-29 22:50:59 +00:00
ld hl, IncGradGBPalTable_04 - 1
ld b, 4
2015-11-20 16:47:52 +00:00
jr RotatePalettesLeft
2013-08-29 22:50:59 +00:00
2015-11-20 16:47:52 +00:00
.dmg
2013-08-29 22:50:59 +00:00
ld hl, IncGradGBPalTable_12 - 1
ld b, 4
2015-11-20 16:47:52 +00:00
jr RotatePalettesLeft
2013-08-29 22:50:59 +00:00
2018-06-24 14:09:41 +00:00
RotateThreePalettesLeft::
ldh a, [hCGB]
2013-08-29 22:50:59 +00:00
and a
2015-11-20 16:47:52 +00:00
jr z, .dmg
2013-08-29 22:50:59 +00:00
ld hl, IncGradGBPalTable_07 - 1
ld b, 3
2015-11-20 16:47:52 +00:00
jr RotatePalettesLeft
2013-08-29 22:50:59 +00:00
2015-11-20 16:47:52 +00:00
.dmg
2013-08-29 22:50:59 +00:00
ld hl, IncGradGBPalTable_15 - 1
ld b, 3
2018-06-24 14:09:41 +00:00
RotatePalettesLeft::
2015-11-20 16:47:52 +00:00
; Rotate palettes to the left and fill with loaded colors from the right
; If we're already at the rightmost color, fill with the rightmost color
2013-08-29 22:50:59 +00:00
push de
ld a, [hld]
ld d, a
ld a, [hld]
ld e, a
call DmgToCgbObjPals
ld a, [hld]
call DmgToCgbBGPals
ld c, 8
call DelayFrames
pop de
dec b
2015-11-20 16:47:52 +00:00
jr nz, RotatePalettesLeft
2013-08-29 22:50:59 +00:00
ret
IncGradGBPalTable_00:: dc 3,3,3,3, 3,3,3,3, 3,3,3,3
IncGradGBPalTable_01:: dc 3,3,3,2, 3,3,3,2, 3,3,3,2
IncGradGBPalTable_02:: dc 3,3,2,1, 3,3,2,1, 3,3,2,1
IncGradGBPalTable_03:: dc 3,2,1,0, 3,2,1,0, 3,2,1,0
2015-11-20 16:47:52 +00:00
IncGradGBPalTable_04:: dc 3,2,1,0, 3,2,1,0, 3,2,1,0
IncGradGBPalTable_05:: dc 2,1,0,0, 2,1,0,0, 2,1,0,0
IncGradGBPalTable_06:: dc 1,0,0,0, 1,0,0,0, 1,0,0,0
2015-11-20 16:47:52 +00:00
IncGradGBPalTable_07:: dc 0,0,0,0, 0,0,0,0, 0,0,0,0
; bgp obp1 obp2
IncGradGBPalTable_08:: dc 3,3,3,3, 3,3,3,3, 3,3,3,3
IncGradGBPalTable_09:: dc 3,3,3,2, 3,3,3,2, 3,3,2,0
IncGradGBPalTable_10:: dc 3,3,2,1, 3,2,1,0, 3,2,1,0
IncGradGBPalTable_11:: dc 3,2,1,0, 3,1,0,0, 3,2,0,0
2015-11-20 16:47:52 +00:00
IncGradGBPalTable_12:: dc 3,2,1,0, 3,1,0,0, 3,2,0,0
IncGradGBPalTable_13:: dc 2,1,0,0, 2,0,0,0, 2,1,0,0
IncGradGBPalTable_14:: dc 1,0,0,0, 1,0,0,0, 1,0,0,0
2015-11-20 16:47:52 +00:00
IncGradGBPalTable_15:: dc 0,0,0,0, 0,0,0,0, 0,0,0,0