2013-08-29 22:50:59 +00:00
|
|
|
; Functions to fade the screen in and out.
|
|
|
|
|
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
Function48c:: ; 48c
|
2013-08-29 22:50:59 +00:00
|
|
|
ld a, [TimeOfDayPal]
|
|
|
|
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]
|
|
|
|
ld [rBGP], a
|
|
|
|
ld a, [hli]
|
|
|
|
ld [rOBP0], a
|
|
|
|
ld a, [hli]
|
|
|
|
ld [rOBP1], a
|
|
|
|
ret
|
|
|
|
; 4a3
|
|
|
|
|
|
|
|
|
2015-11-20 16:47:52 +00:00
|
|
|
RotateFourPalettesRight:: ; 4a3
|
2013-08-29 22:50:59 +00:00
|
|
|
ld a, [hCGB]
|
|
|
|
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
|
|
|
; 4b6
|
|
|
|
|
2015-11-20 16:47:52 +00:00
|
|
|
RotateThreePalettesRight:: ; 4b6
|
2013-08-29 22:50:59 +00:00
|
|
|
ld a, [hCGB]
|
|
|
|
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
|
2015-11-20 16:47:52 +00:00
|
|
|
RotatePalettesRight:: ; 4c7
|
|
|
|
; 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
|
|
|
|
; 4dd
|
|
|
|
|
2015-11-20 16:47:52 +00:00
|
|
|
RotateFourPalettesLeft:: ; 4dd
|
2013-08-29 22:50:59 +00:00
|
|
|
ld a, [hCGB]
|
|
|
|
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
|
|
|
; 4f0
|
|
|
|
|
2015-11-20 16:47:52 +00:00
|
|
|
RotateThreePalettesLeft:: ; 4f0
|
2013-08-29 22:50:59 +00:00
|
|
|
ld a, [hCGB]
|
|
|
|
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
|
2015-11-20 16:47:52 +00:00
|
|
|
RotatePalettesLeft:: ; 501
|
|
|
|
; 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
|
|
|
|
; 517
|
|
|
|
|
|
|
|
|
|
|
|
; 517
|
2014-02-02 01:26:39 +00:00
|
|
|
IncGradGBPalTable_00:: db %11111111, %11111111, %11111111
|
|
|
|
IncGradGBPalTable_01:: db %11111110, %11111110, %11111110
|
|
|
|
IncGradGBPalTable_02:: db %11111001, %11111001, %11111001
|
|
|
|
IncGradGBPalTable_03:: db %11100100, %11100100, %11100100
|
2015-11-20 16:47:52 +00:00
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
IncGradGBPalTable_04:: db %11100100, %11100100, %11100100
|
|
|
|
IncGradGBPalTable_05:: db %10010000, %10010000, %10010000
|
|
|
|
IncGradGBPalTable_06:: db %01000000, %01000000, %01000000
|
2015-11-20 16:47:52 +00:00
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
IncGradGBPalTable_07:: db %00000000, %00000000, %00000000
|
2013-08-29 22:50:59 +00:00
|
|
|
; bgp obp1 obp2
|
2014-02-02 01:26:39 +00:00
|
|
|
IncGradGBPalTable_08:: db %11111111, %11111111, %11111111
|
|
|
|
IncGradGBPalTable_09:: db %11111110, %11111110, %11111000
|
|
|
|
IncGradGBPalTable_10:: db %11111001, %11100100, %11100100
|
|
|
|
IncGradGBPalTable_11:: db %11100100, %11010000, %11100000
|
2015-11-20 16:47:52 +00:00
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
IncGradGBPalTable_12:: db %11100100, %11010000, %11100000
|
|
|
|
IncGradGBPalTable_13:: db %10010000, %10000000, %10010000
|
|
|
|
IncGradGBPalTable_14:: db %01000000, %01000000, %01000000
|
2015-11-20 16:47:52 +00:00
|
|
|
|
2014-02-02 01:26:39 +00:00
|
|
|
IncGradGBPalTable_15:: db %00000000, %00000000, %00000000
|
2013-08-29 22:50:59 +00:00
|
|
|
; 547
|