Sprite: Difference between revisions
Content deleted Content added
Piranhaplant (talk | contribs) No edit summary |
Piranhaplant (talk | contribs) No edit summary Tag: Reverted |
||
Line 4:
Related RAM addresses:
{{#invoke:Utils|lorom2dec|$7E:0000}}
{{RAM reference|addresses=$7E:185E¦$7E:1B5E}}
|
Revision as of 21:03, 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. There can be up to 0x20 sprites displayed at a time.
In-memory Sprites
Related RAM addresses:
-98304
Address | Length | Type | Description |
---|---|---|---|
$7E:185E | 0x280 | byte[0x14][0x20] | Sprite table. 0x14 bytes for each of 0x20 sprites. |
$7E:1B5E | 2 | pointer16 | Pointer to first sprite in sprite table ($7E:185E) |
Sprites in the sprite table 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 |