summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlibjet <libj3t@gmail.com>2020-06-02 17:12:42 +0100
committerlibjet <libj3t@gmail.com>2020-06-02 17:47:38 +0100
commit0297de0841b135923520f025f837c39baff2eac0 (patch)
tree8a3f5bcbc0961ccf96695b3a794297e82a023a2c
parent0e8c23326cd5ff59960ed54a9a51d00cc658fbde (diff)
Add engine/events/poisonstep_pals.asm
-rwxr-xr-xengine/events/poisonstep_pals.asm41
-rw-r--r--main.asm4
2 files changed, 42 insertions, 3 deletions
diff --git a/engine/events/poisonstep_pals.asm b/engine/events/poisonstep_pals.asm
new file mode 100755
index 00000000..2752f5a7
--- /dev/null
+++ b/engine/events/poisonstep_pals.asm
@@ -0,0 +1,41 @@
+LoadPoisonBGPals:
+ call .LoadPals
+ ldh a, [hCGB]
+ and a
+ ret nz
+ ret ; ????
+
+.LoadPals:
+ ldh a, [hCGB]
+ and a
+ jr nz, .cgb
+ ld a, [wTimeOfDayPal]
+ maskbits NUM_DAYTIMES
+ cp DARKNESS_F
+ ld a, %00000000
+ jr z, .convert_pals
+ ld a, %10101010
+
+.convert_pals
+ call DmgToCgbBGPals
+ ld c, 4
+ call DelayFrames
+ farcall _UpdateTimePals
+ ret
+
+.cgb
+ ld hl, wBGPals2
+ ld c, 4 palettes
+.loop
+ ld a, LOW(palred 28 + palgreen 21 + palblue 31)
+ ld [hli], a
+ ld a, HIGH(palred 28 + palgreen 21 + palblue 31)
+ ld [hli], a
+ dec c
+ jr nz, .loop
+ ld a, $1
+ ldh [hCGBPalUpdate], a
+ ld c, 4
+ call DelayFrames
+ farcall _UpdateTimePals
+ ret
diff --git a/main.asm b/main.asm
index 5eebffac..fca530a1 100644
--- a/main.asm
+++ b/main.asm
@@ -380,9 +380,7 @@ SECTION "bank32", ROMX
INCLUDE "engine/battle_anims/bg_effects.asm"
INCLUDE "data/moves/animations.asm"
-
-LoadPoisonBGPals::
- dr $cbc76, $cbcbd
+INCLUDE "engine/events/poisonstep_pals.asm"
TheEndGFX::
INCBIN "gfx/credits/theend.2bpp"