summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Increase-Pokémon-sprite-animation-size.md170
1 files changed, 170 insertions, 0 deletions
diff --git a/Increase-Pokémon-sprite-animation-size.md b/Increase-Pokémon-sprite-animation-size.md
new file mode 100644
index 0000000..c404043
--- /dev/null
+++ b/Increase-Pokémon-sprite-animation-size.md
@@ -0,0 +1,170 @@
+This page is a major TODO.
+
+Most of the code and idea was taken from Prism, adapted for current pokecrystal.
+
+```diff
+diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm
+--- a/engine/gfx/load_pics.asm
++++ b/engine/gfx/load_pics.asm
+@@ -58,7 +58,7 @@ GetMonFrontpic:
+ call _GetFrontpic
+ pop af
+ ld [rSVBK], a
+- ret
++ jp CloseSRAM
+
+ GetAnimatedFrontpic:
+ ld a, [wCurPartySpecies]
+@@ -70,12 +70,18 @@ GetAnimatedFrontpic:
+ xor a
+ ld [hBGMapMode], a
+ call _GetFrontpic
++ ld a, BANK(vTiles3)
++ ld [rVBK], a
+ call GetAnimatedEnemyFrontpic
++ xor a
++ ld [rVBK], a
+ pop af
+ ld [rSVBK], a
+- ret
++ jp CloseSRAM
+
+ _GetFrontpic:
++ ld a, BANK(sScratch)
++ call GetSRAMBank
+ push de
+ call GetBaseData
+ ld a, [wBasePicSize]
+@@ -86,15 +92,24 @@ _GetFrontpic:
+ ld a, BANK(wDecompressEnemyFrontpic)
+ ld [rSVBK], a
+ ld a, b
+- ld de, wDecompressEnemyFrontpic
++ ld de, wDecompressScratch
+ call FarDecompress
++
++ ; Save decompressed size
++ swap e
++ swap d
++ ld a, d
++ and $f0
++ or e
++ ld [sScratch], a
++
+ pop bc
+- ld hl, wDecompressScratch
+- ld de, wDecompressEnemyFrontpic
++ ld hl, sScratch + $10
++ ld de, wDecompressScratch
+ call PadFrontpic
+ pop hl
+ push hl
+- ld de, wDecompressScratch
++ ld de, sScratch + $10
+ ld c, 7 * 7
+ ld a, [hROMBank]
+ ld b, a
+@@ -130,10 +145,8 @@ GetFrontpicPointer:
+ ret
+
+ GetAnimatedEnemyFrontpic:
+- ld a, BANK(vTiles3)
+- ld [rVBK], a
+ push hl
+- ld de, wDecompressScratch
++ ld de, sScratch + $10
+ ld c, 7 * 7
+ ld a, [hROMBank]
+ ld b, a
+@@ -147,18 +160,24 @@ GetAnimatedEnemyFrontpic:
+ call GetFarWRAMByte
+ pop hl
+ and $f
+- ld de, wDecompressEnemyFrontpic + 5 * 5 tiles
++ ld de, wDecompressScratch + 5 * 5 tiles
+ ld c, 5 * 5
+ cp 5
+ jr z, .got_dims
+- ld de, wDecompressEnemyFrontpic + 6 * 6 tiles
++ ld de, wDecompressScratch + 6 * 6 tiles
+ ld c, 6 * 6
+ cp 6
+ jr z, .got_dims
+- ld de, wDecompressEnemyFrontpic + 7 * 7 tiles
++ ld de, wDecompressScratch + 7 * 7 tiles
+ ld c, 7 * 7
+ .got_dims
+
++ ; Get animation size (total - base sprite size)
++ ld a, [sScratch]
++ sub c
++ ret z ; Return if there's no animation
++ ld c, a
++
+ push hl
+ push bc
+ call LoadFrontpicTiles
+@@ -167,10 +186,28 @@ GetAnimatedEnemyFrontpic:
+ ld de, wDecompressScratch
+ ld a, [hROMBank]
+ ld b, a
++
++ ; If we can load it in a single pass, just do it
++ ld a, c
++ sub (128 - 7 * 7)
++ jr c, .copy_and_finish
++
++ ; Otherwise, load the first part...
++ inc a
++ ld [sScratch], a
++ ld c, (127 - 7 * 7)
+ call Get2bpp
+- xor a
+- ld [rVBK], a
+- ret
++
++ ; Then move up a bit and load the rest
++ ld de, wDecompressScratch + (127 - 7 * 7) tiles
++ ld hl, vTiles4
++ ld a, [hROMBank]
++ ld b, a
++ ld a, [sScratch]
++ ld c, a
++
++.copy_and_finish
++ jp Get2bpp
+
+ LoadFrontpicTiles:
+ ld hl, wDecompressScratch
+@@ -184,11 +221,17 @@ LoadFrontpicTiles:
+ push bc
+ call LoadOrientedFrontpic
+ pop bc
++ ld a, c
++ and a
++ jr z, .handle_loop
++ inc b
++ jr .handle_loop
+ .loop
+ push bc
+ ld c, 0
+ call LoadOrientedFrontpic
+ pop bc
++.handle_loop
+ dec b
+ jr nz, .loop
+ ret
+diff --git a/engine/gfx/pic_animation.asm b/engine/gfx/pic_animation.asm
+--- a/engine/gfx/pic_animation.asm
++++ b/engine/gfx/pic_animation.asm
+@@ -621,6 +621,9 @@ PokeAnim_ConvertAndApplyBitmask:
+ add [hl]
+ pop hl
+ ld [hl], a
++ cp $7f
++ ret c
++ inc [hl]
+ ret
+
+ .GetCoord:
+``` \ No newline at end of file