Sprite: Difference between revisions
Content added Content deleted
Piranhaplant (talk | contribs) (Created page with "Sprites are used to display things on the screen using the SNES's "objects". All sprites are made of a number of 16x16 objects. == In-memory Sprites == Sprites in RAM have the following format: {| class="wikitable" |- ! Offset !! Length !! Type !! Description |- | 0x00 || 2 || bit field || Sprite properties |- | 0x02 || 2 || int || X position |- | 0x04 || 2 || int || Z position |- | 0x06 || 2 || int || Y position |- | 0x08 || 4 || pointer || Pointer to sprite tile dat...") |
Piranhaplant (talk | contribs) No edit summary |
||
Line 23: | Line 23: | ||
| 0x0E || 2 || int || Sprite type |
| 0x0E || 2 || int || Sprite type |
||
|- |
|- |
||
| 0x10 || 2 || int || Alternate palette |
| 0x10 || 2 || int || Alternate palette (shifted 9 bits left to align with the tile properties palette) |
||
|- |
|- |
||
| 0x12 || 2 || pointer || Pointer to next sprite |
| 0x12 || 2 || pointer || Pointer to next sprite |
Revision as of 16:57, 16 October 2023
Sprites are used to display things on the screen using the SNES's "objects". All sprites are made of a number of 16x16 objects.
In-memory Sprites
Sprites in RAM have the following format:
Offset | Length | Type | Description |
---|---|---|---|
0x00 | 2 | bit field | Sprite properties |
0x02 | 2 | int | X position |
0x04 | 2 | int | Z position |
0x06 | 2 | int | Y position |
0x08 | 4 | pointer | Pointer to sprite tile data |
0x0C | 2 | int | Parent entity ID |
0x0E | 2 | int | Sprite type |
0x10 | 2 | int | Alternate palette (shifted 9 bits left to align with the tile properties palette) |
0x12 | 2 | pointer | Pointer to next sprite |
Sprite Properties
Bit mask | Description |
---|---|
0x0001 | Sprite entry is used |
0x0002 | Flip horizontally |
0x0004 | Flip vertically |
0x0008 | Priority |
0x0010 | Use alternate palette |
0x0020 | ? |
0x4000 | Absolute positioning |
0x8000 | Visible |
Sprite Tile Data
Sprite tile data is generally located in the ROM, and contains the arrangement of 16x16 tiles used to make up the full sprite.
Header
Offset | Length | Type | Description |
---|---|---|---|
0x00 | 1 | int | Tile count |
Tile data
This data is repeated for each tile (up to "Tile count" from the header)
Offset | Length | Type | Description |
---|---|---|---|
0x00 | 2 | int | X position |
0x02 | 2 | int | Y position |
0x04 | 2 | bit field | Tile properties |
0x06 | 2 | int | Tile number |
Tile properties
Bit mask | Description |
---|---|
0x0E00 | Palette |
0x4000 | Flip horizontally |
0x8000 | Flip vertically |