jjANIMSET class
A set of related sprite animations.
One entry of the global set table jjAnimSets, indexed by ANIM::Set, holding the index of its first animation in jjAnimations. The sets of the original game are always available; a custom set (ANIM::CUSTOM[n]) exists once a script loads or allocates it. Converts implicitly to firstAnim.
Public static functions
-
static auto get_jjAnimSets(std::
uint32_t index) -> jjANIMSET* - Returns the animation set of an ANIM::Set value.
Constructors, destructors, conversion operators
-
jjANIMSET(std::
uint32_t index) explicit - Creates a new instance, the entry of the given set ID.
- ~jjANIMSET()
Public functions
- void AddRef()
- Increments the reference count.
- void Release()
- Decrements the reference count.
-
auto convertAnimSetToUint() -> std::
uint32_t - Converts the set to the index of its first animation, firstAnim.
-
auto load(std::
uint32_t fileSetID, const String& filename, int32_t firstAnimToOverwrite, int32_t firstFrameToOverwrite) -> jjANIMSET* - Loads animations into this set and returns the set.
- auto allocate(const CScriptArray& frameCounts) -> jjANIMSET*
- Creates empty animations for this set and returns the set.
-
auto loadSheet(const jjPIXELMAP& sheet,
std::
uint32_t frameWidth, std:: uint32_t frameHeight, std:: uint32_t frameSpacingX, std:: uint32_t frameSpacingY, std:: uint32_t startX, std:: uint32_t startY, const CScriptArray& coldSpotYOffsets, std:: int32_t firstAnimToOverwrite, std:: int32_t firstFrameToOverwrite) -> jjANIMSET* - Loads animations into this set from a sprite sheet and returns the set.
Public variables
-
std::
uint32_t firstAnim - Index of the set's first animation in jjAnimations, 0 if the set isn't loaded.
Function documentation
jjANIMSET* Jazz2:: Scripting:: Legacy:: jjANIMSET:: load(std:: uint32_t fileSetID,
const String& filename,
int32_t firstAnimToOverwrite,
int32_t firstFrameToOverwrite)
Loads animations into this set and returns the set.
Without a file name, copies the animations of the original game's set fileSetID (2048 means this set itself, which is already loaded). With a file name, reads set fileSetID from that .j2a file. New animations and frames are added at the end of jjAnimations and jjAnimFrames, unless firstAnimToOverwrite or firstFrameToOverwrite give the entries to overwrite.
jjANIMSET* Jazz2:: Scripting:: Legacy:: jjANIMSET:: allocate(const CScriptArray& frameCounts)
Creates empty animations for this set and returns the set.
Adds one animation per element of frameCounts, each with that many blank frames, and points firstAnim at the first of them.
jjANIMSET* Jazz2:: Scripting:: Legacy:: jjANIMSET:: loadSheet(const jjPIXELMAP& sheet,
std:: uint32_t frameWidth,
std:: uint32_t frameHeight,
std:: uint32_t frameSpacingX,
std:: uint32_t frameSpacingY,
std:: uint32_t startX,
std:: uint32_t startY,
const CScriptArray& coldSpotYOffsets,
std:: int32_t firstAnimToOverwrite,
std:: int32_t firstFrameToOverwrite)
Loads animations into this set from a sprite sheet and returns the set.
The sheet is a grid of frameWidth by frameHeight cells starting at startX, startY, separated by frameSpacingX and frameSpacingY pixels. Each row is an animation whose frames are its cells up to the first empty one; the first row without any frame ends the set. Each frame's hotspot and coldspot X are at the middle of its cell, and its coldspot Y is moved by the row's entry of coldSpotYOffsets. Frames keep the full size of the cell. New animations and frames are added unless firstAnimToOverwrite and firstFrameToOverwrite give the entries to overwrite.