EarthBound Beginnings/Sprite data: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
(basic documentation of the sprite tile format)
 
 
(12 intermediate revisions by 2 users not shown)
Line 3: Line 3:
|game=EarthBound Zero
|game=EarthBound Zero
|loc=ROM
|loc=ROM
|numentries=unknown
|numentries=0x289
|entrylength=16 (0x10)
|entrylength=4 (0x4)
|start=2A010
|start=2A010
|end=2C00F
|end=2C00F
Line 10: Line 10:
}}
}}
This controls the sprites in the game.
This controls the sprites in the game.
==Format==
==Pointer==
This starts with 0x289 pointers, which each correspond to one sprite:
* Bytes 0-1: Pointer
* Byte 2: PPU offset
*:Each of the sprite's PPU tiles are offset by this amount, plus 0x18000 ($58010 in ROM)
* Byte 3: Attributes
** Bits 0-1: Palette 1
** Bits 2-3: Palette 2
*:Multiply these numbers by 4, then add 0x29a2d to get the location of the palette in ROM
** Bit 4: '''Unknown'''
*:Set for the 4 main party members, and some other sprites
** Bits 5-7: '''Unknown'''
*:Only used on sprites 0x1df, 0x1e0 and 0x226
==Sprite==
This example uses the sprite data for Ninten forwards, located at 2ABAC-2ABBB:
This example uses the sprite data for Ninten forwards, located at 2ABAC-2ABBB:
<pre>
<pre>
Line 20: Line 33:
# Bottom-right
# Bottom-right
# Bottom-left
# Bottom-left
In this example, `10 20 10 02` is the top-right part of Ninten.
In this example, <code>10 20 10 02</code> is the top-right part of Ninten.
===Tiles===
===Tiles===
Each tile's sprite data has its location, palette and PPU tile.  The position controls where the sprite is drawn on screen relative to the sprite's position. For example, changing the location on NPCs causes parts of their sprite to be detached from the rest.
Each 4 bytes is [https://www.nesdev.org/wiki/PPU_OAM PPU OAM]:
* Byte 0: X location
* Byte 0: X location
* Byte 1: Y location
* Byte 1: Y location
* Byte 2: Palette
* Byte 2: Attributes
*:Anything higher then 0x19 causes the sprite to not be displayed
** Bits 0-1: Palette
** Bits 2-4: Unused
** Bit 5: Priority (0=in front of background, 1=behind background)
** Bit 6: Mirror X
** Bit 7: Mirror Y
* Byte 3: PPU tile index
* Byte 3: PPU tile index
*:Selects the tile index of the sprite gfx (58010 to 5E80F)
*:The pointer's PPU offset is added to this value

Latest revision as of 12:15, 26 January 2024

This is a sub-page of EarthBound Beginnings.

Ally data
Game EarthBound Zero
Start Address 2A010
End Address 2C00F
# of Entries 0x289
Entry Length 4 (0x4)
Total Length 8192 bytes (0x2000)
Back to the ROM map

This controls the sprites in the game.

Pointer

This starts with 0x289 pointers, which each correspond to one sprite:

  • Bytes 0-1: Pointer
  • Byte 2: PPU offset
    Each of the sprite's PPU tiles are offset by this amount, plus 0x18000 ($58010 in ROM)
  • Byte 3: Attributes
    • Bits 0-1: Palette 1
    • Bits 2-3: Palette 2
    Multiply these numbers by 4, then add 0x29a2d to get the location of the palette in ROM
    • Bit 4: Unknown
    Set for the 4 main party members, and some other sprites
    • Bits 5-7: Unknown
    Only used on sprites 0x1df, 0x1e0 and 0x226

Sprite

This example uses the sprite data for Ninten forwards, located at 2ABAC-2ABBB:

10 20 10 02 18 20 10 03 10 28 11 10 18 28 11 11

Sprite are made up of 4 PPU tiles, each of which are four bytes in the sprite data, in order:

  1. Top-right
  2. Top-left
  3. Bottom-right
  4. Bottom-left

In this example, 10 20 10 02 is the top-right part of Ninten.

Tiles

Each 4 bytes is PPU OAM:

  • Byte 0: X location
  • Byte 1: Y location
  • Byte 2: Attributes
    • Bits 0-1: Palette
    • Bits 2-4: Unused
    • Bit 5: Priority (0=in front of background, 1=behind background)
    • Bit 6: Mirror X
    • Bit 7: Mirror Y
  • Byte 3: PPU tile index
    The pointer's PPU offset is added to this value