Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.

Donkey Kong Land 2/Notes: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
m (→‎Graphics Compression: Added some clarification.)
(→‎Metasprites: Moving metasprite notes from DKLIII to DKL2)
Line 1: Line 1:
{{Notes|game=Donkey Kong Land 2}}
{{Notes|game=Donkey Kong Land 2}}
== Metasprites ==
<tt>0x18001</tt>: A list of 24-bit pointers (bank first, big endian) to [[Donkey Kong Land 2:Notes#MetaspriteSet Structure|MetaspriteSet]] structures. It's indexed using a metasprite set ID.
=== MetaspriteSet Structure ===
*The first byte is the number of metasprites in the set.
*Following that is a list of [[Donkey Kong Land 2:Notes#MetaspriteInfo Structure|MetaspriteInfo]] structures- one for each metasprite in the set.
*Following that is a list of [[Donkey Kong Land 2:Notes#MetaspriteLayout Structure|MetaspriteLayout]] structures- one for each metasprite in the set.
=== MetaspriteInfo Structure ===
*<tt>0x0</tt>: The number of sprites used by this metasprite.
*<tt>0x1-2</tt>: A 16-bit pointer (big endian) to the first of the uncompressed tile patterns used by this metasprite. The pointer uses a special format (detailed below).
::*<tt>Bits 0xB-F</tt>: The bank.
::*<tt>Bits 0x0-A</tt>: The address can be calculated as this <tt>value * 0x20</tt>.
=== MetaspriteLayout Structure ===
*A list of [[Donkey Kong Land 2:Notes#SignedPoint Structure|SignedPoint]] structures that define the locations of the sprites that compose a metasprite. Each consecutive [[Donkey Kong Land 2:Notes#SignedPoint Structure|SignedPoint]] is relative to the one before it.
=== SignedPoint Structure ===
*<tt>0x0</tt>: Y coordinate (signed)
*<tt>0x1</tt>: X coordinate (signed)
=== Drawing a Metasprite ===
* Each consecutive sprite forming a metasprite is drawn relative to the previous one based on the offsets defined in its [[Donkey Kong Land 2:Notes#MetaspriteLayout Structure|MetaspriteLayout]] structure.
* Only 8x16 sprites are used.
* Tile pattern indices increase by 2 for every consecutively drawn sprite.
* Each sprite forming the metasprite uses the same sprite palette.
* When flipping the metasprite horizontally, negate the X offset of each sprite before adding it. Additionally, the metasprite should be drawn 7 pixels to the left.


== Graphics Compression ==
== Graphics Compression ==

Revision as of 18:29, 8 December 2014

Chip tiny.png The following article is a Notes Page for Donkey Kong Land 2.

Metasprites

0x18001: A list of 24-bit pointers (bank first, big endian) to MetaspriteSet structures. It's indexed using a metasprite set ID.

MetaspriteSet Structure

  • The first byte is the number of metasprites in the set.
  • Following that is a list of MetaspriteInfo structures- one for each metasprite in the set.
  • Following that is a list of MetaspriteLayout structures- one for each metasprite in the set.

MetaspriteInfo Structure

  • 0x0: The number of sprites used by this metasprite.
  • 0x1-2: A 16-bit pointer (big endian) to the first of the uncompressed tile patterns used by this metasprite. The pointer uses a special format (detailed below).
  • Bits 0xB-F: The bank.
  • Bits 0x0-A: The address can be calculated as this value * 0x20.

MetaspriteLayout Structure

  • A list of SignedPoint structures that define the locations of the sprites that compose a metasprite. Each consecutive SignedPoint is relative to the one before it.

SignedPoint Structure

  • 0x0: Y coordinate (signed)
  • 0x1: X coordinate (signed)

Drawing a Metasprite

  • Each consecutive sprite forming a metasprite is drawn relative to the previous one based on the offsets defined in its MetaspriteLayout structure.
  • Only 8x16 sprites are used.
  • Tile pattern indices increase by 2 for every consecutively drawn sprite.
  • Each sprite forming the metasprite uses the same sprite palette.
  • When flipping the metasprite horizontally, negate the X offset of each sprite before adding it. Additionally, the metasprite should be drawn 7 pixels to the left.

Graphics Compression

Most background graphics are compressed using the same Huffman coding derivative found in Donkey Kong Land and Donkey Kong Land III. The tables used for decompression are found at the same locations as in Donkey Kong Land.

A description of this format can be found at Donkey Kong Land:Notes#Graphics Compression.