1#ifndef ALCHEMY_UNIT_MENU_MENU_H
2#define ALCHEMY_UNIT_MENU_MENU_H
17#define LIST_ORDER_TYPE_MASK 0x7f
18#define LIST_ORDER_EQUIPPED 0x80
19#define LIST_ORDER_END 0xff
62 s32 pageSize,
s32 selectedPage,
s32 rightEdge);
83#define LIST_PAGE_SIZE 5
187 s32 preserveVariant);
250 s32 *gainedCountOut,
s32 *lostCountOut);
266 s32 ownerId,
s32 removePairSlot,
s32 addPairSlot,
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,...
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,...
void Menu_ReleaseEntryObjects(void)
Releases the party figures PsynergyMenu_InitializeEntryObjects created and stops their placement call...
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.
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 a...
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...
UNUSED void PsynergyMenu_ReservedNoOp(void)
Nothing calls it.
void UiIcon_PrepareObject(struct RenderOutput *object)
Shows a menu icon at its stored position, without rotation or scaling.
void UiText_DrawWorkValueWithLabel(struct UiWindow *window)
Writes the party's coins and the "Coins" label into window.
void Palette_LightenBankHighlight(s32 bank)
Copies the last background palette (15) into background palette bank and lightens its colour 4 by 9 s...
void PsynergyMenu_CallIconRoutineWithValue(const void *unused, s32 unit)
Loads the graphics of character unit into menu entry slot 0.
void UiPalette_SetColor2(void)
void Menu_UpdateEntryObjectTransforms(void)
Scheduler callback: each frame, places every party member sprite created by PsynergyMenu_InitializeEn...
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 Pal...
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,...
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 ...
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,...
void Palette_CopyObjectBankToBackground14(void)
Copies the first sprite palette into background palette 14, then colour 4 of background palette 15 ov...
void UiWork_SetMenuBusy(void)
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 pe...
void UiMenu_PositionCursor(s32 xOffset, s32 yOffset)
Places the hand cursor at (xOffset, yOffset) inside the menu's top-left window, bobbing.
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 other...
UNUSED 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.
void Menu_CancelSoundReset(void)
Starts watching for Start: clears FLAG_MENU_START_PRESSED and adds Menu_CancelSoundTick.
void UiWindow_SetBounds(struct UiWindow *window, s32 x, s32 y, s32 width, s32 height)
Moves and resizes a window, in tiles.
s32 Menu_SuspendFieldTasks(void)
Suspends the overlay tasks and tile animations while a menu is open, and sets flags 0x152 and 0x166.
void UiWindow_CloseIfOpen(struct UiWindow **handle, s32 style)
Closes the window kept in *handle, if any, and clears the handle.
void UiWindow_InitializeWork(s32 unused)
Clears the whole menu work and sets its defaults: no pane selected, one entry in each pane,...
void UiPalette_SetColor4(void)
void Menu_CopyListOrder(s32 mode, u8 *order)
Copies the list order of mode 0 to 2 (any other mode: the default order) into order,...
void UiWork_ClearMenuBusy(void)
Lets the window renderer resume drawing after a menu update.
void UiPalette_SetColor15(void)
Sets the window text colour: normal (15), no HP (2) and low HP (4).
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 (...
void Menu_EnsureCancelSound(void)
Stops watching for Start, if Start has not removed the watch already.
s32 Menu_ResumeFieldTasks(void)
Resumes the overlay tasks and tile animations when a menu closes, and clears game flags 0x166 and 0x1...
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,...
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 c...
void InventoryMenu_ShowModalMessage(s32 message, s32 x, s32 y)
Shows message in the item menu, with the hand cursor hidden meanwhile.
void Menu_CancelSoundTick(void)
Scheduler callback while a menu runs: on Start, plays the cancel sound, sets FLAG_MENU_START_PRESSED ...
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.
UNUSED void PsynergyMenu_RefreshOwnerEntriesDefault(void)
Lays the entry icons out eight to a row from (108, 40). Nothing calls it.
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,...
s32 Audio_PlayCueReturnOne(s32 cue)
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,...
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.
s32 ItemMenu_RunOwnerSelection(u16 *ownerIds, u16 *items)
The party member row of the item menu.
s32 ItemMenu_Run(void)
The item picker an event script opens (window command 3): the item menu, in which the player chooses ...
UNUSED s32 InventoryMenu_ItemNamePageReturnTrue(void)
Nothing calls it.
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,...
void ItemMenu_SetItemWindowRow3(void)
Moves the item window to row 3 of the right-hand side.
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 w...
s32 ItemMenu_ChooseCommand(void)
The item command grid: Use, Equip and Details on the top row, Give, Remove and Drop below (grid index...
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...
s32 ItemMenu_ConfirmDrop(s32 item)
Asks whether to drop item (an inventory entry): its name, the question, and Yes or No,...
void ItemMenu_Close(void)
Closes the item menu: releases the party figures, hides the icons and the cursor, and closes every wi...
s32 ItemMenu_SelectTarget(s32 mode)
Chooses the party member to use (mode 0) or give (mode 1) the selected item to.
void ItemMenu_DrawItemDetails(struct UiWindow *window, s32 inventoryEntry)
Writes the description of the inventoryEntry into window, one line a row: for equipment its Attack an...
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,...
s32 Menu_SelectQuantity(s32 value)
The item menu's Details screen: describes the item entry value in a large window (the whole top half ...
void ItemMenu_DrawMessage(s32 unused, s32 message)
Clears the message window and writes message into it.
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 alo...
void ItemMenu_DrawCommands(const s8 *commandStates, struct UiWindow *window)
Writes the six command names into window, the disabled ones in grey.
void EquipmentMenu_UpdateCompatibilityIndicators(void)
Scheduler callback while choosing a member to give an item to: every 32 frames, sets each party figur...
void EquipmentMenu_StartCompatibilityIndicators(void)
Ends EquipmentMenu_UpdateCompatibilityIndicators: puts every party figure back to animation 1 and rem...
s32 InventoryMenu_GetItemQuantity(s32 ownerId, s32 itemId)
Returns how many of itemId the unit ownerId holds: the quantity of its first stack,...
UNUSED void InventoryMenu_NoOp(void)
Nothing calls it.
void ItemMenu_HidePageIcons(void)
Hides the item icons in the first column of the five-wide item grid.
s32 ItemMenu_RunList(s32 paneIndex)
The item list of the member in paneIndex (0: the owner, 1: the receiver of a trade),...
s32 ItemMenu_Use(void)
Uses the selected item from the owner in pane 0 on the member in pane 1.
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_IsSpecial(s32 itemId)
Returns 1 for the items that raise a stat for good (Apple, Hard Nut, Mint and Lucky Pepper),...
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,...
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_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 qu...
UNUSED void InventoryMenu_ItemNamePageNoOp(void)
Nothing calls it.
void ItemMenu_DrawItemHead(void)
Shows the selected item at the top of the message window: its icon, its owner's name and its name.
void ItemMenu_SetMessageWindowHeight3(void)
void ItemMenu_OpenCategory(s32 ownerId)
Shows the equipment view of member ownerId's items in the item window.
void ItemMenu_DrawIcons(u16 *inventoryEntries, s32 iconStyle)
Loads each listed item's icon into its item icon sprite, the first 15 entries of inventoryEntries,...
void Menu_HideEmptyEntryIcons(const u16 *items)
Hides the icon of each of the 32 list entries whose item is 0.
void ItemMenu_HideAllIcons(void)
Hides all 32 item icons.
void ItemMenu_SetMessageWindowHeight5(void)
Makes the message window, along the top right, 5 rows tall.
void Resource_LoadPairedBlocks(void)
Loads the stat arrows (up and down) into two free VRAM blocks, kept in the menu work's resource slots...
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 ...
s32 ItemMenu_OpenDetail(s32 itemIndex)
Opens the details window (top left, 13 by 10 tiles) and describes the item in pane itemIndex there.
void ItemMenu_RefreshOwner(s32 ownerId, s32 mode)
Shows member ownerId's items in the item window, laid out for layout mode (see ItemMenu_RefreshEntry)...
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_H...
s32 ItemMenu_CountItems(s32 ownerId)
Returns how many of member ownerId's 15 inventory slots hold an item.
s32 ItemMenu_ConfirmEquip(s32 unused)
After giving or trading the selected item to the member in pane 1, offers to equip it there,...
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)
void ItemMenu_SetMessageWindowHeight7(void)
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_SetMessageWindowHeight6(void)
void ItemMenu_BuildCommands(s8 *commandStates)
Fills commandStates (indexed by ItemMenuCommand) for the selected item: Use for usable items the owne...
void ItemMenu_SetItemWindowRow5(void)
Moves the item window to row 5 of the right-hand side.
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,...
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 it...
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
The Djinn menu's lists: each party member's Djinn entries and their count.
An entry in a unit's action list: the action's id (OWNER_ACTION_ID_MASK) and marks for an action its ...
A render output: a sprite in a window's output list (a character, an icon or a portrait),...
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
u16 frame
The zoom's step: counts down from 7 to 0 while opening, and up from 0 to duration while closing.
u16 flags
UI_WINDOW_ flags; 0 once closing or free.
u16 state
0 while a message channel is typing into the window; 1 once its text has ended or closed the window,...
The integer types, TRUE, UNUSED and the fixed-address macros.
void Item_PlayUseAnimation(u32 item)
Runs the animation selected by the item's action definition.
void Item_PrepareUsePalette(void)
Copies and lightens the palette used by the item-use animation.
void Ability_PlayUseAnimation(s32 action)
Starts the action's menu animation and waits for its completion.
s32 Menu_ReservedStatusZero(void)
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 BattleEffect_ApplyToTargets(s32 effectId, s32 sourceId, s32 targetId, s32 fixedScale)
Applies healing or permanent-stat effects to one member or the whole party.