ref: 6dde0b274d1edac5db5087bcd9a9931716fe1d83
parent: 399925fff577cf11a77193d997d2bf19ee72aa04
author: yenatch <[email protected]>
date: Tue May 21 14:32:55 EDT 2013
ilex forest tree tile animations
--- /dev/null
+++ b/gfx/tilesets/forest-tree/1.2bpp
@@ -1,0 +1,1 @@
+�W$�2�0[LG`
\ No newline at end of file
--- /dev/null
+++ b/gfx/tilesets/forest-tree/2.2bpp
@@ -1,0 +1,2 @@
+�U&�
+:�(3$nq߰
\ No newline at end of file
binary files /dev/null b/gfx/tilesets/forest-tree/3.2bpp differ
binary files /dev/null b/gfx/tilesets/forest-tree/4.2bpp differ
--- a/main.asm
+++ b/main.asm
@@ -16700,7 +16700,177 @@
INCBIN "baserom.gbc", $fc41c, $fc45c - $fc41c
; fc45c
-INCBIN "baserom.gbc", $fc45c, $fc56d - $fc45c
+
+ForestTreeLeftAnimation: ; fc45c
+ ld hl, [sp+0]
+ ld b, h
+ ld c, l
+
+; Only during the Celebi event.
+ ld a, [$dbf3]
+ bit 2, a
+ jr nz, .asm_fc46c
+ ld hl, ForestTreeLeftFrames
+ jr .asm_fc47d
+
+.asm_fc46c
+ ld a, [TileAnimationTimer]
+ call GetForestTreeFrame
+ add a
+ add a
+ add a
+ add ForestTreeLeftFrames % $100
+ ld l, a
+ ld a, 0
+ adc ForestTreeLeftFrames / $100
+ ld h, a
+
+.asm_fc47d
+ ld sp, hl
+ ld hl, $90c0
+ jp WriteTile
+; fc484
+
+
+ForestTreeLeftFrames: ; fc484
+ INCBIN "gfx/tilesets/forest-tree/1.2bpp"
+ INCBIN "gfx/tilesets/forest-tree/2.2bpp"
+; fc4a4
+
+ForestTreeRightFrames: ; fc4a4
+ INCBIN "gfx/tilesets/forest-tree/3.2bpp"
+ INCBIN "gfx/tilesets/forest-tree/4.2bpp"
+; fc4c4
+
+
+ForestTreeRightAnimation: ; fc4c4
+ ld hl, [sp+0]
+ ld b, h
+ ld c, l
+
+; Only during the Celebi event.
+ ld a, [$dbf3]
+ bit 2, a
+ jr nz, .asm_fc4d4
+ ld hl, ForestTreeRightFrames
+ jr .asm_fc4eb
+
+.asm_fc4d4
+ ld a, [TileAnimationTimer]
+ call GetForestTreeFrame
+ add a
+ add a
+ add a
+ add ForestTreeLeftFrames % $100
+ ld l, a
+ ld a, 0
+ adc ForestTreeLeftFrames / $100
+ ld h, a
+ push bc
+ ld bc, ForestTreeRightFrames - ForestTreeLeftFrames
+ add hl, bc
+ pop bc
+
+.asm_fc4eb
+ ld sp, hl
+ ld hl, $90f0
+ jp WriteTile
+; fc4f2
+
+
+ForestTreeLeftAnimation2: ; fc4f2
+ ld hl, [sp+0]
+ ld b, h
+ ld c, l
+
+; Only during the Celebi event.
+ ld a, [$dbf3]
+ bit 2, a
+ jr nz, .asm_fc502
+ ld hl, ForestTreeLeftFrames
+ jr .asm_fc515
+
+.asm_fc502
+ ld a, [TileAnimationTimer]
+ call GetForestTreeFrame
+ xor 2
+ add a
+ add a
+ add a
+ add ForestTreeLeftFrames % $100
+ ld l, a
+ ld a, 0
+ adc ForestTreeLeftFrames / $100
+ ld h, a
+
+.asm_fc515
+ ld sp, hl
+ ld hl, $90c0
+ jp WriteTile
+; fc51c
+
+
+ForestTreeRightAnimation2: ; fc51c
+ ld hl, [sp+0]
+ ld b, h
+ ld c, l
+
+; Only during the Celebi event.
+ ld a, [$dbf3]
+ bit 2, a
+ jr nz, .asm_fc52c
+ ld hl, ForestTreeRightFrames
+ jr .asm_fc545
+
+.asm_fc52c
+ ld a, [TileAnimationTimer]
+ call GetForestTreeFrame
+ xor 2
+ add a
+ add a
+ add a
+ add ForestTreeLeftFrames % $100
+ ld l, a
+ ld a, 0
+ adc ForestTreeLeftFrames / $100
+ ld h, a
+ push bc
+ ld bc, ForestTreeRightFrames - ForestTreeLeftFrames
+ add hl, bc
+ pop bc
+
+.asm_fc545
+ ld sp, hl
+ ld hl, $90f0
+ jp WriteTile
+; fc54c
+
+
+GetForestTreeFrame: ; fc54c
+; Return 0 if a is even, or 2 if odd.
+ and a
+ jr z, .even
+ cp 1
+ jr z, .odd
+ cp 2
+ jr z, .even
+ cp 3
+ jr z, .odd
+ cp 4
+ jr z, .even
+ cp 5
+ jr z, .odd
+ cp 6
+ jr z, .even
+.odd
+ ld a, 2
+ scf
+ ret
+.even
+ xor a
+ ret
+; fc56d
+
AnimateFlowerTile: ; fc56d
; No parameters.