summaryrefslogtreecommitdiff
path: root/event/poisonstep_pals.asm
diff options
context:
space:
mode:
Diffstat (limited to 'event/poisonstep_pals.asm')
-rw-r--r--event/poisonstep_pals.asm48
1 files changed, 48 insertions, 0 deletions
diff --git a/event/poisonstep_pals.asm b/event/poisonstep_pals.asm
new file mode 100644
index 000000000..c556ba498
--- /dev/null
+++ b/event/poisonstep_pals.asm
@@ -0,0 +1,48 @@
+LoadPoisonBGPals: ; cbcdd
+ call .LoadPals
+ ld a, [hCGB]
+ and a
+ ret nz
+ ret ; ????
+
+.LoadPals: ; cbce5
+ ld a, [hCGB]
+ and a
+ jr nz, .cgb
+ ld a, [TimeOfDayPal]
+ and $3
+ cp $3
+ ld a, %00000000
+ jr z, .convert_pals
+ ld a, %10101010
+
+.convert_pals
+ call DmgToCgbBGPals
+ ld c, 4
+ call DelayFrames
+ callba _UpdateTimePals
+ ret
+
+.cgb
+ ld a, [rSVBK]
+ push af
+ ld a, $5
+ ld [rSVBK], a
+ ld hl, BGPals
+ ld c, $20
+.loop
+; RGB 28, 21, 31
+ ld a, (palred 28 + palgreen 21 + palblue 31) % $100
+ ld [hli], a
+ ld a, (palred 28 + palgreen 21 + palblue 31) / $100
+ ld [hli], a
+ dec c
+ jr nz, .loop
+ pop af
+ ld [rSVBK], a
+ ld a, $1
+ ld [hCGBPalUpdate], a
+ ld c, 4
+ call DelayFrames
+ callba _UpdateTimePals
+ ret