The selection screen's row of icons, and the field menu. More...
Go to the source code of this file.
Data Structures | |
| struct | GlyphCursor |
| Two halfwords of a selection record, the second cleared as its cursor. More... | |
Macros | |
| #define | SELECTION_FIXED 999 |
| #define | NODE_STATUS_SCROLLING 33 |
| #define | NODE_STATUS_SHOWN 1 |
| #define | NODE_KIND_YES_NO 6 |
| #define | SELECTION_ROWS 4 |
| #define | ARROW_SCROLL_FRAMES 8 |
Functions | |
| static __inline__ void | ResetCursor (struct GlyphCursor *cursor) |
| void | UiGlyph_ResetWorkState (void) |
| Allocates and resets the selection screen: the row of icons the player picks from, with arrows at each end and a pointing hand over the chosen target. | |
| void | Resource_ClearOwnerListAndCounters (void) |
| Empties the selection screen's list of entries. | |
| void | Resource_PushPendingPair (u32 kind, u32 base) |
| Adds an entry (kind and id) to the selection screen's list, up to 16. | |
| void | MenuSelection_BuildEntries (u32 unused) |
| Creates icons for the first five listed entries in a row along the bottom of the screen. | |
| void | UiWork_ReservedNoOp (void) |
| struct SelectionNode * | SelectionScreen_FindFreeIcon (s32 kind) |
| Returns a free selection icon record: one of the seven row icons (kind 0) or of the five chosen icons (otherwise), or NULL. | |
| void | Resource_ScheduleOwnerResetDelayed (void) |
| Starts drawing the selection screen each frame. | |
| void | Resource_ScheduleOwnerReset (void) |
| Stops drawing the selection screen. | |
| void | SelectionScreen_Draw (void) |
| The selection screen's per-frame callback: slides and draws the row of icons, the large icon over the chosen one, the end arrows, the icons already chosen and the pointing hand. | |
| void | SelectionScreen_DrawArrow (struct SelectionScreen *state, s32 side) |
| Draws the selection screen's left (index 0) or right (1) arrow, nudged outwards while it flashes after a scroll. | |
| void | Menu_OpenSelectionWindow (s32 mode, u32 count) |
| Opens or refits the name window above the selection row and writes the name of the icon under the cursor, or that nothing is known (mode 4, Psynergy) or held (mode 2, items). | |
| void | Resource_ResetOwnerEntries (void) |
| Closes the selection screen and frees its icons, tiles and work block. | |
| void | Menu_SetNodeCoordinates (u32 x, u32 y) |
| Moves the row of icons to start at pixel (x, y), 16 pixels apart. | |
| void | Menu_SetupSelectionBothSides (void) |
| Sets up both end arrows of the selection row. | |
| void | SelectionScreen_SetupArrow (struct SelectionScreen *state, s32 side) |
| Sets up the left (index 0) or right (1) arrow of the selection row, shown when there are entries beyond that end. | |
| struct SelectionNode * | Selection_GetCursorNode (struct SelectionScreen *screen) |
| Returns the node at the selection screen's cursor index. | |
| s32 | Menu_SelectionLoop (s32 mode) |
| Runs the selection row until the player chooses (the chosen entry's index) or, when mode allows it, cancels with B (-1). | |
| u32 | Menu_WaitForSelectionInput (u32 mode) |
| As Menu_SelectionLoop, with the menu sounds. | |
| UNUSED void | Menu_MoveSelectionForward (struct SelectionScreen *screen) |
| Moves the cursor one entry right, scrolling the row at its fourth place. | |
| UNUSED void | Menu_MoveSelectionBackward (struct SelectionScreen *screen) |
| Moves the cursor one entry left, scrolling the row at its second place. | |
| void | Menu_StepRight (struct SelectionScreen *state) |
| Moves the cursor one entry right, scrolling the row at its edge and wrapping from the last entry to the first. | |
| void | Menu_StepLeft (struct SelectionScreen *state) |
| Moves the cursor one entry left, scrolling the row at its edge and wrapping from the first entry to the last. | |
| void | SelectionScreen_RedrawIcon (struct SelectionScreen *state, u32 rowIndex) |
| Redraws the command icon at row place rowIndex in its plain state. | |
| void | SelectionScreen_HighlightIcon (struct SelectionScreen *state, u32 rowIndex) |
| Redraws the command icon at row place rowIndex and loads its large icon. | |
| void | Menu_SendNodeCountList (struct SelectionScreen *screen) |
| Tells the battle presentation how many icons the row shows. | |
| void | Menu_ScrollSelectionList (struct SelectionScreen *screen, s32 forward) |
| Scrolls the row one entry: forward brings an icon in from the right as the leftmost shrinks away, and back the reverse; waits until it has moved. | |
| s32 | Resource_LoadByMode (s32 mode, s32 value) |
| Loads the icon of an entry of kind mode (1 and 6 commands, 2 items, 4 Psynergy, 9 fixed images) into a free sprite tile slot and returns it, or -1. | |
| s32 | Resource_LoadByModeIntoSlot (s32 mode, s32 value, s32 result, s32 option) |
| Loads the icon of an entry of kind mode into sprite tile slot result (a free slot when -1) and returns the slot. | |
| void | SelectionScreen_SetupIcon (u32 kind, s32 base, struct SelectionNode *node, s32 reuse) |
| Sets up a selection icon for an entry: its icon tiles (in its old slot when reuse is set), its name message and its sprite. | |
| u32 | Menu_ConfirmSelection (struct SelectionScreen *screen) |
| Chooses the entry under the cursor: the other icons gather into it and vanish, and it joins the chosen icons at the top left. | |
| UNUSED void | UiTextResource_NoOpCallback (void) |
| Six empty functions; nothing calls the first, the fourth or the fifth. | |
| void | UiTextResource_NoOpCallbackBank (void) |
| void | UiTextResource_NoOpCallback1 (void) |
| UNUSED void | UiTextResource_NoOpCallback2 (void) |
| UNUSED void | UiTextResource_NoOpCallback3 (void) |
| void | UiTextResource_NoOpCallback4 (void) |
| void | UiTextResource_Initialize (struct MenuSprite *sprite, s32 *slot) |
| Sets up a sprite as the right-pointing arrow, in a free tile slot (returned in *slot). | |
| void | UiTextResource_SetPosition (struct MenuSprite *sprite, s32 x, s32 y) |
| Places an arrow sprite at (x, y) and queues it for drawing. | |
| void | UiTextResource_Release (s32 value) |
| Frees an arrow sprite's tile slot. | |
| void | SelectionScreen_LoadLargeIcon (void) |
| Loads the large icon of the command under the cursor, zooming in. | |
| void | Resource_ResetPendingTransfer (void) |
| Frees the large command icon, if it is shown. | |
| s32 | Menu_RunTopSelection (void) |
| Runs the field menu until the player picks something that leaves it, and returns that choice's result. | |
| void | UiWindow_OpenMode1AndWaitFrame (void) |
| Opens the field menu's window and waits a frame. | |
| void | UiWork_CloseAndRelease (void) |
| Closes the window kept in heap block 16 and frees the block. | |
| UNUSED void | SelectionScreen_CreateEmpty (void) |
| Sets up an empty selection screen and waits a frame. | |
| u32 | Menu_RunSelectionForValue (u32 initialIndex) |
| Runs a selection row with the cursor on entry initialIndex, cancellable, and returns the entry chosen or -1. | |
The selection screen's row of icons, and the field menu.
Part of window.c, the window object, compiled only through it.
Definition in file selection.c.
| #define SELECTION_FIXED 999 |
Definition at line 574 of file selection.c.
Referenced by Menu_SelectionLoop(), and Menu_WaitForSelectionInput().
| #define NODE_STATUS_SCROLLING 33 |
Definition at line 576 of file selection.c.
Referenced by Menu_ConfirmSelection(), Menu_MoveSelectionBackward(), Menu_MoveSelectionForward(), Menu_StepLeft(), and Menu_StepRight().
| #define NODE_STATUS_SHOWN 1 |
Definition at line 577 of file selection.c.
Referenced by Menu_MoveSelectionBackward(), Menu_MoveSelectionForward(), Menu_StepLeft(), and Menu_StepRight().
| #define NODE_KIND_YES_NO 6 |
Definition at line 579 of file selection.c.
Referenced by Menu_WaitForSelectionInput().
| #define SELECTION_ROWS 4 |
Definition at line 581 of file selection.c.
Referenced by Menu_MoveSelectionForward(), and Menu_ScrollSelectionList().
| #define ARROW_SCROLL_FRAMES 8 |
Definition at line 582 of file selection.c.
Referenced by Menu_MoveSelectionBackward(), and Menu_MoveSelectionForward().
|
static |
Definition at line 13 of file selection.c.
Referenced by ResetCursor(), and UiGlyph_ResetWorkState().
| void UiGlyph_ResetWorkState | ( | void | ) |
Allocates and resets the selection screen: the row of icons the player picks from, with arrows at each end and a pointing hand over the chosen target.
Definition at line 22 of file selection.c.
Referenced by SelectionScreen_CreateEmpty(), and UiGlyph_ResetWorkState().
| void Resource_ClearOwnerListAndCounters | ( | void | ) |
Empties the selection screen's list of entries.
The high cursor bit requests resetting both the list origin and cursor.
Definition at line 70 of file selection.c.
Referenced by Resource_ClearOwnerListAndCounters(), and SelectionScreen_CreateEmpty().
Adds an entry (kind and id) to the selection screen's list, up to 16.
The count starts at 0 when the screen is created or cleared.
Definition at line 86 of file selection.c.
Referenced by Resource_PushPendingPair().
| void MenuSelection_BuildEntries | ( | u32 | unused | ) |
Creates icons for the first five listed entries in a row along the bottom of the screen.
Builds the linked row before placing the visible icons and loading the preview.
Definition at line 101 of file selection.c.
Referenced by Menu_RunSelectionForValue(), and MenuSelection_BuildEntries().
| void UiWork_ReservedNoOp | ( | void | ) |
Definition at line 157 of file selection.c.
Referenced by UiWork_ReservedNoOp().
| struct SelectionNode * SelectionScreen_FindFreeIcon | ( | s32 | kind | ) |
Returns a free selection icon record: one of the seven row icons (kind 0) or of the five chosen icons (otherwise), or NULL.
Definition at line 161 of file selection.c.
Referenced by Menu_ConfirmSelection(), Menu_ScrollSelectionList(), MenuSelection_BuildEntries(), and SelectionScreen_FindFreeIcon().
| void Resource_ScheduleOwnerResetDelayed | ( | void | ) |
Starts drawing the selection screen each frame.
Definition at line 180 of file selection.c.
Referenced by Menu_RunSelectionForValue(), and Resource_ScheduleOwnerResetDelayed().
| void Resource_ScheduleOwnerReset | ( | void | ) |
Stops drawing the selection screen.
Definition at line 185 of file selection.c.
Referenced by Resource_ResetOwnerEntries(), and Resource_ScheduleOwnerReset().
| void SelectionScreen_Draw | ( | void | ) |
The selection screen's per-frame callback: slides and draws the row of icons, the large icon over the chosen one, the end arrows, the icons already chosen and the pointing hand.
Definition at line 192 of file selection.c.
Referenced by Resource_ScheduleOwnerReset(), Resource_ScheduleOwnerResetDelayed(), and SelectionScreen_Draw().
| void SelectionScreen_DrawArrow | ( | struct SelectionScreen * | state, |
| s32 | side ) |
Draws the selection screen's left (index 0) or right (1) arrow, nudged outwards while it flashes after a scroll.
Definition at line 373 of file selection.c.
Referenced by SelectionScreen_Draw(), and SelectionScreen_DrawArrow().
Opens or refits the name window above the selection row and writes the name of the icon under the cursor, or that nothing is known (mode 4, Psynergy) or held (mode 2, items).
mode 6 is a yes or no question, placed at the bottom or top of the screen.
Definition at line 410 of file selection.c.
Referenced by Menu_MoveSelectionBackward(), Menu_MoveSelectionForward(), Menu_OpenSelectionWindow(), Menu_RunSelectionForValue(), Menu_StepLeft(), and Menu_StepRight().
| void Resource_ResetOwnerEntries | ( | void | ) |
Closes the selection screen and frees its icons, tiles and work block.
Definition at line 455 of file selection.c.
Referenced by Menu_RunSelectionForValue(), and Resource_ResetOwnerEntries().
Moves the row of icons to start at pixel (x, y), 16 pixels apart.
Definition at line 490 of file selection.c.
Referenced by Menu_SetNodeCoordinates().
| void Menu_SetupSelectionBothSides | ( | void | ) |
Sets up both end arrows of the selection row.
Definition at line 508 of file selection.c.
Referenced by Menu_RunSelectionForValue(), and Menu_SetupSelectionBothSides().
| void SelectionScreen_SetupArrow | ( | struct SelectionScreen * | state, |
| s32 | side ) |
Sets up the left (index 0) or right (1) arrow of the selection row, shown when there are entries beyond that end.
Definition at line 518 of file selection.c.
Referenced by Menu_SetupSelectionBothSides(), and SelectionScreen_SetupArrow().
| struct SelectionNode * Selection_GetCursorNode | ( | struct SelectionScreen * | screen | ) |
Returns the node at the selection screen's cursor index.
cursorIndex is relative to head, not the number of queued entries.
Definition at line 564 of file selection.c.
Referenced by Menu_OpenSelectionWindow(), Selection_GetCursorNode(), SelectionScreen_Draw(), and SelectionScreen_LoadLargeIcon().
Runs the selection row until the player chooses (the chosen entry's index) or, when mode allows it, cancels with B (-1).
SELECTION_FIXED allows no moving or choosing.
Definition at line 587 of file selection.c.
Referenced by Menu_SelectionLoop().
As Menu_SelectionLoop, with the menu sounds.
Definition at line 612 of file selection.c.
Referenced by Menu_RunSelectionForValue(), and Menu_WaitForSelectionInput().
| UNUSED void Menu_MoveSelectionForward | ( | struct SelectionScreen * | screen | ) |
Moves the cursor one entry right, scrolling the row at its fourth place.
This variant stops at the end; Menu_StepRight also wraps around. Nothing calls it.
Definition at line 655 of file selection.c.
Referenced by Menu_MoveSelectionForward().
| UNUSED void Menu_MoveSelectionBackward | ( | struct SelectionScreen * | screen | ) |
Moves the cursor one entry left, scrolling the row at its second place.
This variant stops at the beginning; Menu_StepLeft also wraps around. Nothing calls it.
Definition at line 685 of file selection.c.
Referenced by Menu_MoveSelectionBackward().
| void Menu_StepRight | ( | struct SelectionScreen * | state | ) |
Moves the cursor one entry right, scrolling the row at its edge and wrapping from the last entry to the first.
Definition at line 715 of file selection.c.
Referenced by Menu_SelectionLoop(), Menu_StepRight(), and Menu_WaitForSelectionInput().
| void Menu_StepLeft | ( | struct SelectionScreen * | state | ) |
Moves the cursor one entry left, scrolling the row at its edge and wrapping from the first entry to the last.
Definition at line 784 of file selection.c.
Referenced by Menu_SelectionLoop(), Menu_StepLeft(), and Menu_WaitForSelectionInput().
| void SelectionScreen_RedrawIcon | ( | struct SelectionScreen * | state, |
| u32 | rowIndex ) |
Redraws the command icon at row place rowIndex in its plain state.
Definition at line 858 of file selection.c.
Referenced by Menu_ConfirmSelection(), Menu_MoveSelectionBackward(), Menu_MoveSelectionForward(), Menu_StepLeft(), Menu_StepRight(), and SelectionScreen_RedrawIcon().
| void SelectionScreen_HighlightIcon | ( | struct SelectionScreen * | state, |
| u32 | rowIndex ) |
Redraws the command icon at row place rowIndex and loads its large icon.
Definition at line 876 of file selection.c.
Referenced by Menu_MoveSelectionBackward(), Menu_MoveSelectionForward(), Menu_SelectionLoop(), Menu_StepLeft(), Menu_StepRight(), and SelectionScreen_HighlightIcon().
| void Menu_SendNodeCountList | ( | struct SelectionScreen * | screen | ) |
Tells the battle presentation how many icons the row shows.
Definition at line 896 of file selection.c.
Referenced by Menu_ConfirmSelection(), and Menu_SendNodeCountList().
| void Menu_ScrollSelectionList | ( | struct SelectionScreen * | screen, |
| s32 | forward ) |
Scrolls the row one entry: forward brings an icon in from the right as the leftmost shrinks away, and back the reverse; waits until it has moved.
Releases the departing cache slot only after its shrinking animation finishes.
Definition at line 913 of file selection.c.
Referenced by Menu_MoveSelectionBackward(), Menu_MoveSelectionForward(), Menu_ScrollSelectionList(), Menu_StepLeft(), and Menu_StepRight().
Loads the icon of an entry of kind mode (1 and 6 commands, 2 items, 4 Psynergy, 9 fixed images) into a free sprite tile slot and returns it, or -1.
Definition at line 1011 of file selection.c.
Referenced by RenderOutput_CreateFromResource(), and Resource_LoadByMode().
Loads the icon of an entry of kind mode into sprite tile slot result (a free slot when -1) and returns the slot.
Kind 7 is an item icon without its count, 8 one of the other icons.
Definition at line 1042 of file selection.c.
Referenced by Resource_LoadByModeIntoSlot().
| void SelectionScreen_SetupIcon | ( | u32 | kind, |
| s32 | base, | ||
| struct SelectionNode * | node, | ||
| s32 | reuse ) |
Sets up a selection icon for an entry: its icon tiles (in its old slot when reuse is set), its name message and its sprite.
kind must select a command, item or Psynergy with the matching base ID.
Definition at line 1080 of file selection.c.
Referenced by Menu_ScrollSelectionList(), Menu_StepLeft(), Menu_StepRight(), MenuSelection_BuildEntries(), and SelectionScreen_SetupIcon().
| u32 Menu_ConfirmSelection | ( | struct SelectionScreen * | screen | ) |
Chooses the entry under the cursor: the other icons gather into it and vanish, and it joins the chosen icons at the top left.
Returns the entry's index. The selected row node and a free chosen-icon record must exist before confirming.
Definition at line 1132 of file selection.c.
Referenced by Menu_ConfirmSelection(), and Menu_SelectionLoop().
| UNUSED void UiTextResource_NoOpCallback | ( | void | ) |
Six empty functions; nothing calls the first, the fourth or the fifth.
Definition at line 1226 of file selection.c.
Referenced by UiTextResource_NoOpCallback().
| void UiTextResource_NoOpCallbackBank | ( | void | ) |
Definition at line 1227 of file selection.c.
Referenced by UiTextResource_NoOpCallbackBank().
| void UiTextResource_NoOpCallback1 | ( | void | ) |
Definition at line 1228 of file selection.c.
Referenced by UiTextResource_NoOpCallback1().
| UNUSED void UiTextResource_NoOpCallback2 | ( | void | ) |
Definition at line 1229 of file selection.c.
Referenced by UiTextResource_NoOpCallback2().
| UNUSED void UiTextResource_NoOpCallback3 | ( | void | ) |
Definition at line 1230 of file selection.c.
Referenced by UiTextResource_NoOpCallback3().
| void UiTextResource_NoOpCallback4 | ( | void | ) |
Definition at line 1231 of file selection.c.
Referenced by UiTextResource_NoOpCallback4().
| void UiTextResource_Initialize | ( | struct MenuSprite * | sprite, |
| s32 * | slot ) |
Sets up a sprite as the right-pointing arrow, in a free tile slot (returned in *slot).
The caller owns the cache slot and releases it through UiTextResource_Release.
Definition at line 1237 of file selection.c.
Referenced by FieldUiTextResource_Initialize(), Menu_RunSelection(), Menu_RunSelectionWithCursorObject(), and UiTextResource_Initialize().
| void UiTextResource_SetPosition | ( | struct MenuSprite * | sprite, |
| s32 | x, | ||
| s32 | y ) |
Places an arrow sprite at (x, y) and queues it for drawing.
Definition at line 1254 of file selection.c.
Referenced by FieldUiTextResource_SetPosition(), Menu_RunSelection(), Menu_RunSelectionWithCursorObject(), and UiTextResource_SetPosition().
| void UiTextResource_Release | ( | s32 | value | ) |
Frees an arrow sprite's tile slot.
Definition at line 1261 of file selection.c.
Referenced by Menu_RunSelection(), Menu_RunSelectionWithCursorObject(), Sanctum_ChooseRestartOption(), and UiTextResource_Release().
| void SelectionScreen_LoadLargeIcon | ( | void | ) |
Loads the large icon of the command under the cursor, zooming in.
Definition at line 1264 of file selection.c.
Referenced by MenuSelection_BuildEntries(), SelectionScreen_HighlightIcon(), and SelectionScreen_LoadLargeIcon().
| void Resource_ResetPendingTransfer | ( | void | ) |
Frees the large command icon, if it is shown.
The large preview owns a cache slot independently of the visible row icons.
Definition at line 1300 of file selection.c.
Referenced by Menu_ConfirmSelection(), Resource_ResetOwnerEntries(), and Resource_ResetPendingTransfer().
| s32 Menu_RunTopSelection | ( | void | ) |
Runs the field menu until the player picks something that leaves it, and returns that choice's result.
Definition at line 1316 of file selection.c.
Referenced by Menu_RunTopSelection().
| void UiWindow_OpenMode1AndWaitFrame | ( | void | ) |
Opens the field menu's window and waits a frame.
Definition at line 1383 of file selection.c.
Referenced by Menu_AnimateSelectionToEntry(), Menu_RunTopSelection(), and UiWindow_OpenMode1AndWaitFrame().
| void UiWork_CloseAndRelease | ( | void | ) |
Closes the window kept in heap block 16 and frees the block.
Definition at line 1389 of file selection.c.
Referenced by Menu_AnimateSelectionToEntry(), Menu_RunTopSelection(), and UiWork_CloseAndRelease().
| UNUSED void SelectionScreen_CreateEmpty | ( | void | ) |
Sets up an empty selection screen and waits a frame.
Nothing calls it.
Definition at line 1393 of file selection.c.
Referenced by SelectionScreen_CreateEmpty().
Runs a selection row with the cursor on entry initialIndex, cancellable, and returns the entry chosen or -1.
initialIndex is a row index; cancellation returns -1 encoded as u32.
Definition at line 1402 of file selection.c.
Referenced by Menu_RunSelectionForValue().