Difference between revisions of "Sprites"

From TLoZ: ALTTP Hacking Resources
Jump to: navigation, search
(Overworld Sprite Data)
m (Phase 3)
Line 37: Line 37:
 
====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 he first time
+
*Phase 3 begins after the player has defeated Agahnim for the first time
  
 
==Sprites==
 
==Sprites==

Revision as of 21:26, 16 December 2016

Important Hex Addresses

HP Table

The sprite HP table is located at $06B173. Each value is a single byte, so the offset is equal to the sprite ID number as listed below. All values from $00 to $FF are viable for all sprites, but some cannot be damaged by any weapon without more complex tampering with ASM. The sprite's HP is loaded to an array at RAM address $7E0E50, where $10(decimal: 16) values can be loaded at once.

Damage Table

The sprite damage table is located at $06B266. Each value is a single byte, so the offset is equal to the sprite ID number as listed below. There are a finite amount of damage types which all have a different set of damage values for each of the player's armor levels. Not all damage types are compatible with all sprites.

Dungeon Sprite Data

The pointer table for dungeon sprite data is located at $04D62E. The pointers are 2 byte local addresses. You can find the pointer to a given room's data by taking the room number, multiplying it by two and using that as an offset in this array. The sprite data begins at (and the first pointer points to) $04D92E.

NOTE: Interesting to note that this pointer list seems to have space for $180 rooms, whereas the built in limit is $128. That's the first I've seen of an allocated array in the rom being larger than necessary. O_o.

Layout of these listings:

  • 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.

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

Sprites