Sprite graphics format: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (4 revisions: Import from wikkii) |
(No difference)
|
Revision as of 15:27, 26 June 2011
The 16x16 pixels sprite tiles are divided in 4 8x8 blocks. Each row of these 8x8 blocks are stored backwards in a 4bit planar organization.
- On cart systems, bitplanes 0 and 1 go in the odd C ROMs (C1, C3...), while bitplanes 2 and 3 go in the even ones (C2, C4...).
- On CD systems, bitplanes follow a 1/0/3/2 pattern.
Informations from Raregame.ru: [here] and [here].
Decoding
Pseudocode:
For Tileline = 0 To 7 For Tilerow = 0 To 7 For Quarter = 0 To 3 Select Case Quarter Case 0: xOfs = 8: yOfs = 0 Case 1: xOfs = 8: yOfs = 8 Case 2: xOfs = 0: yOfs = 0 Case 3: xOfs = 0: yOfs = 8 End Select For QuarterLine = 0 To 7 BitPlane(0) = ReadByte(1) BitPlane(1) = ReadByte(1) BitPlane(2) = ReadByte(2) BitPlane(3) = ReadByte(2) For Pixels = 0 To 7 xPos = (Tilerow * 16) + Pixels + xOfs yPos = (Tileline * 16) + QuarterLine + yOfs for Bitplanes = 0 to 3 ColorIndex .= GetBit(Bin(BitPlane(3-Bitplanes)),7-Pixels) next Bitplanes PixelSet (xPos, yPos), Palette[BinToDec(ColorIndex)] Next Pixels Next QuarterLine Next Quarter Next Tilerow Next Tileline