Explains the sprite memory.
Overview
of the sprite memory
Sprites need various data beside its definition in order to
perform their functions normally. Sprite memory is the memory
region for them.
In DKC2, the size of all sprite instances is
0x5E bytes and DKC2 has 24 slots in the sprite memory.
In the
case of complex sprites, they use 2 or more slots to work. For
example, DK barrel is consisted from 2 instances so one DK
barrel use 2 slots of sprite memory.
The variable name represents the address within each instance.
This is a big difference from DKC1 in which the sprite memory is
discrete and the address of the first slot is specified as a
variable.
For example, ind DKC2, "variable $20" always means
the 16-bit spase from the 0x20 byte counting from the start
address of the target instance.
Sprite
over
Sprite memory reserves 24 slot, so when the game will crate more
than 24 sprite instances, extra instances will not be created.
This is the sprite over so-called.
The occurrence of sprite
over is not fatal to the run of the game itself, but it may be
fatal for the player. Thus, in the case of sprites that use
multiple instances, the most important instance is initialized
first. For example, in case DK barrel, the game will initialize
its body first, then initialize its label.
Disposing
instances
Disposing sprite instances is executed by writing a null
pointer, that is 0x0000, at variable $00.
The game also can
dispose instances by writing zero to variable $58. In this case,
the game will execute sprite respawn suppression. The variable
$58 is nothing but a sprite parameter.
Variable $00 is
used to determine the slot is empty or not. If variable $00 of
slot is not zero, the game judge it has a valid instance.