You are not logged in.
Pages: 1
I'm trying to import some of Pokémon Prism's new animated sprites into my own pokecrystal project, which lacks their major refactoring of the internals.
The GetAnimatedFrontpic routine in pokecrystal first loads the tiles for the main static sprite, then loads up to an equal amount of animation tiles, all into VTiles5. So a 7x7-tile sprite can have another 7*7=49 animation tiles. 7*7 + 7*7 = 98, or $62 hex, so animated sprites can use tile IDs $00 to $61. However, Prism's sprites use IDs as large as $8b.
I've already figured out a way (probably not the best way) to use tile IDs $62 to $7e. ($7f is reserved for the space character.) However, now I want to copy Prism's approach and load any tiles beyond that into VTiles4.
Here's an example. I've highlighted Weavile's main sprite in red, and the animation tiles in blue. The final "eye-blinking" animation uses tile ID $80, which naturally ends up in VTiles4. I need to replace the walking NPC sprites with the remaining animation tiles.
This is my routine so far:
GetAnimatedFrontpic: ; 51103
ld a, $1
ld [rVBK], a
push hl
ld de, wDecompressScratch
ld c, 7 * 7
ld a, [hROMBank]
ld b, a
call Get2bpp
pop hl
ld de, 7 * 7 tiles
add hl, de
push hl
ld a, $1
ld hl, BasePicSize
call GetFarWRAMByte
pop hl
and $f
ld de, w6_d800 + 5 * 5 tiles
ld c, 5 * 5
cp 5
jr z, .got_dims
ld de, w6_d800 + 6 * 6 tiles
ld c, 6 * 6
cp 6
jr z, .got_dims
ld de, w6_d800 + 7 * 7 tiles
push hl
ld a, [CurSpecies]
ld c, a
ld hl, .LargeSpriteSizes
.loop
ld a, [hli]
cp -1
jr z, .got_large_dims
cp c
ld a, [hli]
jr nz, .loop
ld c, a
jr .got_large_dims
ld c, 7 * 7
.got_large_dims
pop hl
.got_dims
push hl
push bc
call LoadOrientedFrontpicTiles
pop bc
pop hl
ld a, c
cp $80 - 7 * 7 + 1
jr c, .no_overflow
ld de, wDecompressScratch
ld a, [hROMBank]
ld b, a
push bc
call Get2bpp
pop bc
; ld a, BANK(VTiles4)
; ld [rVBK], a
; ld de, w6_d800 + $80 tiles
; ld hl, VTiles4
; ld a, [hROMBank]
; ld b, a
; ld a, c
; sub $80 - 7 * 7
; ld c, a
; call Get2bpp
jr .finish
.no_overflow
ld de, wDecompressScratch
ld a, [hROMBank]
ld b, a
call Get2bpp
.finish
xor a
ld [rVBK], a
ret
.LargeSpriteSizes:
; species, max tile - size + 1
db GLACEON, $64 - 7 * 7 + 1
db MAMOSWINE, $6f - 7 * 7 + 1
db PORYGON_Z, $6f - 7 * 7 + 1
db SYLVEON, $71 - 7 * 7 + 1
db MISMAGIUS, $71 - 7 * 7 + 1
db ELECTIVIRE, $76 - 7 * 7 + 1
db WEAVILE, $80 - 7 * 7 + 1 ; TODO
db LEAFEON, $81 - 7 * 7 + 1 ; TODO
db GLISCOR, $83 - 7 * 7 + 1 ; TODO
db RHYPERIOR, $85 - 7 * 7 + 1 ; TODO
db TOGEKISS, $88 - 7 * 7 + 1 ; TODO
db MAGMORTAR, $8b - 7 * 7 + 1 ; TODO
db -1
(I special-cased the Pokémon with large animations because (a) loading that many tiles takes a noticeably longer time, and (b) when I indiscriminately loaded as many tiles as would fit into VTiles5 I was getting graphical bugs during battles.)
The part near the end that's commented out is attempting to load the remaining data into VTiles4. It doesn't work: the VRAM gets corrupted when I run it. (Although tile $80 does end up in the right place.)
Clearly there's something I don't understand about modifying VRAM. I'd appreciate a guide to what I'm doing wrong.
Last edited by Rangi (2017-03-17 12:14:48)
My projects on GitHub:
• Polished Map 4.7.1 or 2.7.1++
• Tilemap Studio 4.0.1
• Pokémon Polished Crystal 2.2.0 or 3.0.0 beta
• Pokémon Red★/Blue★: Space World Edition 2020-11-01
Offline
Pages: 1