From 0769c7bb7b5f4d91d50b7bcae16cf15a7ceedbab Mon Sep 17 00:00:00 2001 From: Rangi Date: Sat, 30 Jun 2018 14:52:38 -0400 Subject: Reformat diffs; to do: explain changes --- "Increase-Pok\303\251mon-sprite-animation-size.md" | 106 ++++++++++++++------- screenshots/larger-sprite-anim.png | Bin 0 -> 1298 bytes 2 files changed, 72 insertions(+), 34 deletions(-) create mode 100644 screenshots/larger-sprite-anim.png diff --git "a/Increase-Pok\303\251mon-sprite-animation-size.md" "b/Increase-Pok\303\251mon-sprite-animation-size.md" index 96e5f01..fba12c6 100644 --- "a/Increase-Pok\303\251mon-sprite-animation-size.md" +++ "b/Increase-Pok\303\251mon-sprite-animation-size.md" @@ -49,22 +49,31 @@ By studying how the animation graphics are loaded and played, we can use the ent ## 2. Edit engine/gfx/load_pics.asm -Most of the code and idea was taken from Prism, adapted for current pokecrystal. +Most of the code and idea was taken from Pokémon Prism. ```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: + GetMonFrontpic: + ld a, [wCurPartySpecies] + ld [wCurSpecies], a + call IsAPokemon + ret c + ld a, [rSVBK] + push af call _GetFrontpic pop af ld [rSVBK], a - ret -+ jp CloseSRAM - +- jp CloseSRAM +``` + +```diff GetAnimatedFrontpic: ld a, [wCurPartySpecies] -@@ -70,12 +70,18 @@ GetAnimatedFrontpic: + ld [wCurSpecies], a + call IsAPokemon + ret c + ld a, [rSVBK] + push af xor a ld [hBGMapMode], a call _GetFrontpic @@ -77,21 +86,25 @@ diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm ld [rSVBK], a - ret + jp CloseSRAM - +``` + +```diff _GetFrontpic: + ld a, BANK(sScratch) + call GetSRAMBank push de call GetBaseData ld a, [wBasePicSize] -@@ -86,15 +92,24 @@ _GetFrontpic: + and $f + ld b, a + push bc + call GetFrontpicPointer 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 @@ -99,7 +112,6 @@ diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm + and $f0 + or e + ld [sScratch], a -+ pop bc - ld hl, wDecompressScratch - ld de, wDecompressEnemyFrontpic @@ -113,9 +125,12 @@ diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm ld c, 7 * 7 ld a, [hROMBank] ld b, a -@@ -130,10 +145,8 @@ GetFrontpicPointer: + call Get2bpp + pop hl ret - +``` + +```diff GetAnimatedEnemyFrontpic: - ld a, BANK(vTiles3) - ld [rVBK], a @@ -125,7 +140,13 @@ diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm ld c, 7 * 7 ld a, [hROMBank] ld b, a -@@ -147,18 +160,24 @@ GetAnimatedEnemyFrontpic: + call Get2bpp + pop hl + ld de, 7 * 7 tiles + add hl, de + push hl + ld a, BANK(wBasePicSize) + ld hl, wBasePicSize call GetFarWRAMByte pop hl and $f @@ -143,49 +164,52 @@ diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm + 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: + pop bc + pop hl 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 -+ ++ sub 128 - 7 * 7 ++ jr c, .finish + ; Otherwise, load the first part... + inc a + ld [sScratch], a -+ ld c, (127 - 7 * 7) ++ ld c, 127 - 7 * 7 call Get2bpp - xor a - ld [rVBK], a - ret -+ -+ ; Then move up a bit and load the rest ++ ; ...then load the rest into vTiles4 + 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 ++.finish + jp Get2bpp - +``` + +```diff LoadFrontpicTiles: ld hl, wDecompressScratch -@@ -184,11 +221,17 @@ LoadFrontpicTiles: + swap c + ld a, c + and $f + ld b, a + ld a, c + and $f0 + ld c, a push bc call LoadOrientedFrontpic pop bc @@ -205,14 +229,22 @@ diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm ret ``` +TODO: explain changes. + ## 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 -@@ -621,6 +621,9 @@ PokeAnim_ConvertAndApplyBitmask: + PokeAnim_ConvertAndApplyBitmask: + ... + + .ApplyFrame: + push af + call .GetCoord + pop af + push hl + call .GetTilemap + ld hl, wPokeAnimGraphicStartTile add [hl] pop hl ld [hl], a @@ -220,4 +252,10 @@ diff --git a/engine/gfx/pic_animation.asm b/engine/gfx/pic_animation.asm + ret c + inc [hl] ret -``` \ No newline at end of file +``` + +TODO: explain changes. + +Now we're done! + +![Screenshot](screenshots/larger-sprite-anim.png) diff --git a/screenshots/larger-sprite-anim.png b/screenshots/larger-sprite-anim.png new file mode 100644 index 0000000..842d752 Binary files /dev/null and b/screenshots/larger-sprite-anim.png differ -- cgit v1.2.3