Difference between revisions of "Sprites"

From TLoZ: ALTTP Hacking Resources
Jump to: navigation, search
(Sprites)
(Sprite Data Format: made this into a table)
Line 18: Line 18:
 
*Phase 3 begins after the player has defeated Agahnim for the first time
 
*Phase 3 begins after the player has defeated Agahnim for the first time
 
===Sprite Data Format===
 
===Sprite Data Format===
*First Byte: Stored to $0FB3. Not sure what the purpose of that is yet.
+
*First Byte: Stored to {{$|FB3}}. Not sure what the purpose of that is yet.
 
After the first byte, you will see 3 byte clusters that break down thus:
 
After the first byte, you will see 3 byte clusters that break down thus:
*First Byte:
 
**Bit 7 - If set, the sprite is on BG2, if not it's on BG1
 
**Bits 6,5 - If these are set, they will be used to generate a subtype, stored to $0E30, X.
 
**Bits 4,3,2,1,0 - Y coordinate (in pixels from the top, starting at 0) of the sprite divided by 16.
 
  
*Second Byte:
+
{|class="wikitable"
**Bits 7,6,5 - If all these bits are set then this is an Overlord, otherwise it's a normal sprite. If only some of them are set they can be used to generate a subtype, stored at $0E30, X.
+
! scope="col"| Bit
**Bits 4,3,2,1,0 - X coordinate (in pixels from the far left, starting at 0) of the sprite divided by 16.
+
! scope="col"| First Byte
 
+
! scope="col"| Second Byte
*Third Byte: Sprite or Overlord type. If a sprite, this will get loaded into a slot at $0E20, X. If an Overlord, will get loaded to $0B00, X.
+
! scope="col"| Third Byte
 
+
|-
The array is terminated with a byte of $FF.
+
! scope="row"| 7
 +
| If set, the sprite is on BG2, if not it's on BG1
 +
|rowspan="3"| If all these bits are set then this is an Overlord, otherwise it's a normal sprite. If only some of them are set they can be used to generate a subtype, stored at {{$|E30}}, X.
 +
| rowspan="8"|Sprite or Overlord type. If a sprite, this will get loaded into a slot at {{$|E20}}, X. If an Overlord, will get loaded to {{$|B00}}, X.
 +
|-
 +
! scope="row"| 6
 +
| rowspan="2"| If these are set, they will be used to generate a subtype, stored to {{$|E30}}, X.
 +
|-
 +
! scope="row"| 5
 +
|-
 +
! scope="row"| 4
 +
| rowspan="5"| X coordinate (in pixels from the far left, starting at 0) of the sprite divided by 16.
 +
| rowspan="5"| Y coordinate (in pixels from the top, starting at 0) of the sprite divided by 16.
 +
|-
 +
! scope="row"| 3
 +
|-
 +
! scope="row"| 2
 +
|-
 +
! scope="row"| 1
 +
|-
 +
! scope="row"| 0
 +
|}
  
 
==Sprites==
 
==Sprites==

Revision as of 21:42, 18 December 2016

Important Hex Addresses

Sprite Stats And Properties

See Sprite Properties

Dungeon Sprite Data

  • $04D62E - Pointer Table, 2 byte local addresses, indexed by room ID
  • $04D92E - Data

Overworld Sprite Data

There are separate pointer tables for each phase of the game. The "phase of the game" refers to the byte located at $7EF3C5.

Phase 0/1

  • $04C881 - Pointer Table, 2 byte local addresses, indexed by screen ID
  • This is the stage of the game whilst rain still falls
  • Only has values only for the light world screens, thus dark world screens will roll over to the light world data from the following table and of course be incorrect.

Phase 2

  • $04C901 - Pointer Table, 2 byte local addresses, indexed by screen ID
  • Phase 2 begins when Zelda is rescued and given protection by the Sage in the Sanctuary

Phase 3

  • $04CA21 - Pointer Table, 2 byte local addresses, indexed by screen ID
  • Phase 3 begins after the player has defeated Agahnim for the first time

Sprite Data Format

  • First Byte: Stored to $FB3. Not sure what the purpose of that is yet.

After the first byte, you will see 3 byte clusters that break down thus:

Bit First Byte Second Byte Third Byte
7 If set, the sprite is on BG2, if not it's on BG1 If all these bits are set then this is an Overlord, otherwise it's a normal sprite. If only some of them are set they can be used to generate a subtype, stored at $E30, X. Sprite or Overlord type. If a sprite, this will get loaded into a slot at $E20, X. If an Overlord, will get loaded to $B00, X.
6 If these are set, they will be used to generate a subtype, stored to $E30, X.
5
4 X coordinate (in pixels from the far left, starting at 0) of the sprite divided by 16. Y coordinate (in pixels from the top, starting at 0) of the sprite divided by 16.
3
2
1
0

Sprites