Skip to Content
The Alchemy Project

src/window/window_selection.c

The selection screen: a row of icons along the bottom of the screen with the name of the one under the cursor in a window above it, arrows at its ends when the list runs past them, the icons already chosen gathered at the top left, and in battle the spinning cursor over the target. More…

Included by window.c.

Macros

NameDescription
#defineSELECTION_ICON_SPACING 16The selection row's icons stand 16 pixels apart.
#defineSELECTION_ROW_SHOWN 5The row shows five entries at a time, from its seven icon records; the icons chosen so far take five more.
#defineSELECTION_ROW_RECORDS 7
#defineSELECTION_CHOSEN_RECORDS 5
#defineNAME_WINDOW_FLAGS (WINDOW_FLAG_INSTANT | WINDOW_FLAG_UNREAD)The flags the name window opens with, which mnWindowCreate keeps only WINDOW_FLAG_INSTANT of.
#defineSELECTION_ROW_HIDDEN 32SELECTION_MENU_STATE.verticalScroll as the screen is made: the row's icons drawn 32 pixels lower, below the bottom of the screen, and the cursor held still, until mnSelectionMenuClear readies the list.
#defineSELECTION_YES_NO_AT_BOTTOM 999SELECTION_MENU_STATE.locked as the screen is made and once a yes or no window has opened: nonzero keeps a yes or no row and its window at the bottom of the screen, as mnRunSelectionForValue's 1 does.
#defineLARGE_ICON_ZOOM_STEP 40The large icon's zoom: it opens at this scale (in 8.8) and grows by as much a tick up to six times it.
#defineARROW_FRAME_BYTES (2 * TILE_SIZE_8BPP)One frame of an end arrow's animation: an 8x16 sprite of 256 colours.
#defineCURSOR_FRAME_BYTES (4 * TILE_SIZE_8BPP)One frame of the spinning cursor's animation: a 16x16 sprite of 256 colours.
#defineSELECTION_FIXED 999The selection row's mode that only B leaves: the cursor stays and A chooses nothing.
#defineSELECTION_STATUS_SCROLLING 33The selection row's status while it scrolls, and once it shows.
#defineSELECTION_STATUS_SHOWN 1
#defineSELECTION_LAST_PLACE 4The row's last place, the fifth: the cursor stepping onto it with more entries to come scrolls the row instead.
#defineARROW_SCROLL_TICKS 8

Enumerations

NameDescription
enumanonymous enum { SELECTION_ARROW_LEFT, SELECTION_ARROW_RIGHT }The records of the arrows at the row's ends, before the row's (SELECTION_MENU_STATE.records): an arrow's kind is TRUE while it shows, and its base counts the ticks it stays nudged out after a scroll.

Functions

