Alchemy
Loading...
Searching...
No Matches

menu.h File Reference

Go to the source code of this file.

Macros

#define LIST_ORDER_TYPE_MASK   0x7f
#define LIST_ORDER_EQUIPPED   0x80
#define LIST_ORDER_END   0xff
#define LIST_PAGE_SIZE   5

Typedefs

typedef s32 MenuBackdropResult

Functions

s32 Menu_ResumeFieldTasks (void)
 Resumes the overlay tasks and tile animations when a menu closes, and clears game flags 0x166 and 0x152.
s32 Menu_SuspendFieldTasks (void)
 Suspends the overlay tasks and tile animations while a menu is open, and sets flags 0x152 and 0x166.
void UiWindow_InitializeWork (s32 unused)
 Clears the whole menu work and sets its defaults: no pane selected, one entry in each pane, and a 1x1 cursor grid.
s32 UiWindow_UpdateOrCreate (struct UiWindow **handle, s32 x, s32 y, s32 w, s32 h, s32 flags)
 Opens the window kept in *handle, or redraws it if it is already open.
void UiWindow_CloseIfOpen (struct UiWindow **handle, s32 style)
 Closes the window kept in *handle, if any, and clears the handle.
void Menu_DrawOwnerStatusPanel (struct UiWindow *unused, s32 owner, s32 slot, s32 mode)
 Draws the item menu's status panel for the party member owner (window at tile 0,5, 13 by 12): the name, up to two ailments or the level, and below them what mode's panel kind asks for.
void UiText_DrawNumberRightAligned (s32 number, struct UiWindow *window, s32 x, s32 y)
 Draws number right-aligned in a field that ends at pixel column x and allows 8 pixels for each digit, at least two digits wide.
void Ui_DrawValuePairRows (struct BattleUnit *unit, struct UiWindow *window)
 Draws a character's HP and PP into window as two rows, "HP current/maximum" at pixel row 40 and "PP current/maximum" at row 48.
void UiText_DrawStatComparison (const struct BattleUnit *after, const struct BattleUnit *before, struct UiWindow *window)
 Writes Attack, Defense and Agility into a status window as they are now (before), and beside each one that changes its new value (after) with an up or down arrow: the equipment preview.
s32 UiIcon_CreateWithResource (struct UiWindow *window, s32 unused, s32 x, s32 y)
 Creates a hand cursor sprite in window at (x, y), loading the hand's tiles into a free VRAM block.
s32 UiIcon_CreateWithResourceVariant (struct UiWindow *window, s32 x, s32 y)
 Creates the menu's hand cursor sprite in window at (x, y), loading the hand's tiles into a free VRAM block.
void UiIcon_PrepareObject (struct RenderOutput *object)
 Shows a menu icon at its stored position, without rotation or scaling.
void PsynergyMenu_CallIconRoutineWithValue (const void *unused, s32 unit)
 Loads the graphics of character unit into menu entry slot 0.
struct UiWindow * UiMenu_CreateCursor (void *source)
 Opens the menu's top-left window (13 by 5 tiles) and puts the hand cursor in it, hidden for now.
void PsynergyMenu_InitializeEntryObjects (void *source, s32 originX, s32 originY, s32 spacing, s32 unused)
 Creates a walking figure for each active party member, side by side under the window source: origin (originX, originY) in tiles from the window's corner, each figure 16 + spacing pixels after the last, at full scale.
void Menu_ReleaseEntryObjects (void)
 Releases the party figures PsynergyMenu_InitializeEntryObjects created and stops their placement callback.
void Menu_UpdateEntryObjectTransforms (void)
 Scheduler callback: each frame, places every party member sprite created by PsynergyMenu_InitializeEntryObjects at its menu position and scale, through the field's projected placement.
void UiMenu_PositionCursor (s32 xOffset, s32 yOffset)
 Places the hand cursor at (xOffset, yOffset) inside the menu's top-left window, bobbing.
void UiMenu_SlideCursor (s32 x, s32 y)
 Slides the hand cursor from where it is to (x, y) inside the menu's top-left window over two frames, in 1/16 pixel steps.
void PsynergyMenu_ReservedNoOp (void)
 Nothing calls it.
void PsynergyMenu_RefreshOwnerEntriesDefault (void)
 Lays the entry icons out eight to a row from (108, 40). Nothing calls it.
void PsynergyMenu_RefreshOwnerEntries (s32 originX, s32 originY, s32 columns)
 Lays the menu's entry icons (up to 32) out in a grid of 16x16 cells, columns wide, from (originX, originY); empty slots keep their place.
void PsynergyMenu_PositionOwnerEntry (struct RenderOutput **slot, s32 index, s32 originX, s32 originY, s32 columns)
 Places the icon in *slot at grid cell index (0 above 31) of a grid of 16x16 cells, columns wide, from (originX, originY), and shows it.
void ItemMenu_PlaceIcon (struct RenderOutput **slot, s32 slotIndex, s32 originX, s32 originY, s32 columns)
 Places the icon at slotIndex (0 above 15) in a columns-wide grid of 24x16 cells starting at (originX, originY), and shows it.
void ItemMenu_RefreshEntry (s32 layout)
 Lays the inventory's 15 item icons out five to a row from (116, y): y is 56 for layout 1 and 40 otherwise.
void InventoryMenu_ShowModalMessage (s32 message, s32 x, s32 y)
 Shows message in the item menu, with the hand cursor hidden meanwhile.
s32 InventoryMenu_SortByListOrder (u16 *inventory, s32 mode)
 Sorts a party member's 15 inventory slots by the list order of mode (see Menu_CopyListOrder): items are grouped by the order's item types and, within a type, run from the highest item id down.
void Menu_CopyListOrder (s32 mode, u8 *order)
 Copies the list order of mode 0 to 2 (any other mode: the default order) into order, up to and including its LIST_ORDER_END and at most 32 bytes.
s32 Menu_HandlePageInput (s32 horizontal, s32 count, s32 pageSize, s32 *cursor, s32 *page)
 Moves a paged list's cursor and page with the d-pad's repeating keys.
void Palette_LightenBankHighlight (s32 bank)
 Copies the last background palette (15) into background palette bank and lightens its colour 4 by 9 steps in each channel: the highlight colour of the menu's selected rows.
void Menu_DrawPageIndicator (struct UiWindow *window, s32 itemCount, s32 pageSize, s32 selectedPage, s32 rightEdge)
 Draws a paged list's page numbers on the top border of window, ending at tile rightEdge: one digit per page between the page arrows, selectedPage in palette 14 and the others in palette 15.
void Render_SetTilemapFlagRect (const struct UiWindow *window, s32 x, s32 y, s32 width, s32 height, u32 palette)
 Switches a rectangle of a window's text between palette 15 (normal) and 14 (the highlight made by Palette_LightenBankHighlight): palette is the new palette number.
void Palette_CopyObjectBankToBackground14 (void)
 Copies the first sprite palette into background palette 14, then colour 4 of background palette 15 over its colour 14.
void Menu_SetPageIcons (s32 pageSize, s32 first, struct UiWindow *window, s32 x, s32 y)
 Shows the item icons of one page of the item list: entries first to first + pageSize - 1, one row of 16 pixels each from (x, y).
void UiText_DrawWorkValueWithLabel (struct UiWindow *window)
 Writes the party's coins and the "Coins" label into window.
void UiWindow_SetBounds (struct UiWindow *window, s32 x, s32 y, s32 width, s32 height)
 Moves and resizes a window, in tiles.
void UiWork_SetMenuBusy (void)
void UiWork_ClearMenuBusy (void)
 Lets the window renderer resume drawing after a menu update.
s32 Audio_PlayCueReturnOne (s32 cue)
void Menu_CancelSoundTick (void)
 Scheduler callback while a menu runs: on Start, plays the cancel sound, sets FLAG_MENU_START_PRESSED and removes itself.
void Menu_CancelSoundReset (void)
 Starts watching for Start: clears FLAG_MENU_START_PRESSED and adds Menu_CancelSoundTick.
void Menu_EnsureCancelSound (void)
 Stops watching for Start, if Start has not removed the watch already.
void UiPalette_SetColor15 (void)
 Sets the window text colour: normal (15), no HP (2) and low HP (4).
void UiPalette_SetColor2 (void)
void UiPalette_SetColor4 (void)
void FourObjectMotion_ClearSlotsAndSchedule (void)
void FourObjectMotion_ClearSlotsAndScheduleAlt (void)
s32 ItemMenu_Run (void)
 The item picker an event script opens (window command 3): the item menu, in which the player chooses one party member's item.
s32 ItemMenu_RunCommands (s32 *ownerOut, s32 *targetOut, s32 *itemOut)
 Runs the item menu: choose a party member, one of their items and a command (Use, Equip, Give, Drop, Remove or Inspect), then carry it out, until the player backs out or presses Start.
s32 ItemMenu_Use (void)
 Uses the selected item from the owner in pane 0 on the member in pane 1.
void ItemMenu_Initialize (s32 x, s32 y, s32 mode, s32 columns)
 Sets up the item menu's first screen: the cursor window with the party's figures, the info window along the bottom, and an 8 by 2 cursor grid.
void Menu_SpawnIconEntries (struct InventoryMenuState *state, struct UiWindow *window)
 Creates the 32 item icon sprites in window, off screen until placed: slots 0 to 7 at x 248, the rest at x 256, all at y 168, each showing item graphic slot of the same number.
void ItemMenu_HideAllIcons (void)
 Hides all 32 item icons.
void ItemMenu_HidePageIcons (void)
 Hides the item icons in the first column of the five-wide item grid.
void ItemMenu_Close (void)
 Closes the item menu: releases the party figures, hides the icons and the cursor, and closes every window the menu opened.
s32 ItemMenu_SelectMember (s32 pane)
 Lets the player choose a party member in pane (0 or 1), starting from the member chosen last.
s32 ItemMenu_RunOwnerSelection (u16 *ownerIds, u16 *items)
 The party member row of the item menu.
void ItemMenu_OpenCategory (s32 ownerId)
 Shows the equipment view of member ownerId's items in the item window.
s32 ItemMenu_SelectTarget (s32 mode)
 Chooses the party member to use (mode 0) or give (mode 1) the selected item to.
void EquipmentMenu_UpdateCompatibilityIndicators (void)
 Scheduler callback while choosing a member to give an item to: every 32 frames, sets each party figure's animation by whether that member can equip the item (3) or not (1).
void EquipmentMenu_StartCompatibilityIndicators (void)
 Ends EquipmentMenu_UpdateCompatibilityIndicators: puts every party figure back to animation 1 and removes the callback.
s32 ItemMenu_IsSpecial (s32 itemId)
 Returns 1 for the items that raise a stat for good (Apple, Hard Nut, Mint and Lucky Pepper), whose use shows the stats panel instead of HP and PP.
void ItemMenu_DrawMessage (s32 unused, s32 message)
 Clears the message window and writes message into it.
void Menu_HideEmptyEntryIcons (const u16 *items)
 Hides the icon of each of the 32 list entries whose item is 0.
s32 ItemMenu_CountItems (s32 ownerId)
 Returns how many of member ownerId's 15 inventory slots hold an item.
s32 InventoryMenu_GetItemQuantity (s32 ownerId, s32 itemId)
 Returns how many of itemId the unit ownerId holds: the quantity of its first stack, or 0.
s32 ItemMenu_CollectItems (struct BattleUnit *unit, u16 *items, s32 mode)
 Copies the unit's items into the list items (32 entries), skipping empty slots and clearing the rest.
void ItemMenu_DrawIcons (u16 *inventoryEntries, s32 iconStyle)
 Loads each listed item's icon into its item icon sprite, the first 15 entries of inventoryEntries, and hides the icons of empty entries.
void ItemMenu_RefreshOwner (s32 ownerId, s32 mode)
 Shows member ownerId's items in the item window, laid out for layout mode (see ItemMenu_RefreshEntry), or "no items" when there are none.
void InventoryMenu_NoOp (void)
 Nothing calls it.
void ItemMenu_DrawEquipPreview (s32 owner, s32 slot, s32 mode, s32 target)
 Shows in the status panel what the item in owner's inventory slot would mean to member target: for a usable item, target's status; for equipment, target's stats with it equipped; for a Psynergy item, the Psynergy it teaches.
s32 Inventory_RemoveFirstUnflagged (s32 ownerId)
 Makes room in ownerId's inventory: if no slot is free, removes the whole stack in the first slot that is not equipped.
s32 ItemMenu_CommandCursorX (s32 column, s32 row)
 The x and y of the item command cursor on column and row of the command grid (three commands to a row).
s32 ItemMenu_CommandCursorY (s32 column, s32 row)
s32 ItemMenu_ChooseCommand (void)
 The item command grid: Use, Equip and Details on the top row, Give, Remove and Drop below (grid index = row * 3 + column, as ItemMenuCommand counts them).
void ItemMenu_BuildCommands (s8 *commandStates)
 Fills commandStates (indexed by ItemMenuCommand) for the selected item: Use for usable items the owner can use here and for field items, Equip for equipment the owner can wear and is not wearing, Remove for worn equipment that is not cursed, Give with someone to give to, Drop unless the item is indispensable, and neither for cursed equipment being worn.
void ItemMenu_DrawCommands (const s8 *commandStates, struct UiWindow *window)
 Writes the six command names into window, the disabled ones in grey.
s32 Item_ClassifyUseMode (s32 ownerId, s32 inventoryEntry)
 Says how ownerId can use inventoryEntry from the item menu: 0 the item works on the field (BattleFx_HasTriggerFar), or its action is usable neither in the field nor in battle, and is used once the menu closes; 1 usable in the field: choose a party member to use it on; 2 usable in the field on the whole party at once (range 0xff); -1 it cannot be used here: it has no action, it is equipment the owner cannot wear or of use type 3, or its action is usable only in battle.
void ItemMenu_TryBreak (void)
 After the selected item is used: an item of use type 2 breaks one time in eight, with the break sound.
s32 ItemMenu_OpenDetail (s32 itemIndex)
 Opens the details window (top left, 13 by 10 tiles) and describes the item in pane itemIndex there.
s32 Menu_SelectQuantity (s32 value)
 The item menu's Details screen: describes the item entry value in a large window (the whole top half after patch 1) and waits for A or B.
