src/field/field_sprite_viewer.c
The debug sprite viewer: one sprite shown once for each way it can face, in a ring, with up to four sprite animations laid over it and the keys to change each one's sprite, animation, priority and colour mode. More…
Included by field.c.
Structures
| Name | Description | |
|---|---|---|
struct | SPR_VIEWER_LAYER | One sprite animation the sprite viewer edits. |
Macros
| Name | Description | |
|---|---|---|
#define | ANGLE_BITS 16 | An angle's bits: shifted up and back down, a value keeps only them. |
Enumerations
| Name | Description | |
|---|---|---|
enum | anonymous enum { SPRITE_VIEWER_COPY_COUNT, SPRITE_VIEWER_SPRITE_LIMIT, SPRITE … } | |
enum | SPR_VIEWER_EDIT_MODE { SPRITE_VIEWER_EDIT_ANIMATION, SPRITE_VIEWER_EDIT_SPRITE, SPR … } | What left and right choose for L and R to change on the selected sprite animation. |
Functions
| Name | Description | |
|---|---|---|
void | fdSpriteViewerSetLayerPriority (Sint32 layerIndex, Sint32 priority) | Gives sprite animation layerIndex of each of the viewer's ten sprites the drawing order priority. |
void | fdSpriteViewerSetLayerColorMode (Sint32 layerIndex, Sint32 colorMode) | Gives sprite animation layerIndex (0 to 3) of each of the viewer's ten sprites the colour mode. |
Sint32 | fdSpriteViewerStartStaggeredAnimations (Sint32 layerIndex, Sint32 animationIndex) | Starts animationIndex on sprite animation layerIndex of each of the viewer's ten sprites, each one a tick (16 timer units) behind the last, so the copies are staggered. |
void | fdSpriteViewerSetLayerSprite (Sint32 layerIndex, Sint32 spriteId) | Sets spriteId on sprite animation layerIndex of each of the viewer's ten sprites, and resets each sprite animation from its new metadata. |
void | fdSpriteViewerLayOutRing (Sint32 centerX, Sint32 centerY, SPR_PLACEMENT *positions) | Lays out the sprite viewer's ring around (centerX, centerY), in pixels: one position per facing of the first sprite's facing kind (6, 8, 10 or 4, or two opposite pairs for ANIM_FACING_TWO_PART), 56 pixels out (40 for a two-part sprite). |
Sint32 | fdSpriteViewerStepSpriteId (Sint32 spriteId, Sint32 delta) | Steps a sprite id (0 to 715) by delta: a step of one wraps around the range, a larger step forward goes to the next stop above spriteId and one back to the last stop below it (SpriteViewerSkipStops, from which a step forward wraps to 0). |
void | fdSpriteViewerPlaceRing (void) | Each tick in the sprite viewer: places each copy of the sprite at its ring position, facing the way that position stands for. |
void | fdSpriteViewerRun (void) | The debug sprite viewer, in The Broken Seal's form with this game's changes; it never returns. |
Variables
| Name | Description | |
|---|---|---|
extern const Uint16 | SpriteViewerBackdropColors [8] | The backdrop colours B steps through, the sprite ids a fast step stops at (ended by (Uint16)-1), and the copies' scale (map_grid_data.c). |
extern const Uint16 | SpriteViewerSkipStops [] | The sprite ids the sprite viewer's fast step (Start held with L or R) stops at, the first of each group of sprites: a skip forward goes to the next stop above the sprite shown, back to the last stop below it. |
extern const SPR_SCALE | SpriteViewerScale | The sprite viewer's scale for its ring of copies: full size. |
Description
The debug sprite viewer: one sprite shown once for each way it can face, in a
ring, with up to four sprite animations laid over it and the keys to change
each one's sprite, animation, priority and colour mode. Part of field.c.
Macros in detail
ANGLE_BITS
#define ANGLE_BITS 16
An angle's bits: shifted up and back down, a value keeps only them.
Referenced by fdSpriteViewerLayOutRing().
Definition at line 48 of file field_sprite_viewer.c.
Enumerations in detail
anonymous enum
enum { SPRITE_VIEWER_COPY_COUNT, SPRITE_VIEWER_SPRITE_LIMIT, SPRITE_VIEWER_ANIMATION_LIMIT, SPRITE_VIEWER_HIDDEN_PRIORITY, … }
| Enumerator | Value | Description |
|---|---|---|
SPRITE_VIEWER_COPY_COUNT | 10 | The sprite copies and their ring positions; a facing kind places 4, 6, 8 or 10 of them (fdSpriteViewerLayOutRing). |
SPRITE_VIEWER_SPRITE_LIMIT | 716 | Sprite ids 0 to 715 are offered. |
SPRITE_VIEWER_ANIMATION_LIMIT | 100 | Animations 0 to 99. |
SPRITE_VIEWER_HIDDEN_PRIORITY | 8 | A sprite animation priority above 3, which fdSpriteComposePicture skips. |
SPRITE_VIEWER_FAST_STEP | 10 | The sprite ids L and R step by while Start is held: any step past one goes to the next stop of SpriteViewerSkipStops. |
SPRITE_VIEWER_SKIP_STOPS | 10 | SpriteViewerSkipStops' entries, its end marker the last. |
SPRITE_VIEWER_FILL_COLOR | 3 | The colour SPRITE_COLOR_FILL paints in the viewer (DecodeFillByte): colour 3 of the basic sprite palette, orange. |
SPRITE_VIEWER_DEBUG_MODE | 2 | DebugMode while the viewer runs. Every reader tests it only for nonzero, so 2 turns on the same debug keys any other value would. |
Definition at line 16 of file field_sprite_viewer.c.
SPR_VIEWER_EDIT_MODE
enum SPR_VIEWER_EDIT_MODE
What left and right choose for L and R to change on the selected sprite animation.
| Enumerator | Value | Description |
|---|---|---|
SPRITE_VIEWER_EDIT_ANIMATION | ||
SPRITE_VIEWER_EDIT_SPRITE | ||
SPRITE_VIEWER_EDIT_PRIORITY | ||
SPRITE_VIEWER_EDIT_COLOR | ||
SPRITE_VIEWER_EDIT_COUNT |
Definition at line 52 of file field_sprite_viewer.c.
Functions in detail
fdSpriteViewerSetLayerPriority
void fdSpriteViewerSetLayerPriority(Sint32 layerIndex, Sint32 priority)
Gives sprite animation layerIndex of each of the viewer's ten sprites the drawing order priority.
References Sint32.
Referenced by fdSpriteViewerRun().
Definition at lines 5 and 558 of file field_sprite_viewer.c.
fdSpriteViewerSetLayerColorMode
void fdSpriteViewerSetLayerColorMode(Sint32 layerIndex, Sint32 colorMode)
Gives sprite animation layerIndex (0 to 3) of each of the viewer's ten sprites the colour mode.
References Sint32.
Referenced by fdSpriteViewerRun().
Definition at lines 6 and 544 of file field_sprite_viewer.c.
fdSpriteViewerStartStaggeredAnimations
Sint32 fdSpriteViewerStartStaggeredAnimations(Sint32 layerIndex, Sint32 animationIndex)
Starts animationIndex on sprite animation layerIndex of each of the viewer's ten sprites, each one a tick (16 timer units) behind the last, so the copies are staggered. Also sets each copy's offsetY and clears its rotation.
References fdResourceGetMetadataRecordStub() and Sint32.
Referenced by fdSpriteViewerRun().
Definition at lines 7 and 573 of file field_sprite_viewer.c.
fdSpriteViewerSetLayerSprite
void fdSpriteViewerSetLayerSprite(Sint32 layerIndex, Sint32 spriteId)
Sets spriteId on sprite animation layerIndex of each of the viewer's ten sprites, and resets each sprite animation from its new metadata.
References fdResourceGetMetadataRecordStub(), fdSpriteAnimationReset() and Sint32.
Referenced by fdSpriteViewerRun().
Definition at lines 9 and 619 of file field_sprite_viewer.c.
fdSpriteViewerLayOutRing
void fdSpriteViewerLayOutRing(Sint32 centerX, Sint32 centerY, SPR_PLACEMENT *positions)
Lays out the sprite viewer's ring around (centerX, centerY), in pixels: one
position per facing of the first sprite's facing kind (6, 8, 10 or 4, or two
opposite pairs for ANIM_FACING_TWO_PART), 56 pixels out (40 for a two-part
sprite). B held turns the ring. Called by fdSpriteViewerRun when it starts
and while Start moves the ring.
References FrameCount, PerWork, Sint32, sySpritePlacementValues() and syVectorAddPolarOffset().
Referenced by fdSpriteViewerRun().
Definition at lines 10 and 428 of file field_sprite_viewer.c.
fdSpriteViewerStepSpriteId
Sint32 fdSpriteViewerStepSpriteId(Sint32 spriteId, Sint32 delta)
Steps a sprite id (0 to 715) by delta: a step of one wraps around the range,
a larger step forward goes to the next stop above spriteId and one back to
the last stop below it (SpriteViewerSkipStops, from which a step forward
wraps to 0). A delta of 0 returns spriteId unchanged.
References Sint32 and SpriteViewerSkipStops.
Referenced by fdSpriteViewerRun().
Definition at lines 13 and 364 of file field_sprite_viewer.c.
fdSpriteViewerPlaceRing
void fdSpriteViewerPlaceRing(void)
Each tick in the sprite viewer: places each copy of the sprite at its ring position, facing the way that position stands for.
References fdRenderApplyProjectedPlacement(), Sint32 and SpriteViewerScale.
Referenced by fdSpriteViewerRun().
Definition at lines 14 and 637 of file field_sprite_viewer.c.
fdSpriteViewerRun
void fdSpriteViewerRun(void)
The debug sprite viewer, in The Broken Seal's form with this game's changes; it never returns.
References ActorSpriteSlots, DebugMode, DecodeFillByte, fdActorSystemInit(), fdResourceGetMetadataRecordStub(), fdSpriteAddAnimation(), fdSpriteCreate(), fdSpritePictureCacheLoad(), fdSpriteViewerLayOutRing(), fdSpriteViewerPlaceRing(), fdSpriteViewerSetLayerColorMode(), fdSpriteViewerSetLayerPriority(), fdSpriteViewerSetLayerSprite(), fdSpriteViewerStartStaggeredAnimations(), fdSpriteViewerStepSpriteId(), MapGridMetatileBuffer, PerWork, Sint32, SpriteAnimationMetadata, SpriteViewerBackdropColors, syDummyReturnZero(), syHeapInit(), syHeapSlotAllocateEWRAM(), syInitEvent(), syScreenFadeFromBlack(), sySetEvent(), sySynch() and syVRAMCacheReset().
Definition at line 74 of file field_sprite_viewer.c.