Alchemy
Loading...
Searching...
No Matches

menu.h

Go to the documentation of this file.
1#ifndef ALCHEMY_UNIT_MENU_MENU_H
2#define ALCHEMY_UNIT_MENU_MENU_H
3
4#include "types.h"
5
6struct BattleUnit;
7struct DjinnListTable;
9struct MenuResult;
10struct OwnerActionSlot;
11struct UiWindow;
12struct RenderOutput;
13
14// The item menu's sort orders (gMenu_ListOrder*): one byte per group, an
15// item type, with LIST_ORDER_EQUIPPED for only the equipped items of that
16// type, ending with LIST_ORDER_END.
17#define LIST_ORDER_TYPE_MASK 0x7f
18#define LIST_ORDER_EQUIPPED 0x80
19#define LIST_ORDER_END 0xff
20
23void UiWindow_InitializeWork(s32 unused);
24s32 UiWindow_UpdateOrCreate(struct UiWindow **handle, s32 x, s32 y, s32 w,
25 s32 h, s32 flags);
26void UiWindow_CloseIfOpen(struct UiWindow **handle, s32 style);
27void Menu_DrawOwnerStatusPanel(struct UiWindow *unused, s32 owner, s32 slot,
28 s32 mode);
29void UiText_DrawNumberRightAligned(s32 number, struct UiWindow *window, s32 x,
30 s32 y);
31void Ui_DrawValuePairRows(struct BattleUnit *unit, struct UiWindow *window);
32void UiText_DrawStatComparison(const struct BattleUnit *after,
33 const struct BattleUnit *before,
34 struct UiWindow *window);
35s32 UiIcon_CreateWithResource(struct UiWindow *window, s32 unused, s32 x,
36 s32 y);
38void UiIcon_PrepareObject(struct RenderOutput *object);
39void PsynergyMenu_CallIconRoutineWithValue(const void *unused, s32 unit);
40struct UiWindow *UiMenu_CreateCursor(void *source);
41void PsynergyMenu_InitializeEntryObjects(void *source, s32 originX, s32 originY,
42 s32 spacing, s32 unused);
45void UiMenu_PositionCursor(s32 xOffset, s32 yOffset);
49void PsynergyMenu_RefreshOwnerEntries(s32 originX, s32 originY, s32 columns);
50void PsynergyMenu_PositionOwnerEntry(struct RenderOutput **slot, s32 index,
51 s32 originX, s32 originY, s32 columns);
52void ItemMenu_PlaceIcon(struct RenderOutput **slot, s32 slotIndex, s32 originX,
53 s32 originY, s32 columns);
54void ItemMenu_RefreshEntry(s32 layout);
57void Menu_CopyListOrder(s32 mode, u8 *order);
58s32 Menu_HandlePageInput(s32 horizontal, s32 count, s32 pageSize, s32 *cursor,
59 s32 *page);
61void Menu_DrawPageIndicator(struct UiWindow *window, s32 itemCount,
62 s32 pageSize, s32 selectedPage, s32 rightEdge);
63void Render_SetTilemapFlagRect(const struct UiWindow *window, s32 x, s32 y,
64 s32 width, s32 height, u32 palette);
66void Menu_SetPageIcons(s32 pageSize, s32 first, struct UiWindow *window, s32 x,
67 s32 y);
68void UiText_DrawWorkValueWithLabel(struct UiWindow *window);
69void UiWindow_SetBounds(struct UiWindow *window, s32 x, s32 y, s32 width,
70 s32 height);
71void UiWork_SetMenuBusy(void);
72void UiWork_ClearMenuBusy(void);
74void Menu_CancelSoundTick(void);
75void Menu_CancelSoundReset(void);
76void Menu_EnsureCancelSound(void);
77void UiPalette_SetColor15(void);
78void UiPalette_SetColor2(void);
79void UiPalette_SetColor4(void);
82
83#define LIST_PAGE_SIZE 5
84
85s32 ItemMenu_Run(void);
86s32 ItemMenu_RunCommands(s32 *ownerOut, s32 *targetOut, s32 *itemOut);
87s32 ItemMenu_Use(void);
88void ItemMenu_Initialize(s32 x, s32 y, s32 mode, s32 columns);
90 struct UiWindow *window);
91void ItemMenu_HideAllIcons(void);
92void ItemMenu_HidePageIcons(void);
93void ItemMenu_Close(void);
95s32 ItemMenu_RunOwnerSelection(u16 *ownerIds, u16 *items);
96void ItemMenu_OpenCategory(s32 ownerId);
101void ItemMenu_DrawMessage(s32 unused, s32 message);
102void Menu_HideEmptyEntryIcons(const u16 *items);
105s32 ItemMenu_CollectItems(struct BattleUnit *unit, u16 *items, s32 mode);
106void ItemMenu_DrawIcons(u16 *inventoryEntries, s32 iconStyle);
107void ItemMenu_RefreshOwner(s32 ownerId, s32 mode);
108void InventoryMenu_NoOp(void);
109void ItemMenu_DrawEquipPreview(s32 owner, s32 slot, s32 mode, s32 target);
114void ItemMenu_BuildCommands(s8 *commandStates);
115void ItemMenu_DrawCommands(const s8 *commandStates, struct UiWindow *window);
116s32 Item_ClassifyUseMode(s32 ownerId, s32 inventoryEntry);
117void ItemMenu_TryBreak(void);
118s32 ItemMenu_OpenDetail(s32 itemIndex);
120void ItemMenu_DrawItemDetails(struct UiWindow *window, s32 inventoryEntry);
121void ItemMenu_DrawStat(s32 statChange, s32 unused, struct UiWindow *window,
122 s32 x, s32 y);
129s32 ItemMenu_SelectGiveQuantity(s32 baseQuantity, s32 quantityRange,
130 s32 dropMode);
131void ItemMenu_DrawItemHead(void);
135s32 ItemMenu_PageResult(struct MenuResult *result, s32 index);
136s32 ItemMenu_DrawItemDetailPage(struct UiWindow *window, void *ownerWork,
137 struct MenuResult *pageState);
138s32 ItemMenu_DrawNamePage(struct UiWindow *window, s32 unused,
139 const struct MenuResult *pageState);
142s32 ItemMenu_RunList(s32 paneIndex);
143
145s32 Menu_ResolveSelectedAction(s32 *outOwner, s32 *unused, s32 *outAction);
148s32 PsynergyMenu_SelectMember(u16 *ownerIds, u16 *unused);
151void PsynergyMenu_NoOp(void);
153s32 PsynergyMenu_SetShortcut(s32 ownerId, s32 actionId, s32 shortcutIndex);
154s32 PsynergyMenu_DrawShortcuts(struct UiWindow *window, s32 owner);
157void PsynergyMenu_DrawPsynergyIcons(u16 *psynergies);
158s32 PsynergyMenu_CollectActions(struct BattleUnit *unit, u16 *actions,
159 s32 mode);
160s32 PsynergyMenu_BuildPageResult(struct MenuResult *result, s32 index);
161s32 PsynergyMenu_DrawDetailPage(struct UiWindow *window, s32 *work,
162 struct MenuResult *state);
163s32 PsynergyMenu_DrawActionPage(struct UiWindow *window, s32 unused,
164 const struct MenuResult *pageState);
165s32 PsynergyMenu_RunList(s32 paneIndex);
167
170s32 StatusMenu_Run(void);
176s32 CharacterSelector_MoveEntry(s32 selectedIndex, s32 direction);
177void Menu_InitSelectorCursorAndEntries(s32 unused0, s32 unused1, s32 unused2,
178 s32 unused3);
181void CharacterMenu_DrawSelectionCursor(s32 mode, s32 selected, u8 *entries,
182 s32 invert);
183void CharacterMenu_DrawSelectionLabels(struct UiWindow *target, s32 selected,
184 const u8 *entries);
185void StatusMenu_ShowOwnerProgressMessage(struct UiWindow *destination,
186 s32 messageVariant,
187 s32 preserveVariant);
188void CharacterMenu_DrawStatusAilments(struct UiWindow *window, s32 ownerId,
189 s32 mode);
190void Runtime_RunBusyWaitDelay(void);
191void ItemMenu_DrawOwnerStatus(struct UiWindow *window, s32 ownerId, s32 flags);
192s32 CharacterMenu_BuildAvailability(u8 *ailments, s32 requested, s32 ownerId);
193s32 Menu_BuildPageResult(struct MenuResult *result, s32 index);
194void Menu_BuildPatternTiles(void);
195void PsynergyMenu_DrawRange(struct UiWindow *window, s32 x, s32 y, s32 range,
196 s32 unused);
197s32 PsynergyMenu_DrawRangePage(struct UiWindow *window, s32 unused,
198 struct MenuResult *state);
199s32 PsynergyMenu_DrawListPage(struct UiWindow *window, s32 unused,
200 const struct MenuResult *res);
203void PsynergyMenu_DrawPreparedPsynergyIcons(const void *unused, s32 ownerId);
206s32 ItemMenu_DrawEquipPage(struct UiWindow *window, s32 unused,
207 struct MenuResult *state);
208s32 Shop_DrawItemPage(struct UiWindow *window, s32 unused,
209 struct MenuResult *state);
211s32 Menu_MoveGridCursor(s32 *columnOut, s32 *rowOut, s32 direction);
213void ItemMenu_DrawCategory(struct UiWindow *window, s32 ownerId, s32 mode);
214void ItemMenu_DrawEquippedItemNames(struct UiWindow *window, u16 *items);
215void Menu_PlaceEntryObjectsInGrid(s32 originX, s32 originY, s32 columns);
216void Menu_PlaceEntryObjectInGrid(struct RenderOutput *icon, s32 index,
217 s32 originX, s32 originY, s32 columns);
219void ItemMenu_PosCategory(void);
221void ItemMenu_ApplyFlags(const u8 *flags);
222void ItemMenu_ResetCategory(void);
224
225void Item_PrepareUsePalette(void);
226void Item_UseNoOpCallback(void);
227s32 Item_Use(s32 slot, s32 ownerId, s32 targetId);
228s32 Item_ReturnOne(void);
229s32 BattleEffect_ApplyToTargets(s32 effectId, s32 sourceId, s32 targetId,
230 s32 fixedScale);
231void Item_PlayUseAnimation(u32 item);
232void Ability_PlayUseAnimation(s32 action);
233
235s32 Menu_WrapIndex(s32 value, s32 modulus);
237s32 DjinnMenu_Run(void);
239void Graphics_AdjustPaletteBank(s32 brightnessDelta);
240#ifdef UBFIX
241typedef void MenuBackdropResult;
242#else
244#endif
245// The native wrapper forwards an implicit result; the defined interface is
246// void.
249 struct OwnerActionSlot *after, u16 *actionsOut,
250 s32 *gainedCountOut, s32 *lostCountOut);
251s32 DjinnMenu_BuildLists(void *table);
252#ifdef UBFIX
253void DjinnMenu_DrawElementList(struct DjinnListTable *table);
254#endif
257 s32 palette);
259void UiWindow_SetInteriorRectPalette(void *window, s32 x, s32 y, s32 width,
260 s32 height, s32 palette);
263s32 Djinn_ListOwnerEntries(u16 *entriesOut, s32 ownerId, s32 element);
264s32 DjinnMenu_DrawPairPreview(s32 mode, s32 pageIndex);
266 s32 ownerId, s32 removePairSlot, s32 addPairSlot,
267 s32 previewMode, s32 page, s32 side);
268
269void FourObjectMotion_InitializeTopRow(void *unused0, s32 unused1);
272void FourObjectMotion_InitializeBottomRow(s32 unused0, s32 unused1);
275s32 FourObjectMotion_ReplaceSlot(s32 index, s32 resourceKind, s32 value);
277
280s32 Djinn_MarkBalancedEntries(s8 *requiresTrade, s32 sourceOwnerColumn);
281s32 Djinn_CheckTurnBalance(s32 sourceOwnerColumn, s32 targetOwnerColumn);
282void Djinn_CountTurns(u8 *ownedCounts);
285s32 UiIcon_LoadResourceIntoSlot(s32 resourceId, s32 slot);
287 s32 resourceId);
289 s32 variant);
291 s32 variant);
292
293#endif
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,...
Definition common.c:625
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,...
Definition common.c:708
void Menu_ReleaseEntryObjects(void)
Releases the party figures PsynergyMenu_InitializeEntryObjects created and stops their placement call...
Definition common.c:555
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.
Definition common.c:483
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...
Definition common.c:824
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...
Definition common.c:394
UNUSED void PsynergyMenu_ReservedNoOp(void)
Nothing calls it.
Definition common.c:680
void UiIcon_PrepareObject(struct RenderOutput *object)
Shows a menu icon at its stored position, without rotation or scaling.
Definition common.c:465
void UiText_DrawWorkValueWithLabel(struct UiWindow *window)
Writes the party's coins and the "Coins" label into window.
Definition common.c:1154
void Palette_LightenBankHighlight(s32 bank)
Copies the last background palette (15) into background palette bank and lightens its colour 4 by 9 s...
Definition common.c:1012
void PsynergyMenu_CallIconRoutineWithValue(const void *unused, s32 unit)
Loads the graphics of character unit into menu entry slot 0.
Definition common.c:477
void UiPalette_SetColor2(void)
Definition common.c:1214
void Menu_UpdateEntryObjectTransforms(void)
Scheduler callback: each frame, places every party member sprite created by PsynergyMenu_InitializeEn...
Definition common.c:580
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...
Definition common.c:1075
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,...
Definition common.c:689
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 ...
Definition common.c:451
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,...
Definition common.c:723
void Palette_CopyObjectBankToBackground14(void)
Copies the first sprite palette into background palette 14, then colour 4 of background palette 15 ov...
Definition common.c:1121
void UiWork_SetMenuBusy(void)
Definition common.c:1173
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...
Definition common.c:1040
void UiMenu_PositionCursor(s32 xOffset, s32 yOffset)
Places the hand cursor at (xOffset, yOffset) inside the menu's top-left window, bobbing.
Definition common.c:611
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...
Definition common.c:737
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.
Definition common.c:435
void Menu_CancelSoundReset(void)
Starts watching for Start: clears FLAG_MENU_START_PRESSED and adds Menu_CancelSoundTick.
Definition common.c:1199
void UiWindow_SetBounds(struct UiWindow *window, s32 x, s32 y, s32 width, s32 height)
Moves and resizes a window, in tiles.
Definition common.c:1163
s32 Menu_SuspendFieldTasks(void)
Suspends the overlay tasks and tile animations while a menu is open, and sets flags 0x152 and 0x166.
Definition common.c:52
void UiWindow_CloseIfOpen(struct UiWindow **handle, s32 style)
Closes the window kept in *handle, if any, and clears the handle.
Definition common.c:98
void UiWindow_InitializeWork(s32 unused)
Clears the whole menu work and sets its defaults: no pane selected, one entry in each pane,...
Definition common.c:61
void UiPalette_SetColor4(void)
Definition common.c:1216
void Menu_CopyListOrder(s32 mode, u8 *order)
Copies the list order of mode 0 to 2 (any other mode: the default order) into order,...
Definition common.c:890
void UiWork_ClearMenuBusy(void)
Lets the window renderer resume drawing after a menu update.
Definition common.c:1178
void UiPalette_SetColor15(void)
Sets the window text colour: normal (15), no HP (2) and low HP (4).
Definition common.c:1212
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 (...
Definition common.c:511
void Menu_EnsureCancelSound(void)
Stops watching for Start, if Start has not removed the watch already.
Definition common.c:1205
s32 Menu_ResumeFieldTasks(void)
Resumes the overlay tasks and tile animations when a menu closes, and clears game flags 0x166 and 0x1...
Definition common.c:38
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,...
Definition common.c:117
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...
Definition common.c:333
void InventoryMenu_ShowModalMessage(s32 message, s32 x, s32 y)
Shows message in the item menu, with the hand cursor hidden meanwhile.
Definition common.c:770
void Menu_CancelSoundTick(void)
Scheduler callback while a menu runs: on Start, plays the cancel sound, sets FLAG_MENU_START_PRESSED ...
Definition common.c:1189
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.
Definition common.c:931
UNUSED void PsynergyMenu_RefreshOwnerEntriesDefault(void)
Lays the entry icons out eight to a row from (108, 40). Nothing calls it.
Definition common.c:683
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,...
Definition common.c:316
s32 Audio_PlayCueReturnOne(s32 cue)
Definition common.c:1182
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,...
Definition common.c:1131
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.
Definition common.c:78
void FourObjectMotion_UpdateAllPositions(void)
Projects the four objects at full scale from their saved row positions.
void FourObjectMotion_ClearSlotsAndScheduleAlt(void)
s32 FourObjectMotion_ReplaceSlot(s32 index, s32 resourceKind, s32 value)
Replaces one displayed object and selects its animation.
void FourObjectMotion_InitializeBottomRow(s32 unused0, s32 unused1)
Replaces the bottom row's four objects and starts its easing task.
void FourObjectMotion_ClearSlotsAndSchedule(void)
void FourObjectMotion_InitializeTopRow(void *unused0, s32 unused1)
Replaces the four displayed objects and starts their projected-position 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)
UNUSED void Menu_StartPartyFiguresWalking(void)
Starts the walking animation (1) of each party figure. Nothing calls it.
void FourObjectMotion_UpdateBottomRow(void)
Projects the bottom row using its saved scale or easing toward full size.
s32 ItemMenu_RunOwnerSelection(u16 *ownerIds, u16 *items)
The party member row of the item menu.
Definition item.c:1016
s32 ItemMenu_Run(void)
The item picker an event script opens (window command 3): the item menu, in which the player chooses ...
Definition item.c:90
UNUSED s32 InventoryMenu_ItemNamePageReturnTrue(void)
Nothing calls it.
Definition item.c:2772
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,...
Definition item.c:2730
void ItemMenu_SetItemWindowRow3(void)
Moves the item window to row 3 of the right-hand side.
Definition item.c:2335
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...
Definition item.c:2690
s32 ItemMenu_ChooseCommand(void)
The item command grid: Use, Equip and Details on the top row, Give, Remove and Drop below (grid index...
Definition item.c:1634
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...
Definition item.c:1573
s32 ItemMenu_ConfirmDrop(s32 item)
Asks whether to drop item (an inventory entry): its name, the question, and Yes or No,...
Definition item.c:2494
void ItemMenu_Close(void)
Closes the item menu: releases the party figures, hides the icons and the cursor, and closes every wi...
Definition item.c:962
s32 ItemMenu_SelectTarget(s32 mode)
Chooses the party member to use (mode 0) or give (mode 1) the selected item to.
Definition item.c:1145
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...
Definition item.c:2094
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,...
Definition item.c:206
s32 Menu_SelectQuantity(s32 value)
The item menu's Details screen: describes the item entry value in a large window (the whole top half ...
Definition item.c:2003
void ItemMenu_DrawMessage(s32 unused, s32 message)
Clears the message window and writes message into it.
Definition item.c:1335
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...
Definition item.c:860
void ItemMenu_DrawCommands(const s8 *commandStates, struct UiWindow *window)
Writes the six command names into window, the disabled ones in grey.
Definition item.c:1871
void EquipmentMenu_UpdateCompatibilityIndicators(void)
Scheduler callback while choosing a member to give an item to: every 32 frames, sets each party figur...
Definition item.c:1282
void EquipmentMenu_StartCompatibilityIndicators(void)
Ends EquipmentMenu_UpdateCompatibilityIndicators: puts every party figure back to animation 1 and rem...
Definition item.c:1305
s32 InventoryMenu_GetItemQuantity(s32 ownerId, s32 itemId)
Returns how many of itemId the unit ownerId holds: the quantity of its first stack,...
Definition item.c:1380
UNUSED void InventoryMenu_NoOp(void)
Nothing calls it.
Definition item.c:1474
void ItemMenu_HidePageIcons(void)
Hides the item icons in the first column of the five-wide item grid.
Definition item.c:943
s32 ItemMenu_RunList(s32 paneIndex)
The item list of the member in paneIndex (0: the owner, 1: the receiver of a trade),...
Definition item.c:2783
s32 ItemMenu_Use(void)
Uses the selected item from the owner in pane 0 on the member in pane 1.
Definition item.c:831
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...
Definition item.c:1969
s32 ItemMenu_IsSpecial(s32 itemId)
Returns 1 for the items that raise a stat for good (Apple, Hard Nut, Mint and Lucky Pepper),...
Definition item.c:1323
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,...
Definition item.c:886
s32 ItemMenu_SelectMember(s32 pane)
Lets the player choose a party member in pane (0 or 1), starting from the member chosen last.
Definition item.c:988
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...
Definition item.c:2372
UNUSED void InventoryMenu_ItemNamePageNoOp(void)
Nothing calls it.
Definition item.c:2775
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 item.c:2476
void ItemMenu_SetMessageWindowHeight3(void)
Definition item.c:2360
void ItemMenu_OpenCategory(s32 ownerId)
Shows the equipment view of member ownerId's items in the item window.
Definition item.c:1130
void ItemMenu_DrawIcons(u16 *inventoryEntries, s32 iconStyle)
Loads each listed item's icon into its item icon sprite, the first 15 entries of inventoryEntries,...
Definition item.c:1431
void Menu_HideEmptyEntryIcons(const u16 *items)
Hides the icon of each of the 32 list entries whose item is 0.
Definition item.c:1344
void ItemMenu_HideAllIcons(void)
Hides all 32 item icons.
Definition item.c:927
void ItemMenu_SetMessageWindowHeight5(void)
Makes the message window, along the top right, 5 rows tall.
Definition item.c:2342
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 item.c:2643
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 ...
Definition item.c:1482
s32 ItemMenu_OpenDetail(s32 itemIndex)
Opens the details window (top left, 13 by 10 tiles) and describes the item in pane itemIndex there.
Definition item.c:1988
void ItemMenu_RefreshOwner(s32 ownerId, s32 mode)
Shows member ownerId's items in the item window, laid out for layout mode (see ItemMenu_RefreshEntry)...
Definition item.c:1457
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...
Definition item.c:1923
s32 ItemMenu_CountItems(s32 ownerId)
Returns how many of member ownerId's 15 inventory slots hold an item.
Definition item.c:1357
s32 ItemMenu_ConfirmEquip(s32 unused)
After giving or trading the selected item to the member in pane 1, offers to equip it there,...
Definition item.c:2556
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 item.c:1605
s32 ItemMenu_CommandCursorY(s32 column, s32 row)
Definition item.c:1611
void ItemMenu_SetMessageWindowHeight7(void)
Definition item.c:2354
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.
Definition item.c:1409
void ItemMenu_SetMessageWindowHeight6(void)
Definition item.c:2348
void ItemMenu_BuildCommands(s8 *commandStates)
Fills commandStates (indexed by ItemMenuCommand) for the selected item: Use for usable items the owne...
Definition item.c:1811
void ItemMenu_SetItemWindowRow5(void)
Moves the item window to row 5 of the right-hand side.
Definition item.c:2328
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,...
Definition item.c:2657
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...
Definition item.c:2296
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 ...
Definition djinn.c:47
s32 DjinnMenu_SelectDjinn(s32 mode)
Chooses an owner and Djinni, or a set, standby, give or trade action.
Definition djinn.c:830
s32 DjinnMenu_RunScreen(void)
Chooses a Djinni, previews changes, then sets, stands by, gives or trades it.
Definition djinn.c:181
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 pale...
Definition djinn.c:660
s32 DjinnMenu_Run(void)
Runs the Djinn menu, preserving field tiles and the message speed.
Definition djinn.c:68
void Graphics_AdjustPaletteBank(s32 brightnessDelta)
Writes copies of background palettes 15, 5 and 7, each brightnessDelta lighter in every channel (clam...
Definition djinn.c:401
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 in...
Definition djinn.c:702
s32 Menu_SetFirstObjectRowCoordinates(s32 yOffset)
Places the Djinn menu's first row at its normal height plus yOffset.
Definition djinn.c:52
s32 DjinnMenu_ShowHelp(void)
Runs the Djinn help choices and restores the list when the player leaves.
Definition djinn.c:710
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 ...
Definition djinn.c:1564
MenuBackdropResult Menu_OpenBackdropScreen(void)
Draws the backdrop behind the Djinn menu's list: its window, tiles and palettes.
Definition djinn.c:462
void DjinnMenu_DrawElementList(struct DjinnListTable *table)
Draws each owner's Djinn column, including set and recovering entries.
Definition djinn.c:583
s32 Djinn_ListOwnerEntries(u16 *entriesOut, s32 ownerId, s32 element)
Lists owned Djinn by element and index, marking those that are set.
Definition djinn.c:1506
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.
Definition djinn.c:495
s32 DjinnMenu_BuildLists(void *table)
Rebuilds the Djinn lists in table: each owner's packed Djinn entries and their count.
Definition djinn.c:548
s32 DjinnMenu_DrawPairPreview(s32 mode, s32 pageIndex)
Draws both sides of the give or trade preview for the selected page.
Definition djinn.c:1538
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'...
Definition djinn.c:648
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.
void Djinn_CountTurns(u8 *ownedCounts)
Counts each owner's Djinn across its set and available bitmasks.
s32 OwnerAction_RunCompareLoop(u32 mode)
Previews a give, trade, set or standby change without committing it.
s32 Djinn_CheckTurnBalance(s32 sourceOwnerColumn, s32 targetOwnerColumn)
Tests whether a hypothetical give leaves every pair of owners within one Djinn.
s32 UiIcon_LoadResourceIntoSlot(s32 resourceId, s32 slot)
Decodes one icon into a temporary buffer and reloads its VRAM slot.
Definition icons.c:36
s32 UiIcon_DrawVariantWithTileOffset(struct UiWindow *window, s32 x, s32 y, s32 variant)
Creates an arrow with the vertical adjustment for its resource variant.
Definition icons.c:97
void Resource_LoadPairedBlocksIfAvailable(void)
Loads each menu icon resource whose cache slot was acquired.
Definition icons.c:8
void Menu_ResetTwoResourceEntries(void)
Releases both cached icon resources used by the menu.
Definition icons.c:27
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 icons.c:51
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 icons.c:66
s32 PsynergyMenu_SelectPartySlot(s32 partySlot)
Lets the player choose a party member in pane partySlot (0 or 1), starting from the one chosen last,...
Definition psynergy.c:331
void PsynergyMenu_CreateEntryGrid(void)
Sets up a Psynergy grid screen: the cursor window with the party's figures, a 30 by 15 window below w...
Definition psynergy.c:765
s32 PsynergyMenu_Run(void)
The Psynergy menu an event opens (window command 1): the field menu's Psynergy screen over the field,...
Definition psynergy.c:42
UNUSED void PsynergyMenu_NoOp(void)
Definition psynergy.c:522
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,...
Definition psynergy.c:1006
s32 PsynergyMenu_DrawShortcuts(struct UiWindow *window, s32 ownerId)
Definition psynergy.c:628
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 li...
Definition psynergy.c:911
s32 PsynergyMenu_SelectMember(u16 *ownerIds, u16 *unused)
The party member row of the Psynergy menu.
Definition psynergy.c:391
void PsynergyMenu_RefreshOwnerPsynergy(s32 ownerId)
Shows member ownerId's Psynergy icons in the Psynergy window, eight to a row, or "no Psynergy" when t...
Definition psynergy.c:501
s32 PsynergyMenu_IsActionRestricted(s32 actionEntry)
Returns 1 when actionEntry cannot be used from the menu: it has no field effect and is not usable bot...
Definition psynergy.c:1316
s32 PsynergyMenu_ClassifySelectedPsynergy(void)
Says how the selected Psynergy is used from the menu: 0 on the field once the menu closes (its effect...
Definition psynergy.c:306
s32 PsynergyMenu_RunList(s32 paneIndex)
The Psynergy list of the member in paneIndex, five a page.
Definition psynergy.c:1080
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.
Definition psynergy.c:849
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 w...
Definition psynergy.c:950
void PsynergyMenu_CloseWindows(void)
Releases the party figures and closes the Psynergy grid screen's windows.
Definition psynergy.c:813
void PsynergyMenu_DrawPsynergyIcons(u16 *psynergies)
Loads each listed Psynergy's icon into its icon sprite (32 entries) and hides the icons of empty entr...
Definition psynergy.c:825
UNUSED s32 PsynergyMenu_ReturnTrue(void)
Nothing calls them.
Definition psynergy.c:520
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 ...
Definition psynergy.c:118
s32 PsynergyMenu_SelectTarget(s32 targetMode)
Chooses the party member to use the selected Psynergy on.
Definition psynergy.c:527
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...
Definition psynergy.c:610
void ItemMenu_ArrangeCategoryItemIcons(u16 *items)
Loads and places the owner's equipment-category icons.
Definition status.c:1965
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...
Definition status.c:922
s32 Menu_MoveGridCursor(s32 *columnOut, s32 *rowOut, s32 direction)
Moves through the status grid's irregular rows and returns row * 9 + column.
Definition status.c:1811
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,...
Definition status.c:1247
s32 StatusMenu_Run(void)
The Status menu an event opens (window command 4) over the field: saves the first two background pale...
Definition status.c:145
s32 Menu_RunActionFlow(void)
The Status menu's pages: choose a party member, then their status page, A for their Psynergy page and...
Definition status.c:227
s32 Menu_ReservedStatusOne(void)
Definition status.c:1880
s32 Shop_DrawItemPage(struct UiWindow *window, s32 unused, struct MenuResult *state)
Definition status.c:1642
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,...
Definition status.c:643
s32 CharacterSelector_RunRearrange(void)
The Status menu's party row: Left and Right choose a member, showing their status; L and R move the m...
Definition status.c:395
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...
Definition status.c:890
void ItemMenu_DrawCategory(struct UiWindow *window, s32 ownerId, s32 mode)
Shows the owner's equipped items and optionally its category icons.
Definition status.c:1883
s32 DjinnMenu_ShowCurrentList(void)
Shows every Djinn the party has found, a column of seven for each element, until A,...
Definition status.c:310
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,...
Definition status.c:1080
void ItemMenu_ResetCategory(void)
Moves each category sprite off screen before it is reused.
Definition status.c:2076
s32 CharacterSelector_MoveEntry(s32 selectedIndex, s32 direction)
Moves the party member at selectedIndex one place later (direction 1) or earlier (0) in the party ord...
Definition status.c:577
s32 Menu_OpenCharacterSelector(void)
Lets the player choose one party member, over the field (the Colosso scenes use it).
Definition status.c:95
s32 CharacterMenu_SelectCommand(void)
The member's status page.
Definition status.c:695
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 membe...
Definition status.c:662
s32 CharacterMenu_SelectOwner(s32 slot)
Lets the player choose a party member in slot, from the one chosen last: the member chooser when the ...
Definition status.c:279
void PsynergyMenu_PreparedIconsSecondNoOp(void)
Reserved second empty callback for the prepared Psynergy page.
Definition status.c:1562
s32 ItemMenu_SelectItem(void)
Definition status.c:1685
void CharacterMenu_DrawStatusAilments(struct UiWindow *window, s32 ownerId, s32 mode)
Draws member ownerId's status page into window: the top rows (ItemMenu_ DrawOwnerStatus),...
Definition status.c:956
void ItemMenu_ApplyFlags(const u8 *flags)
Shows enabled category icons down the left edge, sixteen pixels apart.
Definition status.c:2043
s32 CharacterSelector_Run(void)
The member chooser's loop. Returns the chosen member's id, or -1.
Definition status.c:124
void Menu_PlaceEntryObjectsInGrid(s32 originX, s32 originY, s32 columns)
Positions the shared entry sprites on the requested grid.
Definition status.c:1934
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,...
Definition status.c:1169
s32 Menu_CreateEightEntryObjects(struct UiWindow *window)
Creates the eight shared category sprites, initially off screen.
Definition status.c:2021
s32 CharacterMenu_UpdateSelectionIcons(const u8 *enabled)
Loads each enabled ailment's icon into its category resource slot.
Definition status.c:2093
s32 ItemMenu_DrawEquipPage(struct UiWindow *window, s32 unused, struct MenuResult *state)
Definition status.c:1564
s32 CharacterMenu_BuildAvailability(u8 *ailments, s32 requested, s32 ownerId)
Fills ailments[0..4] (CharacterAilment) with member ownerId's ailments: down (only when requested is ...
Definition status.c:1130
void PsynergyMenu_PreparedIconsNoOp(void)
Reserved empty callback for the prepared Psynergy page.
Definition status.c:1559
s32 PsynergyMenu_ActionReturnTrue(void)
A page callback.
Definition status.c:1547
void PsynergyMenu_DrawPreparedPsynergyIcons(const void *unused, s32 ownerId)
Draws this owner's prepared Psynergy list in the shared entry sprites.
Definition status.c:1550
void ItemMenu_DrawEquippedItemNames(struct UiWindow *window, u16 *items)
Draws the nonempty equipment entries by their item names.
Definition status.c:1904
void ItemMenu_PosCategory(void)
Moves all entry sprites off screen before arranging another category.
Definition status.c:2001
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 status.c:1951
s32 PsynergyMenu_DrawListPage(struct UiWindow *window, s32 unused, const struct MenuResult *res)
Definition status.c:1358
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 ro...
Definition status.c:1209
void Runtime_RunBusyWaitDelay(void)
Spins for 256 loop passes (international editions only).
Definition status.c:1066
s32 PsynergyMenu_SelectAction(void)
Definition status.c:1432
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...
Definition status.c:1264
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...
Definition status.c:844
s32 PsynergyMenu_SelectOwner(void)
The member chooser (menu page 3): Left and Right choose a party member, showing their status and Psyn...
Definition status.c:508
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.
Definition djinn_menu.h:23
The item menu's work, in the HEAP_SLOT_MENU work slot: its windows, the party figures,...
A paged list for one party member: their unit, the list's length and pages, and the page and row of t...
Definition menu_result.h:12
An entry in a unit's action list: the action's id (OWNER_ACTION_ID_MASK) and marks for an action its ...
Definition battle_unit.h:19
A render output: a sprite in a window's output list (a character, an icon or a portrait),...
u16 y
screen pixels
u16 x
screen pixels
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
Definition uiwindow.h:11
u16 frame
The zoom's step: counts down from 7 to 0 while opening, and up from 0 to duration while closing.
Definition uiwindow.h:28
u16 y
tiles
Definition uiwindow.h:16
u16 flags
UI_WINDOW_ flags; 0 once closing or free.
Definition uiwindow.h:25
u16 state
0 while a message channel is typing into the window; 1 once its text has ended or closed the window,...
Definition uiwindow.h:24
u16 x
tiles
Definition uiwindow.h:15
u16 height
tiles
Definition uiwindow.h:14
u16 width
tiles
Definition uiwindow.h:13
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
signed char s8
Definition types.h:10
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11
s32 MenuBackdropResult
Definition menu.h:243
void Item_PlayUseAnimation(u32 item)
Runs the animation selected by the item's action definition.
Definition use.c:311
void Item_PrepareUsePalette(void)
Copies and lightens the palette used by the item-use animation.
Definition use.c:9
void Ability_PlayUseAnimation(s32 action)
Starts the action's menu animation and waits for its completion.
Definition use.c:317
s32 Menu_ReservedStatusZero(void)
Definition use.c:382
void Item_UseNoOpCallback(void)
Reserved empty callback during an item's menu animation.
Definition use.c:15
s32 Item_Use(s32 slot, s32 ownerId, s32 targetId)
Applies the slot's action, then consumes or transforms the item on success.
Definition use.c:18
s32 BattleEffect_ApplyToTargets(s32 effectId, s32 sourceId, s32 targetId, s32 fixedScale)
Applies healing or permanent-stat effects to one member or the whole party.
Definition use.c:51
s32 Item_ReturnOne(void)
Definition use.c:47