NameDescription
voidmnSelectionMenuCreate (void)Allocates and resets the selection screen: the row of icons the player picks from, with arrows at each end and the spinning cursor over the chosen target.
voidmnSelectionMenuClear (void)Empties the selection screen's list of entries.
voidmnSelectionMenuAddEntry (Uint32 kind, Uint32 base)Adds an entry (kind and id) to the selection screen's list, up to 16.
voidmnSelectionMenuBuildEntries (Uint32 unused)Creates the row's icons for the five listed entries from the first shown (top) on, along the bottom of the screen.
voidmnSelectionMenuReservedNoOperation (void)An empty function, reached only through a bare entry of the window stub table (window/stubs.s).
SELECTION_NODE *mnSelectionMenuFindFreeIcon (Sint32 kind)Returns a free selection icon record of kind (SELECTION_ICON_GROUP), or NULL.
voidmnSelectionMenuStartDrawing (void)Starts drawing the selection screen each tick, in the tick pass (EVENT_PASS_TICK).
voidmnSelectionMenuStopDrawing (void)Stops drawing the selection screen.
voidmnSelectionMenuDraw (void)The selection screen's per-tick event: slides and draws the row of icons, the large icon over the chosen one, the end arrows, the icons already chosen and the spinning cursor.
voidmnSelectionMenuDrawArrow (SELECTION_MENU_STATE *state, Sint32 side)Draws the selection screen's left (index 0) or right (1) arrow, nudged outwards while it flashes after a scroll: the record's base holds the ticks left of the nudge (8 after each scroll) and is the nudge in pixels.
voidmnSelectionMenuOpenNameWindow (Sint32 kind, Uint32 nameWidth)Opens or refits the name window above the selection row, nameWidth tiles inside (0 keeps an open window's width), and writes the name of the icon under the cursor, or for an empty list of kind "You don't know it." (ICON_KIND_ABILITY) or "You don't have it." (ICON_KIND_ITEM).
voidmnSelectionMenuClose (void)Closes the selection screen and frees its icons, tiles and state block.
voidmnSelectionMenuSetPos (Uint32 x, Uint32 y)Moves the row of icons to start at pixel (x, y), 16 pixels apart.
voidmnSetupSelectionBothSides (void)Sets up both end arrows of the selection row.
voidmnSelectionMenuSetupArrow (SELECTION_MENU_STATE *state, Sint32 side)Sets up the left (index 0) or right (1) arrow of the selection row, shown when there are entries beyond that end.
SELECTION_NODE *mnSelectionMenuGetCursorNode (SELECTION_MENU_STATE *state)Returns the row icon under the cursor, cursorIndex counting from the first icon shown (head), not from the list's first entry.
Sint32mnSelectionMenuRun (Sint32 mode)Runs the selection row until the player chooses (the chosen entry's index) or, when mode allows it, cancels with B (-1).
Uint32mnSelectionMenuRunWithSounds (Uint32 mode)mnSelectionMenuRun with the menu's sounds: the cursor's move, a confirm, and on a yes or no row a cancel for no; B, when mode allows it, cancels with its sound.
voidmnMoveSelectionForward (SELECTION_MENU_STATE *state)Moves the cursor one entry right, scrolling the row at its fourth place.
voidmnMoveSelectionBackward (SELECTION_MENU_STATE *state)Moves the cursor one entry left, scrolling the row at its second place.
voidmnSelectionMenuStepRight (SELECTION_MENU_STATE *state)Moves the cursor one entry right, scrolling the row at its edge and wrapping from the last entry to the first.
voidmnSelectionMenuStepLeft (SELECTION_MENU_STATE *state)Moves the cursor one entry left, scrolling the row at its edge and wrapping from the first entry to the last.
voidmnSelectionMenuRedrawIcon (SELECTION_MENU_STATE *state, Uint32 rowIndex)Redraws the command icon at row place rowIndex in its plain state, in its own VRAM cache entry.
voidmnSelectionMenuHighlightIcon (SELECTION_MENU_STATE *state, Uint32 rowIndex)Redraws the command icon at row place rowIndex and loads its large icon.
voidmnClearBattleHighlight (SELECTION_MENU_STATE *state)Stops the battle engine's highlight of units as an entry is chosen (mnConfirmSelection).
voidmnSelectionMenuScroll (SELECTION_MENU_STATE *state, Sint32 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.
Sint32mnSelectionIconLoad (Sint32 kind, Sint32 entry)Loads the icon of entry, of kind (ICON_KIND_COMMAND, ICON_KIND_YES_NO, ICON_KIND_ITEM, ICON_KIND_ABILITY or ICON_KIND_TABLE_ENTRY), into a free sprite tile slot and returns it, or -1.
Sint32mnSelectionIconLoadIntoSlot (Sint32 kind, Sint32 entry, Sint32 slot, Sint32 baseIcon)Loads the icon of entry, of kind (ICON_KIND), into sprite tile slot slot (a free one when -1), over the frame or base baseIcon where the kind takes one, and returns the slot, or -1 when none was free.
voidmnSelectionMenuSetupIcon (Uint32 kind, Sint32 base, SELECTION_NODE *node, Sint32 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.
Uint32mnConfirmSelection (SELECTION_MENU_STATE *state)Chooses the entry under the cursor: the other icons gather into it and vanish, and it joins the chosen icons at the top left.
voidmnArrowNoOperation1 (void)Six empty functions, written ahead of the arrow's own routines.
voidmnArrowNoOperation2 (void)
voidmnArrowNoOperation3 (void)
voidmnArrowNoOperation4 (void)
voidmnArrowNoOperation5 (void)
voidmnArrowNoOperation6 (void)
voidmnArrowCreate (MENU_SPR *sprite, Sint32 *slot)Sets up a sprite as the right-pointing arrow, in a free tile slot (returned in *slot).
voidmnArrowSetPos (MENU_SPR *sprite, Sint32 x, Sint32 y)Places an arrow sprite at screen pixel (x, y) and queues it for drawing this tick, at depth slot 252; the caller calls it every tick it shows.
voidmnArrowRelease (Sint32 slot)Frees an arrow sprite's tile slot.
voidmnSelectionMenuLoadLargeIcon (void)Loads the large icon of the command under the cursor, zooming in: 32x32 in 256 colours, its scale stepping up by LARGE_ICON_ZOOM_STEP a tick, after which mnSelectionMenuDraw shows it at its own size.
voidmnSelectionMenuFreeLargeIcon (void)Frees the large command icon, if it is shown.
Sint32mnFieldMenuRun (void)Runs the field menu until the player picks something that leaves it, and returns the chosen screen's result.
voidmnPartyStatusOpenAndWait (void)Opens the party status window that shows with the field menu, with its PP row (flags 1), and waits a tick.
voidmnPartyStatusCloseWithMenu (void)Closes the party status window that shows with the field menu and frees its state block (PartyStatusState).
voidmnSelectionMenuCreateEmpty (void)Sets up an empty selection screen and waits a tick.
Uint32mnRunSelectionForValue (Uint32 initIndex)Runs a selection row with the cursor on entry initIndex, cancellable, and returns the entry chosen or -1. initIndex is a row index; cancellation returns -1 encoded as Uint32.

Description

The selection screen: a row of icons along the bottom of the screen with the name of the one under the cursor in a window above it, arrows at its ends when the list runs past them, the icons already chosen gathered at the top left, and in battle the spinning cursor over the target. Also the field menu's loop, which runs the Psynergy, Djinn, Item and Status screens. Part of window.c.

Macros in detail

SELECTION_ICON_SPACING

#define SELECTION_ICON_SPACING 16

The selection row's icons stand 16 pixels apart.

Referenced by mnConfirmSelection(), mnSelectionMenuBuildEntries(), mnSelectionMenuScroll(), mnSelectionMenuSetPos(), mnSelectionMenuSetupArrow(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().

Definition at line 11 of file window_selection.c.

SELECTION_ROW_SHOWN

#define SELECTION_ROW_SHOWN 5

The row shows five entries at a time, from its seven icon records; the icons chosen so far take five more.

Referenced by mnRunSelectionForValue(), mnSelectionMenuBuildEntries(), mnSelectionMenuSetupArrow(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().

Definition at line 14 of file window_selection.c.

SELECTION_ROW_RECORDS

#define SELECTION_ROW_RECORDS 7

Referenced by mnSelectionMenuFindFreeIcon().

Definition at line 15 of file window_selection.c.

SELECTION_CHOSEN_RECORDS

#define SELECTION_CHOSEN_RECORDS 5

Referenced by mnSelectionMenuCreate() and mnSelectionMenuFindFreeIcon().

Definition at line 16 of file window_selection.c.

NAME_WINDOW_FLAGS

#define NAME_WINDOW_FLAGS (WINDOW_FLAG_INSTANT | WINDOW_FLAG_UNREAD)

The flags the name window opens with, which mnWindowCreate keeps only WINDOW_FLAG_INSTANT of. A yes or no window opens with its kind, ICON_KIND_YES_NO, as its flags, which come to the same.

Referenced by mnSelectionMenuOpenNameWindow().

Definition at line 30 of file window_selection.c.

SELECTION_ROW_HIDDEN

#define SELECTION_ROW_HIDDEN 32

SELECTION_MENU_STATE.verticalScroll as the screen is made: the row's icons drawn 32 pixels lower, below the bottom of the screen, and the cursor held still, until mnSelectionMenuClear readies the list.

Referenced by mnSelectionMenuCreate().

Definition at line 35 of file window_selection.c.

SELECTION_YES_NO_AT_BOTTOM

#define SELECTION_YES_NO_AT_BOTTOM 999

SELECTION_MENU_STATE.locked as the screen is made and once a yes or no window has opened: nonzero keeps a yes or no row and its window at the bottom of the screen, as mnRunSelectionForValue's 1 does.

Referenced by mnSelectionMenuCreate() and mnSelectionMenuOpenNameWindow().

Definition at line 40 of file window_selection.c.

LARGE_ICON_ZOOM_STEP

#define LARGE_ICON_ZOOM_STEP 40

The large icon's zoom: it opens at this scale (in 8.8) and grows by as much a tick up to six times it.

Referenced by mnSelectionMenuLoadLargeIcon().

Definition at line 44 of file window_selection.c.

ARROW_FRAME_BYTES

#define ARROW_FRAME_BYTES (2 * TILE_SIZE_8BPP)

One frame of an end arrow's animation: an 8x16 sprite of 256 colours.

Referenced by mnArrowCreate(), mnSelectionMenuDrawArrow() and mnSelectionMenuSetupArrow().

Definition at line 47 of file window_selection.c.

CURSOR_FRAME_BYTES

#define CURSOR_FRAME_BYTES (4 * TILE_SIZE_8BPP)

One frame of the spinning cursor's animation: a 16x16 sprite of 256 colours.

Referenced by mnSelectionMenuCreate() and mnSelectionMenuDraw().

Definition at line 49 of file window_selection.c.

SELECTION_FIXED

#define SELECTION_FIXED 999

The selection row's mode that only B leaves: the cursor stays and A chooses nothing.

Referenced by mnSelectionMenuRun() and mnSelectionMenuRunWithSounds().

Definition at line 749 of file window_selection.c.

SELECTION_STATUS_SCROLLING

#define SELECTION_STATUS_SCROLLING 33

The selection row's status while it scrolls, and once it shows. Each tick drawn adds 1 to it, and nothing reads it.

Referenced by mnConfirmSelection(), mnMoveSelectionBackward(), mnMoveSelectionForward(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().

Definition at line 753 of file window_selection.c.

SELECTION_STATUS_SHOWN

#define SELECTION_STATUS_SHOWN 1

Referenced by mnMoveSelectionBackward(), mnMoveSelectionForward(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().

Definition at line 754 of file window_selection.c.

SELECTION_LAST_PLACE

#define SELECTION_LAST_PLACE 4

The row's last place, the fifth: the cursor stepping onto it with more entries to come scrolls the row instead.

Referenced by mnMoveSelectionForward(), mnSelectionMenuScroll(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().

Definition at line 758 of file window_selection.c.

ARROW_SCROLL_TICKS

#define ARROW_SCROLL_TICKS 8

Referenced by mnMoveSelectionBackward(), mnMoveSelectionForward(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().

Definition at line 759 of file window_selection.c.

Enumerations in detail

anonymous enum

enum { SELECTION_ARROW_LEFT, SELECTION_ARROW_RIGHT }

The records of the arrows at the row's ends, before the row's (SELECTION_MENU_STATE.records): an arrow's kind is TRUE while it shows, and its base counts the ticks it stays nudged out after a scroll.

EnumeratorValueDescription
SELECTION_ARROW_LEFT0
SELECTION_ARROW_RIGHT1

Definition at line 21 of file window_selection.c.

Functions in detail

mnSelectionMenuCreate

void mnSelectionMenuCreate(void)

Allocates and resets the selection screen: the row of icons the player picks from, with arrows at each end and the spinning cursor over the chosen target.

References MenuAnimatedCursorTiles, Sint32, state, syHeapSlotAllocateEWRAM(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Referenced by mnSelectionMenuCreateEmpty().

Definition at line 53 of file window_selection.c.

mnSelectionMenuClear

void mnSelectionMenuClear(void)

Empties the selection screen's list of entries. After an entry has been chosen (SELECTION_CURSOR_RESET), the next list starts again from its first entry.

References state.

Referenced by mnSelectionMenuCreateEmpty().

Definition at line 106 of file window_selection.c.

mnSelectionMenuAddEntry

void mnSelectionMenuAddEntry(Uint32 kind, Uint32 base)

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.

References state.

Definition at line 124 of file window_selection.c.

mnSelectionMenuBuildEntries

void mnSelectionMenuBuildEntries(Uint32 unused)

Creates the row's icons for the five listed entries from the first shown (top) on, along the bottom of the screen.

References mnSelectionMenuFindFreeIcon(), mnSelectionMenuLoadLargeIcon(), mnSelectionMenuSetupIcon(), Sint32 and state.

Referenced by mnRunSelectionForValue().

Definition at line 139 of file window_selection.c.

mnSelectionMenuReservedNoOperation

void mnSelectionMenuReservedNoOperation(void)

An empty function, reached only through a bare entry of the window stub table (window/stubs.s).

Definition at line 203 of file window_selection.c.

mnSelectionMenuFindFreeIcon

SELECTION_NODE *mnSelectionMenuFindFreeIcon(Sint32 kind)

Returns a free selection icon record of kind (SELECTION_ICON_GROUP), or NULL.

References Sint32 and state.

Referenced by mnConfirmSelection(), mnSelectionMenuBuildEntries() and mnSelectionMenuScroll().

Definition at line 209 of file window_selection.c.

mnSelectionMenuStartDrawing

void mnSelectionMenuStartDrawing(void)

Starts drawing the selection screen each tick, in the tick pass (EVENT_PASS_TICK).

References mnSelectionMenuDraw() and sySetEvent().

Referenced by mnRunSelectionForValue().

Definition at line 236 of file window_selection.c.

mnSelectionMenuStopDrawing

void mnSelectionMenuStopDrawing(void)

Stops drawing the selection screen.

References mnSelectionMenuDraw() and syCloseEvent().

Referenced by mnSelectionMenuClose().

Definition at line 242 of file window_selection.c.

mnSelectionMenuDraw

void mnSelectionMenuDraw(void)

The selection screen's per-tick event: slides and draws the row of icons, the large icon over the chosen one, the end arrows, the icons already chosen and the spinning cursor.

References btMotionProjectScaledPosStub(), fdScreenPointCoordinates(), FrameCount, gmFlagGetStub(), MenuAnimatedCursorTiles, MenuCursorBobOffsets, mnSelectionMenuDrawArrow(), mnSelectionMenuGetCursorNode(), Sint32, state, syOAMAddSpriteAtDepth(), syOAMMatrixAllocateFromTransform() and syVRAMCacheLoad().

Referenced by mnSelectionMenuStartDrawing() and mnSelectionMenuStopDrawing().

Definition at line 250 of file window_selection.c.

mnSelectionMenuDrawArrow

void mnSelectionMenuDrawArrow(SELECTION_MENU_STATE *state, Sint32 side)

Draws the selection screen's left (index 0) or right (1) arrow, nudged outwards while it flashes after a scroll: the record's base holds the ticks left of the nudge (8 after each scroll) and is the nudge in pixels.

References FrameCount, gmFlagGetStub(), MenuCursorActorTiles, MenuCursorLeftActorTiles, Sint32, state, syOAMAddSpriteAtDepth() and syVRAMCacheLoad().

Referenced by mnSelectionMenuDraw().

Definition at line 495 of file window_selection.c.

mnSelectionMenuOpenNameWindow

void mnSelectionMenuOpenNameWindow(Sint32 kind, Uint32 nameWidth)

Opens or refits the name window above the selection row, nameWidth tiles inside (0 keeps an open window's width), and writes the name of the icon under the cursor, or for an empty list of kind "You don't know it." (ICON_KIND_ABILITY) or "You don't have it." (ICON_KIND_ITEM).

References mnSelectionMenuGetCursorNode(), mnTextDrawMessageAsTiles(), mnWindowClose(), mnWindowCreate(), mnWindowSpritePrepareForRedraw(), Sint32 and state.

Referenced by mnMoveSelectionBackward(), mnMoveSelectionForward(), mnRunSelectionForValue(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().

Definition at line 538 of file window_selection.c.

mnSelectionMenuClose

void mnSelectionMenuClose(void)

Closes the selection screen and frees its icons, tiles and state block.

References mnSelectionMenuFreeLargeIcon(), mnSelectionMenuStopDrawing(), mnWindowClose(), state, syHeapSlotRelease(), sySynch() and syVRAMCacheFreeEntry().

Referenced by mnRunSelectionForValue().

Definition at line 609 of file window_selection.c.

mnSelectionMenuSetPos

void mnSelectionMenuSetPos(Uint32 x, Uint32 y)

Moves the row of icons to start at pixel (x, y), 16 pixels apart.

References state.

Definition at line 653 of file window_selection.c.

mnSetupSelectionBothSides

void mnSetupSelectionBothSides(void)

Sets up both end arrows of the selection row.

References mnSelectionMenuSetupArrow() and state.

Referenced by mnRunSelectionForValue().

Definition at line 673 of file window_selection.c.

mnSelectionMenuSetupArrow

void mnSelectionMenuSetupArrow(SELECTION_MENU_STATE *state, Sint32 side)

Sets up the left (index 0) or right (1) arrow of the selection row, shown when there are entries beyond that end.

References MenuCursorActorTiles, MenuCursorLeftActorTiles, Sint32, state, syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Referenced by mnSetupSelectionBothSides().

Definition at line 684 of file window_selection.c.

mnSelectionMenuGetCursorNode

SELECTION_NODE *mnSelectionMenuGetCursorNode(SELECTION_MENU_STATE *state)

Returns the row icon under the cursor, cursorIndex counting from the first icon shown (head), not from the list's first entry.

References Sint32 and state.

Referenced by mnSelectionMenuDraw(), mnSelectionMenuLoadLargeIcon() and mnSelectionMenuOpenNameWindow().

Definition at line 735 of file window_selection.c.

mnSelectionMenuRun

Sint32 mnSelectionMenuRun(Sint32 mode)

Runs the selection row until the player chooses (the chosen entry's index) or, when mode allows it, cancels with B (-1).

References mnConfirmSelection(), mnSelectionMenuHighlightIcon(), mnSelectionMenuStepLeft(), mnSelectionMenuStepRight(), PerPush, PerRepeat, Sint32, state and sySynch().

Definition at line 763 of file window_selection.c.

mnSelectionMenuRunWithSounds

Uint32 mnSelectionMenuRunWithSounds(Uint32 mode)

mnSelectionMenuRun with the menu's sounds: the cursor's move, a confirm, and on a yes or no row a cancel for no; B, when mode allows it, cancels with its sound.

References mnSelectionMenuStepLeft(), mnSelectionMenuStepRight(), PerPush, PerRepeat, state, sySoundPlayStub() and sySynch().

Referenced by mnRunSelectionForValue().

Definition at line 801 of file window_selection.c.

mnMoveSelectionForward

void mnMoveSelectionForward(SELECTION_MENU_STATE *state)

Moves the cursor one entry right, scrolling the row at its fourth place. This variant stops at the end; mnSelectionMenuStepRight also wraps around.

References mnSelectionMenuHighlightIcon(), mnSelectionMenuOpenNameWindow(), mnSelectionMenuRedrawIcon(), mnSelectionMenuScroll(), state and sySynch().

Definition at line 857 of file window_selection.c.

mnMoveSelectionBackward

void mnMoveSelectionBackward(SELECTION_MENU_STATE *state)

Moves the cursor one entry left, scrolling the row at its second place. This variant stops at the beginning; mnSelectionMenuStepLeft also wraps around.

References mnSelectionMenuHighlightIcon(), mnSelectionMenuOpenNameWindow(), mnSelectionMenuRedrawIcon(), mnSelectionMenuScroll(), state and sySynch().

Definition at line 891 of file window_selection.c.

mnSelectionMenuStepRight

void mnSelectionMenuStepRight(SELECTION_MENU_STATE *state)

Moves the cursor one entry right, scrolling the row at its edge and wrapping from the last entry to the first.

References mnSelectionMenuHighlightIcon(), mnSelectionMenuOpenNameWindow(), mnSelectionMenuRedrawIcon(), mnSelectionMenuScroll(), mnSelectionMenuSetupIcon(), Sint32, state and sySynch().

Referenced by mnSelectionMenuRun() and mnSelectionMenuRunWithSounds().

Definition at line 927 of file window_selection.c.

mnSelectionMenuStepLeft

void mnSelectionMenuStepLeft(SELECTION_MENU_STATE *state)

Moves the cursor one entry left, scrolling the row at its edge and wrapping from the first entry to the last.

References mnSelectionMenuHighlightIcon(), mnSelectionMenuOpenNameWindow(), mnSelectionMenuRedrawIcon(), mnSelectionMenuScroll(), mnSelectionMenuSetupIcon(), Sint32, state and sySynch().

Referenced by mnSelectionMenuRun() and mnSelectionMenuRunWithSounds().

Definition at line 1014 of file window_selection.c.

mnSelectionMenuRedrawIcon

void mnSelectionMenuRedrawIcon(SELECTION_MENU_STATE *state, Uint32 rowIndex)

Redraws the command icon at row place rowIndex in its plain state, in its own VRAM cache entry. Other kinds of icon are left alone.

References mnIconBuildCommandIconTiles() and state.

Referenced by mnConfirmSelection(), mnMoveSelectionBackward(), mnMoveSelectionForward(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().

Definition at line 1108 of file window_selection.c.

mnSelectionMenuHighlightIcon

void mnSelectionMenuHighlightIcon(SELECTION_MENU_STATE *state, Uint32 rowIndex)

Redraws the command icon at row place rowIndex and loads its large icon.

References mnIconBuildCommandIconTiles(), mnSelectionMenuLoadLargeIcon() and state.

Referenced by mnMoveSelectionBackward(), mnMoveSelectionForward(), mnSelectionMenuRun(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().

Definition at line 1130 of file window_selection.c.

mnClearBattleHighlight

void mnClearBattleHighlight(SELECTION_MENU_STATE *state)

Stops the battle engine's highlight of units as an entry is chosen (mnConfirmSelection). The unit list is set only at its end, which HIGHLIGHT_OFF never reads.

References btHighlightSetModesStub(), Sint32 and state.

Referenced by mnConfirmSelection().

Definition at line 1155 of file window_selection.c.

mnSelectionMenuScroll

void mnSelectionMenuScroll(SELECTION_MENU_STATE *state, Sint32 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.

References mnSelectionMenuFindFreeIcon(), mnSelectionMenuSetupIcon(), Sint32, state, sySynch() and syVRAMCacheFreeEntry().

Referenced by mnMoveSelectionBackward(), mnMoveSelectionForward(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().

Definition at line 1172 of file window_selection.c.

mnSelectionIconLoad

Sint32 mnSelectionIconLoad(Sint32 kind, Sint32 entry)

Loads the icon of entry, of kind (ICON_KIND_COMMAND, ICON_KIND_YES_NO, ICON_KIND_ITEM, ICON_KIND_ABILITY or ICON_KIND_TABLE_ENTRY), into a free sprite tile slot and returns it, or -1.

References mnAbilityBuildIconTiles(), mnIconBuildCommandIconTiles(), mnItemIconLoadLayersIntoSlot(), mnTitleLoadFirstTile(), Sint32 and syVRAMCacheFindFreeEntry().

Referenced by mnWindowSpriteCreateFromResource().

Definition at line 1278 of file window_selection.c.

mnSelectionIconLoadIntoSlot

Sint32 mnSelectionIconLoadIntoSlot(Sint32 kind, Sint32 entry, Sint32 slot, Sint32 baseIcon)

Loads the icon of entry, of kind (ICON_KIND), into sprite tile slot slot (a free one when -1), over the frame or base baseIcon where the kind takes one, and returns the slot, or -1 when none was free.

References mnAbilityBuildIconTiles(), mnIconBuildCommandIconTiles(), mnIconBuildMiscellaneousIconTiles(), mnItemIconLoadLayersIntoSlot(), mnTitleLoadFirstTile(), Sint32 and syVRAMCacheFindFreeEntry().

Definition at line 1315 of file window_selection.c.

mnSelectionMenuSetupIcon

void mnSelectionMenuSetupIcon(Uint32 kind, Sint32 base, SELECTION_NODE *node, Sint32 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.

References mnAbilityBuildIconTiles(), mnIconBuildCommandIconTiles(), mnIconBuildItemIconTiles() and Sint32.

Referenced by mnSelectionMenuBuildEntries(), mnSelectionMenuScroll(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().

Definition at line 1361 of file window_selection.c.

mnConfirmSelection

Uint32 mnConfirmSelection(SELECTION_MENU_STATE *state)

Chooses the entry under the cursor: the other icons gather into it and vanish, and it joins the chosen icons at the top left.

References mnClearBattleHighlight(), mnSelectionMenuFindFreeIcon(), mnSelectionMenuFreeLargeIcon(), mnSelectionMenuRedrawIcon(), state, sySynch() and syVRAMCacheFreeEntry().

Referenced by mnSelectionMenuRun().

Definition at line 1415 of file window_selection.c.

mnArrowNoOperation1

void mnArrowNoOperation1(void)

Six empty functions, written ahead of the arrow's own routines. The second, third and sixth have entries in the window stub table (window/stubs.s) and no caller by name; nothing reaches the other three.

Definition at line 1523 of file window_selection.c.

mnArrowNoOperation2

void mnArrowNoOperation2(void)

Definition at line 1527 of file window_selection.c.

mnArrowNoOperation3

void mnArrowNoOperation3(void)

Definition at line 1531 of file window_selection.c.

mnArrowNoOperation4

void mnArrowNoOperation4(void)

Definition at line 1535 of file window_selection.c.

mnArrowNoOperation5

void mnArrowNoOperation5(void)

Definition at line 1539 of file window_selection.c.

mnArrowNoOperation6

void mnArrowNoOperation6(void)

Definition at line 1543 of file window_selection.c.

mnArrowCreate

void mnArrowCreate(MENU_SPR *sprite, Sint32 *slot)

Sets up a sprite as the right-pointing arrow, in a free tile slot (returned in *slot).

References MenuCursorActorTiles, Sint32, syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Referenced by mnDebugFlagEditorRun(), mnDebugSceneSelectRun() and scFieldMenuArrowCreate().

Definition at line 1549 of file window_selection.c.

mnArrowSetPos

void mnArrowSetPos(MENU_SPR *sprite, Sint32 x, Sint32 y)

Places an arrow sprite at screen pixel (x, y) and queues it for drawing this tick, at depth slot 252; the caller calls it every tick it shows.

References Sint32 and syOAMAddSpriteAtDepth().

Referenced by mnDebugFlagEditorRun(), mnDebugSceneSelectRun() and scFieldMenuArrowSetPos().

Definition at line 1568 of file window_selection.c.

mnArrowRelease

void mnArrowRelease(Sint32 slot)

Frees an arrow sprite's tile slot.

References Sint32 and syVRAMCacheFreeEntry().

Referenced by mnDebugFlagEditorRun(), mnDebugSceneSelectRun() and scSanctumChooseRestartOption().

Definition at line 1576 of file window_selection.c.

mnSelectionMenuLoadLargeIcon

void mnSelectionMenuLoadLargeIcon(void)

Loads the large icon of the command under the cursor, zooming in: 32x32 in 256 colours, its scale stepping up by LARGE_ICON_ZOOM_STEP a tick, after which mnSelectionMenuDraw shows it at its own size.

References mnSelectionMenuGetCursorNode(), Sint32, state, syDecompressByteLZ(), syHeapSlotAllocate(), syHeapSlotRelease(), syResourceGetTableEntry(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Referenced by mnSelectionMenuBuildEntries() and mnSelectionMenuHighlightIcon().

Definition at line 1584 of file window_selection.c.

mnSelectionMenuFreeLargeIcon

void mnSelectionMenuFreeLargeIcon(void)

Frees the large command icon, if it is shown.

References syVRAMCacheFreeEntry().

Referenced by mnConfirmSelection() and mnSelectionMenuClose().

Definition at line 1622 of file window_selection.c.

mnFieldMenuRun

Sint32 mnFieldMenuRun(void)

Runs the field menu until the player picks something that leaves it, and returns the chosen screen's result. Cancelling the menu returns an undefined value, the missing result of mnPartyStatusCloseWithMenu (0 under UBFIX); its one caller, fdEngineRun, ignores the result. Its case for command 0, which stores the cue tile ahead in the field state's examineMetatile, is unreachable.

References fdActorGetCueMetatileAheadOfCurrentStub(), fdEffectReleaseRevealSparklesStub(), mnDjinnMenuRunStub(), mnFieldMenuSelectCommand(), mnItemMenuRunStub(), mnPartyStatusCloseWithMenu(), mnPartyStatusOpenAndWait(), mnPsynergyMenuRunStub(), mnStatusScreenRunStub(), Sint32, state and sySynch().

Definition at line 1640 of file window_selection.c.

mnPartyStatusOpenAndWait

void mnPartyStatusOpenAndWait(void)

Opens the party status window that shows with the field menu, with its PP row (flags 1), and waits a tick.

References mnPartyStatusCreateWindow() and sySynch().

Referenced by mnAnimateSelectionToEntry() and mnFieldMenuRun().

Definition at line 1716 of file window_selection.c.

mnPartyStatusCloseWithMenu

void mnPartyStatusCloseWithMenu(void)

Closes the party status window that shows with the field menu and frees its state block (PartyStatusState).

References mnPartyStatusClose().

Referenced by mnAnimateSelectionToEntry() and mnFieldMenuRun().

Definition at line 1724 of file window_selection.c.

mnSelectionMenuCreateEmpty

void mnSelectionMenuCreateEmpty(void)

Sets up an empty selection screen and waits a tick.

References mnSelectionMenuClear(), mnSelectionMenuCreate() and sySynch().

Definition at line 1730 of file window_selection.c.

mnRunSelectionForValue

Uint32 mnRunSelectionForValue(Uint32 initIndex)

Runs a selection row with the cursor on entry initIndex, cancellable, and returns the entry chosen or -1. initIndex is a row index; cancellation returns -1 encoded as Uint32.

References mnSelectionMenuBuildEntries(), mnSelectionMenuClose(), mnSelectionMenuOpenNameWindow(), mnSelectionMenuRunWithSounds(), mnSelectionMenuStartDrawing(), mnSetupSelectionBothSides() and state.

Definition at line 1740 of file window_selection.c.