diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2018-06-05 11:47:22 -0400 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2018-06-05 11:47:22 -0400 |
commit | e80bd60ed6e65477319a977b2d3839260bdaf450 (patch) | |
tree | ff70f7cc61046f0f999a063098650cf03b2e765c | |
parent | c4c2b3cc6ede5259a1246c195a8c1d58e6d3a35d (diff) |
Time of day palettes and fade functions
-rw-r--r-- | home/fade.asm | 95 | ||||
-rw-r--r-- | home/rtc.asm | 20 | ||||
-rw-r--r-- | shim.sym | 3 | ||||
-rw-r--r-- | wram.asm | 3 |
4 files changed, 120 insertions, 1 deletions
diff --git a/home/fade.asm b/home/fade.asm new file mode 100644 index 0000000..e39bd83 --- /dev/null +++ b/home/fade.asm @@ -0,0 +1,95 @@ +include "constants.asm" + +if DEBUG +SECTION "DMG Palette Fade Effect", ROM0 [$0343] +else +SECTION "DMG Palette Fade Effect", ROM0 [$0307] +endc + +Function0343:: ; 0343 + ld a, [wTimeOfDayPal] + ld b, a + ld hl, IncGradGBPalTable_11 ; $39f + ld a, l + sub b + ld l, a + jr nc, .okay + dec h +.okay + ld a, [hli] + ld [rBGP], a + ld a, [hli] + ld [rOBP0], a + ld a, [hli] + ld [rOBP1], a + ret + +RotateFourPalettesRight:: + ld hl, IncGradGBPalTable_08 ; $396 + ld b, $4 + jr RotatePalettesRight + +RotateThreePalettesRight:: + ld hl, IncGradGBPalTable_13 ; $3a5 + ld b, $3 +RotatePalettesRight:: ; 0366 +; 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 +.loop + 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, .loop + ret + +RotateFourPalettesLeft:: + ld hl, IncGradGBPalTable_12 - 1 ; $3a1 + ld b, $4 + jr RotatePalettesLeft + +RotateThreePalettesLeft:: + ld hl, IncGradGBPalTable_15 - 1 ; $3aa + ld b, $3 +RotatePalettesLeft:: ; 0384 +; 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 +.loop + 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, .loop + ret + +; IncGradGBPalTable_00:: db %11111111, %11111111, %11111111 +; IncGradGBPalTable_01:: db %11111110, %11111110, %11111110 +; IncGradGBPalTable_02:: db %11111001, %11111001, %11111001 +; IncGradGBPalTable_03:: db %11100100, %11100100, %11100100 + +; IncGradGBPalTable_04:: db %11100100, %11100100, %11100100 +; IncGradGBPalTable_05:: db %10010000, %10010000, %10010000 +; IncGradGBPalTable_06:: db %01000000, %01000000, %01000000 + +; IncGradGBPalTable_07:: db %00000000, %00000000, %00000000 +; bgp obp1 obp2 +IncGradGBPalTable_08:: db %11111111, %11111111, %11111111 +IncGradGBPalTable_09:: db %11111110, %11111110, %11111000 +IncGradGBPalTable_10:: db %11111001, %11100100, %11100100 +IncGradGBPalTable_11:: db %11100100, %11010000, %11100000 + +IncGradGBPalTable_12:: db %11100100, %11010000, %11100000 +IncGradGBPalTable_13:: db %10010000, %10000000, %10010000 +IncGradGBPalTable_14:: db %01000000, %01000000, %01000000 + +IncGradGBPalTable_15:: db %00000000, %00000000, %00000000 diff --git a/home/rtc.asm b/home/rtc.asm new file mode 100644 index 0000000..6179278 --- /dev/null +++ b/home/rtc.asm @@ -0,0 +1,20 @@ +include "constants.asm" + +if DEBUG +SECTION "Time Of Day Palettes", ROM0 [$032B] +else +SECTION "Time Of Day Palettes", ROM0 [$02EF] +endc + +UpdateTimeOfDayPalettes: ; 32b (0:032b) + ld a, [wVramState] + bit 0, a + ret z +TimeOfDayPals:: + callab _TimeOfDayPals ; Func_8c2e3 + ret + +UpdateTimePals:: ; 33a + callab _UpdateTimePals ; Func_8c335 + ret + @@ -1,5 +1,4 @@ ; ROM0 -00:032b UpdateTimeOfDayPalettes 00:0436 UpdateTime 00:051C Reset 00:0D0A LoadFont @@ -170,6 +169,8 @@ 23:4000 AnimateTilesetImpl 23:42dc UpdateTimeOfDayPal +23:42e3 _TimeOfDayPals +23:4335 _UpdateTimePals 23:4354 ReplaceTimeOfDayPals 23:4370 GetTimePalette 23:44BE Function_8c4be @@ -347,6 +347,9 @@ wPredefBC:: ; cd54 wFarCallBCBuffer:: ; cd54 dw + ds 3 +wVramState:: db + SECTION "CD76", WRAM0[$CD76] wCurItem:: db ; cd76 |