summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Increase-Pokémon-sprite-animation-size.md59
-rw-r--r--screenshots/battle-vram.pngbin0 -> 12865 bytes
-rw-r--r--screenshots/broken-sprite-anim.pngbin0 -> 1327 bytes
-rw-r--r--screenshots/gfx-pokemon-haunter-front-edit.pngbin0 -> 1098 bytes
-rw-r--r--screenshots/gfx-pokemon-haunter-front.pngbin0 -> 900 bytes
-rw-r--r--screenshots/haunter-anim-tiles-edit.pngbin0 -> 1188 bytes
-rw-r--r--screenshots/haunter-anim-tiles.pngbin0 -> 870 bytes
7 files changed, 56 insertions, 3 deletions
diff --git a/Increase-Pokémon-sprite-animation-size.md b/Increase-Pokémon-sprite-animation-size.md
index c404043..9c95c03 100644
--- a/Increase-Pokémon-sprite-animation-size.md
+++ b/Increase-Pokémon-sprite-animation-size.md
@@ -1,4 +1,53 @@
-This page is a major TODO.
+By default, Pokémon sprite animations have maximum sizes that limit how creative you can be with them. It's possible to overcome these limits and have animations use up to 255 tiles.
+
+
+## Contents
+
+- [1. Understanding the problem](#1-understanding-the-problem)
+- [2. Edit engine/gfx/load_pics.asm](#2-edit-enginegfxload_picsasm)
+- [3. Edit engine/gfx/pic_animation.asm](#3-edit-enginegfxpic_animationasm)
+
+
+## 1. Understanding the problem
+
+Pokémon sprite animations are composed of frames; for example, Haunter's 5-frame animation:
+
+![gfx/pokemon/haunter/front.png](screenshots/gfx-pokemon-haunter-front.png)
+
+Sometimes you may try to redesign an animation; for example, this one by SoupPotato:
+
+![gfx/pokemon/haunter/front.png](screenshots/gfx-pokemon-haunter-front-edit.png)
+
+But some tiles are incorrect when it plays:
+
+![Screenshot](screenshots/broken-sprite-anim.png)
+
+This is because sprite animations have size limits:
+
+- A 5x5-tile sprite (40x40 pixels) uses 5×5=25 tiles for its first frame, and can use another 25 for its animation tiles, for a total of 50 tiles
+- A 6x6-tile sprite (48x48 pixels) uses 6×6=36 tiles for its first frame, and can use another 36 for its animation tiles, for a total of 72 tiles
+- A 7x7-tile sprite (56x56 pixels) uses 7×7=49 tiles for its first frame, and can use another 49 for its animation tiles, for a total of 98 tiles
+
+What are "animation tiles"? Well, all graphics are composed of 8x8-pixel tiles, and only a few of them change from one frame to the next. So animations are stored in a compressed form: every tile of the first frame is kept, but then there's only one copy of each unique tile for all its animation frames. So Haunter's animation gets stored like this:
+
+![Screenshot](screenshots/haunter-anim-tiles.png)
+
+That takes up 56 tiles: 36 for the first frame, and 20 for the animation frames, which is within the 72-tile limit. But here's the edited animation:
+
+![Screenshot](screenshots/haunter-anim-tiles-edit.png)
+
+That's 78 tiles. The last 6 don't even get loaded, so they show up incorrectly when the animation plays, which is why the earlier screenshot shows white tiles where Haunter's hand is.
+
+To see how this might be solved, let's look at [BGB](http://bgb.bircd.org/)'s VRAM viewer:
+
+![Screenshot](screenshots/battle-vram.png)
+
+The top-left segment of VRAM (video memory) stores tiles for move animations. The middle-left is for text characters. The bottom-left is for the enemy's front sprite, the player's back sprite, and the battle interface. Finally, the bottom-right is for the enemy's animation: its entire first frame, and then the unique animation tiles. The top-right and middle-right segments are unused.
+
+By studying how the animation graphics are loaded and played, we can use the entire bottom-left and middle-left segments to allow 255-tile animations.
+
+
+## 2. Edit engine/gfx/load_pics.asm
Most of the code and idea was taken from Prism, adapted for current pokecrystal.
@@ -154,6 +203,12 @@ diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm
dec b
jr nz, .loop
ret
+```
+
+
+## 3. Edit engine/gfx/pic_animation.asm
+
+```diff
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
@@ -165,6 +220,4 @@ diff --git a/engine/gfx/pic_animation.asm b/engine/gfx/pic_animation.asm
+ ret c
+ inc [hl]
ret
-
- .GetCoord:
``` \ No newline at end of file
diff --git a/screenshots/battle-vram.png b/screenshots/battle-vram.png
new file mode 100644
index 0000000..e06c7e4
--- /dev/null
+++ b/screenshots/battle-vram.png
Binary files differ
diff --git a/screenshots/broken-sprite-anim.png b/screenshots/broken-sprite-anim.png
new file mode 100644
index 0000000..982a9da
--- /dev/null
+++ b/screenshots/broken-sprite-anim.png
Binary files differ
diff --git a/screenshots/gfx-pokemon-haunter-front-edit.png b/screenshots/gfx-pokemon-haunter-front-edit.png
new file mode 100644
index 0000000..0735703
--- /dev/null
+++ b/screenshots/gfx-pokemon-haunter-front-edit.png
Binary files differ
diff --git a/screenshots/gfx-pokemon-haunter-front.png b/screenshots/gfx-pokemon-haunter-front.png
new file mode 100644
index 0000000..5f6c2d1
--- /dev/null
+++ b/screenshots/gfx-pokemon-haunter-front.png
Binary files differ
diff --git a/screenshots/haunter-anim-tiles-edit.png b/screenshots/haunter-anim-tiles-edit.png
new file mode 100644
index 0000000..ad54433
--- /dev/null
+++ b/screenshots/haunter-anim-tiles-edit.png
Binary files differ
diff --git a/screenshots/haunter-anim-tiles.png b/screenshots/haunter-anim-tiles.png
new file mode 100644
index 0000000..663ed65
--- /dev/null
+++ b/screenshots/haunter-anim-tiles.png
Binary files differ