src/window/window_selection.c
The selection screen, the row of icons a command, item or Psynergy is picked from in battle and on the field, and the field menu. More…
Included by window.c.
Macros
| Name | Description | |
|---|---|---|
#define | SELECTION_ICON_SPACING 16 | The selection row's icons stand 16 pixels apart. |
#define | SELECTION_ROW_PLACES 5 | The row's places on screen, its icons (two more, for those sliding in and out) and the icons chosen so far. |
#define | SELECTION_ROW_ICONS 7 | |
#define | SELECTION_CHOSEN_ICONS 5 | |
#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. |
#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. |
#define | ARROW_PICTURE_BYTES (2 * TILE_SIZE_8BPP) | One picture of an end arrow's animation: an 8x16 sprite of 256 colours. |
#define | HAND_PICTURE_BYTES (4 * TILE_SIZE_8BPP) | One picture of the pointing hand's animation: a 16x16 sprite of 256 colours. |
#define | SELECTION_SIZE_8X16 0 | SELECTION_SPR.size, which with its shape gives a sprite's dimensions: the end arrows are 8x16 (OBJ_SHAPE_VERTICAL), the icons and the hand 16x16 and the large icon 32x32. |
#define | SELECTION_SIZE_16X16 1 | |
#define | SELECTION_SIZE_32X32 2 | |
#define | SELECTION_ARROW_HIDDEN ICON_KIND_NONE | An end arrow's record keeps in its kind whether the arrow shows. |
#define | SELECTION_ARROW_SHOWN 1 | |
#define | SELECTION_NO_CANCEL 0 | What the player may do on the row: choose without cancelling, choose or cancel with B, or only cancel. |
#define | SELECTION_CANCELLABLE 1 | |
#define | SELECTION_FIXED 999 | |
#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. |
#define | ARROW_SCROLL_TICKS 8 | |
#define | SELECTION_SCROLL_ON (state) | Scrolls the row one entry on under a cursor held at its last place: the right arrow is nudged outwards (mnSelectionMenuDrawArrow), and hides once the last entry is in the row; the left arrow shows. |
#define | SELECTION_SCROLL_BACK (state) | Scrolls the row one entry back under a cursor held at its second place: the left arrow is nudged outwards, and hides once the first entry is in the row; the right arrow shows. |
#define | LARGE_ICON_ZOOM_STEP 40 | The large icon's zoom: it opens at this scale (in 8.8) and grows by as much each tick until six steps, when mnSelectionMenuDraw shows it at its own size. |
Enumerations
| Name | Description | |
|---|---|---|
enum | SELECTION_ARROW { SELECTION_ARROW_LEFT, SELECTION_ARROW_RIGHT } | The arrows at the row's ends: their records in SELECTION_MENU_STATE.records, and the side mnSelectionMenuSetupArrow and mnSelectionMenuDrawArrow take. |
Functions
| Name | Description | |
|---|---|---|
Sint32 | mnSelectionMenuFindFreeIcon (Sint32 kind) | Called before their definitions. |
void | mnSelectionMenuLoadLargeIcon (void) | Loads the large icon of the command under the cursor, zooming in: 32x32 in 256 colours (SELECTION_RECORD_LARGE_ICON), its scale growing by LARGE_ICON_ZOOM_STEP a tick. |
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 pointing hand. |
void | mnSelectionMenuDrawArrow (SELECTION_MENU_STATE *state, Sint32 side) | Draws the selection screen's left or right arrow (SELECTION_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. |
void | mnSelectionMenuSetupArrow (SELECTION_MENU_STATE *state, Sint32 index) | Sets up the left or right arrow of the selection row (SELECTION_ARROW), shown when there are entries beyond that end. |
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. |
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. |
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. |
void | mnSelectionMenuHighlightIcon (SELECTION_MENU_STATE *state, Uint32 rowIndex) | Redraws the command icon at row place rowIndex and loads its large icon. |
void | mnSelectionMenuScroll (SELECTION_MENU_STATE *screen, 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. |
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. |
Uint32 | mnConfirmSelection (SELECTION_MENU_STATE *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. |
void | mnPartyStatusOpenAndWait (void) | Opens the party status window, with its PP row, that shows with the field menu and waits a tick. |
void | mnSelectionMenuCreate (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, whose picture takes a VRAM cache entry. |
void | mnSelectionMenuClear (void) | Empties the selection screen's list of entries; after an entry was chosen (SELECTION_CURSOR_RESET) the next list starts again from its first entry. |
void | mnSelectionMenuAddEntry (Uint32 kind, Uint32 base) | Adds an entry to the selection screen's list, up to SELECTION_MENU_ENTRY_LIMIT. |
void | mnSelectionMenuBuildEntries (Uint32 unused) | Makes the icons of the listed entries from top, as many as the row's places, in a row along the bottom of the screen, and loads the large icon of the one under the cursor. |
void | mnSelectionMenuReservedNoOperation (void) | Does nothing; reached only through the window stub table. |
void | mnSelectionMenuStartDrawing (void) | Draws the selection screen once a tick from now on, as an event of the tick pass (EVENT_PASS_TICK). |
void | mnSelectionMenuStopDrawing (void) | Stops drawing the selection screen. |
void | mnSelectionMenuOpenNameWindow (Sint32 kind, Uint32 count) | Opens or refits the name window above the selection row and writes the name of the icon under the cursor, or, for an empty list of kind (ICON_KIND), that no Psynergy is known or no item held. |
void | mnSelectionMenuClose (void) | Closes the selection screen and frees its icons, tiles and state. |
void | mnSelectionMenuSetPos (Uint32 x, Uint32 y) | Moves the row of icons to start at pixel (x, y), 16 pixels apart. |
void | mnSetupSelectionBothSides (void) | Sets up both end arrows of the selection row. |
SELECTION_NODE * | mnSelectionMenuGetCursorNode (SELECTION_MENU_STATE *screen) | Returns the icon under the cursor: the row's icon at place cursorIndex. |
Sint32 | mnSelectionMenuRun (Sint32 controls) | Runs the selection row until the player chooses (the chosen entry's index) or, when controls allows it, cancels with B (-1). |
Uint32 | mnSelectionMenuRunWithSounds (Uint32 controls) | As mnSelectionMenuRun, with the menu sounds. |
void | mnMoveSelectionForward (SELECTION_MENU_STATE *screen) | Unused: moves the cursor one entry right, scrolling the row at its last place; it stops at the end, where mnSelectionMenuStepRight wraps around. |
void | mnMoveSelectionBackward (SELECTION_MENU_STATE *screen) | Moves the cursor one entry left, scrolling the row at its second place; it stops at the beginning, where mnSelectionMenuStepLeft wraps around. |
void | mnClearBattleHighlight (SELECTION_MENU_STATE *screen) | Stops the battle's highlight of units (HIGHLIGHT_OFF) as an entry is chosen. |
Sint32 | mnSelectionIconLoad (Uint32 kind, Sint32 value) | Loads the icon of an entry of kind (ICON_KIND: a command, a yes or no, an item or a Psynergy) into a free sprite tile slot and returns the slot, or -1 when none was free or kind is another. |
Sint32 | mnSelectionIconLoadIntoSlot (Sint32 kind, Sint32 value, Sint32 slot, Sint32 option) | Loads the icon of an entry of kind (ICON_KIND) into sprite tile slot slot (a free one when -1) and returns the slot, or -1 when none was free. |
void | mnArrowNoOperation1 (void) | Six empty functions, written ahead of the menu arrow's routines and told apart only by their place. |
void | mnArrowNoOperation2 (void) | Does nothing. |
void | mnArrowNoOperation3 (void) | Does nothing. |
void | mnArrowNoOperation4 (void) | |
void | mnArrowNoOperation5 (void) | |
void | mnArrowNoOperation6 (void) | Does nothing. |
void | mnArrowCreate (MENU_SPR *sprite, Sint32 *slot) | Sets up a sprite as the right-pointing arrow, in a free VRAM cache entry returned in *slot, which mnArrowRelease frees. |
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 OAM_DEPTH_FRONT - 3; the caller calls it every tick it shows. |
void | mnArrowRelease (Sint32 slot) | Frees an arrow sprite's tile slot. |
void | mnSelectionMenuFreeLargeIcon (void) | Frees the large icon's VRAM cache entry, if it holds one, and marks it empty. |
Sint32 | mnFieldMenuSelectCommand (Sint32) | The field menu's row of commands (screens_icon_menu.c), which returns the one chosen. |
Sint32 | mnFieldMenuRun (void) | Runs the field menu until the player picks something that leaves it, and returns the chosen screen's result. |
void | mnPartyStatusCloseWithMenu (void) | Closes the party status window that shows with the field menu. |
void | mnSelectionMenuCreateEmpty (void) | Sets up an empty selection screen and waits a tick. |
Uint32 | mnRunSelectionForValue (Uint32 initIndex) | Runs a selection row with the cursor on entry initIndex, cancellable, and returns the entry chosen or -1. |
Variables
| Name | Description | |
|---|---|---|
extern Uint8 | MenuCursorActorTiles [], MenuCursorLeftActorTiles[] | The pictures of the selection row's right and left arrows (sprite_cursors.list.tsv). |
Description
The selection screen, the row of icons a command, item or Psynergy is picked
from in battle and on the field, and the field menu. 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 26 of file window_selection.c.
SELECTION_ROW_PLACES
#define SELECTION_ROW_PLACES 5
The row's places on screen, its icons (two more, for those sliding in and out) and the icons chosen so far.
Referenced by mnSelectionMenuBuildEntries(), mnSelectionMenuSetupArrow(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().
Definition at line 30 of file window_selection.c.
SELECTION_ROW_ICONS
#define SELECTION_ROW_ICONS 7
Referenced by mnSelectionMenuFindFreeIcon().
Definition at line 31 of file window_selection.c.
SELECTION_CHOSEN_ICONS
#define SELECTION_CHOSEN_ICONS 5
Referenced by mnSelectionMenuCreate() and mnSelectionMenuFindFreeIcon().
Definition at line 32 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 45 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 50 of file window_selection.c.
ARROW_PICTURE_BYTES
#define ARROW_PICTURE_BYTES (2 * TILE_SIZE_8BPP)
One picture of an end arrow's animation: an 8x16 sprite of 256 colours.
Referenced by mnArrowCreate(), mnSelectionMenuDrawArrow() and mnSelectionMenuSetupArrow().
Definition at line 57 of file window_selection.c.
HAND_PICTURE_BYTES
#define HAND_PICTURE_BYTES (4 * TILE_SIZE_8BPP)
One picture of the pointing hand's animation: a 16x16 sprite of 256 colours.
Referenced by mnSelectionMenuCreate() and mnSelectionMenuDraw().
Definition at line 59 of file window_selection.c.
SELECTION_SIZE_8X16
#define SELECTION_SIZE_8X16 0
SELECTION_SPR.size, which with its shape gives a sprite's dimensions: the end
arrows are 8x16 (OBJ_SHAPE_VERTICAL), the icons and the hand 16x16 and the
large icon 32x32.
Referenced by mnSelectionMenuSetupArrow().
Definition at line 64 of file window_selection.c.
SELECTION_SIZE_16X16
#define SELECTION_SIZE_16X16 1
Referenced by mnConfirmSelection(), mnSelectionMenuCreate() and mnSelectionMenuSetupIcon().
Definition at line 65 of file window_selection.c.
SELECTION_SIZE_32X32
#define SELECTION_SIZE_32X32 2
Referenced by mnSelectionMenuDraw().
Definition at line 66 of file window_selection.c.
SELECTION_ARROW_HIDDEN
#define SELECTION_ARROW_HIDDEN ICON_KIND_NONE
An end arrow's record keeps in its kind whether the arrow shows.
Referenced by mnConfirmSelection(), mnSelectionMenuCreate(), mnSelectionMenuDrawArrow(), mnSelectionMenuSetupArrow() and mnSelectionMenuStepRight().
Definition at line 69 of file window_selection.c.
SELECTION_ARROW_SHOWN
#define SELECTION_ARROW_SHOWN 1
Referenced by mnSelectionMenuSetupArrow(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().
Definition at line 70 of file window_selection.c.
SELECTION_NO_CANCEL
#define SELECTION_NO_CANCEL 0
What the player may do on the row: choose without cancelling, choose or cancel with B, or only cancel.
Referenced by mnSelectionMenuRun() and mnSelectionMenuRunWithSounds().
Definition at line 775 of file window_selection.c.
SELECTION_CANCELLABLE
#define SELECTION_CANCELLABLE 1
Referenced by mnRunSelectionForValue().
Definition at line 776 of file window_selection.c.
SELECTION_FIXED
#define SELECTION_FIXED 999
Referenced by mnSelectionMenuRun() and mnSelectionMenuRunWithSounds().
Definition at line 777 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 781 of file window_selection.c.
ARROW_SCROLL_TICKS
#define ARROW_SCROLL_TICKS 8
Definition at line 782 of file window_selection.c.
SELECTION_SCROLL_ON
#define SELECTION_SCROLL_ON(state)
Scrolls the row one entry on under a cursor held at its last place: the right
arrow is nudged outwards (mnSelectionMenuDrawArrow), and hides once the last
entry is in the row; the left arrow shows. mnMoveSelectionForward and
mnSelectionMenuStepRight both scroll by it.
Referenced by mnMoveSelectionForward() and mnSelectionMenuStepRight().
Definition at line 879 of file window_selection.c.
SELECTION_SCROLL_BACK
#define SELECTION_SCROLL_BACK(state)
Scrolls the row one entry back under a cursor held at its second place: the
left arrow is nudged outwards, and hides once the first entry is in the row;
the right arrow shows. mnMoveSelectionBackward and mnSelectionMenuStepLeft
both scroll by it.
Referenced by mnMoveSelectionBackward() and mnSelectionMenuStepLeft().
Definition at line 892 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
each tick until six steps, when mnSelectionMenuDraw shows it at its own size.
Referenced by mnSelectionMenuLoadLargeIcon().
Definition at line 1581 of file window_selection.c.
Enumerations in detail
SELECTION_ARROW
enum SELECTION_ARROW
The arrows at the row's ends: their records in SELECTION_MENU_STATE.records,
and the side mnSelectionMenuSetupArrow and mnSelectionMenuDrawArrow take.
| Enumerator | Value | Description |
|---|---|---|
SELECTION_ARROW_LEFT | 0 | |
SELECTION_ARROW_RIGHT | 1 |
Definition at line 36 of file window_selection.c.
Functions in detail
mnSelectionMenuFindFreeIcon
Sint32 mnSelectionMenuFindFreeIcon(Sint32 kind)
Called before their definitions.
Returns a free selection icon record of kind (SELECTION_ICON_GROUP), or
NULL.
References Sint32.
Referenced by mnConfirmSelection(), mnSelectionMenuBuildEntries() and mnSelectionMenuScroll().
Definition at lines 8 and 237 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 (SELECTION_RECORD_LARGE_ICON), its scale growing by
LARGE_ICON_ZOOM_STEP a tick. Other kinds of entry show none. The icon keeps
its VRAM cache entry until mnSelectionMenuFreeLargeIcon.
References mnSelectionMenuGetCursorNode(), Sint32, syDecompressByteLZ(), syHeapSlotAllocate(), syHeapSlotRelease(), syResourceGetTableEntry(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().
Referenced by mnSelectionMenuBuildEntries() and mnSelectionMenuHighlightIcon().
Definition at lines 9 and 1587 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 pointing hand.
References btMotionProjectScaledPosStub(), FrameCount, MenuAnimatedCursorTiles, MenuCursorBobOffsets, mnSelectionMenuDrawArrow(), mnSelectionMenuGetCursorNode(), Sint32, syGameFlagGet(), syOAMAddSpriteAtDepth(), syOAMMatrixAllocateFromTransform() and syVRAMCacheLoad().
Referenced by mnSelectionMenuStartDrawing() and mnSelectionMenuStopDrawing().
Definition at lines 10 and 279 of file window_selection.c.
mnSelectionMenuDrawArrow
void mnSelectionMenuDrawArrow(SELECTION_MENU_STATE *state, Sint32 side)
Draws the selection screen's left or right arrow (SELECTION_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, MenuCursorActorTiles, Sint32, syGameFlagGet(), syOAMAddSpriteAtDepth() and syVRAMCacheLoad().
Referenced by mnSelectionMenuDraw().
Definition at lines 11 and 516 of file window_selection.c.
mnSelectionMenuSetupArrow
void mnSelectionMenuSetupArrow(SELECTION_MENU_STATE *state, Sint32 index)
void mnSelectionMenuSetupArrow(SELECTION_MENU_STATE *state, Sint32 side)
Sets up the left or right arrow of the selection row (SELECTION_ARROW), shown
when there are entries beyond that end. The first call takes the arrow's VRAM
cache entry; later calls only move it and decide whether it shows.
References MenuCursorActorTiles, Sint32, syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().
Referenced by mnSetupSelectionBothSides().
Definition at lines 12 and 711 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(), mnSelectionMenuSetupIcon(), Sint32 and sySynch().
Referenced by mnSelectionMenuRun() and mnSelectionMenuRunWithSounds().
Definition at lines 13 and 954 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(), mnSelectionMenuSetupIcon(), Sint32 and sySynch().
Referenced by mnSelectionMenuRun() and mnSelectionMenuRunWithSounds().
Definition at lines 14 and 1031 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().
Referenced by mnConfirmSelection(), mnMoveSelectionBackward(), mnMoveSelectionForward(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().
Definition at lines 15 and 1114 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. The
small icon is drawn the same as mnSelectionMenuRedrawIcon draws it; the
highlight is the large icon.
References mnIconBuildCommandIconTiles() and mnSelectionMenuLoadLargeIcon().
Referenced by mnMoveSelectionBackward(), mnMoveSelectionForward(), mnSelectionMenuRun(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().
Definition at lines 16 and 1137 of file window_selection.c.
mnSelectionMenuScroll
void mnSelectionMenuScroll(SELECTION_MENU_STATE *screen, 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. The icons move 2 pixels a tick, and the arriving and leaving icons zoom by an eighth a tick, so a scroll takes 8 ticks.
References mnSelectionMenuFindFreeIcon(), mnSelectionMenuSetupIcon(), Sint32, sySynch() and syVRAMCacheFreeEntry().
Definition at lines 17 and 1181 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. Items and Psynergy are drawn over
the icon base; the sprite is 16x16 at full size (Q_8_8(1)).
References mnAbilityBuildIconTiles(), mnIconBuildCommandIconTiles(), mnIconBuildItemIconTiles() and Sint32.
Referenced by mnSelectionMenuBuildEntries(), mnSelectionMenuScroll(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().
Definition at lines 18 and 1362 of file window_selection.c.
mnConfirmSelection
Uint32 mnConfirmSelection(SELECTION_MENU_STATE *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.
References mnClearBattleHighlight(), mnSelectionMenuFindFreeIcon(), mnSelectionMenuFreeLargeIcon(), mnSelectionMenuRedrawIcon(), sySynch() and syVRAMCacheFreeEntry().
Referenced by mnSelectionMenuRun().
Definition at lines 22 and 1415 of file window_selection.c.
mnPartyStatusOpenAndWait
void mnPartyStatusOpenAndWait(void)
Opens the party status window, with its PP row, that shows with the field menu and waits a tick.
References mnPartyStatusCreateWindow() and sySynch().
Referenced by mnAnimateSelectionToEntry() and mnFieldMenuRun().
Definition at lines 23 and 1710 of file window_selection.c.
mnSelectionMenuCreate
void mnSelectionMenuCreate(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,
whose picture takes a VRAM cache entry.
References MenuAnimatedCursorTiles, Sint32, syHeapSlotAllocateEWRAM(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().
Referenced by mnSelectionMenuCreateEmpty().
Definition at line 75 of file window_selection.c.
mnSelectionMenuClear
void mnSelectionMenuClear(void)
Empties the selection screen's list of entries; after an entry was chosen
(SELECTION_CURSOR_RESET) the next list starts again from its first entry.
Referenced by mnSelectionMenuCreateEmpty().
Definition at line 131 of file window_selection.c.
mnSelectionMenuAddEntry
void mnSelectionMenuAddEntry(Uint32 kind, Uint32 base)
Adds an entry to the selection screen's list, up to
SELECTION_MENU_ENTRY_LIMIT. The kinds mnSelectionMenuSetupIcon draws (enum
ICON_KIND) are ICON_KIND_COMMAND, ICON_KIND_YES_NO, ICON_KIND_ITEM and
ICON_KIND_ABILITY; base is the command's, item's or ability's number.
Definition at line 151 of file window_selection.c.
mnSelectionMenuBuildEntries
void mnSelectionMenuBuildEntries(Uint32 unused)
Makes the icons of the listed entries from top, as many as the row's places, in a row along the bottom of the screen, and loads the large icon of the one under the cursor.
References mnSelectionMenuFindFreeIcon(), mnSelectionMenuLoadLargeIcon(), mnSelectionMenuSetupIcon() and Sint32.
Referenced by mnRunSelectionForValue().
Definition at line 167 of file window_selection.c.
mnSelectionMenuReservedNoOperation
void mnSelectionMenuReservedNoOperation(void)
Does nothing; reached only through the window stub table.
Definition at line 231 of file window_selection.c.
mnSelectionMenuStartDrawing
void mnSelectionMenuStartDrawing(void)
Draws the selection screen once a tick from now on, as an event of the tick
pass (EVENT_PASS_TICK).
References mnSelectionMenuDraw() and sySetEvent().
Referenced by mnRunSelectionForValue().
Definition at line 265 of file window_selection.c.
mnSelectionMenuStopDrawing
void mnSelectionMenuStopDrawing(void)
Stops drawing the selection screen.
References mnSelectionMenuDraw() and syCloseEvent().
Referenced by mnSelectionMenuClose().
Definition at line 271 of file window_selection.c.
mnSelectionMenuOpenNameWindow
void mnSelectionMenuOpenNameWindow(Sint32 kind, Uint32 count)
Opens or refits the name window above the selection row and writes the name
of the icon under the cursor, or, for an empty list of kind (ICON_KIND), that
no Psynergy is known or no item held. A yes or no row (ICON_KIND_YES_NO) has
its window at the bottom or top of the screen. count is the name's width in
tiles inside the border; 0 keeps the open window as it is. The window stays
open until mnSelectionMenuClose closes it.
References mnSelectionMenuGetCursorNode(), mnTextDrawMessageAsTiles(), mnWindowClose(), mnWindowCreate(), mnWindowSpritePrepareForRedraw() and Sint32.
Referenced by mnMoveSelectionBackward(), mnMoveSelectionForward(), mnRunSelectionForValue(), mnSelectionMenuStepLeft() and mnSelectionMenuStepRight().
Definition at line 561 of file window_selection.c.
mnSelectionMenuClose
void mnSelectionMenuClose(void)
Closes the selection screen and frees its icons, tiles and state. The chosen icons go too, so the choices are only in the indexes the loops returned.
References mnSelectionMenuFreeLargeIcon(), mnSelectionMenuStopDrawing(), mnWindowClose(), syHeapSlotRelease(), sySynch() and syVRAMCacheFreeEntry().
Referenced by mnRunSelectionForValue().
Definition at line 634 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.
Definition at line 679 of file window_selection.c.
mnSetupSelectionBothSides
void mnSetupSelectionBothSides(void)
Sets up both end arrows of the selection row.
References mnSelectionMenuSetupArrow().
Referenced by mnRunSelectionForValue().
Definition at line 700 of file window_selection.c.
mnSelectionMenuGetCursorNode
SELECTION_NODE *mnSelectionMenuGetCursorNode(SELECTION_MENU_STATE *screen)
Returns the icon under the cursor: the row's icon at place cursorIndex.
References Sint32.
Referenced by mnSelectionMenuDraw(), mnSelectionMenuLoadLargeIcon() and mnSelectionMenuOpenNameWindow().
Definition at line 761 of file window_selection.c.
mnSelectionMenuRun
Sint32 mnSelectionMenuRun(Sint32 controls)
Runs the selection row until the player chooses (the chosen entry's index)
or, when controls allows it, cancels with B (-1). SELECTION_FIXED allows no
moving or choosing; anything but SELECTION_NO_CANCEL allows cancelling.
Reached only through a bare entry of the window stub table.
References mnConfirmSelection(), mnSelectionMenuHighlightIcon(), mnSelectionMenuStepLeft(), mnSelectionMenuStepRight(), PerWork, Sint32 and sySynch().
Definition at line 788 of file window_selection.c.
mnSelectionMenuRunWithSounds
Uint32 mnSelectionMenuRunWithSounds(Uint32 controls)
As mnSelectionMenuRun, with the menu sounds.
References mnSelectionMenuStepLeft(), mnSelectionMenuStepRight(), PerWork, result, sySoundPlayStub() and sySynch().
Referenced by mnRunSelectionForValue().
Definition at line 823 of file window_selection.c.
mnMoveSelectionForward
void mnMoveSelectionForward(SELECTION_MENU_STATE *screen)
Unused: moves the cursor one entry right, scrolling the row at its last
place; it stops at the end, where mnSelectionMenuStepRight wraps around.
References mnSelectionMenuHighlightIcon(), mnSelectionMenuOpenNameWindow(), mnSelectionMenuRedrawIcon() and sySynch().
Definition at line 902 of file window_selection.c.
mnMoveSelectionBackward
void mnMoveSelectionBackward(SELECTION_MENU_STATE *screen)
Moves the cursor one entry left, scrolling the row at its second place; it
stops at the beginning, where mnSelectionMenuStepLeft wraps around.
References mnSelectionMenuHighlightIcon(), mnSelectionMenuOpenNameWindow(), mnSelectionMenuRedrawIcon() and sySynch().
Definition at line 928 of file window_selection.c.
mnClearBattleHighlight
void mnClearBattleHighlight(SELECTION_MENU_STATE *screen)
Stops the battle's highlight of units (HIGHLIGHT_OFF) as an entry is chosen.
The unit list it passes has a place for each icon of the row, but only its
end marker (BATTLE_UNIT_LIST_END) is written: HIGHLIGHT_OFF never reads the
list.
References btHighlightSetModesStub() and Sint32.
Referenced by mnConfirmSelection().
Definition at line 1162 of file window_selection.c.
mnSelectionIconLoad
Sint32 mnSelectionIconLoad(Uint32 kind, Sint32 value)
Loads the icon of an entry of kind (ICON_KIND: a command, a yes or no, an
item or a Psynergy) into a free sprite tile slot and returns the slot, or -1
when none was free or kind is another.
References mnAbilityBuildIconTiles(), mnIconBuildCommandIconTiles(), mnItemIconLoadLayersIntoSlot(), Sint32 and syVRAMCacheFindFreeEntry().
Referenced by mnWindowSpriteCreateFromResource().
Definition at line 1287 of file window_selection.c.
mnSelectionIconLoadIntoSlot
Sint32 mnSelectionIconLoadIntoSlot(Sint32 kind, Sint32 value, Sint32 slot, Sint32 option)
Loads the icon of an entry of kind (ICON_KIND) into sprite tile slot slot
(a free one when -1) and returns the slot, or -1 when none was free.
References mnAbilityBuildIconTiles(), mnIconBuildCommandIconTiles(), mnIconBuildMiscellaneousIconTiles(), mnItemIconLoadLayersIntoSlot(), Sint32 and syVRAMCacheFindFreeEntry().
Definition at line 1316 of file window_selection.c.
mnArrowNoOperation1
void mnArrowNoOperation1(void)
Six empty functions, written ahead of the menu arrow's routines and told
apart only by their place. The second, third and sixth fill entries of the
window stub table (stubs.s) that nothing calls; nothing refers to the other
three.
Definition at line 1521 of file window_selection.c.
mnArrowNoOperation2
void mnArrowNoOperation2(void)
Does nothing.
Definition at line 1525 of file window_selection.c.
mnArrowNoOperation3
void mnArrowNoOperation3(void)
Does nothing.
Definition at line 1529 of file window_selection.c.
mnArrowNoOperation4
void mnArrowNoOperation4(void)
Definition at line 1533 of file window_selection.c.
mnArrowNoOperation5
void mnArrowNoOperation5(void)
Definition at line 1537 of file window_selection.c.
mnArrowNoOperation6
void mnArrowNoOperation6(void)
Does nothing.
Definition at line 1541 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 VRAM cache entry
returned in *slot, which mnArrowRelease frees.
References MenuCursorActorTiles, Sint32, syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().
Referenced by mnDebugFlagEditorRun() and mnDebugSceneSelectRun().
Definition at line 1547 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 OAM_DEPTH_FRONT - 3; the caller calls it every tick it shows.
References Sint32 and syOAMAddSpriteAtDepth().
Referenced by mnDebugFlagEditorRun() and mnDebugSceneSelectRun().
Definition at line 1566 of file window_selection.c.
mnArrowRelease
void mnArrowRelease(Sint32 slot)
Frees an arrow sprite's tile slot.
References Sint32 and syVRAMCacheFreeEntry().
Referenced by mnDebugFlagEditorRun() and mnDebugSceneSelectRun().
Definition at line 1574 of file window_selection.c.
mnSelectionMenuFreeLargeIcon
void mnSelectionMenuFreeLargeIcon(void)
Frees the large icon's VRAM cache entry, if it holds one, and marks it empty.
References syVRAMCacheFreeEntry().
Referenced by mnConfirmSelection() and mnSelectionMenuClose().
Definition at line 1624 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(), mnDjinnMenuRunStub(), mnFieldMenuSelectCommand(), mnItemMenuRunStub(), mnPartyStatusCloseWithMenu(), mnPartyStatusOpenAndWait(), mnPsynergyMenuRunStub(), mnStatusScreenRunStub() and Sint32.
Definition at line 1647 of file window_selection.c.
mnPartyStatusCloseWithMenu
void mnPartyStatusCloseWithMenu(void)
Closes the party status window that shows with the field menu.
References mnPartyStatusClose().
Referenced by mnAnimateSelectionToEntry() and mnFieldMenuRun().
Definition at line 1717 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 1723 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.
References mnSelectionMenuBuildEntries(), mnSelectionMenuClose(), mnSelectionMenuOpenNameWindow(), mnSelectionMenuRunWithSounds(), mnSelectionMenuStartDrawing(), mnSetupSelectionBothSides() and result.
Definition at line 1732 of file window_selection.c.
Variables in detail
MenuCursorActorTiles
extern Uint8 MenuCursorActorTiles[], MenuCursorLeftActorTiles[]
The pictures of the selection row's right and left arrows
(sprite_cursors.list.tsv).
Referenced by mnArrowCreate(), mnSelectionMenuDrawArrow() and mnSelectionMenuSetupArrow().
Definition at line 54 of file window_selection.c.