Skip to Content
The Alchemy Project

include/field/sprite.h

Animated sprites: their layers, pictures and colour modes, and the resource slots they draw from.

Included by battle_effect_internal.h, battle_effect_table.c, field_engine_tables.c, menu_internal.h, sprite_metadata.c, actor.h, ground_mask.h, shop.h, djinn_preview.h and menu_list.h.

Structures

NameDescription
structSPR_ANIMATIONOne of a sprite's four sprite animations: its animation id, pictures, running script and timer.
structSPR_PICTURE_CACHEA sprite picture cache: the tag of the animation loaded into it (slot number and animation id) and the buffer holding its pictures.
structACTOR_SYSTEM_STATEThe actor system's state: the flag that suspends sprite projection, the outline's edge and fill colours, and the sprite picture caches (HEAP_SLOT_ACTOR_SYSTEM).
structANIMATION_SPR_PARTThe hardware sprite attributes one part of an animated sprite (its image or its shadow) is drawn with: the depth-slot link followed by OAM attributes 0 to 2 and the fourth halfword.
structSPRAn animated sprite: its image and shadow, scale, rotation, size and up to four sprite animations.

Macros

NameDescription
#defineSPRITE_COLOR_BLINK 0x100Passed to fdActorConfigureSpriteColor in place of a SPR_COL_MODE: the actor blinks white every few ticks (fdActorUpdateBlink) until it is given a mode again.
#defineSPRITE_PICTURE_NONE 255A sprite animation's picture or pictureBase when it shows none: fdSpriteComposePicture skips it until an animation is selected.
#defineSPRITE_ANIMATION_KEEP_PLACE 0x80An animation number's bit 7: keep the place and timer of the script already running.
#defineSPRITE_ANIMATION_INDEX_MASK 0x7f
#defineANIM_STEP_NORMAL 16SPR_ANIMATION.step at normal speed, as fdActorSetAnimationSpeed sets it: a timed command's ticks run as written.
#definePICTURE_CACHE_TAG_SLOT_SHIFT 12A picture cache's tag holds its slot above the sprite id's bits.
#defineSPRITE_PICTURE_TAG (slot, id)A sprite id with the sprite picture cache its pictures load into, as a SPR_PICTURE_CACHE's tag holds them.
#defineSPRITE_ID_MASK 0xfffA battle sprite id's low twelve bits, the sprite.
#defineSPRITE_SECOND_PART SPRITE_PICTURE_TAG(2, 1)What the Kraken's and the Fusion Dragon's second part adds to their first: the next sprite, its pictures two slots on, past the two slots a large enemy's first part takes.

Enumerations

NameDescription
enumSPR_COL_MODE { SPRITE_COLOR_NORMAL, SPRITE_COLOR_GRB, SPRITE_COLOR_RBG, SPR … }SPR_ANIMATION.colorMode: how fdRenderDecodePicture colours a layer's pixels.
enumACTOR_ANIMATION { ANIM_STILL, ANIM_STAND, ANIM_WALK, ANIM_NOD, ANIM_SHAKE_HEAD … }Animation numbers of an actor's sprite, for syImportActorSetAnimation and fdSpriteStartAnimation.

Description

Animated sprites: their layers, pictures and colour modes, and the resource slots they draw from.

Macros in detail

#define SPRITE_COLOR_BLINK 0x100

Passed to fdActorConfigureSpriteColor in place of a SPR_COL_MODE: the actor blinks white every few ticks (fdActorUpdateBlink) until it is given a mode again.

Referenced by fdActorConfigureSpriteColor(), scMercuryLighthouseAerieSaturosAndAlexWarpIn(), scMercuryLighthouseAerieSaturosAndAlexWarpOut(), scMercuryLighthouseRaiseActorWithSparks(), scSanctumAskToAcceptQuest(), scSanctumReceiveWiseOnesMission(), scSolSanctumElementalStarRoomAlexTakesStars(), scSolSanctumElementalStarRoomAlexWarpsIn(), scSolSanctumElementalStarRoomDemandElementalStars(), scSolSanctumElementalStarRoomEnterStarRoom(), scSolSanctumEruptionRaiseAndShrinkActor(), scSolSanctumLunaSolRoomsRiseToElementalStarRoom() and scVenusLighthouseAerieCombineSaturosAndMenardi().

Definition at line 35 of file sprite.h.

SPRITE_PICTURE_NONE

