djinn_figures.c
FourObjectMotion: the row of four figures the Status and Djinn menus show, placed by a scheduler callback and eased in and out.
games/tbs/src/menu/menu/djinn_figures.c on GitHub
FourObjectMotion: the row of four figures the Status and Djinn menus show, placed by a scheduler callback and eased in and out. Part of menu.c, the menu object, compiled only through it.
Functions
FourObjectMotion_InitializeTopRow
void FourObjectMotion_InitializeTopRow(void *unused0, s32 unused1)
Replaces the four displayed objects and starts their projected-position task: one Djinni figure of each element (gFourObjectMotion_ResourceIds) in animation 2, at (16, 32) until the screen moves them, placed each frame by FourObjectMotion_UpdateAllPositions. The Status menu calls it when the party has Djinn; FourObjectMotion_ClearSlotsAndSchedule releases them.
Used by StatusMenu_Run.
FourObjectMotion_UpdateAllPositions
void FourObjectMotion_UpdateAllPositions(void)
Projects the four objects at full scale from their saved row positions. Scheduler callback, each frame from FourObjectMotion_InitializeTopRow. The image stands at (positionsX, positionsY); verticalOrigins, which is the party figures' ownerY, only moves the depth slot.
Used by FourObjectMotion_InitializeTopRow.
FourObjectMotion_UpdateBottomRow
void FourObjectMotion_UpdateBottomRow(void)
Projects the bottom row using its saved scale or easing toward full size. Scheduler callback, each frame from FourObjectMotion_InitializeBottomRow (the Djinn menu); it also animates the page arrows. A figure whose y has FourObjectMotion_SetSlotPosition's negative mark (a recovering Djinni) faces 0x8000 instead of 0x4000.
Used by FourObjectMotion_InitializeBottomRow.
FourObjectMotion_InitializeBottomRow
void FourObjectMotion_InitializeBottomRow(s32 unused0, s32 unused1)
Replaces the bottom row's four objects and starts its easing task: one Djinni figure of each element in animation 2, at full size, at (16, 200) below the screen until the Djinn menu moves one. DjinnMenu_Run calls it and FourObjectMotion_ClearSlotsAndScheduleAlt releases them.
Used by DjinnMenu_Run.
FourObjectMotion_SetSlotPosition
s32 FourObjectMotion_SetSlotPosition(s32 index, s32 x, s32 y, s32 negative)
Updates one object's saved position and its signed y marker: with negative set, y keeps its low bits but gets bit 15, which makes it negative. Does nothing to an empty slot. Returns the work offset of positionsY[index] (0x23c + 2 * index), or index for an empty slot; callers ignore it.
Used by DjinnMenu_RunScreen, DjinnMenu_SelectDjinn, DjinnMenu_ShowOwnerStatus, OwnerAction_RunCompareLoop.
FourObjectMotion_SetSlotPhase
s32 FourObjectMotion_SetSlotPhase(s32 index, s32 phase)
Sets figure index's scale phase (16.16): negative for a fixed scale of -phase, otherwise the scale it grows from toward full size. The Djinn chooser sets 0 after each cursor move, so the figure grows in again.
Used by DjinnMenu_SelectDjinn, OwnerAction_RunCompareLoop.
FourObjectMotion_ReplaceSlot
s32 FourObjectMotion_ReplaceSlot(s32 index, s32 resourceKind, s32 value)
Replaces one displayed object and selects its animation: figure index becomes the Djinni figure of element resourceKind (gFourObjectMotion_ResourceIds) in animation value. Returns 1.
Used by DjinnMenu_SelectDjinn.
Also, functions without a comment: Menu_StartPartyFiguresWalking.
Macros
FOUR_OBJECT_MOTION_DEFINE_RELEASE
#define FOUR_OBJECT_MOTION_DEFINE_RELEASE(name, update)
Releases the four objects and removes their scheduler callback. It defines FourObjectMotion_ClearSlotsAndSchedule (the Status menu's row) and FourObjectMotion_ClearSlotsAndScheduleAlt (the Djinn menu's), which schedule nothing despite their names.
Also, macros without a comment: FOUR_OBJECT_MOTION_FULL_SCALE, FOUR_OBJECT_MOTION_ORIGIN_Y.