Difference between revisions of "Sprites"

From TLoZ: ALTTP Hacking Resources
Jump to: navigation, search
(Important Hex Addresses)
Line 3: Line 3:
 
See [[Sprite Properties]]
 
See [[Sprite Properties]]
 
===Dungeon Sprite Data===
 
===Dungeon Sprite Data===
$04D62E - Pointer Table, 2 byte local addresses, indexed by room ID  
+
*$04D62E - Pointer Table, 2 byte local addresses, indexed by room ID  
$04D92E - Data
+
*$04D92E - Data
 
===Overworld Sprite 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.
 
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====
 
====Phase 0/1====
$04C881 - Pointer Table, 2 byte local addresses, indexed by screen ID
+
*$04C881 - Pointer Table, 2 byte local addresses, indexed by screen ID
 
*This is the stage of the game whilst rain still falls
 
*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.  
 
*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====
 
====Phase 2====
$04C901 - Pointer Table, 2 byte local addresses, indexed by screen ID
+
*$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 2 begins when Zelda is rescued and given protection by the Sage in the Sanctuary
 
====Phase 3====
 
====Phase 3====
$04CA21 - Pointer Table, 2 byte local addresses, indexed by screen ID
+
*$04CA21 - Pointer Table, 2 byte local addresses, indexed by screen ID
 
*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===

Revision as of 21:02, 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 $0FB3. Not sure what the purpose of that is yet.

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:
    • 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.
    • Bits 4,3,2,1,0 - X coordinate (in pixels from the far left, starting at 0) of the sprite divided by 16.
  • 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.

The array is terminated with a byte of $FF.

Sprites