void ItemMenu_DrawItemDetails (struct UiWindow *window, s32 inventoryEntry)
 Writes the description of the inventoryEntry into window, one line a row: for equipment its Attack and Defense bonuses, then each of its effects (flat bonuses, rates as multipliers, elemental Power and Resist with the element's icon, and the effects that are only text), whether it is cursed or bestows Psynergy, whether it is used up or may break, and for a stack how many there are.
void ItemMenu_DrawStat (s32 statChange, s32 unused, struct UiWindow *window, s32 x, s32 y)
 Writes a signed stat change at (x, y) of window: the number, with a plus or minus sign just before its first digit.
void ItemMenu_SetItemWindowRow5 (void)
 Moves the item window to row 5 of the right-hand side.
void ItemMenu_SetItemWindowRow3 (void)
 Moves the item window to row 3 of the right-hand side.
void ItemMenu_SetMessageWindowHeight5 (void)
 Makes the message window, along the top right, 5 rows tall.
void ItemMenu_SetMessageWindowHeight6 (void)
void ItemMenu_SetMessageWindowHeight7 (void)
void ItemMenu_SetMessageWindowHeight3 (void)
s32 ItemMenu_SelectGiveQuantity (s32 baseQuantity, s32 quantityRange, s32 dropMode)
 Asks how many of the selected item stack to give or drop: Left and Right choose a number from 1 to quantityRange (shown as baseQuantity + 1 up to baseQuantity + quantityRange on a dial of digit sprites), with the owner's remaining count and, when giving (dropMode 0), the receiver's new count beside their names.
void ItemMenu_DrawItemHead (void)
 Shows the selected item at the top of the message window: its icon, its owner's name and its name.
s32 ItemMenu_ConfirmDrop (s32 item)
 Asks whether to drop item (an inventory entry): its name, the question, and Yes or No, No first.
s32 ItemMenu_ConfirmEquip (s32 unused)
 After giving or trading the selected item to the member in pane 1, offers to equip it there, showing the stats it would give.
void Resource_LoadPairedBlocks (void)
 Loads the stat arrows (up and down) into two free VRAM blocks, kept in the menu work's resource slots.
s32 ItemMenu_PageResult (struct MenuResult *result, s32 index)
 Fills result with the item list of the member in pane index: their unit, how many items they hold, and the page and row of the item chosen last for them (kept within the list), five items to a page.
s32 ItemMenu_DrawItemDetailPage (struct UiWindow *window, void *ownerWork, struct MenuResult *pageState)
 Updates the item list for the row under the cursor: puts the selected item's plain name in the info window and highlights its row of the five.
s32 ItemMenu_DrawNamePage (struct UiWindow *window, s32 unused, const struct MenuResult *pageState)
 Draws one page of the item list into window: up to five item names with their icons, and the page numbers when there is more than one page.
s32 InventoryMenu_ItemNamePageReturnTrue (void)
 Nothing calls it.
void InventoryMenu_ItemNamePageNoOp (void)
 Nothing calls it.
s32 ItemMenu_RunList (s32 paneIndex)
 The item list of the member in paneIndex (0: the owner, 1: the receiver of a trade), five items a page.
s32 PsynergyMenu_Run (void)
 The Psynergy menu an event opens (window command 1): the field menu's Psynergy screen over the field, which stops meanwhile.
s32 Menu_ResolveSelectedAction (s32 *outOwner, s32 *unused, s32 *outAction)
 Runs the Psynergy menu: choose a party member and one of their Psynergy, then use it on a member (or the whole party), or, in the shortcut modes, set it as the L or R shortcut.
s32 PsynergyMenu_ClassifySelectedPsynergy (void)
 Says how the selected Psynergy is used from the menu: 0 on the field once the menu closes (its effect has a field event), 2 on the whole party (range 0xff), 1 on one chosen member when its target mode is 2, and 0 otherwise.
s32 PsynergyMenu_SelectPartySlot (s32 partySlot)
 Lets the player choose a party member in pane partySlot (0 or 1), starting from the one chosen last, with each member's Psynergy shown as the cursor passes.
s32 PsynergyMenu_SelectMember (u16 *ownerIds, u16 *unused)
 The party member row of the Psynergy menu.
void PsynergyMenu_RefreshOwnerPsynergy (s32 ownerId)
 Shows member ownerId's Psynergy icons in the Psynergy window, eight to a row, or "no Psynergy" when they have none.
s32 PsynergyMenu_ReturnTrue (void)
 Nothing calls them.
void PsynergyMenu_NoOp (void)
s32 PsynergyMenu_SelectTarget (s32 targetMode)
 Chooses the party member to use the selected Psynergy on.
s32 PsynergyMenu_SetShortcut (s32 ownerId, s32 actionId, s32 shortcutIndex)
 Sets the L (shortcutIndex 0) or R (shortcutIndex 1) Psynergy shortcut: ownerId << 10 | the Psynergy's id.
s32 PsynergyMenu_DrawShortcuts (struct UiWindow *window, s32 owner)
void PsynergyMenu_CreateEntryGrid (void)
 Sets up a Psynergy grid screen: the cursor window with the party's figures, a 30 by 15 window below with a hidden grid cursor and a portrait, and 16 Psynergy icon sprites in two rows of eight from (96, 8), on an 8 by 2 grid.
void PsynergyMenu_CloseWindows (void)
 Releases the party figures and closes the Psynergy grid screen's windows.
void PsynergyMenu_DrawPsynergyIcons (u16 *psynergies)
 Loads each listed Psynergy's icon into its icon sprite (32 entries) and hides the icons of empty entries.
s32 PsynergyMenu_CollectActions (struct BattleUnit *unit, u16 *actions, s32 mode)
 Lists unit's Psynergy into actions (32 entries, cleared first) and returns how many there are.
s32 PsynergyMenu_BuildPageResult (struct MenuResult *result, s32 index)
 Fills result with the Psynergy list of the member in pane index: their unit, how many Psynergy are listed, and the page and row of the one chosen last for them (kept within the list), five to a page.
s32 PsynergyMenu_DrawDetailPage (struct UiWindow *window, s32 *work, struct MenuResult *state)
 Updates the Psynergy list for the row under the cursor: puts the Psynergy's description in the info window, unless a kept message is there, and highlights its row of the five.
s32 PsynergyMenu_DrawActionPage (struct UiWindow *window, s32 unused, const struct MenuResult *pageState)
 Draws one page of the Psynergy list into window: up to five names with their icons and PP costs, Psynergy the member cannot afford in the no-HP colour and one restricted here in the low-HP colour, the page numbers, and the help line (how to set a shortcut while Select is held, else how to change member).
s32 PsynergyMenu_RunList (s32 paneIndex)
 The Psynergy list of the member in paneIndex, five a page.
s32 PsynergyMenu_IsActionRestricted (s32 actionEntry)
 Returns 1 when actionEntry cannot be used from the menu: it has no field effect and is not usable both in the field and in battle.
s32 Menu_OpenCharacterSelector (void)
 Lets the player choose one party member, over the field (the Colosso scenes use it).
s32 CharacterSelector_Run (void)
 The member chooser's loop. Returns the chosen member's id, or -1.
s32 StatusMenu_Run (void)
 The Status menu an event opens (window command 4) over the field: saves the first two background palettes and the window tiles it draws over, sets up the party row and, when the party has Djinn, the four Djinn sprites, runs the status pages, then puts everything back.
s32 Menu_RunActionFlow (void)
 The Status menu's pages: choose a party member, then their status page, A for their Psynergy page and A again for their equipment page; B steps back.
s32 CharacterMenu_SelectOwner (s32 slot)
 Lets the player choose a party member in slot, from the one chosen last: the member chooser when the menu is on page 3, else the Status menu's party row.
s32 DjinnMenu_ShowCurrentList (void)
 Shows every Djinn the party has found, a column of seven for each element, until A, B or Select, then puts the Djinn menu back.
s32 CharacterSelector_RunRearrange (void)
 The Status menu's party row: Left and Right choose a member, showing their status; L and R move the member one place along the party order; Select lists the Djinn found (once the first is caught, FLAG_DJINNI_0); A chooses the member and B backs out.
s32 PsynergyMenu_SelectOwner (void)
 The member chooser (menu page 3): Left and Right choose a party member, showing their status and Psynergy icons; A chooses and B backs out.
s32 CharacterSelector_MoveEntry (s32 selectedIndex, s32 direction)
 Moves the party member at selectedIndex one place later (direction 1) or earlier (0) in the party order.
void Menu_InitSelectorCursorAndEntries (s32 unused0, s32 unused1, s32 unused2, s32 unused3)
 Sets up the Status menu's first screen: the cursor window with the party's figures, no other windows yet, and an 8 by 2 cursor grid.
void Menu_CreateWindowAndEntryObjects (s32 resource, s32 frame)
 Shows member resource's status in the status window (0, 5, 30 by 15), opening it first with the member's portrait, the item icons on the chooser page, and the eight stat sprites; then draws the status and ailments.
s32 CharacterMenu_SelectCommand (void)
 The member's status page.
void CharacterMenu_DrawSelectionCursor (s32 mode, s32 selected, u8 *entries, s32 invert)
 Highlights (invert 0) or unhighlights (invert 1) the selected entry of the status page: in pane 0 the selected ailment row, as wide as its label (gCharacterMenu_CursorWidths); in pane 1 one of the first four status rows or of the rows below.
void CharacterMenu_DrawSelectionLabels (struct UiWindow *target, s32 selected, const u8 *entries)
 Writes the advice for the selected ailment (two lines, for example how to revive a member who is down) into window target, or that the member is well when they have no ailment.
void StatusMenu_ShowOwnerProgressMessage (struct UiWindow *destination, s32 messageVariant, s32 preserveVariant)
 Writes the help text of status entry messageVariant into destination: the entries skip Djinn when the party has none (preserveVariant 0); the experience entry says how many points the next level needs, or, at level 99, gives the plain experience text.
void CharacterMenu_DrawStatusAilments (struct UiWindow *window, s32 ownerId, s32 mode)
 Draws member ownerId's status page into window: the top rows (ItemMenu_ DrawOwnerStatus), the ailment list or "Normal", and except on the chooser page the Djinn counts by element and, in mode 1, the elemental levels, Power and Resist.
void Runtime_RunBusyWaitDelay (void)
 Spins for 256 loop passes (international editions only).
void ItemMenu_DrawOwnerStatus (struct UiWindow *window, s32 ownerId, s32 flags)
 Draws the top rows of member ownerId's status page into window: name, class, level, experience, HP and PP on the left, Attack, Defense, Agility and Luck on the right.
s32 CharacterMenu_BuildAvailability (u8 *ailments, s32 requested, s32 ownerId)
 Fills ailments[0..4] (CharacterAilment) with member ownerId's ailments: down (only when requested is 1), poison or venom, curse and haunt.
s32 Menu_BuildPageResult (struct MenuResult *result, s32 index)
 Fills result with the item list of the member in pane index for the equipment pages: their unit, the menu's item count, and the page and row of the item chosen last for them, STATUS_EQUIP_PAGE_SIZE items to a page.
void Menu_BuildPatternTiles (void)
 Builds twelve 8x8 tiles in the window tile area: two sets of six, each a fill of colour 4 with the rows of gMenu_PatternRowMasks XORed in, the first set growing row by row and the second skipping its top row.
void PsynergyMenu_DrawRange (struct UiWindow *window, s32 x, s32 y, s32 range, s32 unused)
 Draws a Psynergy range icon at (x, y) of window: three tiles from the range icon tiles, the left one mirrored.
s32 PsynergyMenu_DrawRangePage (struct UiWindow *window, s32 unused, struct MenuResult *state)
 Updates the Psynergy page for the row under the cursor: the Psynergy's description in the info window, where it can be used (in the field, in battle, or anywhere), and the row highlights with the range icons.
s32 PsynergyMenu_DrawListPage (struct UiWindow *window, s32 unused, const struct MenuResult *res)
s32 PsynergyMenu_SelectAction (void)
s32 PsynergyMenu_ActionReturnTrue (void)
 A page callback.
void PsynergyMenu_DrawPreparedPsynergyIcons (const void *unused, s32 ownerId)
 Draws this owner's prepared Psynergy list in the shared entry sprites.
void PsynergyMenu_PreparedIconsNoOp (void)
 Reserved empty callback for the prepared Psynergy page.
void PsynergyMenu_PreparedIconsSecondNoOp (void)
 Reserved second empty callback for the prepared Psynergy page.
s32 ItemMenu_DrawEquipPage (struct UiWindow *window, s32 unused, struct MenuResult *state)
s32 Shop_DrawItemPage (struct UiWindow *window, s32 unused, struct MenuResult *state)
s32 ItemMenu_SelectItem (void)
s32 Menu_MoveGridCursor (s32 *columnOut, s32 *rowOut, s32 direction)
 Moves through the status grid's irregular rows and returns row * 9 + column.
s32 Menu_ReservedStatusOne (void)
void ItemMenu_DrawCategory (struct UiWindow *window, s32 ownerId, s32 mode)
 Shows the owner's equipped items and optionally its category icons.
void ItemMenu_DrawEquippedItemNames (struct UiWindow *window, u16 *items)
 Draws the nonempty equipment entries by their item names.
void Menu_PlaceEntryObjectsInGrid (s32 originX, s32 originY, s32 columns)
 Positions the shared entry sprites on the requested grid.
void Menu_PlaceEntryObjectInGrid (struct RenderOutput *icon, s32 index, s32 originX, s32 originY, s32 columns)
 Positions one entry sprite in the requested number of grid columns.
void ItemMenu_ArrangeCategoryItemIcons (u16 *items)
 Loads and places the owner's equipment-category icons.
void ItemMenu_PosCategory (void)
 Moves all entry sprites off screen before arranging another category.
s32 Menu_CreateEightEntryObjects (struct UiWindow *window)
 Creates the eight shared category sprites, initially off screen.
void ItemMenu_ApplyFlags (const u8 *flags)
 Shows enabled category icons down the left edge, sixteen pixels apart.
void ItemMenu_ResetCategory (void)
 Moves each category sprite off screen before it is reused.
s32 CharacterMenu_UpdateSelectionIcons (const u8 *enabled)
 Loads each enabled ailment's icon into its category resource slot.
void Item_PrepareUsePalette (void)
 Copies and lightens the palette used by the item-use animation.
void Item_UseNoOpCallback (void)
 Reserved empty callback during an item's menu animation.
s32 Item_Use (s32 slot, s32 ownerId, s32 targetId)
 Applies the slot's action, then consumes or transforms the item on success.
s32 Item_ReturnOne (void)
s32 BattleEffect_ApplyToTargets (s32 effectId, s32 sourceId, s32 targetId, s32 fixedScale)
 Applies healing or permanent-stat effects to one member or the whole party.
void Item_PlayUseAnimation (u32 item)
 Runs the animation selected by the item's action definition.
void Ability_PlayUseAnimation (s32 action)
 Starts the action's menu animation and waits for its completion.
s32 Menu_ReservedStatusZero (void)
s32 Menu_WrapIndex (s32 value, s32 modulus)
 Wraps a cursor index that has stepped one past either end of modulus entries: -1 becomes modulus - 1 and modulus becomes 0.
s32 Menu_SetFirstObjectRowCoordinates (s32 yOffset)
 Places the Djinn menu's first row at its normal height plus yOffset.
s32 DjinnMenu_Run (void)
 Runs the Djinn menu, preserving field tiles and the message speed.
s32 DjinnMenu_RunScreen (void)
 Chooses a Djinni, previews changes, then sets, stands by, gives or trades it.
void Graphics_AdjustPaletteBank (s32 brightnessDelta)
 Writes copies of background palettes 15, 5 and 7, each brightnessDelta lighter in every channel (clamped to 0-31), into palettes 14, 4 and 6.
MenuBackdropResult Menu_OpenBackdropScreen (void)
 Draws the backdrop behind the Djinn menu's list: its window, tiles and palettes.
s32 OwnerAction_DiffSlots (struct OwnerActionSlot *before, struct OwnerActionSlot *after, u16 *actionsOut, s32 *gainedCountOut, s32 *lostCountOut)
 Lists the actions after a preview, marking gains, then appends the losses.
s32 DjinnMenu_BuildLists (void *table)
 Rebuilds the Djinn lists in table: each owner's packed Djinn entries and their count.
s32 UiWindow_SetInteriorPaletteBitRect (const struct UiWindow *window, s32 x, s32 y, s32 width, s32 height, s32 palette)
 Sets the palette of a rectangle of window's interior, (x, y) and its size in tiles from the interior's corner, through UiWindow_SetPaletteBitRectFar.
void UiWindow_SetRectPalette (s32 x, s32 y, s32 width, s32 height, s32 palette)
 Moves each tile of a screen rectangle (in tiles, clipped to the screen) that shows palette 15 to palette.
void UiWindow_SetInteriorRectPalette (void *window, s32 x, s32 y, s32 width, s32 height, s32 palette)
 UiWindow_SetRectPalette on a rectangle of window's interior, (x, y) and its size in tiles from the interior's corner.
s32 DjinnMenu_ShowHelp (void)
 Runs the Djinn help choices and restores the list when the player leaves.
s32 DjinnMenu_SelectDjinn (s32 mode)
 Chooses an owner and Djinni, or a set, standby, give or trade action.
s32 Djinn_ListOwnerEntries (u16 *entriesOut, s32 ownerId, s32 element)
 Lists owned Djinn by element and index, marking those that are set.
s32 DjinnMenu_DrawPairPreview (s32 mode, s32 pageIndex)
 Draws both sides of the give or trade preview for the selected page.
s32 DjinnMenu_DrawStatPreview (struct UiWindow *window, s32 x, s32 y, s32 ownerId, s32 removePairSlot, s32 addPairSlot, s32 previewMode, s32 page, s32 side)
 Saves the unit, applies a hypothetical Djinn change, draws its differences and restores the original unit before returning.
void FourObjectMotion_InitializeTopRow (void *unused0, s32 unused1)
 Replaces the four displayed objects and starts their projected-position task.
void FourObjectMotion_UpdateAllPositions (void)
 Projects the four objects at full scale from their saved row positions.
void FourObjectMotion_UpdateBottomRow (void)
 Projects the bottom row using its saved scale or easing toward full size.
void FourObjectMotion_InitializeBottomRow (s32 unused0, s32 unused1)
 Replaces the bottom row's four objects and starts its easing task.
s32 FourObjectMotion_SetSlotPosition (s32 index, s32 x, s32 y, s32 negative)
 Updates one object's saved position and its signed y marker.
s32 FourObjectMotion_SetSlotPhase (s32 index, s32 phase)
s32 FourObjectMotion_ReplaceSlot (s32 index, s32 resourceKind, s32 value)
 Replaces one displayed object and selects its animation.
void Menu_StartPartyFiguresWalking (void)
 Starts the walking animation (1) of each party figure. Nothing calls it.
s32 OwnerAction_RunCompareLoop (u32 mode)
 Previews a give, trade, set or standby change without committing it.
s32 DjinnMenu_ShowOwnerStatus (void)
 Shows the chosen owner's current stats and paged Psynergy list.
s32 Djinn_MarkBalancedEntries (s8 *requiresTrade, s32 sourceOwnerColumn)
 Marks recipients that would leave unequal Djinn totals after a direct give.
s32 Djinn_CheckTurnBalance (s32 sourceOwnerColumn, s32 targetOwnerColumn)
 Tests whether a hypothetical give leaves every pair of owners within one Djinn.
void Djinn_CountTurns (u8 *ownedCounts)
 Counts each owner's Djinn across its set and available bitmasks.
void Resource_LoadPairedBlocksIfAvailable (void)
 Loads each menu icon resource whose cache slot was acquired.
void Menu_ResetTwoResourceEntries (void)
 Releases both cached icon resources used by the menu.
s32 UiIcon_LoadResourceIntoSlot (s32 resourceId, s32 slot)
 Decodes one icon into a temporary buffer and reloads its VRAM slot.
s32 UiIcon_CreateWithLoadedResource (struct UiWindow *window, s32 x, s32 y, s32 resourceId)
 Loads an icon into a free cache slot and creates its sprite when possible.
s32 UiIcon_CreateStatChangeArrow (struct UiWindow *window, s32 x, s32 y, s32 variant)
 Creates a stat-change arrow from one of the two loaded resources.
s32 UiIcon_DrawVariantWithTileOffset (struct UiWindow *window, s32 x, s32 y, s32 variant)
 Creates an arrow with the vertical adjustment for its resource variant.

Macro Definition Documentation

◆ LIST_ORDER_TYPE_MASK

#define LIST_ORDER_TYPE_MASK   0x7f

Definition at line 17 of file menu.h.

Referenced by InventoryMenu_SortByListOrder().

◆ LIST_ORDER_EQUIPPED

#define LIST_ORDER_EQUIPPED   0x80

Definition at line 18 of file menu.h.

Referenced by InventoryMenu_SortByListOrder().

◆ LIST_ORDER_END

#define LIST_ORDER_END   0xff

Definition at line 19 of file menu.h.

Referenced by InventoryMenu_SortByListOrder(), and Menu_CopyListOrder().

◆ LIST_PAGE_SIZE

Typedef Documentation

◆ MenuBackdropResult

Definition at line 243 of file menu.h.

Function Documentation

◆ Menu_ResumeFieldTasks()

s32 Menu_ResumeFieldTasks ( void )

Resumes the overlay tasks and tile animations when a menu closes, and clears game flags 0x166 and 0x152.

Returns nothing useful; callers ignore the value.

Definition at line 38 of file common.c.

Referenced by DjinnMenu_Run(), ItemMenu_Run(), Menu_ResumeFieldTasks(), PsynergyMenu_Run(), and StatusMenu_Run().

◆ Menu_SuspendFieldTasks()

s32 Menu_SuspendFieldTasks ( void )

Suspends the overlay tasks and tile animations while a menu is open, and sets flags 0x152 and 0x166.

Returns the scheduler's result.

Definition at line 52 of file common.c.

Referenced by DjinnMenu_Run(), ItemMenu_Run(), Menu_SuspendFieldTasks(), PsynergyMenu_Run(), and StatusMenu_Run().

◆ UiWindow_InitializeWork()

void UiWindow_InitializeWork ( s32 unused)

Clears the whole menu work and sets its defaults: no pane selected, one entry in each pane, and a 1x1 cursor grid.

Definition at line 61 of file common.c.

Referenced by DjinnMenu_Run(), ItemMenu_Run(), Menu_OpenCharacterSelector(), PsynergyMenu_Run(), StatusMenu_Run(), and UiWindow_InitializeWork().

◆ UiWindow_UpdateOrCreate()

s32 UiWindow_UpdateOrCreate ( struct UiWindow ** handle,
s32 x,
s32 y,
s32 w,
s32 h,
s32 flags )

Opens the window kept in *handle, or redraws it if it is already open.

If *handle is empty, creates a window at (x, y), w by h tiles, in the style given by the low byte of flags, stores it in *handle and returns 1. If the window exists, redraws its saved rectangle (unless flags has WINDOW_KEEP_EXISTING) and returns 0.

Definition at line 78 of file common.c.

Referenced by CharacterMenu_SelectCommand(), DjinnMenu_ShowOwnerStatus(), InventoryMenu_ShowModalMessage(), ItemMenu_OpenDetail(), ItemMenu_RunList(), ItemMenu_RunOwnerSelection(), ItemMenu_SelectItem(), Menu_CreateWindowAndEntryObjects(), Menu_DrawOwnerStatusPanel(), Menu_OpenBackdropScreen(), OwnerAction_RunCompareLoop(), PsynergyMenu_RunList(), PsynergyMenu_SelectAction(), PsynergyMenu_SelectMember(), UiMenu_CreateCursor(), and UiWindow_UpdateOrCreate().

◆ UiWindow_CloseIfOpen()

void UiWindow_CloseIfOpen ( struct UiWindow ** handle,
s32 style )

Closes the window kept in *handle, if any, and clears the handle.

style is passed on to UiWork_FinalizeFar and chooses how the window closes.

Definition at line 98 of file common.c.

Referenced by DjinnMenu_ShowOwnerStatus(), InventoryMenu_ShowModalMessage(), ItemMenu_Close(), OwnerAction_RunCompareLoop(), and UiWindow_CloseIfOpen().

◆ Menu_DrawOwnerStatusPanel()

void Menu_DrawOwnerStatusPanel ( struct UiWindow * unused,
s32 owner,
s32 slot,
s32 mode )

Draws the item menu's status panel for the party member owner (window at tile 0,5, 13 by 12): the name, up to two ailments or the level, and below them what mode's panel kind asks for.

slot is the inventory slot of the item the panel is about, for the equipment and Psynergy item panels. The first parameter, the status window, is not used: the window is the menu work's.

Definition at line 117 of file common.c.

Referenced by ItemMenu_ChooseCommand(), ItemMenu_DrawEquipPreview(), ItemMenu_RunCommands(), ItemMenu_RunOwnerSelection(), ItemMenu_SelectTarget(), Menu_DrawOwnerStatusPanel(), Menu_ResolveSelectedAction(), PsynergyMenu_RunList(), PsynergyMenu_SelectMember(), and PsynergyMenu_SelectTarget().

◆ UiText_DrawNumberRightAligned()

void UiText_DrawNumberRightAligned ( s32 number,
struct UiWindow * window,
s32 x,
s32 y )

Draws number right-aligned in a field that ends at pixel column x and allows 8 pixels for each digit, at least two digits wide.

The international editions draw a character's HP and PP with it (Ui_DrawValuePairRows). The Japanese editions draw those figures in four-character fields padded with spaces, which keeps the digits in line because the Japanese font's space is as wide as a digit (7 pixels). The Latin font's space is 5 pixels, so here each figure gets a field as wide as its digits instead.

The number writer draws the digits 7 pixels apart, so a number ends about a pixel per digit before x: 99 ends 2 pixels before it, 100 ends 3. A number under 10 draws as a 5-pixel space and its digit, and ends 4 pixels before x.

number: the value to draw, 0 or more x: the field's right edge, in pixels within the window y: the pixel row of the text, within the window

Definition at line 316 of file common.c.

Referenced by Ui_DrawValuePairRows(), and UiText_DrawNumberRightAligned().

◆ Ui_DrawValuePairRows()

void Ui_DrawValuePairRows ( struct BattleUnit * unit,
struct UiWindow * window )

Draws a character's HP and PP into window as two rows, "HP current/maximum" at pixel row 40 and "PP current/maximum" at row 48.

Current HP is drawn in colour 4 when it is below a quarter of maximum HP and in colour 2 at 0; then the colour goes back to 15, the default text colour.

Definition at line 333 of file common.c.

Referenced by Menu_DrawOwnerStatusPanel(), and Ui_DrawValuePairRows().

◆ UiText_DrawStatComparison()

void UiText_DrawStatComparison ( const struct BattleUnit * after,
const struct BattleUnit * before,
struct UiWindow * window )

Writes Attack, Defense and Agility into a status window as they are now (before), and beside each one that changes its new value (after) with an up or down arrow: the equipment preview.

Definition at line 394 of file common.c.

Referenced by Menu_DrawOwnerStatusPanel(), and UiText_DrawStatComparison().

◆ UiIcon_CreateWithResource()

s32 UiIcon_CreateWithResource ( struct UiWindow * window,
s32 unused,
s32 x,
s32 y )

Creates a hand cursor sprite in window at (x, y), loading the hand's tiles into a free VRAM block.

Returns the sprite, or 0 when no block is free. Nothing calls it; UiIcon_CreateWithResourceVariant is the one in use.

Definition at line 435 of file common.c.

Referenced by UiIcon_CreateWithResource().

◆ UiIcon_CreateWithResourceVariant()

s32 UiIcon_CreateWithResourceVariant ( struct UiWindow * window,
s32 x,
s32 y )

Creates the menu's hand cursor sprite in window at (x, y), loading the hand's tiles into a free VRAM block.

Returns the sprite, or 0 when no block is free.

Definition at line 451 of file common.c.

Referenced by PsynergyMenu_CreateEntryGrid(), UiIcon_CreateWithResourceVariant(), and UiMenu_CreateCursor().

◆ UiIcon_PrepareObject()

◆ PsynergyMenu_CallIconRoutineWithValue()

void PsynergyMenu_CallIconRoutineWithValue ( const void * unused,
s32 unit )

◆ UiMenu_CreateCursor()

struct UiWindow * UiMenu_CreateCursor ( void * source)

Opens the menu's top-left window (13 by 5 tiles) and puts the hand cursor in it, hidden for now.

Selects no tab yet. Returns the window.

Definition at line 483 of file common.c.

Referenced by ItemMenu_Initialize(), Menu_InitSelectorCursorAndEntries(), PsynergyMenu_CreateEntryGrid(), and UiMenu_CreateCursor().

◆ PsynergyMenu_InitializeEntryObjects()

void PsynergyMenu_InitializeEntryObjects ( void * source,
s32 originX,
s32 originY,
s32 spacing,
s32 unused )

Creates a walking figure for each active party member, side by side under the window source: origin (originX, originY) in tiles from the window's corner, each figure 16 + spacing pixels after the last, at full scale.

Clears the unused figure slots and starts the callback that places them every frame.

Definition at line 511 of file common.c.

Referenced by CharacterSelector_RunRearrange(), ItemMenu_Initialize(), Menu_InitSelectorCursorAndEntries(), PsynergyMenu_CreateEntryGrid(), and PsynergyMenu_InitializeEntryObjects().

◆ Menu_ReleaseEntryObjects()

void Menu_ReleaseEntryObjects ( void )

Releases the party figures PsynergyMenu_InitializeEntryObjects created and stops their placement callback.

Definition at line 555 of file common.c.

Referenced by CharacterSelector_RunRearrange(), ItemMenu_Close(), Menu_ReleaseEntryObjects(), and PsynergyMenu_CloseWindows().

◆ Menu_UpdateEntryObjectTransforms()

void Menu_UpdateEntryObjectTransforms ( void )

Scheduler callback: each frame, places every party member sprite created by PsynergyMenu_InitializeEntryObjects at its menu position and scale, through the field's projected placement.

Definition at line 580 of file common.c.

Referenced by CharacterMenu_SelectCommand(), DjinnMenu_ShowHelp(), DjinnMenu_ShowOwnerStatus(), ItemMenu_SelectItem(), Menu_ReleaseEntryObjects(), Menu_SelectQuantity(), Menu_UpdateEntryObjectTransforms(), OwnerAction_RunCompareLoop(), PsynergyMenu_InitializeEntryObjects(), and PsynergyMenu_SelectAction().

◆ UiMenu_PositionCursor()

◆ UiMenu_SlideCursor()

void UiMenu_SlideCursor ( s32 x,
s32 y )

Slides the hand cursor from where it is to (x, y) inside the menu's top-left window over two frames, in 1/16 pixel steps.

Positions carry a 64-pixel bias while moving so that they stay positive. Does nothing, once, after skipSlide is set.

Definition at line 625 of file common.c.

Referenced by CharacterMenu_SelectCommand(), CharacterMenu_SelectOwner(), DjinnMenu_SelectDjinn(), ItemMenu_ChooseCommand(), ItemMenu_ConfirmDrop(), ItemMenu_ConfirmEquip(), ItemMenu_SelectGiveQuantity(), ItemMenu_SelectMember(), OwnerAction_RunCompareLoop(), PsynergyMenu_SelectPartySlot(), PsynergyMenu_SelectTarget(), and UiMenu_SlideCursor().

◆ PsynergyMenu_ReservedNoOp()

void PsynergyMenu_ReservedNoOp ( void )

Nothing calls it.

Definition at line 680 of file common.c.

Referenced by PsynergyMenu_ReservedNoOp().

◆ PsynergyMenu_RefreshOwnerEntriesDefault()

void PsynergyMenu_RefreshOwnerEntriesDefault ( void )

Lays the entry icons out eight to a row from (108, 40). Nothing calls it.

Definition at line 683 of file common.c.

Referenced by PsynergyMenu_RefreshOwnerEntriesDefault().

◆ PsynergyMenu_RefreshOwnerEntries()

void PsynergyMenu_RefreshOwnerEntries ( s32 originX,
s32 originY,
s32 columns )

Lays the menu's entry icons (up to 32) out in a grid of 16x16 cells, columns wide, from (originX, originY); empty slots keep their place.

Definition at line 689 of file common.c.

Referenced by PsynergyMenu_RefreshOwnerEntries(), PsynergyMenu_RefreshOwnerEntriesDefault(), and PsynergyMenu_RefreshOwnerPsynergy().

◆ PsynergyMenu_PositionOwnerEntry()

void PsynergyMenu_PositionOwnerEntry ( struct RenderOutput ** slot,
s32 index,
s32 originX,
s32 originY,
s32 columns )

Places the icon in *slot at grid cell index (0 above 31) of a grid of 16x16 cells, columns wide, from (originX, originY), and shows it.

Definition at line 708 of file common.c.

Referenced by PsynergyMenu_PositionOwnerEntry(), and PsynergyMenu_RefreshOwnerEntries().

◆ ItemMenu_PlaceIcon()

void ItemMenu_PlaceIcon ( struct RenderOutput ** slot,
s32 slotIndex,
s32 originX,
s32 originY,
s32 columns )

Places the icon at slotIndex (0 above 15) in a columns-wide grid of 24x16 cells starting at (originX, originY), and shows it.

Definition at line 723 of file common.c.

Referenced by ItemMenu_PlaceIcon(), and ItemMenu_RefreshEntry().

◆ ItemMenu_RefreshEntry()

void ItemMenu_RefreshEntry ( s32 layout)

Lays the inventory's 15 item icons out five to a row from (116, y): y is 56 for layout 1 and 40 otherwise.

Definition at line 737 of file common.c.

Referenced by ItemMenu_RefreshEntry(), and ItemMenu_RefreshOwner().

◆ InventoryMenu_ShowModalMessage()

void InventoryMenu_ShowModalMessage ( s32 message,
s32 x,
s32 y )

Shows message in the item menu, with the hand cursor hidden meanwhile.

With y == -1 the message goes into the info window; otherwise a modal window sized to the message opens at (x, y). With x == -1 the message stays up and FLAG_MENU_INFO_KEPT records that the info window holds it (the next selection keeps it instead of drawing the item name); otherwise it waits for A, B or Start and clears it again.

Definition at line 770 of file common.c.

Referenced by InventoryMenu_ShowModalMessage(), ItemMenu_RunCommands(), ItemMenu_TryBreak(), ItemMenu_Use(), and Menu_ResolveSelectedAction().

◆ InventoryMenu_SortByListOrder()

s32 InventoryMenu_SortByListOrder ( u16 * inventory,
s32 mode )

Sorts a party member's 15 inventory slots by the list order of mode (see Menu_CopyListOrder): items are grouped by the order's item types and, within a type, run from the highest item id down.

Empty slots go to the end. L + A in the item menu cycles through the modes. Returns 1.

Definition at line 824 of file common.c.

Referenced by InventoryMenu_SortByListOrder(), ItemMenu_RunOwnerSelection(), and ItemMenu_SelectItem().

◆ Menu_CopyListOrder()

void Menu_CopyListOrder ( s32 mode,
u8 * order )

Copies the list order of mode 0 to 2 (any other mode: the default order) into order, up to and including its LIST_ORDER_END and at most 32 bytes.

Definition at line 890 of file common.c.

Referenced by InventoryMenu_SortByListOrder(), and Menu_CopyListOrder().

◆ Menu_HandlePageInput()

s32 Menu_HandlePageInput ( s32 horizontal,
s32 count,
s32 pageSize,
s32 * cursor,
s32 * page )

Moves a paged list's cursor and page with the d-pad's repeating keys.

count entries are shown pageSize at a time; *cursor is the row on the page and *page the page. Vertical lists (horizontal 0) move the cursor with Up and Down and turn pages with Left and Right; horizontal lists the other way round. Moving past either end wraps round; turning to a shorter page pulls the cursor up to its last entry. Returns 1 after a page turn, 0 after a cursor move and -1 when nothing moved or the list is empty.

Definition at line 931 of file common.c.

Referenced by ItemMenu_RunList(), ItemMenu_SelectItem(), Menu_HandlePageInput(), PsynergyMenu_RunList(), and PsynergyMenu_SelectAction().

◆ Palette_LightenBankHighlight()

void Palette_LightenBankHighlight ( s32 bank)

Copies the last background palette (15) into background palette bank and lightens its colour 4 by 9 steps in each channel: the highlight colour of the menu's selected rows.

Definition at line 1012 of file common.c.

Referenced by CharacterSelector_RunRearrange(), DjinnMenu_Run(), Item_PrepareUsePalette(), ItemMenu_Run(), Menu_SelectQuantity(), Palette_LightenBankHighlight(), PsynergyMenu_Run(), and StatusMenu_Run().

◆ Menu_DrawPageIndicator()

void Menu_DrawPageIndicator ( struct UiWindow * window,
s32 itemCount,
s32 pageSize,
s32 selectedPage,
s32 rightEdge )

Draws a paged list's page numbers on the top border of window, ending at tile rightEdge: one digit per page between the page arrows, selectedPage in palette 14 and the others in palette 15.

Draws nothing for a single page.

Definition at line 1040 of file common.c.

Referenced by ItemMenu_DrawNamePage(), Menu_DrawPageIndicator(), PsynergyMenu_DrawActionPage(), PsynergyMenu_DrawListPage(), and Shop_DrawItemPage().

◆ Render_SetTilemapFlagRect()

void Render_SetTilemapFlagRect ( const struct UiWindow * window,
s32 x,
s32 y,
s32 width,
s32 height,
u32 palette )

Switches a rectangle of a window's text between palette 15 (normal) and 14 (the highlight made by Palette_LightenBankHighlight): palette is the new palette number.

Only bit 12 of each map entry is cleared before it is set, so this works between those two palettes. (x, y) and the size are in tiles inside the window's border; the rectangle is clipped to the screen.

Definition at line 1075 of file common.c.

Referenced by CharacterMenu_DrawSelectionCursor(), ItemMenu_DrawEquipPage(), ItemMenu_DrawItemDetailPage(), PsynergyMenu_DrawDetailPage(), PsynergyMenu_DrawRangePage(), and Render_SetTilemapFlagRect().

◆ Palette_CopyObjectBankToBackground14()

void Palette_CopyObjectBankToBackground14 ( void )

Copies the first sprite palette into background palette 14, then colour 4 of background palette 15 over its colour 14.

Definition at line 1121 of file common.c.

Referenced by Item_PrepareUsePalette(), ItemMenu_OpenDetail(), Menu_SelectQuantity(), and Palette_CopyObjectBankToBackground14().

◆ Menu_SetPageIcons()

void Menu_SetPageIcons ( s32 pageSize,
s32 first,
struct UiWindow * window,
s32 x,
s32 y )

Shows the item icons of one page of the item list: entries first to first + pageSize - 1, one row of 16 pixels each from (x, y).

Hides all the others.

Definition at line 1131 of file common.c.

Referenced by ItemMenu_DrawNamePage(), Menu_SetPageIcons(), PsynergyMenu_DrawActionPage(), PsynergyMenu_DrawListPage(), and Shop_DrawItemPage().

◆ UiText_DrawWorkValueWithLabel()

void UiText_DrawWorkValueWithLabel ( struct UiWindow * window)

Writes the party's coins and the "Coins" label into window.

Definition at line 1154 of file common.c.

Referenced by ItemMenu_RunCommands(), PsynergyMenu_SelectMember(), and UiText_DrawWorkValueWithLabel().

◆ UiWindow_SetBounds()

◆ UiWork_SetMenuBusy()

void UiWork_SetMenuBusy ( void )

Definition at line 1173 of file common.c.

Referenced by UiWork_SetMenuBusy().

◆ UiWork_ClearMenuBusy()

void UiWork_ClearMenuBusy ( void )

Lets the window renderer resume drawing after a menu update.

Definition at line 1178 of file common.c.

Referenced by UiWork_ClearMenuBusy().

◆ Audio_PlayCueReturnOne()

s32 Audio_PlayCueReturnOne ( s32 cue)

Definition at line 1182 of file common.c.

Referenced by Ability_PlayUseAnimation(), and Audio_PlayCueReturnOne().

◆ Menu_CancelSoundTick()

void Menu_CancelSoundTick ( void )

Scheduler callback while a menu runs: on Start, plays the cancel sound, sets FLAG_MENU_START_PRESSED and removes itself.

Definition at line 1189 of file common.c.

Referenced by Menu_CancelSoundReset(), Menu_CancelSoundTick(), and Menu_EnsureCancelSound().

◆ Menu_CancelSoundReset()

void Menu_CancelSoundReset ( void )

Starts watching for Start: clears FLAG_MENU_START_PRESSED and adds Menu_CancelSoundTick.

Definition at line 1199 of file common.c.

Referenced by ItemMenu_Run(), Menu_CancelSoundReset(), PsynergyMenu_Run(), and StatusMenu_Run().

◆ Menu_EnsureCancelSound()

void Menu_EnsureCancelSound ( void )

Stops watching for Start, if Start has not removed the watch already.

Definition at line 1205 of file common.c.

Referenced by ItemMenu_Run(), Menu_EnsureCancelSound(), PsynergyMenu_Run(), and StatusMenu_Run().

◆ UiPalette_SetColor15()

void UiPalette_SetColor15 ( void )

Sets the window text colour: normal (15), no HP (2) and low HP (4).

Definition at line 1212 of file common.c.

Referenced by UiPalette_SetColor15().

◆ UiPalette_SetColor2()

void UiPalette_SetColor2 ( void )

Definition at line 1214 of file common.c.

Referenced by UiPalette_SetColor2().

◆ UiPalette_SetColor4()

void UiPalette_SetColor4 ( void )

Definition at line 1216 of file common.c.

Referenced by UiPalette_SetColor4().

◆ FourObjectMotion_ClearSlotsAndSchedule()

void FourObjectMotion_ClearSlotsAndSchedule ( void )

Definition at line 56 of file djinn_figures.c.

Referenced by StatusMenu_Run().

◆ FourObjectMotion_ClearSlotsAndScheduleAlt()

void FourObjectMotion_ClearSlotsAndScheduleAlt ( void )

Definition at line 205 of file djinn_figures.c.

Referenced by DjinnMenu_Run().

◆ ItemMenu_Run()

s32 ItemMenu_Run ( void )

The item picker an event script opens (window command 3): the item menu, in which the player chooses one party member's item.

Records the choice in the event work and returns 1 if one was made.

Definition at line 90 of file item.c.

Referenced by ItemMenu_Run().

◆ ItemMenu_RunCommands()

s32 ItemMenu_RunCommands ( s32 * ownerOut,
s32 * targetOut,
s32 * itemOut )

Runs the item menu: choose a party member, one of their items and a command (Use, Equip, Give, Drop, Remove or Inspect), then carry it out, until the player backs out or presses Start.

Returns 1 when an item is to be used outside the menu, with its owner, target and item id in the out parameters; -1 when the player backed out or pressed Start; 0 otherwise.

Definition at line 206 of file item.c.

Referenced by ItemMenu_Run(), and ItemMenu_RunCommands().

◆ ItemMenu_Use()

s32 ItemMenu_Use ( void )

Uses the selected item from the owner in pane 0 on the member in pane 1.

On failure plays the error sound, shows why in the info window and returns -1; otherwise plays the item's animation, recalculates both members and returns 1.

Definition at line 831 of file item.c.

Referenced by ItemMenu_RunCommands(), and ItemMenu_Use().

◆ ItemMenu_Initialize()

void ItemMenu_Initialize ( s32 x,
s32 y,
s32 mode,
s32 columns )

Sets up the item menu's first screen: the cursor window with the party's figures, the info window along the bottom, and an 8 by 2 cursor grid.

The parameters are not used.

Definition at line 860 of file item.c.

Referenced by DjinnMenu_Run(), ItemMenu_Initialize(), ItemMenu_Run(), and PsynergyMenu_Run().

◆ Menu_SpawnIconEntries()

void Menu_SpawnIconEntries ( struct InventoryMenuState * state,
struct UiWindow * window )

Creates the 32 item icon sprites in window, off screen until placed: slots 0 to 7 at x 248, the rest at x 256, all at y 168, each showing item graphic slot of the same number.

Definition at line 886 of file item.c.

Referenced by ItemMenu_RunOwnerSelection(), ItemMenu_SelectItem(), Menu_CreateWindowAndEntryObjects(), Menu_SpawnIconEntries(), PsynergyMenu_SelectAction(), and PsynergyMenu_SelectMember().

◆ ItemMenu_HideAllIcons()

◆ ItemMenu_HidePageIcons()

void ItemMenu_HidePageIcons ( void )

Hides the item icons in the first column of the five-wide item grid.

Definition at line 943 of file item.c.

Referenced by ItemMenu_HidePageIcons(), and ItemMenu_RunCommands().

◆ ItemMenu_Close()

void ItemMenu_Close ( void )

Closes the item menu: releases the party figures, hides the icons and the cursor, and closes every window the menu opened.

Definition at line 962 of file item.c.

Referenced by DjinnMenu_Run(), ItemMenu_Close(), ItemMenu_Run(), Menu_OpenCharacterSelector(), PsynergyMenu_Run(), and StatusMenu_Run().

◆ ItemMenu_SelectMember()

s32 ItemMenu_SelectMember ( s32 pane)

Lets the player choose a party member in pane (0 or 1), starting from the member chosen last.

Returns the member's id, or -1 when the player backs out.

Definition at line 988 of file item.c.

Referenced by ItemMenu_RunCommands(), and ItemMenu_SelectMember().

◆ ItemMenu_RunOwnerSelection()

s32 ItemMenu_RunOwnerSelection ( u16 * ownerIds,
u16 * items )

The party member row of the item menu.

Left and Right move between members, showing each one's items and status; holding R shows their equipment instead; L + A sorts the member's items, a new sort order each press; A chooses a member who has items and B backs out. Returns the chosen member's id, or -1.

Definition at line 1016 of file item.c.

Referenced by ItemMenu_RunOwnerSelection(), and ItemMenu_SelectMember().

◆ ItemMenu_OpenCategory()

void ItemMenu_OpenCategory ( s32 ownerId)

Shows the equipment view of member ownerId's items in the item window.

Definition at line 1130 of file item.c.

Referenced by ItemMenu_OpenCategory(), and ItemMenu_RunOwnerSelection().

◆ ItemMenu_SelectTarget()

s32 ItemMenu_SelectTarget ( s32 mode)

Chooses the party member to use (mode 0) or give (mode 1) the selected item to.

Using shows each member's status as the cursor passes; giving shows each member's items, how many of this item they already hold, or that they would have to trade, and the equipment preview. The party members who can equip the item move while the cursor is up. Returns the chosen member's id, or -1 when the player backs out; giving cannot choose the item's owner.

Definition at line 1145 of file item.c.

Referenced by ItemMenu_RunCommands(), and ItemMenu_SelectTarget().

◆ EquipmentMenu_UpdateCompatibilityIndicators()

void EquipmentMenu_UpdateCompatibilityIndicators ( void )

Scheduler callback while choosing a member to give an item to: every 32 frames, sets each party figure's animation by whether that member can equip the item (3) or not (1).

Definition at line 1282 of file item.c.

Referenced by EquipmentMenu_StartCompatibilityIndicators(), EquipmentMenu_UpdateCompatibilityIndicators(), ItemMenu_ChooseCommand(), and ItemMenu_SelectTarget().

◆ EquipmentMenu_StartCompatibilityIndicators()

void EquipmentMenu_StartCompatibilityIndicators ( void )

Ends EquipmentMenu_UpdateCompatibilityIndicators: puts every party figure back to animation 1 and removes the callback.

Definition at line 1305 of file item.c.

Referenced by EquipmentMenu_StartCompatibilityIndicators(), ItemMenu_ChooseCommand(), and ItemMenu_SelectTarget().

◆ ItemMenu_IsSpecial()

s32 ItemMenu_IsSpecial ( s32 itemId)

Returns 1 for the items that raise a stat for good (Apple, Hard Nut, Mint and Lucky Pepper), whose use shows the stats panel instead of HP and PP.

Definition at line 1323 of file item.c.

Referenced by ItemMenu_IsSpecial(), ItemMenu_RunCommands(), and ItemMenu_SelectTarget().

◆ ItemMenu_DrawMessage()

void ItemMenu_DrawMessage ( s32 unused,
s32 message )

Clears the message window and writes message into it.

Definition at line 1335 of file item.c.

Referenced by ItemMenu_DrawMessage(), ItemMenu_RunCommands(), and Menu_ResolveSelectedAction().

◆ Menu_HideEmptyEntryIcons()

void Menu_HideEmptyEntryIcons ( const u16 * items)

Hides the icon of each of the 32 list entries whose item is 0.

Definition at line 1344 of file item.c.

Referenced by ItemMenu_DrawIcons(), Menu_HideEmptyEntryIcons(), PsynergyMenu_DrawPsynergyIcons(), and PsynergyMenu_SelectOwner().

◆ ItemMenu_CountItems()

s32 ItemMenu_CountItems ( s32 ownerId)

Returns how many of member ownerId's 15 inventory slots hold an item.

Definition at line 1357 of file item.c.

Referenced by ItemMenu_CountItems(), ItemMenu_PageResult(), ItemMenu_RefreshOwner(), ItemMenu_RunCommands(), ItemMenu_RunOwnerSelection(), and ItemMenu_SelectTarget().

◆ InventoryMenu_GetItemQuantity()

s32 InventoryMenu_GetItemQuantity ( s32 ownerId,
s32 itemId )

Returns how many of itemId the unit ownerId holds: the quantity of its first stack, or 0.

The Spanish and Italian editions add up every stack of it.

Definition at line 1380 of file item.c.

Referenced by InventoryMenu_GetItemQuantity(), ItemMenu_RunCommands(), ItemMenu_SelectGiveQuantity(), and ItemMenu_SelectTarget().

◆ ItemMenu_CollectItems()

s32 ItemMenu_CollectItems ( struct BattleUnit * unit,
u16 * items,
s32 mode )

Copies the unit's items into the list items (32 entries), skipping empty slots and clearing the rest.

Returns how many there are. mode is not used.

Definition at line 1409 of file item.c.

Referenced by Item_Use(), ItemMenu_CollectItems(), ItemMenu_RefreshOwner(), ItemMenu_RunCommands(), ItemMenu_RunList(), ItemMenu_RunOwnerSelection(), ItemMenu_SelectItem(), and ItemMenu_SelectMember().

◆ ItemMenu_DrawIcons()

void ItemMenu_DrawIcons ( u16 * inventoryEntries,
s32 iconStyle )

Loads each listed item's icon into its item icon sprite, the first 15 entries of inventoryEntries, and hides the icons of empty entries.

iconStyle 0 draws the list's icons; any other iconStyle the equipment view's (graphics kind 7).

Definition at line 1431 of file item.c.

Referenced by ItemMenu_DrawCategory(), ItemMenu_DrawIcons(), ItemMenu_RefreshOwner(), ItemMenu_RunCommands(), ItemMenu_RunList(), and ItemMenu_SelectItem().

◆ ItemMenu_RefreshOwner()

void ItemMenu_RefreshOwner ( s32 ownerId,
s32 mode )

Shows member ownerId's items in the item window, laid out for layout mode (see ItemMenu_RefreshEntry), or "no items" when there are none.

Definition at line 1457 of file item.c.

Referenced by ItemMenu_RefreshOwner(), ItemMenu_RunCommands(), ItemMenu_RunOwnerSelection(), and ItemMenu_SelectTarget().

◆ InventoryMenu_NoOp()

void InventoryMenu_NoOp ( void )

Nothing calls it.

Definition at line 1474 of file item.c.

Referenced by InventoryMenu_NoOp().

◆ ItemMenu_DrawEquipPreview()

void ItemMenu_DrawEquipPreview ( s32 owner,
s32 slot,
s32 mode,
s32 target )

Shows in the status panel what the item in owner's inventory slot would mean to member target: for a usable item, target's status; for equipment, target's stats with it equipped; for a Psynergy item, the Psynergy it teaches.

When target is someone else, the item is put into a copy of target's inventory for the preview, making room first if it is full, and target is restored after. mode 1 redraws only the lower part of the panel.

Definition at line 1482 of file item.c.

Referenced by ItemMenu_ChooseCommand(), ItemMenu_ConfirmEquip(), ItemMenu_DrawEquipPreview(), ItemMenu_RunCommands(), ItemMenu_RunList(), and ItemMenu_SelectTarget().

◆ Inventory_RemoveFirstUnflagged()

s32 Inventory_RemoveFirstUnflagged ( s32 ownerId)

Makes room in ownerId's inventory: if no slot is free, removes the whole stack in the first slot that is not equipped.

Returns 1 when a slot is free (or was freed), 0 otherwise.

Definition at line 1573 of file item.c.

Referenced by Inventory_RemoveFirstUnflagged(), and ItemMenu_DrawEquipPreview().

◆ ItemMenu_CommandCursorX()

s32 ItemMenu_CommandCursorX ( s32 column,
s32 row )

The x and y of the item command cursor on column and row of the command grid (three commands to a row).

Definition at line 1605 of file item.c.

Referenced by ItemMenu_ChooseCommand(), and ItemMenu_CommandCursorX().

◆ ItemMenu_CommandCursorY()

s32 ItemMenu_CommandCursorY ( s32 column,
s32 row )

Definition at line 1611 of file item.c.

Referenced by ItemMenu_ChooseCommand(), and ItemMenu_CommandCursorY().

◆ ItemMenu_ChooseCommand()

s32 ItemMenu_ChooseCommand ( void )

The item command grid: Use, Equip and Details on the top row, Give, Remove and Drop below (grid index = row * 3 + column, as ItemMenuCommand counts them).

Disabled commands are grey and refuse A. The status panel follows the cursor: the owner's status on Use, the stats with the item equipped on Equip and Details, and without it on the bottom row, where Give also shows who can equip it. The cursor starts on the command chosen last, or on the first available one. Returns the command chosen, or -1 when the player backs out.

Definition at line 1634 of file item.c.

Referenced by ItemMenu_ChooseCommand(), and ItemMenu_RunCommands().

◆ ItemMenu_BuildCommands()

void ItemMenu_BuildCommands ( s8 * commandStates)

Fills commandStates (indexed by ItemMenuCommand) for the selected item: Use for usable items the owner can use here and for field items, Equip for equipment the owner can wear and is not wearing, Remove for worn equipment that is not cursed, Give with someone to give to, Drop unless the item is indispensable, and neither for cursed equipment being worn.

Definition at line 1811 of file item.c.

Referenced by ItemMenu_BuildCommands(), and ItemMenu_ChooseCommand().

◆ ItemMenu_DrawCommands()

void ItemMenu_DrawCommands ( const s8 * commandStates,
struct UiWindow * window )

Writes the six command names into window, the disabled ones in grey.

Definition at line 1871 of file item.c.

Referenced by ItemMenu_ChooseCommand(), and ItemMenu_DrawCommands().

◆ Item_ClassifyUseMode()

s32 Item_ClassifyUseMode ( s32 ownerId,
s32 inventoryEntry )

Says how ownerId can use inventoryEntry from the item menu: 0 the item works on the field (BattleFx_HasTriggerFar), or its action is usable neither in the field nor in battle, and is used once the menu closes; 1 usable in the field: choose a party member to use it on; 2 usable in the field on the whole party at once (range 0xff); -1 it cannot be used here: it has no action, it is equipment the owner cannot wear or of use type 3, or its action is usable only in battle.

Usable items always qualify; equipment only when the owner can wear it.

Definition at line 1923 of file item.c.

Referenced by Item_ClassifyUseMode(), ItemMenu_BuildCommands(), and ItemMenu_RunCommands().

◆ ItemMenu_TryBreak()

void ItemMenu_TryBreak ( void )

After the selected item is used: an item of use type 2 breaks one time in eight, with the break sound.

"It broke!"

Definition at line 1969 of file item.c.

Referenced by ItemMenu_RunCommands(), and ItemMenu_TryBreak().

◆ ItemMenu_OpenDetail()

s32 ItemMenu_OpenDetail ( s32 itemIndex)

Opens the details window (top left, 13 by 10 tiles) and describes the item in pane itemIndex there.

Returns 1.

Definition at line 1988 of file item.c.

Referenced by ItemMenu_OpenDetail().

◆ Menu_SelectQuantity()

s32 Menu_SelectQuantity ( s32 value)

The item menu's Details screen: describes the item entry value in a large window (the whole top half after patch 1) and waits for A or B.

Up and Down move an unused counter from 0 to 4. Returns the counter, or -1 after B.

Definition at line 2003 of file item.c.

Referenced by ItemMenu_RunCommands(), and Menu_SelectQuantity().

◆ ItemMenu_DrawItemDetails()

void ItemMenu_DrawItemDetails ( struct UiWindow * window,
s32 inventoryEntry )

Writes the description of the inventoryEntry into window, one line a row: for equipment its Attack and Defense bonuses, then each of its effects (flat bonuses, rates as multipliers, elemental Power and Resist with the element's icon, and the effects that are only text), whether it is cursed or bestows Psynergy, whether it is used up or may break, and for a stack how many there are.

An item with nothing to say is rare, important, or undescribed.

Definition at line 2094 of file item.c.

Referenced by ItemMenu_DrawItemDetails(), ItemMenu_OpenDetail(), and Menu_SelectQuantity().

◆ ItemMenu_DrawStat()

void ItemMenu_DrawStat ( s32 statChange,
s32 unused,
struct UiWindow * window,
s32 x,
s32 y )

Writes a signed stat change at (x, y) of window: the number, with a plus or minus sign just before its first digit.

Definition at line 2296 of file item.c.

Referenced by ItemMenu_DrawItemDetails(), and ItemMenu_DrawStat().

◆ ItemMenu_SetItemWindowRow5()

void ItemMenu_SetItemWindowRow5 ( void )

Moves the item window to row 5 of the right-hand side.

Definition at line 2328 of file item.c.

Referenced by ItemMenu_RunCommands(), and ItemMenu_SetItemWindowRow5().

◆ ItemMenu_SetItemWindowRow3()

void ItemMenu_SetItemWindowRow3 ( void )

Moves the item window to row 3 of the right-hand side.

Definition at line 2335 of file item.c.

Referenced by ItemMenu_RunCommands(), and ItemMenu_SetItemWindowRow3().

◆ ItemMenu_SetMessageWindowHeight5()

void ItemMenu_SetMessageWindowHeight5 ( void )

Makes the message window, along the top right, 5 rows tall.

Definition at line 2342 of file item.c.

Referenced by ItemMenu_RunCommands(), and ItemMenu_SetMessageWindowHeight5().

◆ ItemMenu_SetMessageWindowHeight6()

void ItemMenu_SetMessageWindowHeight6 ( void )

Definition at line 2348 of file item.c.

Referenced by ItemMenu_RunCommands(), and ItemMenu_SetMessageWindowHeight6().

◆ ItemMenu_SetMessageWindowHeight7()

void ItemMenu_SetMessageWindowHeight7 ( void )

◆ ItemMenu_SetMessageWindowHeight3()

void ItemMenu_SetMessageWindowHeight3 ( void )

Definition at line 2360 of file item.c.

Referenced by ItemMenu_RunCommands(), and ItemMenu_SetMessageWindowHeight3().

◆ ItemMenu_SelectGiveQuantity()

s32 ItemMenu_SelectGiveQuantity ( s32 baseQuantity,
s32 quantityRange,
s32 dropMode )

Asks how many of the selected item stack to give or drop: Left and Right choose a number from 1 to quantityRange (shown as baseQuantity + 1 up to baseQuantity + quantityRange on a dial of digit sprites), with the owner's remaining count and, when giving (dropMode 0), the receiver's new count beside their names.

Returns the number less one, or -1 when the player backs out.

Definition at line 2372 of file item.c.

Referenced by ItemMenu_RunCommands(), and ItemMenu_SelectGiveQuantity().

◆ ItemMenu_DrawItemHead()

void ItemMenu_DrawItemHead ( void )

Shows the selected item at the top of the message window: its icon, its owner's name and its name.

Definition at line 2476 of file item.c.

Referenced by ItemMenu_ChooseCommand(), ItemMenu_DrawItemHead(), and ItemMenu_RunCommands().

◆ ItemMenu_ConfirmDrop()

s32 ItemMenu_ConfirmDrop ( s32 item)

Asks whether to drop item (an inventory entry): its name, the question, and Yes or No, No first.

Returns 0 for Yes and 1 for No, B or Start.

Definition at line 2494 of file item.c.

Referenced by ItemMenu_ConfirmDrop(), and ItemMenu_RunCommands().

◆ ItemMenu_ConfirmEquip()

s32 ItemMenu_ConfirmEquip ( s32 unused)

After giving or trading the selected item to the member in pane 1, offers to equip it there, showing the stats it would give.

Returns 0 when it is equipped; 1 when the player says No, backs out, or the member cannot equip it, and the member is left as before.

Definition at line 2556 of file item.c.

Referenced by ItemMenu_ConfirmEquip(), and ItemMenu_RunCommands().

◆ Resource_LoadPairedBlocks()

void Resource_LoadPairedBlocks ( void )

Loads the stat arrows (up and down) into two free VRAM blocks, kept in the menu work's resource slots.

Definition at line 2643 of file item.c.

Referenced by ItemMenu_Run(), and Resource_LoadPairedBlocks().

◆ ItemMenu_PageResult()

s32 ItemMenu_PageResult ( struct MenuResult * result,
s32 index )

Fills result with the item list of the member in pane index: their unit, how many items they hold, and the page and row of the item chosen last for them (kept within the list), five items to a page.

Returns 1.

Definition at line 2657 of file item.c.

Referenced by ItemMenu_PageResult(), and ItemMenu_RunList().

◆ ItemMenu_DrawItemDetailPage()

s32 ItemMenu_DrawItemDetailPage ( struct UiWindow * window,
void * ownerWork,
struct MenuResult * pageState )

Updates the item list for the row under the cursor: puts the selected item's plain name in the info window and highlights its row of the five.

window and ownerWork are not used.

Definition at line 2690 of file item.c.

Referenced by ItemMenu_DrawItemDetailPage(), and ItemMenu_RunList().

◆ ItemMenu_DrawNamePage()

s32 ItemMenu_DrawNamePage ( struct UiWindow * window,
s32 unused,
const struct MenuResult * pageState )

Draws one page of the item list into window: up to five item names with their icons, and the page numbers when there is more than one page.

Definition at line 2730 of file item.c.

Referenced by ItemMenu_DrawNamePage(), and ItemMenu_RunList().

◆ InventoryMenu_ItemNamePageReturnTrue()

s32 InventoryMenu_ItemNamePageReturnTrue ( void )

Nothing calls it.

Definition at line 2772 of file item.c.

Referenced by InventoryMenu_ItemNamePageReturnTrue().

◆ InventoryMenu_ItemNamePageNoOp()

void InventoryMenu_ItemNamePageNoOp ( void )

Nothing calls it.

Definition at line 2775 of file item.c.

Referenced by InventoryMenu_ItemNamePageNoOp().

◆ ItemMenu_RunList()

s32 ItemMenu_RunList ( s32 paneIndex)

The item list of the member in paneIndex (0: the owner, 1: the receiver of a trade), five items a page.

The cursor's item is named in the info window and previewed in the status panel, its icon animates, and the party members who can equip it move. Up and Down move the cursor, Left and Right turn pages, and in paneIndex 0 L and R switch to the previous or next member who has items. Returns the chosen inventory entry, or -1 when the player backs out.

Definition at line 2783 of file item.c.

Referenced by ItemMenu_RunCommands(), and ItemMenu_RunList().

◆ PsynergyMenu_Run()

s32 PsynergyMenu_Run ( void )

The Psynergy menu an event opens (window command 1): the field menu's Psynergy screen over the field, which stops meanwhile.

When the player picks Psynergy to use on the field, it is recorded in the event work's psynergyRequest (owner << 10 | Psynergy) and 1 is returned; -1 when the player backs out.

Definition at line 42 of file psynergy.c.

Referenced by PsynergyMenu_Run().

◆ Menu_ResolveSelectedAction()

s32 Menu_ResolveSelectedAction ( s32 * outOwner,
s32 * unused,
s32 * outAction )

Runs the Psynergy menu: choose a party member and one of their Psynergy, then use it on a member (or the whole party), or, in the shortcut modes, set it as the L or R shortcut.

Returns 1 with the owner and Psynergy in the out parameters when the chosen Psynergy works on the field, to be used once the menu closes; -1 when the player backs out or presses Start; otherwise the result of the last use.

Definition at line 118 of file psynergy.c.

Referenced by Menu_ResolveSelectedAction(), and PsynergyMenu_Run().

◆ PsynergyMenu_ClassifySelectedPsynergy()

s32 PsynergyMenu_ClassifySelectedPsynergy ( void )

Says how the selected Psynergy is used from the menu: 0 on the field once the menu closes (its effect has a field event), 2 on the whole party (range 0xff), 1 on one chosen member when its target mode is 2, and 0 otherwise.

Definition at line 306 of file psynergy.c.

Referenced by Menu_ResolveSelectedAction(), and PsynergyMenu_ClassifySelectedPsynergy().

◆ PsynergyMenu_SelectPartySlot()

s32 PsynergyMenu_SelectPartySlot ( s32 partySlot)

Lets the player choose a party member in pane partySlot (0 or 1), starting from the one chosen last, with each member's Psynergy shown as the cursor passes.

Returns the chosen member's id, or -1 when the player backs out.

Definition at line 331 of file psynergy.c.

Referenced by Menu_ResolveSelectedAction(), and PsynergyMenu_SelectPartySlot().

◆ PsynergyMenu_SelectMember()

s32 PsynergyMenu_SelectMember ( u16 * ownerIds,
u16 * unused )

The party member row of the Psynergy menu.

Left and Right move between members, showing each one's Psynergy, status and shortcuts; A chooses a member who has Psynergy to use, L or R one who has field Psynergy to set as that shortcut (menu mode 1 or 2), and B backs out. Returns the chosen member's id, or -1.

Definition at line 391 of file psynergy.c.

Referenced by PsynergyMenu_SelectMember(), and PsynergyMenu_SelectPartySlot().

◆ PsynergyMenu_RefreshOwnerPsynergy()

void PsynergyMenu_RefreshOwnerPsynergy ( s32 ownerId)

Shows member ownerId's Psynergy icons in the Psynergy window, eight to a row, or "no Psynergy" when they have none.

Definition at line 501 of file psynergy.c.

Referenced by PsynergyMenu_RefreshOwnerPsynergy(), and PsynergyMenu_SelectMember().

◆ PsynergyMenu_ReturnTrue()

s32 PsynergyMenu_ReturnTrue ( void )

Nothing calls them.

Definition at line 520 of file psynergy.c.

Referenced by PsynergyMenu_ReturnTrue().

◆ PsynergyMenu_NoOp()

void PsynergyMenu_NoOp ( void )

Definition at line 522 of file psynergy.c.

Referenced by PsynergyMenu_NoOp().

◆ PsynergyMenu_SelectTarget()

s32 PsynergyMenu_SelectTarget ( s32 targetMode)

Chooses the party member to use the selected Psynergy on.

In mode 0 each member's status shows as the cursor passes, with the Psynergy's description once. Returns the chosen member's id, or -1 when the player backs out.

Definition at line 527 of file psynergy.c.

Referenced by Menu_ResolveSelectedAction(), and PsynergyMenu_SelectTarget().

◆ PsynergyMenu_SetShortcut()

s32 PsynergyMenu_SetShortcut ( s32 ownerId,
s32 actionId,
s32 shortcutIndex )

Sets the L (shortcutIndex 0) or R (shortcutIndex 1) Psynergy shortcut: ownerId << 10 | the Psynergy's id.

Returns 1.

Definition at line 610 of file psynergy.c.

Referenced by Menu_ResolveSelectedAction(), PsynergyMenu_RunList(), and PsynergyMenu_SetShortcut().

◆ PsynergyMenu_DrawShortcuts()

s32 PsynergyMenu_DrawShortcuts ( struct UiWindow * window,
s32 owner )

Definition at line 628 of file psynergy.c.

Referenced by PsynergyMenu_DrawShortcuts(), and PsynergyMenu_SelectMember().

◆ PsynergyMenu_CreateEntryGrid()

void PsynergyMenu_CreateEntryGrid ( void )

Sets up a Psynergy grid screen: the cursor window with the party's figures, a 30 by 15 window below with a hidden grid cursor and a portrait, and 16 Psynergy icon sprites in two rows of eight from (96, 8), on an 8 by 2 grid.

Definition at line 765 of file psynergy.c.

Referenced by PsynergyMenu_CreateEntryGrid().

◆ PsynergyMenu_CloseWindows()

void PsynergyMenu_CloseWindows ( void )

Releases the party figures and closes the Psynergy grid screen's windows.

Definition at line 813 of file psynergy.c.

Referenced by PsynergyMenu_CloseWindows().

◆ PsynergyMenu_DrawPsynergyIcons()

void PsynergyMenu_DrawPsynergyIcons ( u16 * psynergies)

Loads each listed Psynergy's icon into its icon sprite (32 entries) and hides the icons of empty entries.

Definition at line 825 of file psynergy.c.

Referenced by PsynergyMenu_DrawPreparedPsynergyIcons(), PsynergyMenu_DrawPsynergyIcons(), PsynergyMenu_RefreshOwnerPsynergy(), PsynergyMenu_RunList(), and PsynergyMenu_SelectOwner().

◆ PsynergyMenu_CollectActions()

s32 PsynergyMenu_CollectActions ( struct BattleUnit * unit,
u16 * actions,
s32 mode )

Lists unit's Psynergy into actions (32 entries, cleared first) and returns how many there are.

mode 1 lists only the Psynergy that work on the field (those that can be shortcuts); mode 2 those with a field effect or usable in the field; any other mode those first, then the rest.

Definition at line 849 of file psynergy.c.

Referenced by PsynergyMenu_CollectActions(), PsynergyMenu_RefreshOwnerPsynergy(), PsynergyMenu_RunList(), PsynergyMenu_SelectAction(), PsynergyMenu_SelectMember(), PsynergyMenu_SelectOwner(), and PsynergyMenu_SelectPartySlot().

◆ PsynergyMenu_BuildPageResult()

s32 PsynergyMenu_BuildPageResult ( struct MenuResult * result,
s32 index )

Fills result with the Psynergy list of the member in pane index: their unit, how many Psynergy are listed, and the page and row of the one chosen last for them (kept within the list), five to a page.

Returns 1.

Definition at line 911 of file psynergy.c.

Referenced by PsynergyMenu_BuildPageResult(), and PsynergyMenu_RunList().

◆ PsynergyMenu_DrawDetailPage()

s32 PsynergyMenu_DrawDetailPage ( struct UiWindow * window,
s32 * work,
struct MenuResult * state )

Updates the Psynergy list for the row under the cursor: puts the Psynergy's description in the info window, unless a kept message is there, and highlights its row of the five.

window and work are not used.

Definition at line 950 of file psynergy.c.

Referenced by PsynergyMenu_DrawDetailPage(), and PsynergyMenu_RunList().

◆ PsynergyMenu_DrawActionPage()

s32 PsynergyMenu_DrawActionPage ( struct UiWindow * window,
s32 unused,
const struct MenuResult * pageState )

Draws one page of the Psynergy list into window: up to five names with their icons and PP costs, Psynergy the member cannot afford in the no-HP colour and one restricted here in the low-HP colour, the page numbers, and the help line (how to set a shortcut while Select is held, else how to change member).

Definition at line 1006 of file psynergy.c.

Referenced by PsynergyMenu_DrawActionPage(), and PsynergyMenu_RunList().

◆ PsynergyMenu_RunList()

s32 PsynergyMenu_RunList ( s32 paneIndex)

The Psynergy list of the member in paneIndex, five a page.

The cursor's Psynergy is described in the info window and its icon animates; L and R switch to the previous or next member who has Psynergy to list. In the use mode (menu mode 0), A chooses Psynergy the member can use and afford; holding Select shows the shortcut help, and L or R with Select set the Psynergy as that shortcut. In the shortcut modes (1 and 2) only field Psynergy are listed and A chooses one. Returns the chosen Psynergy, or -1 when the player backs out.

Definition at line 1080 of file psynergy.c.

Referenced by Menu_ResolveSelectedAction(), and PsynergyMenu_RunList().

◆ PsynergyMenu_IsActionRestricted()

s32 PsynergyMenu_IsActionRestricted ( s32 actionEntry)

Returns 1 when actionEntry cannot be used from the menu: it has no field effect and is not usable both in the field and in battle.

Definition at line 1316 of file psynergy.c.

Referenced by PsynergyMenu_DrawActionPage(), PsynergyMenu_IsActionRestricted(), and PsynergyMenu_RunList().

◆ Menu_OpenCharacterSelector()

s32 Menu_OpenCharacterSelector ( void )

Lets the player choose one party member, over the field (the Colosso scenes use it).

Returns the chosen member's id, or -1 when the player backs out.

Definition at line 95 of file status.c.

Referenced by Colosso_OfferCheeringSpot(), and Menu_OpenCharacterSelector().

◆ CharacterSelector_Run()

s32 CharacterSelector_Run ( void )

The member chooser's loop. Returns the chosen member's id, or -1.

Definition at line 124 of file status.c.

Referenced by CharacterSelector_Run(), and Menu_OpenCharacterSelector().

◆ StatusMenu_Run()

s32 StatusMenu_Run ( void )

The Status menu an event opens (window command 4) over the field: saves the first two background palettes and the window tiles it draws over, sets up the party row and, when the party has Djinn, the four Djinn sprites, runs the status pages, then puts everything back.

Returns their result.

Definition at line 145 of file status.c.

Referenced by StatusMenu_Run().

◆ Menu_RunActionFlow()

s32 Menu_RunActionFlow ( void )

The Status menu's pages: choose a party member, then their status page, A for their Psynergy page and A again for their equipment page; B steps back.

Returns the last page's result, or -1 when the player backs out or presses Start.

Definition at line 227 of file status.c.

Referenced by Menu_RunActionFlow(), and StatusMenu_Run().

◆ CharacterMenu_SelectOwner()

s32 CharacterMenu_SelectOwner ( s32 slot)

Lets the player choose a party member in slot, from the one chosen last: the member chooser when the menu is on page 3, else the Status menu's party row.

Game flag 0x172 adds a divider to the party window. Returns the chooser's result.

Definition at line 279 of file status.c.

Referenced by CharacterMenu_SelectOwner(), CharacterSelector_Run(), and Menu_RunActionFlow().

◆ DjinnMenu_ShowCurrentList()

s32 DjinnMenu_ShowCurrentList ( void )

Shows every Djinn the party has found, a column of seven for each element, until A, B or Select, then puts the Djinn menu back.

Definition at line 310 of file status.c.

Referenced by CharacterSelector_RunRearrange(), and DjinnMenu_ShowCurrentList().

◆ CharacterSelector_RunRearrange()

s32 CharacterSelector_RunRearrange ( void )

The Status menu's party row: Left and Right choose a member, showing their status; L and R move the member one place along the party order; Select lists the Djinn found (once the first is caught, FLAG_DJINNI_0); A chooses the member and B backs out.

Returns 1 or -1.

Definition at line 395 of file status.c.

Referenced by CharacterMenu_SelectOwner(), and CharacterSelector_RunRearrange().

◆ PsynergyMenu_SelectOwner()

s32 PsynergyMenu_SelectOwner ( void )

The member chooser (menu page 3): Left and Right choose a party member, showing their status and Psynergy icons; A chooses and B backs out.

Returns 1 or -1.

Definition at line 508 of file status.c.

Referenced by CharacterMenu_SelectOwner(), and PsynergyMenu_SelectOwner().

◆ CharacterSelector_MoveEntry()

s32 CharacterSelector_MoveEntry ( s32 selectedIndex,
s32 direction )

Moves the party member at selectedIndex one place later (direction 1) or earlier (0) in the party order.

Returns 1, or 0 when it cannot move.

Definition at line 577 of file status.c.

Referenced by CharacterSelector_MoveEntry(), and CharacterSelector_RunRearrange().

◆ Menu_InitSelectorCursorAndEntries()

void Menu_InitSelectorCursorAndEntries ( s32 unused0,
s32 unused1,
s32 unused2,
s32 unused3 )

Sets up the Status menu's first screen: the cursor window with the party's figures, no other windows yet, and an 8 by 2 cursor grid.

The parameters are not used.

Definition at line 643 of file status.c.

Referenced by Menu_InitSelectorCursorAndEntries(), Menu_OpenCharacterSelector(), and StatusMenu_Run().

◆ Menu_CreateWindowAndEntryObjects()

void Menu_CreateWindowAndEntryObjects ( s32 resource,
s32 frame )

Shows member resource's status in the status window (0, 5, 30 by 15), opening it first with the member's portrait, the item icons on the chooser page, and the eight stat sprites; then draws the status and ailments.

Definition at line 662 of file status.c.

Referenced by CharacterSelector_RunRearrange(), Menu_CreateWindowAndEntryObjects(), and PsynergyMenu_SelectOwner().

◆ CharacterMenu_SelectCommand()

s32 CharacterMenu_SelectCommand ( void )

The member's status page.

The left pane lists their ailments (or the stat help when they have none) and the right pane the status entries (name and level, experience, HP, PP, Djinn when the party has any, elemental levels, Power and Resist); the cursor's entry is highlighted and explained in the help window. Up and Down move in a pane, Left and Right switch panes, L and R switch to the previous or next member; A goes on to the Psynergy page and B backs out. Returns 1 or -1.

Definition at line 695 of file status.c.

Referenced by CharacterMenu_SelectCommand(), and Menu_RunActionFlow().

◆ CharacterMenu_DrawSelectionCursor()

void CharacterMenu_DrawSelectionCursor ( s32 mode,
s32 selected,
u8 * entries,
s32 invert )

Highlights (invert 0) or unhighlights (invert 1) the selected entry of the status page: in pane 0 the selected ailment row, as wide as its label (gCharacterMenu_CursorWidths); in pane 1 one of the first four status rows or of the rows below.

Definition at line 844 of file status.c.

Referenced by CharacterMenu_DrawSelectionCursor(), and CharacterMenu_SelectCommand().

◆ CharacterMenu_DrawSelectionLabels()

void CharacterMenu_DrawSelectionLabels ( struct UiWindow * target,
s32 selected,
const u8 * entries )

Writes the advice for the selected ailment (two lines, for example how to revive a member who is down) into window target, or that the member is well when they have no ailment.

Definition at line 890 of file status.c.

Referenced by CharacterMenu_DrawSelectionLabels(), and CharacterMenu_SelectCommand().

◆ StatusMenu_ShowOwnerProgressMessage()

void StatusMenu_ShowOwnerProgressMessage ( struct UiWindow * destination,
s32 messageVariant,
s32 preserveVariant )

Writes the help text of status entry messageVariant into destination: the entries skip Djinn when the party has none (preserveVariant 0); the experience entry says how many points the next level needs, or, at level 99, gives the plain experience text.

Definition at line 922 of file status.c.

Referenced by CharacterMenu_SelectCommand(), and StatusMenu_ShowOwnerProgressMessage().

◆ CharacterMenu_DrawStatusAilments()

void CharacterMenu_DrawStatusAilments ( struct UiWindow * window,
s32 ownerId,
s32 mode )

Draws member ownerId's status page into window: the top rows (ItemMenu_ DrawOwnerStatus), the ailment list or "Normal", and except on the chooser page the Djinn counts by element and, in mode 1, the elemental levels, Power and Resist.

mode's 0x100 keeps what is drawn instead of clearing it.

Definition at line 956 of file status.c.

Referenced by CharacterMenu_DrawStatusAilments(), CharacterMenu_SelectCommand(), and Menu_CreateWindowAndEntryObjects().

◆ Runtime_RunBusyWaitDelay()

void Runtime_RunBusyWaitDelay ( void )

Spins for 256 loop passes (international editions only).

Definition at line 1066 of file status.c.

Referenced by Runtime_RunBusyWaitDelay().

◆ ItemMenu_DrawOwnerStatus()

void ItemMenu_DrawOwnerStatus ( struct UiWindow * window,
s32 ownerId,
s32 flags )

Draws the top rows of member ownerId's status page into window: name, class, level, experience, HP and PP on the left, Attack, Defense, Agility and Luck on the right.

flags' 0x100 keeps what is drawn instead of clearing it.

Definition at line 1080 of file status.c.

Referenced by CharacterMenu_DrawStatusAilments(), and ItemMenu_DrawOwnerStatus().

◆ CharacterMenu_BuildAvailability()

s32 CharacterMenu_BuildAvailability ( u8 * ailments,
s32 requested,
s32 ownerId )

Fills ailments[0..4] (CharacterAilment) with member ownerId's ailments: down (only when requested is 1), poison or venom, curse and haunt.

Returns how many they have.

Definition at line 1130 of file status.c.

Referenced by CharacterMenu_BuildAvailability(), CharacterMenu_DrawStatusAilments(), CharacterMenu_SelectCommand(), and Menu_DrawOwnerStatusPanel().

◆ Menu_BuildPageResult()

s32 Menu_BuildPageResult ( struct MenuResult * result,
s32 index )

Fills result with the item list of the member in pane index for the equipment pages: their unit, the menu's item count, and the page and row of the item chosen last for them, STATUS_EQUIP_PAGE_SIZE items to a page.

Returns 1.

Definition at line 1169 of file status.c.

Referenced by ItemMenu_SelectItem(), Menu_BuildPageResult(), and PsynergyMenu_SelectAction().

◆ Menu_BuildPatternTiles()

void Menu_BuildPatternTiles ( void )

Builds twelve 8x8 tiles in the window tile area: two sets of six, each a fill of colour 4 with the rows of gMenu_PatternRowMasks XORed in, the first set growing row by row and the second skipping its top row.

Definition at line 1209 of file status.c.

Referenced by Menu_BuildPatternTiles(), and PsynergyMenu_SelectAction().

◆ PsynergyMenu_DrawRange()

void PsynergyMenu_DrawRange ( struct UiWindow * window,
s32 x,
s32 y,
s32 range,
s32 unused )

Draws a Psynergy range icon at (x, y) of window: three tiles from the range icon tiles, the left one mirrored.

Definition at line 1247 of file status.c.

Referenced by PsynergyMenu_DrawListPage(), and PsynergyMenu_DrawRange().

◆ PsynergyMenu_DrawRangePage()

s32 PsynergyMenu_DrawRangePage ( struct UiWindow * window,
s32 unused,
struct MenuResult * state )

Updates the Psynergy page for the row under the cursor: the Psynergy's description in the info window, where it can be used (in the field, in battle, or anywhere), and the row highlights with the range icons.

Definition at line 1264 of file status.c.

Referenced by PsynergyMenu_DrawRangePage(), and PsynergyMenu_SelectAction().

◆ PsynergyMenu_DrawListPage()

s32 PsynergyMenu_DrawListPage ( struct UiWindow * window,
s32 unused,
const struct MenuResult * res )

Definition at line 1358 of file status.c.

Referenced by PsynergyMenu_DrawListPage(), and PsynergyMenu_SelectAction().

◆ PsynergyMenu_SelectAction()

s32 PsynergyMenu_SelectAction ( void )

Definition at line 1432 of file status.c.

Referenced by Menu_RunActionFlow(), and PsynergyMenu_SelectAction().

◆ PsynergyMenu_ActionReturnTrue()

s32 PsynergyMenu_ActionReturnTrue ( void )

A page callback.

Definition at line 1547 of file status.c.

Referenced by PsynergyMenu_ActionReturnTrue().

◆ PsynergyMenu_DrawPreparedPsynergyIcons()

void PsynergyMenu_DrawPreparedPsynergyIcons ( const void * unused,
s32 ownerId )

Draws this owner's prepared Psynergy list in the shared entry sprites.

Definition at line 1550 of file status.c.

Referenced by PsynergyMenu_DrawPreparedPsynergyIcons(), and PsynergyMenu_SelectAction().

◆ PsynergyMenu_PreparedIconsNoOp()

void PsynergyMenu_PreparedIconsNoOp ( void )

Reserved empty callback for the prepared Psynergy page.

Definition at line 1559 of file status.c.

Referenced by PsynergyMenu_PreparedIconsNoOp().

◆ PsynergyMenu_PreparedIconsSecondNoOp()

void PsynergyMenu_PreparedIconsSecondNoOp ( void )

Reserved second empty callback for the prepared Psynergy page.

Definition at line 1562 of file status.c.

Referenced by PsynergyMenu_PreparedIconsSecondNoOp().

◆ ItemMenu_DrawEquipPage()

s32 ItemMenu_DrawEquipPage ( struct UiWindow * window,
s32 unused,
struct MenuResult * state )

Definition at line 1564 of file status.c.

Referenced by ItemMenu_DrawEquipPage(), and ItemMenu_SelectItem().

◆ Shop_DrawItemPage()

s32 Shop_DrawItemPage ( struct UiWindow * window,
s32 unused,
struct MenuResult * state )

Definition at line 1642 of file status.c.

Referenced by ItemMenu_SelectItem(), and Shop_DrawItemPage().

◆ ItemMenu_SelectItem()

s32 ItemMenu_SelectItem ( void )

Definition at line 1685 of file status.c.

Referenced by ItemMenu_SelectItem(), and Menu_RunActionFlow().

◆ Menu_MoveGridCursor()

s32 Menu_MoveGridCursor ( s32 * columnOut,
s32 * rowOut,
s32 direction )

Moves through the status grid's irregular rows and returns row * 9 + column.

Definition at line 1811 of file status.c.

Referenced by Menu_MoveGridCursor().

◆ Menu_ReservedStatusOne()

s32 Menu_ReservedStatusOne ( void )

Definition at line 1880 of file status.c.

Referenced by Menu_ReservedStatusOne().

◆ ItemMenu_DrawCategory()

void ItemMenu_DrawCategory ( struct UiWindow * window,
s32 ownerId,
s32 mode )

Shows the owner's equipped items and optionally its category icons.

Definition at line 1883 of file status.c.

Referenced by ItemMenu_DrawCategory(), ItemMenu_OpenCategory(), and ItemMenu_SelectItem().

◆ ItemMenu_DrawEquippedItemNames()

void ItemMenu_DrawEquippedItemNames ( struct UiWindow * window,
u16 * items )

Draws the nonempty equipment entries by their item names.

Definition at line 1904 of file status.c.

Referenced by ItemMenu_DrawCategory(), and ItemMenu_DrawEquippedItemNames().

◆ Menu_PlaceEntryObjectsInGrid()

void Menu_PlaceEntryObjectsInGrid ( s32 originX,
s32 originY,
s32 columns )

Positions the shared entry sprites on the requested grid.

Definition at line 1934 of file status.c.

Referenced by Menu_PlaceEntryObjectsInGrid(), and PsynergyMenu_SelectOwner().

◆ Menu_PlaceEntryObjectInGrid()

void Menu_PlaceEntryObjectInGrid ( struct RenderOutput * icon,
s32 index,
s32 originX,
s32 originY,
s32 columns )

Positions one entry sprite in the requested number of grid columns.

Definition at line 1951 of file status.c.

Referenced by Menu_PlaceEntryObjectInGrid(), and Menu_PlaceEntryObjectsInGrid().

◆ ItemMenu_ArrangeCategoryItemIcons()

void ItemMenu_ArrangeCategoryItemIcons ( u16 * items)

Loads and places the owner's equipment-category icons.

Definition at line 1965 of file status.c.

Referenced by ItemMenu_ArrangeCategoryItemIcons(), and ItemMenu_DrawCategory().

◆ ItemMenu_PosCategory()

void ItemMenu_PosCategory ( void )

Moves all entry sprites off screen before arranging another category.

Definition at line 2001 of file status.c.

Referenced by ItemMenu_ArrangeCategoryItemIcons(), ItemMenu_DrawCategory(), ItemMenu_OpenCategory(), ItemMenu_PosCategory(), ItemMenu_SelectItem(), Menu_ResolveSelectedAction(), and PsynergyMenu_SelectAction().

◆ Menu_CreateEightEntryObjects()

s32 Menu_CreateEightEntryObjects ( struct UiWindow * window)

Creates the eight shared category sprites, initially off screen.

Definition at line 2021 of file status.c.

Referenced by Menu_CreateEightEntryObjects(), and Menu_CreateWindowAndEntryObjects().

◆ ItemMenu_ApplyFlags()

void ItemMenu_ApplyFlags ( const u8 * flags)

Shows enabled category icons down the left edge, sixteen pixels apart.

Definition at line 2043 of file status.c.

Referenced by CharacterMenu_DrawStatusAilments(), and ItemMenu_ApplyFlags().

◆ ItemMenu_ResetCategory()

void ItemMenu_ResetCategory ( void )

Moves each category sprite off screen before it is reused.

Definition at line 2076 of file status.c.

Referenced by CharacterMenu_SelectCommand(), DjinnMenu_ShowCurrentList(), ItemMenu_ApplyFlags(), and ItemMenu_ResetCategory().

◆ CharacterMenu_UpdateSelectionIcons()

s32 CharacterMenu_UpdateSelectionIcons ( const u8 * enabled)

Loads each enabled ailment's icon into its category resource slot.

Definition at line 2093 of file status.c.

Referenced by CharacterMenu_DrawStatusAilments(), and CharacterMenu_UpdateSelectionIcons().

◆ Item_PrepareUsePalette()

void Item_PrepareUsePalette ( void )

Copies and lightens the palette used by the item-use animation.

Definition at line 9 of file use.c.

Referenced by Item_PrepareUsePalette().

◆ Item_UseNoOpCallback()

void Item_UseNoOpCallback ( void )

Reserved empty callback during an item's menu animation.

Definition at line 15 of file use.c.

Referenced by Item_UseNoOpCallback().

◆ Item_Use()

s32 Item_Use ( s32 slot,
s32 ownerId,
s32 targetId )

Applies the slot's action, then consumes or transforms the item on success.

Definition at line 18 of file use.c.

Referenced by Item_Use(), and ItemMenu_Use().

◆ Item_ReturnOne()

s32 Item_ReturnOne ( void )

Definition at line 47 of file use.c.

Referenced by Item_ReturnOne().

◆ BattleEffect_ApplyToTargets()

s32 BattleEffect_ApplyToTargets ( s32 effectId,
s32 sourceId,
s32 targetId,
s32 fixedScale )

Applies healing or permanent-stat effects to one member or the whole party.

The result message is kept in menu work; -1 reports that nothing changed.

Definition at line 51 of file use.c.

Referenced by BattleEffect_ApplyToTargets(), Item_Use(), and Menu_ResolveSelectedAction().

◆ Item_PlayUseAnimation()

void Item_PlayUseAnimation ( u32 item)

Runs the animation selected by the item's action definition.

Definition at line 311 of file use.c.

Referenced by Item_PlayUseAnimation(), and ItemMenu_Use().

◆ Ability_PlayUseAnimation()

void Ability_PlayUseAnimation ( s32 action)

Starts the action's menu animation and waits for its completion.

Definition at line 317 of file use.c.

Referenced by Ability_PlayUseAnimation(), Item_PlayUseAnimation(), and Menu_ResolveSelectedAction().

◆ Menu_ReservedStatusZero()

s32 Menu_ReservedStatusZero ( void )

Definition at line 382 of file use.c.

Referenced by Menu_ReservedStatusZero().

◆ Menu_WrapIndex()

s32 Menu_WrapIndex ( s32 value,
s32 modulus )

Wraps a cursor index that has stepped one past either end of modulus entries: -1 becomes modulus - 1 and modulus becomes 0.

Definition at line 47 of file djinn.c.

Referenced by DjinnMenu_SelectDjinn(), DjinnMenu_ShowHelp(), DjinnMenu_ShowOwnerStatus(), Menu_WrapIndex(), and OwnerAction_RunCompareLoop().

◆ Menu_SetFirstObjectRowCoordinates()

s32 Menu_SetFirstObjectRowCoordinates ( s32 yOffset)

Places the Djinn menu's first row at its normal height plus yOffset.

Definition at line 52 of file djinn.c.

Referenced by DjinnMenu_Run(), DjinnMenu_RunScreen(), and Menu_SetFirstObjectRowCoordinates().

◆ DjinnMenu_Run()

s32 DjinnMenu_Run ( void )

Runs the Djinn menu, preserving field tiles and the message speed.

Definition at line 68 of file djinn.c.

Referenced by DjinnMenu_Run().

◆ DjinnMenu_RunScreen()

s32 DjinnMenu_RunScreen ( void )

Chooses a Djinni, previews changes, then sets, stands by, gives or trades it.

Confirmation states fall through to their matching commit states on success.

Definition at line 181 of file djinn.c.

Referenced by DjinnMenu_Run(), and DjinnMenu_RunScreen().

◆ Graphics_AdjustPaletteBank()

void Graphics_AdjustPaletteBank ( s32 brightnessDelta)

Writes copies of background palettes 15, 5 and 7, each brightnessDelta lighter in every channel (clamped to 0-31), into palettes 14, 4 and 6.

Palette 7's copy is 12 darker instead.

Definition at line 401 of file djinn.c.

Referenced by Graphics_AdjustPaletteBank(), and Menu_OpenBackdropScreen().

◆ Menu_OpenBackdropScreen()

MenuBackdropResult Menu_OpenBackdropScreen ( void )

Draws the backdrop behind the Djinn menu's list: its window, tiles and palettes.

Definition at line 462 of file djinn.c.

Referenced by DjinnMenu_RunScreen(), and Menu_OpenBackdropScreen().

◆ OwnerAction_DiffSlots()

s32 OwnerAction_DiffSlots ( struct OwnerActionSlot * before,
struct OwnerActionSlot * after,
u16 * actionsOut,
s32 * gainedCountOut,
s32 * lostCountOut )

Lists the actions after a preview, marking gains, then appends the losses.

The two output counts distinguish gained and lost actions.

Definition at line 495 of file djinn.c.

Referenced by DjinnMenu_DrawStatPreview(), DjinnMenu_ShowOwnerStatus(), OwnerAction_DiffSlots(), and OwnerAction_RunCompareLoop().

◆ DjinnMenu_BuildLists()

s32 DjinnMenu_BuildLists ( void * table)

Rebuilds the Djinn lists in table: each owner's packed Djinn entries and their count.

Definition at line 548 of file djinn.c.

Referenced by DjinnMenu_BuildLists(), and DjinnMenu_RunScreen().

◆ UiWindow_SetInteriorPaletteBitRect()

s32 UiWindow_SetInteriorPaletteBitRect ( const struct UiWindow * window,
s32 x,
s32 y,
s32 width,
s32 height,
s32 palette )

Sets the palette of a rectangle of window's interior, (x, y) and its size in tiles from the interior's corner, through UiWindow_SetPaletteBitRectFar.

Definition at line 648 of file djinn.c.

Referenced by DjinnMenu_SelectDjinn(), DjinnMenu_ShowHelp(), and UiWindow_SetInteriorPaletteBitRect().

◆ UiWindow_SetRectPalette()

void UiWindow_SetRectPalette ( s32 x,
s32 y,
s32 width,
s32 height,
s32 palette )

Moves each tile of a screen rectangle (in tiles, clipped to the screen) that shows palette 15 to palette.

Definition at line 660 of file djinn.c.

Referenced by DjinnMenu_ShowHelp(), UiWindow_SetInteriorRectPalette(), and UiWindow_SetRectPalette().

◆ UiWindow_SetInteriorRectPalette()

void UiWindow_SetInteriorRectPalette ( void * window,
s32 x,
s32 y,
s32 width,
s32 height,
s32 palette )

UiWindow_SetRectPalette on a rectangle of window's interior, (x, y) and its size in tiles from the interior's corner.

Definition at line 702 of file djinn.c.

Referenced by DjinnMenu_SelectDjinn(), DjinnMenu_ShowHelp(), and UiWindow_SetInteriorRectPalette().

◆ DjinnMenu_ShowHelp()

s32 DjinnMenu_ShowHelp ( void )

Runs the Djinn help choices and restores the list when the player leaves.

Definition at line 710 of file djinn.c.

Referenced by DjinnMenu_RunScreen(), and DjinnMenu_ShowHelp().

◆ DjinnMenu_SelectDjinn()

s32 DjinnMenu_SelectDjinn ( s32 mode)

Chooses an owner and Djinni, or a set, standby, give or trade action.

The tutorial can replace the sampled input without changing the input order.

Definition at line 830 of file djinn.c.

Referenced by DjinnMenu_RunScreen(), and DjinnMenu_SelectDjinn().

◆ Djinn_ListOwnerEntries()

s32 Djinn_ListOwnerEntries ( u16 * entriesOut,
s32 ownerId,
s32 element )

Lists owned Djinn by element and index, marking those that are set.

For element -1, entries also encode their owner.

Definition at line 1506 of file djinn.c.

Referenced by Djinn_ListOwnerEntries(), DjinnMenu_BuildLists(), and DjinnMenu_DrawElementList().

◆ DjinnMenu_DrawPairPreview()

s32 DjinnMenu_DrawPairPreview ( s32 mode,
s32 pageIndex )

Draws both sides of the give or trade preview for the selected page.

Definition at line 1538 of file djinn.c.

Referenced by DjinnMenu_DrawPairPreview(), and OwnerAction_RunCompareLoop().

◆ DjinnMenu_DrawStatPreview()

s32 DjinnMenu_DrawStatPreview ( struct UiWindow * window,
s32 x,
s32 y,
s32 ownerId,
s32 removePairSlot,
s32 addPairSlot,
s32 previewMode,
s32 page,
s32 side )

Saves the unit, applies a hypothetical Djinn change, draws its differences and restores the original unit before returning.

Definition at line 1564 of file djinn.c.

Referenced by DjinnMenu_DrawPairPreview(), DjinnMenu_DrawStatPreview(), DjinnMenu_ShowOwnerStatus(), and OwnerAction_RunCompareLoop().

◆ FourObjectMotion_InitializeTopRow()

void FourObjectMotion_InitializeTopRow ( void * unused0,
s32 unused1 )

Replaces the four displayed objects and starts their projected-position task.

Definition at line 10 of file djinn_figures.c.

Referenced by FourObjectMotion_InitializeTopRow(), and StatusMenu_Run().

◆ FourObjectMotion_UpdateAllPositions()

void FourObjectMotion_UpdateAllPositions ( void )

Projects the four objects at full scale from their saved row positions.

Definition at line 64 of file djinn_figures.c.

Referenced by FourObjectMotion_ClearSlotsAndSchedule(), FourObjectMotion_InitializeTopRow(), and FourObjectMotion_UpdateAllPositions().

◆ FourObjectMotion_UpdateBottomRow()

void FourObjectMotion_UpdateBottomRow ( void )

Projects the bottom row using its saved scale or easing toward full size.

Definition at line 93 of file djinn_figures.c.

Referenced by FourObjectMotion_ClearSlotsAndScheduleAlt(), FourObjectMotion_InitializeBottomRow(), and FourObjectMotion_UpdateBottomRow().

◆ FourObjectMotion_InitializeBottomRow()

void FourObjectMotion_InitializeBottomRow ( s32 unused0,
s32 unused1 )

Replaces the bottom row's four objects and starts its easing task.

Definition at line 140 of file djinn_figures.c.

Referenced by DjinnMenu_Run(), and FourObjectMotion_InitializeBottomRow().

◆ FourObjectMotion_SetSlotPosition()

s32 FourObjectMotion_SetSlotPosition ( s32 index,
s32 x,
s32 y,
s32 negative )

Updates one object's saved position and its signed y marker.

Definition at line 167 of file djinn_figures.c.

Referenced by DjinnMenu_RunScreen(), DjinnMenu_SelectDjinn(), DjinnMenu_ShowOwnerStatus(), FourObjectMotion_SetSlotPosition(), and OwnerAction_RunCompareLoop().

◆ FourObjectMotion_SetSlotPhase()

s32 FourObjectMotion_SetSlotPhase ( s32 index,
s32 phase )

◆ FourObjectMotion_ReplaceSlot()

s32 FourObjectMotion_ReplaceSlot ( s32 index,
s32 resourceKind,
s32 value )

Replaces one displayed object and selects its animation.

Definition at line 186 of file djinn_figures.c.

Referenced by DjinnMenu_SelectDjinn(), and FourObjectMotion_ReplaceSlot().

◆ Menu_StartPartyFiguresWalking()

void Menu_StartPartyFiguresWalking ( void )

Starts the walking animation (1) of each party figure. Nothing calls it.

Definition at line 208 of file djinn_figures.c.

Referenced by Menu_StartPartyFiguresWalking().

◆ OwnerAction_RunCompareLoop()

s32 OwnerAction_RunCompareLoop ( u32 mode)

Previews a give, trade, set or standby change without committing it.

It saves and restores the unit records before polling for confirmation.

Definition at line 10 of file djinn_preview.c.

Referenced by DjinnMenu_RunScreen(), and OwnerAction_RunCompareLoop().

◆ DjinnMenu_ShowOwnerStatus()

s32 DjinnMenu_ShowOwnerStatus ( void )

Shows the chosen owner's current stats and paged Psynergy list.

Definition at line 532 of file djinn_preview.c.

Referenced by DjinnMenu_RunScreen(), and DjinnMenu_ShowOwnerStatus().

◆ Djinn_MarkBalancedEntries()

s32 Djinn_MarkBalancedEntries ( s8 * requiresTrade,
s32 sourceOwnerColumn )

Marks recipients that would leave unequal Djinn totals after a direct give.

Returns how many recipients would need a trade instead.

Definition at line 680 of file djinn_preview.c.

Referenced by Djinn_MarkBalancedEntries(), and DjinnMenu_SelectDjinn().

◆ Djinn_CheckTurnBalance()

s32 Djinn_CheckTurnBalance ( s32 sourceOwnerColumn,
s32 targetOwnerColumn )

Tests whether a hypothetical give leaves every pair of owners within one Djinn.

Definition at line 708 of file djinn_preview.c.

Referenced by Djinn_CheckTurnBalance(), and Djinn_MarkBalancedEntries().

◆ Djinn_CountTurns()

void Djinn_CountTurns ( u8 * ownedCounts)

Counts each owner's Djinn across its set and available bitmasks.

Definition at line 740 of file djinn_preview.c.

Referenced by Djinn_CheckTurnBalance(), and Djinn_CountTurns().

◆ Resource_LoadPairedBlocksIfAvailable()

void Resource_LoadPairedBlocksIfAvailable ( void )

Loads each menu icon resource whose cache slot was acquired.

Definition at line 8 of file icons.c.

Referenced by DjinnMenu_Run(), and Resource_LoadPairedBlocksIfAvailable().

◆ Menu_ResetTwoResourceEntries()

void Menu_ResetTwoResourceEntries ( void )

Releases both cached icon resources used by the menu.

Definition at line 27 of file icons.c.

Referenced by DjinnMenu_Run(), ItemMenu_Run(), and Menu_ResetTwoResourceEntries().

◆ UiIcon_LoadResourceIntoSlot()

s32 UiIcon_LoadResourceIntoSlot ( s32 resourceId,
s32 slot )

Decodes one icon into a temporary buffer and reloads its VRAM slot.

Definition at line 36 of file icons.c.

Referenced by UiIcon_CreateWithLoadedResource(), and UiIcon_LoadResourceIntoSlot().

◆ UiIcon_CreateWithLoadedResource()

s32 UiIcon_CreateWithLoadedResource ( struct UiWindow * window,
s32 x,
s32 y,
s32 resourceId )

Loads an icon into a free cache slot and creates its sprite when possible.

Definition at line 51 of file icons.c.

Referenced by DjinnMenu_DrawStatPreview(), and UiIcon_CreateWithLoadedResource().

◆ UiIcon_CreateStatChangeArrow()

s32 UiIcon_CreateStatChangeArrow ( struct UiWindow * window,
s32 x,
s32 y,
s32 variant )

Creates a stat-change arrow from one of the two loaded resources.

Definition at line 66 of file icons.c.

Referenced by UiIcon_CreateStatChangeArrow(), and UiText_DrawStatComparison().

◆ UiIcon_DrawVariantWithTileOffset()

s32 UiIcon_DrawVariantWithTileOffset ( struct UiWindow * window,
s32 x,
s32 y,
s32 variant )

Creates an arrow with the vertical adjustment for its resource variant.

Definition at line 97 of file icons.c.

Referenced by DjinnMenu_DrawStatPreview(), and UiIcon_DrawVariantWithTileOffset().