Alchemy
Loading...
Searching...
No Matches

common.c File Reference

The pieces the menu screens share: windows, the status panel, numbers, icons, the party figures, the hand cursor, paged lists, palettes and the Start watch. More...

Go to the source code of this file.

Macros

#define STATUS_PANEL_TEXT_X   32
#define STATUS_PANEL_CANNOT_EQUIP_X   0
#define STATUS_PANEL_LEARN_NAME_Y   48
#define STATUS_PANEL_LEARN_STATUS_Y   56
#define WINDOW_KEEP_EXISTING   0x100
 UiWindow_UpdateOrCreate: keep an existing window as it is, without redrawing its saved rectangle.
#define WINDOW_STYLE_MASK   0xff
#define NUMBER_PIXELS_PER_DIGIT   8
 The pixels the field allows each digit.
#define ICON_TILE_BYTES   0x80
 Size of one 16x16 4bpp sprite tile block.
#define CURSOR_BOB_STEP()
 The cursor bobs through an 8-step table, one step every two frames.
#define PAGE_LABEL_FIRST   49
 The page indicator: the window font's digit tiles for pages 1, 2, ..., between the two page arrows.

Enumerations

enum  StatArrow { STAT_ARROW_UP , STAT_ARROW_DOWN }
 The stat arrows: the up and down arrow sprites the menu loads into its two resource slots (Resource_LoadPairedBlocks). More...

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.
static void Owner_Copy (struct BattleUnit *destination, struct BattleUnit *source)
 Copies one BattleUnit with the resident IWRAM word copy.
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.
static s32 CountDigitsAtLeastTwo (s32 number)
 Returns how many decimal digits number has, but at least 2: 0-99 give 2, 100-999 give 3, 1000-9999 give 4.
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.
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.
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.
UNUSED void PsynergyMenu_ReservedNoOp (void)
 Nothing calls it.
UNUSED 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)

Detailed Description

The pieces the menu screens share: windows, the status panel, numbers, icons, the party figures, the hand cursor, paged lists, palettes and the Start watch.

Part of menu.c, the menu object, compiled only through it.

Definition in file common.c.

Macro Definition Documentation

◆ STATUS_PANEL_TEXT_X

#define STATUS_PANEL_TEXT_X   32

Definition at line 13 of file common.c.

Referenced by Menu_DrawOwnerStatusPanel().

◆ STATUS_PANEL_CANNOT_EQUIP_X

#define STATUS_PANEL_CANNOT_EQUIP_X   0

Definition at line 14 of file common.c.

Referenced by Menu_DrawOwnerStatusPanel().

◆ STATUS_PANEL_LEARN_NAME_Y

#define STATUS_PANEL_LEARN_NAME_Y   48

Definition at line 26 of file common.c.

Referenced by Menu_DrawOwnerStatusPanel().

◆ STATUS_PANEL_LEARN_STATUS_Y

#define STATUS_PANEL_LEARN_STATUS_Y   56

Definition at line 27 of file common.c.

Referenced by Menu_DrawOwnerStatusPanel().

◆ WINDOW_KEEP_EXISTING

#define WINDOW_KEEP_EXISTING   0x100

UiWindow_UpdateOrCreate: keep an existing window as it is, without redrawing its saved rectangle.

The low byte of the flags is the window style.

Definition at line 32 of file common.c.

Referenced by InventoryMenu_ShowModalMessage(), Menu_DrawOwnerStatusPanel(), and UiWindow_UpdateOrCreate().

◆ WINDOW_STYLE_MASK

#define WINDOW_STYLE_MASK   0xff

Definition at line 33 of file common.c.

Referenced by UiWindow_UpdateOrCreate().

◆ NUMBER_PIXELS_PER_DIGIT

#define NUMBER_PIXELS_PER_DIGIT   8

The pixels the field allows each digit.

The Latin font's digits are 7 pixels wide, so the digits themselves take a pixel less each.

Definition at line 275 of file common.c.

Referenced by UiText_DrawNumberRightAligned().

◆ ICON_TILE_BYTES

#define ICON_TILE_BYTES   0x80

Size of one 16x16 4bpp sprite tile block.

Definition at line 430 of file common.c.

Referenced by UiIcon_CreateWithResource(), and UiIcon_CreateWithResourceVariant().

◆ CURSOR_BOB_STEP

#define CURSOR_BOB_STEP ( )
Value:
((gFrameCount >> 1) & 7)
volatile u32 gFrameCount
Frames WaitFrames has finished.

The cursor bobs through an 8-step table, one step every two frames.

Definition at line 607 of file common.c.

Referenced by UiMenu_PositionCursor().

◆ PAGE_LABEL_FIRST

#define PAGE_LABEL_FIRST   49

The page indicator: the window font's digit tiles for pages 1, 2, ..., between the two page arrows.

Definition at line 921 of file common.c.

Referenced by Menu_DrawPageIndicator().

Enumeration Type Documentation

◆ StatArrow

enum StatArrow

The stat arrows: the up and down arrow sprites the menu loads into its two resource slots (Resource_LoadPairedBlocks).

Enumerator
STAT_ARROW_UP 
STAT_ARROW_DOWN 

Definition at line 389 of file common.c.

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().

◆ Owner_Copy()

void Owner_Copy ( struct BattleUnit * destination,
struct BattleUnit * source )
inlinestatic

Copies one BattleUnit with the resident IWRAM word copy.

Definition at line 106 of file common.c.

Referenced by Menu_DrawOwnerStatusPanel(), and Owner_Copy().

◆ 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().

◆ CountDigitsAtLeastTwo()

s32 CountDigitsAtLeastTwo ( s32 number)
inlinestatic

Returns how many decimal digits number has, but at least 2: 0-99 give 2, 100-999 give 3, 1000-9999 give 4.

The count starts with the units digit, adds one for each division by ten that leaves 10 or more, then adds the leading digit; a number under 10 has its one digit counted as both, which is where the minimum of 2 comes from.

Definition at line 282 of file common.c.

Referenced by CountDigitsAtLeastTwo(), and UiText_DrawNumberRightAligned().

◆ 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()

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.

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()

UNUSED void PsynergyMenu_ReservedNoOp ( void )

Nothing calls it.

Definition at line 680 of file common.c.

Referenced by PsynergyMenu_ReservedNoOp().

◆ PsynergyMenu_RefreshOwnerEntriesDefault()

UNUSED 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().