#define SPRITE_PICTURE_NONE 255

A sprite animation's picture or pictureBase when it shows none: fdSpriteComposePicture skips it until an animation is selected.

Referenced by btEffectTintBattler(), btMotionPlayFall(), btMotionShowDowned(), btObjectSetColorMode(), btPlaybackRun(), fdSpriteAnimationAllocate(), fdSpriteAnimationReset(), fdSpriteComposePicture(), fdSpriteResetAnimations(), fdSpriteViewerStartStaggeredAnimations() and scTolbiSpringSetActorAppearance().

Definition at line 39 of file sprite.h.

SPRITE_ANIMATION_KEEP_PLACE

#define SPRITE_ANIMATION_KEEP_PLACE 0x80

An animation number's bit 7: keep the place and timer of the script already running.

Referenced by fdSpriteAnimationStart() and fdSpriteStartAnimation().

Definition at line 43 of file sprite.h.

SPRITE_ANIMATION_INDEX_MASK

#define SPRITE_ANIMATION_INDEX_MASK 0x7f

Referenced by fdSpriteStartAnimation().

Definition at line 44 of file sprite.h.

ANIM_STEP_NORMAL

#define ANIM_STEP_NORMAL 16

SPR_ANIMATION.step at normal speed, as fdActorSetAnimationSpeed sets it: a timed command's ticks run as written.

Referenced by btActionRunBuild(), btAutoBattleRunApproachAttack(), btAutoBattleRunAttackOrItem(), btEffectRunAstralBlast(), btEffectRunCastingImpact(), btEffectRunCriticalHit(), btEffectRunRagnarok(), btEffectRunVolleyWithAction(), btObjectUpdatePose(), btProcessTurnEnd(), btStagingRunAttack(), btStagingRunItem(), btStagingRunPlainAttack(), btStagingRunPsynergyCast(), btUnitProcessActionEnd(), fdPsynergyResumeHaltedActor(), fdPsynergyStartCast(), fdTalkToActor(), mnSanctumRunMemberIconBurst(), scActorSteerByPad(), scCrossboneIsleKeysBaneLastEscape(), scCrossboneIsleKeysInitBane(), scLamakanDesertFallIntoPit(), scLeaderSlideOnIce(), scShipRoomsNoticeShipRocking(), scShipRoomsReachIsland(), scShipRoomsSetPassengerRowing(), scShipRoomsShowRowing() and scTolbiSpringUpdateTossSimulation().

Definition at line 79 of file sprite.h.

PICTURE_CACHE_TAG_SLOT_SHIFT

#define PICTURE_CACHE_TAG_SLOT_SHIFT 12

A picture cache's tag holds its slot above the sprite id's bits.

Referenced by btEnemySpriteLoadIntoSlots() and fdSpritePictureCacheLoad().

Definition at line 90 of file sprite.h.

SPRITE_PICTURE_TAG

#define SPRITE_PICTURE_TAG(slot, id)

A sprite id with the sprite picture cache its pictures load into, as a SPR_PICTURE_CACHE's tag holds them.

Referenced by fdSpriteViewerRun().

Definition at line 93 of file sprite.h.

SPRITE_ID_MASK

#define SPRITE_ID_MASK 0xfff

A battle sprite id's low twelve bits, the sprite. The bits above hold the enemy sprite slot its pictures are loaded into (btEnemySpriteLoadIntoSlots).

Referenced by btObjectSpawnObjectsForList() and syResourceGetMetadataRecord().

Definition at line 98 of file sprite.h.

SPRITE_SECOND_PART

#define SPRITE_SECOND_PART SPRITE_PICTURE_TAG(2, 1)

What the Kraken's and the Fusion Dragon's second part adds to their first: the next sprite, its pictures two slots on, past the two slots a large enemy's first part takes.

Referenced by btEffectRunStarfieldFall() and btObjectSpawnObjectsForList().

Definition at line 103 of file sprite.h.

Enumerations in detail

SPR_COL_MODE

enum SPR_COL_MODE

SPR_ANIMATION.colorMode: how fdRenderDecodePicture colours a layer's pixels.

