include/field/sprite.h
Animated sprites: their layers, pictures and colour modes, and the resource slots they draw from.
#include "edition.h"#include "fixed_math.h"#include "static_assert.h"#include "types.h"#include "graphics/render_placement.h"
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
| Name | Description | |
|---|---|---|
struct | SPR_ANIMATION | One of a sprite's four sprite animations: its animation id, pictures, running script and timer. |
struct | SPR_PICTURE_CACHE | A sprite picture cache: the tag of the animation loaded into it (slot number and animation id) and the buffer holding its pictures. |
struct | ACTOR_SYSTEM_STATE | The 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). |
struct | ANIMATION_SPR_PART | The 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. |
struct | SPR | An animated sprite: its image and shadow, scale, rotation, size and up to four sprite animations. |
Macros
| Name | Description | |
|---|---|---|
#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. |
#define | SPRITE_PICTURE_NONE 255 | A sprite animation's picture or pictureBase when it shows none: fdSpriteComposePicture skips it until an animation is selected. |
#define | SPRITE_ANIMATION_KEEP_PLACE 0x80 | An animation number's bit 7: keep the place and timer of the script already running. |
#define | SPRITE_ANIMATION_INDEX_MASK 0x7f | |
#define | ANIM_STEP_NORMAL 16 | SPR_ANIMATION.step at normal speed, as fdActorSetAnimationSpeed sets it: a timed command's ticks run as written. |
#define | PICTURE_CACHE_TAG_SLOT_SHIFT 12 | A picture cache's tag holds its slot above the sprite id's bits. |
#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. |
#define | SPRITE_ID_MASK 0xfff | A battle sprite id's low twelve bits, the sprite. |
#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. |
Enumerations
| Name | Description | |
|---|---|---|
enum | SPR_COL_MODE { SPRITE_COLOR_NORMAL, SPRITE_COLOR_GRB, SPRITE_COLOR_RBG, SPR … } | SPR_ANIMATION.colorMode: how fdRenderDecodePicture colours a layer's pixels. |
enum | ACTOR_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
SPRITE_COLOR_BLINK
#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.
| Enumerator | Value | Description |
|---|---|---|
SPRITE_COLOR_NORMAL | 0 | |
SPRITE_COLOR_GRB | 1 | red and green swapped |
SPRITE_COLOR_RBG | 2 | green and blue swapped |
SPRITE_COLOR_BGR | 3 | red and blue swapped |
SPRITE_COLOR_GBR | 4 | red to blue, green to red, blue to green |
SPRITE_COLOR_BRG | 5 | red to green, green to blue, blue to red |
SPRITE_COLOR_GREY | 6 | greyscale |
SPRITE_COLOR_WHITE | 7 | solid colour 15, white |
SPRITE_COLOR_BLUE_TINT | 9 | blue raised to full |
SPRITE_COLOR_RED_TINT | 10 | red raised to full |
SPRITE_COLOR_GREEN_TINT | 11 | green raised to full |
SPRITE_COLOR_FILL | 13 | solid DecodeFillByte |
SPRITE_COLOR_BLACK | 14 | solid colour 1, black |
SPRITE_COLOR_HIDDEN | 15 | solid 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.
| Enumerator | Value | Description |
|---|---|---|
ANIM_STILL | 0 | Standing still: nearly every sprite's first frame held, without the blinks and small gestures of ANIM_STAND. |
ANIM_STAND | 1 | |
ANIM_WALK | 2 | |
ANIM_NOD | 3 | |
ANIM_SHAKE_HEAD | 4 | |
ANIM_LEADER_RUN | 5 | Running, 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_SPRING | 6 | Leaning back for a moment before a jump. |
ANIM_LEADER_LEAP | 7 | In mid-stride, leaning forward. |
ANIM_PUSH | 8 | The leader leaning into what it pushes, as scenes play it while a statue or stone pillar slides ahead of it. |
ANIM_LEADER_LOOK_AROUND | 9 | ANIM_STAND's idle with more glances to each side, as when a whirlwind catches the leader. |
ANIM_LEADER_CLIMB | 10 | Climbing a wall, seen from behind. |
ANIM_LEADER_CLIMB_OVER_TOP | 11 | Stepping off the top of a ladder, as onto the roof beside Isaac's house. |
ANIM_LEADER_CLING | 12 | Still on a wall, seen from behind. |
ANIM_LEADER_CLIMB_DOWN_FROM_TOP | 13 | ANIM_LEADER_CLIMB_OVER_TOP played backwards: stepping from the top of a ladder onto its rungs. |
ANIM_LEADER_CLIMB_EAST | 14 | Reaching along a wall as he climbs east. |
ANIM_LEADER_CLIMB_WEST | 15 | Reaching along a wall as he climbs west. |
ANIM_LEADER_STRIDE | 16 | One 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_PSYNERGY | 17 | Holding out a glowing hand, as the party's sprites cast Psynergy (isaac.png, garet.png). |
ANIM_LEADER_BATHE | 18 | Sitting waist-deep in water and splashing, as in a Lamakan Desert oasis. |
ANIM_COLLAPSE | 19 | Lying collapsed on the ground; |
ANIM_LEADER_LEAN_BACK | 22 | every 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_ALTERNATE | 23 | The 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_ARRIVE | 24 | |
ANIM_LEADER_LEAVE_ALTERNATE | 25 | |
ANIM_LEADER_LEAVE | 26 | |
ANIM_LEADER_WALK_BACKWARDS | 27 | ANIM_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_RAISED | 28 | Both arms raised over his head. |
ANIM_LEADER_TOSS | 29 | Swinging an arm out to throw, as he tosses a coin or medal at Tolbi's spring. |
ANIM_PARTY_RUN | 30 | ANIM_LEADER_RUN again, on every |
ANIM_LEADER_CROUCH | 35 | party 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_FALL | 36 | Staggering, 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.