Sprite compression (Generation I): Difference between revisions
m
no edit summary
mNo edit summary |
mNo edit summary |
||
(10 intermediate revisions by the same user not shown) | |||
Line 1:
{{incomplete|needs proper analysis. The official method may also have been in the source code}}
'''Sprite compression''' is the means in Generation I for where pure graphics data is compressed into a Pokémon or Trainer sprite. The sprite is decompressed again using [[Sprite decompression (Generation I)|the sprite decompression routine]] and allocates use of SRAM bank 0/"unbanked" SRAM. While the source compressor code is not in the ROMs; there are a few rules for a compressed sprite:
*The image to compress is usually a maximum of 56x56 pixels. Other Pokémon sprites can be 32x32, 40x40
*Each nybble of the starting offset to the compressed sprite is dimensions/8. Front sprites can be of various sizes; a 56x56 sprite is represented as 0x77, a 48x48 one as 0x66, a 40x40 one as 0x55, a 32x32 as 0x44.
*Backsprites are internally 32x32 pixels (0x44). Usually, these backsprites also have a little white space at the bottom (hidden by the battle menu).
*White space occupies smaller sprites to add up to 56x56.
*Unofficially, a .2bpp file can be converted into a compressed Pokémon sprite using
*It is possible for the sprite to be flipped for a non-00 value in memory address 0xD0AA ([[Pokémon Red and Blue]]) or 0xD0A9 ([[Pokémon Yellow]]). The [[inverse sprites glitch]] corrupts these memory addresses, possibly leading to glitched sprites.
Unintended compressed sprites with dimensions of 0 are known for their memory overflows, such as Yellow [[MissingNo.]]'s sprite (treated as dimensions of 256, or (256/8)=32).
If copying individual rows from a VRAM viewer, it may be necessary to rearrange the bytes; i.e. in this sample image for a 56x56 (0x44) sprite:
<pre>
00000000000000000100010206050506000000000000000019041D02CA15946B0000000000000000B7400EF131DEFD9200000000000000004000C020F010F010
07040506020301010201010000000000F30DF708EB145CA3CDF753EF2FD7B1CE2FD0FD0211018C00C59EFB8E8E5FDF0E7090709070907090705050303040C020
0000000000000000000000000000000066DD87FFEF5DAD7EBB7CDC3FB17F3DFE570CEF00D500FF00E91741BE2CD7F30C7000A04020C0C080C000E08040C0E0C0
00000000000000000000000000000000F17F3DFADE7D3CFFEF7F26FF32FD3EFF22DDAFF06FF105FB3BD542BF25DF37C860C000E0A060C020806000E060E000E0
</pre>
Line 18 ⟶ 24:
<pre>
00000000000000000100010206050506|000000000000000019041D02CA15946B|0000000000000000B7400EF131DEFD92|00000000000000004000C020F010F010
00000000000000000000000000000000|66DD87FFEF5DAD7EBB7CDC3FB17F3DFE|570CEF00D500FF00E91741BE2CD7F30C|7000A04020C0C080C000E08040C0E0C0
00000000000000000000000000000000|F17F3DFADE7D3CFFEF7F26FF32FD3EFF|22DDAFF06FF105FB3BD542BF25DF37C8|60C000E0A060C020806000E060E000E0
Line 27 ⟶ 33:
<pre>
00000000000000000100010206050506070405060203010102010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000019041D02CA15946BF30DF708EB145CA3CDF753EF2FD7B1CE66DD87FFEF5DAD7EBB7CDC3FB17F3DFEF17F3DFADE7D3CFFEF7F26FF32FD3EFF0000000000000000B7400EF131DEFD922FD0FD0211018C00C59EFB8E8E5FDF0E570CEF00D500FF00E91741BE2CD7F30C22DDAFF06FF105FB3BD542BF25DF37C800000000000000004000C020F010F0107090709070907090705050303040C0207000A04020C0C080C000E08040C0E0C060C000E0A060C020806000E060E000E0
</pre>
Line 33 ⟶ 39:
<pre>
44BE1D54ECF6653AA4642AA541999A8B51707B0C63743EF0EE324CEFB0A21C36143C8CA6048970A8522212E0DC84329B0C8EE2A0A260A230E0A71CA5C341418942C1B3187DD0C5BB082EC62B555EB0A22A5D54BAAAA3D3DF4AD54849CF45533BD55DDD44AE550C1734173D1AA082D21048CC5642470C1C1321408261C12B07444168464A2861FB97A09861434F4D9095026B5AC182110AF959557863DB2150654AAAE820B487B2A09BC11E80
</pre>
(Can be applied with [[arbitrary sprites]] or ROM hacking)
[[File:Sprite compression sample.png|thumb|left|160px|Sample image loaded using [[arbitrary sprites]] ([[GlitchDex/Y:230|9ゥ (E6)]] with default palette); exported drawing of Torchic from Game Boy Camera]]
{{clr}}
==External links==
*[https://rgmechex.com/tech/gen1decompress.html Retro Game Mechanics Explained's tool to compress and decompress sprites online (supports PNGs)]
*"Sprite import tools for RBY" can be downloaded within Evie's Google Sites backup [https://drive.google.com/drive/folders/1DAVPYay9sAuXwi4qXbDQfPU2sIDI_mXH?usp=sharing here]
[[Category:Generation I mechanics]]
|