mirror of https://github.com/pret/pokecrystal.git
recomment tileset animation interface
This commit is contained in:
parent
0a821fe964
commit
28fd514bef
30
main.asm
30
main.asm
|
@ -587,47 +587,42 @@ endr
|
||||||
|
|
||||||
|
|
||||||
SafeTileAnimation: ; 17d3
|
SafeTileAnimation: ; 17d3
|
||||||
; call from vblank
|
; Only call during the first fifth of VBlank
|
||||||
|
|
||||||
ld a, [$ffde]
|
ld a, [$ffde]
|
||||||
and a
|
and a
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
; abort if too far into vblank
|
; Back out if we're too far into VBlank
|
||||||
ld a, [rLY]
|
ld a, [rLY]
|
||||||
; ret unless ly = 144-150
|
|
||||||
cp 144
|
cp 144
|
||||||
ret c
|
ret c
|
||||||
cp 151
|
cp 151
|
||||||
ret nc
|
ret nc
|
||||||
|
|
||||||
; save affected banks
|
|
||||||
; switch to new banks
|
|
||||||
ld a, [hROMBank]
|
ld a, [hROMBank]
|
||||||
push af ; save bank
|
push af
|
||||||
ld a, BANK(DoTileAnimation)
|
ld a, BANK(DoTileAnimation)
|
||||||
rst Bankswitch ; bankswitch
|
rst Bankswitch
|
||||||
|
|
||||||
ld a, [rSVBK]
|
ld a, [rSVBK]
|
||||||
push af ; save wram bank
|
push af
|
||||||
ld a, $1 ; wram bank 1
|
ld a, 1
|
||||||
ld [rSVBK], a
|
ld [rSVBK], a
|
||||||
|
|
||||||
ld a, [rVBK]
|
ld a, [rVBK]
|
||||||
push af ; save vram bank
|
push af
|
||||||
ld a, $0 ; vram bank 0
|
ld a, 0
|
||||||
ld [rVBK], a
|
ld [rVBK], a
|
||||||
|
|
||||||
; take care of tile animation queue
|
|
||||||
call DoTileAnimation
|
call DoTileAnimation
|
||||||
|
|
||||||
; restore affected banks
|
|
||||||
pop af
|
pop af
|
||||||
ld [rVBK], a
|
ld [rVBK], a
|
||||||
pop af
|
pop af
|
||||||
ld [rSVBK], a
|
ld [rSVBK], a
|
||||||
pop af
|
pop af
|
||||||
rst Bankswitch ; bankswitch
|
rst Bankswitch
|
||||||
ret
|
ret
|
||||||
; 17ff
|
; 17ff
|
||||||
|
|
||||||
|
@ -645,6 +640,7 @@ GetSpritePalette: ; 17ff
|
||||||
ret
|
ret
|
||||||
; 180e
|
; 180e
|
||||||
|
|
||||||
|
|
||||||
Function180e: ; 180e
|
Function180e: ; 180e
|
||||||
push hl
|
push hl
|
||||||
push bc
|
push bc
|
||||||
|
|
Loading…
Reference in New Issue