summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2013-08-31 21:15:31 -0400
committeryenatch <yenatch@gmail.com>2013-08-31 21:47:22 -0400
commit28fd514bef1c7c345672ebe65ba00abb95053431 (patch)
tree2e4ad4f1f6304236b4d10418317b64305c8ca9d2
parent0a821fe964309449b2bcc87e7b318e2aefb210fa (diff)
recomment tileset animation interface
-rw-r--r--main.asm30
1 files changed, 13 insertions, 17 deletions
diff --git a/main.asm b/main.asm
index 2fc1490dc..0f7e9e39e 100644
--- a/main.asm
+++ b/main.asm
@@ -587,47 +587,42 @@ endr
SafeTileAnimation: ; 17d3
-; call from vblank
+; Only call during the first fifth of VBlank
ld a, [$ffde]
and a
ret z
-; abort if too far into vblank
+; Back out if we're too far into VBlank
ld a, [rLY]
-; ret unless ly = 144-150
cp 144
ret c
cp 151
ret nc
-
-; save affected banks
-; switch to new banks
+
ld a, [hROMBank]
- push af ; save bank
+ push af
ld a, BANK(DoTileAnimation)
- rst Bankswitch ; bankswitch
+ rst Bankswitch
ld a, [rSVBK]
- push af ; save wram bank
- ld a, $1 ; wram bank 1
+ push af
+ ld a, 1
ld [rSVBK], a
ld a, [rVBK]
- push af ; save vram bank
- ld a, $0 ; vram bank 0
+ push af
+ ld a, 0
ld [rVBK], a
-
-; take care of tile animation queue
+
call DoTileAnimation
-
-; restore affected banks
+
pop af
ld [rVBK], a
pop af
ld [rSVBK], a
pop af
- rst Bankswitch ; bankswitch
+ rst Bankswitch
ret
; 17ff
@@ -645,6 +640,7 @@ GetSpritePalette: ; 17ff
ret
; 180e
+
Function180e: ; 180e
push hl
push bc