EnumeratorValueDescription
SPRITE_COLOR_NORMAL0
SPRITE_COLOR_GRB1red and green swapped
SPRITE_COLOR_RBG2green and blue swapped
SPRITE_COLOR_BGR3red and blue swapped
SPRITE_COLOR_GBR4red to blue, green to red, blue to green
SPRITE_COLOR_BRG5red to green, green to blue, blue to red
SPRITE_COLOR_GREY6greyscale
SPRITE_COLOR_WHITE7solid colour 15, white
SPRITE_COLOR_BLUE_TINT9blue raised to full
SPRITE_COLOR_RED_TINT10red raised to full
SPRITE_COLOR_GREEN_TINT11green raised to full
SPRITE_COLOR_FILL13solid DecodeFillByte
SPRITE_COLOR_BLACK14solid colour 1, black
SPRITE_COLOR_HIDDEN15solid colour 0, transparent

Definition at line 14 of file sprite.h.

ACTOR_ANIMATION

enum ACTOR_ANIMATION

Animation numbers of an actor's sprite, for syImportActorSetAnimation and fdSpriteStartAnimation.

EnumeratorValueDescription
ANIM_STILL0Standing still: nearly every sprite's first frame held, without the blinks and small gestures of ANIM_STAND.
ANIM_STAND1
ANIM_WALK2
ANIM_NOD3
ANIM_SHAKE_HEAD4
ANIM_LEADER_RUN5Running, leaning forward, four ticks a step to the walk's six. This and the leader's other poses below are as Isaac's sprite (isaac.png) draws them.
ANIM_LEADER_SPRING6Leaning back for a moment before a jump.
ANIM_LEADER_LEAP7In mid-stride, leaning forward.
ANIM_PUSH8The leader leaning into what it pushes, as scenes play it while a statue or stone pillar slides ahead of it.
ANIM_LEADER_LOOK_AROUND9ANIM_STAND's idle with more glances to each side, as when a whirlwind catches the leader.
ANIM_LEADER_CLIMB10Climbing a wall, seen from behind.
ANIM_LEADER_CLIMB_OVER_TOP11Stepping off the top of a ladder, as onto the roof beside Isaac's house.
ANIM_LEADER_CLING12Still on a wall, seen from behind.
ANIM_LEADER_CLIMB_DOWN_FROM_TOP13ANIM_LEADER_CLIMB_OVER_TOP played backwards: stepping from the top of a ladder onto its rungs.
ANIM_LEADER_CLIMB_EAST14Reaching along a wall as he climbs east.
ANIM_LEADER_CLIMB_WEST15Reaching along a wall as he climbs west.
ANIM_LEADER_STRIDE16One leg forward, braced, held briefly: the tick ANIM_LEADER_LEAP holds and the run starts on, as when he lunges into a fight or pulls someone from a river.
ANIM_CAST_PSYNERGY17Holding out a glowing hand, as the party's sprites cast Psynergy (isaac.png, garet.png).
ANIM_LEADER_BATHE18Sitting waist-deep in water and splashing, as in a Lamakan Desert oasis.
ANIM_COLLAPSE19Lying collapsed on the ground;
ANIM_LEADER_LEAN_BACK22every party member's sprite sheet maps this number to such a pose (isaac.png to mia.png). Leaning back, his head thrown back.
ANIM_LEADER_ARRIVE_ALTERNATE23The arrivals and leavings of the animated exits (EXIT_STYLE), each four ticks of the leader turning: an arrival grows from a small figure seen side-on to full size facing the player, a leaving turns from his back to side-on as he shrinks and is then hidden.
ANIM_LEADER_ARRIVE24
ANIM_LEADER_LEAVE_ALTERNATE25
ANIM_LEADER_LEAVE26
ANIM_LEADER_WALK_BACKWARDS27ANIM_WALK's six pictures in reverse order, three ticks each, played as a log carries the leader across water or a torn leaf drops him. Open question (no evidence in reach): what the player sees of it; render script reaches neither a torn leaf's fall (the second touch of one leaf) nor a ride on Crossbone Isle's floating logs.
ANIM_LEADER_ARMS_RAISED28Both arms raised over his head.
ANIM_LEADER_TOSS29Swinging an arm out to throw, as he tosses a coin or medal at Tolbi's spring.
ANIM_PARTY_RUN30ANIM_LEADER_RUN again, on every
ANIM_LEADER_CROUCH35party member's sprite sheet: the shops run the chosen party member in place with it. Held in ANIM_LEADER_SPRING's crouch, knees bent, as after a lost match.
ANIM_LEADER_FALL36Staggering, reeling back, then lying flat (isaac.png), as he collapses at the end of a Colosso match.

Definition at line 203 of file sprite.h.