1#ifndef ALCHEMY_UNIT_WINDOW_WINDOW_H
2#define ALCHEMY_UNIT_WINDOW_WINDOW_H
45#define UI_CANVAS_VRAM ((void *)0x06002500)
46#define UI_CANVAS_SIZE 0xf00
47#define UI_CANVAS_FIRST_TILE 0x128
51#define UI_TILEMAP_VRAM ((u8 *)0x06002000)
54#define UI_TILE(tile) (0xf000 | (tile))
57#define UI_TILE_PAIR(entry) ((u32)(entry) << 16 | (entry))
63#define UI_PAGE_ARROW_TILE 0x128
64#define UI_PAGE_ARROW_VRAM \
65 ((s32)BG_CHAR_BLOCK(0) + UI_PAGE_ARROW_TILE * TILE_SIZE_4BPP)
66#define UI_PAGE_ARROW_LEFT UI_TILE(UI_PAGE_ARROW_TILE)
67#define UI_PAGE_ARROW_RIGHT UI_TILE(UI_PAGE_ARROW_TILE + 1)
105#define TILE_HFLIP 0x400
106#define TILE_VFLIP 0x800
109#define DMA_FILL32(count) \
110 ((DMA_ENABLE | DMA_32BIT | DMA_SRC_FIXED) << 16 | (count))
112#define DMA_COPY32(count) ((DMA_ENABLE | DMA_32BIT) << 16 | (count))
114#define DMA_COPY16(count) ((DMA_ENABLE << 16) | (count))
215 s32 offsetX,
s32 offsetY);
267#define UI_WORK ((struct UiRenderWork *)gWindowWork[0])
269#define ACTION_ID_MASK 0x3fff
274#define DEFINE_GET_RESOURCE_DIMENSIONS(name, flags) \
275 s32 name(s32 no, s32 *x, s32 *y, u32 *width, u32 *height) { \
276 struct UiRenderWork *work; \
280 idx = UiText_BuildRenderEntries(no, 0); \
281 if (work->entries[idx] == 0) { \
284 UiWindow_FitOnScreen(idx, x, y, width, height, 0, flags); \
418 u32 offsetX,
u32 offsetY);
421 s32 offsetX,
s32 offsetY);
s32 UiText_BuildRenderEntries(s32 script, s32 clear)
Decodes message script into the ring of decoded text (UiRenderWork.entries) and returns where it star...
u32 UiText_AppendArticleName(s32 mode, u16 *name, u32 writePosition, u16 *entries, s32 articleForm, s32 plural, s32 *suffix)
The English form: form 1 (or 3 with a single item) takes "a" or "an" (by the name's first letter unle...
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
void UiText_ShowPositionedMessageAndWait(s32 message, s32 flags)
Shows a message in a window centred on the screen, waits until it is typed out and closes it.
void UiWindow_DrawFrame(s32 x, s32 y, u32 width, u32 height)
Draws an empty window: a frame around a filled interior, at tile (x, y) of width by height tiles.
void UiWindow_DrawZoomFrame(void *windowArg, s32 savePosition)
Draws the frame of a zooming window at its size for this frame: the window grows from its centre as f...
void UiText_PrepareMessageWork(s32 argument)
Shows a message in the battle message window, opening the window (a full-width text canvas along the ...
void UiWork_FinalizeSharedSlot(void)
Closes the battle message window, if one is open.
void UiWork_ResetCounters(void)
Resets the text style glyphs are drawn with: colour 15, no outline, line spacing 10.
struct UiWindow * UiText_OpenMessageWindow(s32 message, s32 x, s32 y, u32 packed)
Opens a window sized to a message near tile (x, y) and starts typing the message into it.
s32 UiWork_IsIdle(struct UiWindow *window)
Returns 1 when a window is fully closed (its slot free), and 0 while it is open or closing.
void UiWork_InitCountersWithResourceAndScheduleRefresh(void)
Loads the glyph tiles, resets the text style and starts the per-frame window update (UiWork_ProcessAl...
void UiWork_ProcessAll(void)
The window system's per-frame callback: windows, then message channels, then sprite animation.
u16 * Memory_FillHalfwordsDma(u16 *dst, s32 value, s32 count)
Fills count halfwords at dst with value by DMA, and returns the position after them.
void UiWindow_MapTextCanvasTiles(s32 x, s32 y, u32 width, u32 height, s32 fullWidth)
Maps the text canvas tiles into the interior of a window at tile (x, y).
void UiWork_InitCountersAndScheduleRefresh(s32 loadGlyphTiles)
Resets the text style and starts the per-frame window update (UiWork_ProcessAll), loading the glyph t...
void UiText_ShowMessageAndWaitCore(s32 argument)
Shows a message in the battle message window and waits until it has been typed out.
void UiWork_ProcessDirectWork(void)
The per-frame window update: steps each window's zoom while it opens or closes, draws it in full once...
s32 UiWork_IsComplete(void)
Returns 1 when every message channel has finished its text (or is idle), and 0 while one is still typ...
s32 UiText_OpenEntryMessage(struct UiWindow *window, s32 message)
Types a message into an open window from its top left.
void UiWork_SetBusyFlags(s32 flags)
Sets the effects the next message is decoded with (UiText_BuildRenderEntries): flags bit 0 (spacingBe...
Font glyphs and their palettes.
u8 * UiText_FormatNumber(u8 *buffer, s32 input, s32 width)
Writes value as decimal text into buffer (14 bytes) and returns where the text starts.
s32 UiText_GetWideStringWidth(u16 *text)
Returns the width in pixels of a zero-terminated string of 16-bit character codes: 4 for a space,...
s32 UiText_RenderGlyphPair(s32 code, u32 *out)
Draws a character, and a second one when the code carries it in bits 8 to 15, into a 16x16-pixel cell...
UNUSED void UiText_RenderGlyphTileAtWorkOffset(u16 *buffer, const struct UiWindow *work, s32 offsetX, s32 offsetY)
Draws a string of 16-bit character codes straight into the UI tilemap, as tiles, inside a window at t...
void UiText_RenderWideStringAtOffset(u16 *text, struct UiWindow *window, s32 x, s32 y)
Draws a zero-terminated string of 16-bit character codes into a text canvas window at pixel (x,...
void UiText_MeasureAllPages(s32 entryIndex, u32 *outWidth, u32 *outHeight, u16 *spacing)
Measures decoded text from start over all its pages: the width of the first page's longest line and t...
void UiText_MeasureEntryDimensions(s32 entryIndex, u32 *outWidth, u32 *outHeight, u16 *spacing)
Measures decoded text from entryIndex to its first page's end: returns the width of the longest line ...
void UiText_MeasureResourceEntries(s32 message, s32 *x, s32 *y)
Decodes message no and returns its text's width and height in pixels.
void UiWindow_FitOnScreen(s32 entryIndex, s32 *windowX, s32 *windowY, u32 *windowWidth, u32 *windowHeight, u16 *spacing, u32 flags)
Sizes a window for decoded text no and moves (*px, *py) so the window fits on the screen.
void SystemMenu_Initialize(void)
Allocates the system menu's work block and starts its per-frame callback.
UNUSED void GraphicsPalette_ReservedNoOpC9C4(void)
struct UiWindow * SystemMenu_Open(void)
Opens the system menu's window with its entries (Save your quest, Sleep, Change settings,...
UNUSED void OptionMenu_LowerSetting(struct WorkspaceWork *work)
Lowers the setting on the three-row cursor's row: message speed, window hue or window brightness.
UNUSED void WindowColor_ComputeTint(struct WorkspaceWork *work)
Works out the window tint (red, green and blue, 0 to 31) from the window colour settings: the hue pic...
UNUSED void OptionMenu_ResetEntries(struct WorkspaceWork *work)
Clears the option screen's seven entry states, its row, its tint and its cursor animation.
void OptionMenu_AnimateCursors(void)
The option screen's per-frame callback: moves the cursor and the two slider markers,...
s32 Menu_RunWorkspaceSelectionLoop(void)
Runs the system menu until the player picks an entry (its number, counting Save your quest as 0) or c...
void OptionMenu_InitializeWork(void)
Allocates the option screen's work block, copies the settings into it with how many values each takes...
void SystemMenu_Release(void)
Stops the system menu's per-frame callback and frees its work block.
struct UiWindow * OptionMenu_Open(void)
Opens the option screen's window: the labels, the hue and brightness sliders with their markers,...
void GraphicsPalette_SelectionNoOp(void)
UNUSED void GraphicsPalette_ReservedNoOpC9C0(void)
void SystemMenu_AnimateCursor(void)
The system menu's per-frame callback: moves the cursor and pulses the chosen entry's icon.
u16 Color_ScaleComponents(s16 *rgb, s32 redScale, s32 greenScale, s32 blueScale)
Returns rgb with each channel scaled (16.16 fixed point) and clamped to 0 to 31, as a BGR555 colour.
u16 WindowColor_ScaleTint(struct WorkspaceWork *work, s32 redScale, s32 greenScale, s32 blueScale)
Returns the window tint with each channel scaled (16.16 fixed point) and clamped to 0 to 31,...
void OptionMenu_Release(void)
Stops the option screen's per-frame callback and frees its work block.
UNUSED void OptionMenu_RaiseSetting(struct WorkspaceWork *work)
Raises the setting on the three-row cursor's row: message speed, window hue or window brightness.
void PaletteGlow_Update(s32 phase, s32 brightness)
Sets the window colours (BG palette 15, colours 4 to 10) for a window hue (0 to 23) and brightness (0...
UNUSED void WindowColor_WritePalette(struct WorkspaceWork *work)
Writes window colours 4 to 10 of BG palette 15, each a fixed scale of the window tint.
UNUSED void OptionMenu_NextRow(struct WorkspaceWork *work)
Moves the three-row settings cursor down, wrapping to the top.
s32 Menu_RunWorkspaceOptions(void)
Runs the option screen (window colour and brightness, message speed, speech, auto-sleep) until A or S...
UNUSED void GraphicsPalette_ReservedNoOpC9BC(void)
Nothing calls them.
UNUSED void OptionMenu_PreviousRow(struct WorkspaceWork *work)
Moves the three-row settings cursor up, wrapping to the bottom.
UNUSED void Menu_MoveSelectionBackward(struct SelectionScreen *screen)
Moves the cursor one entry left, scrolling the row at its second place.
void Menu_SetupSelectionBothSides(void)
Sets up both end arrows of the selection row.
void Menu_OpenSelectionWindow(s32 mode, u32 count)
Opens or refits the name window above the selection row and writes the name of the icon under the cur...
void UiGlyph_ResetWorkState(void)
Allocates and resets the selection screen: the row of icons the player picks from,...
void Resource_ScheduleOwnerReset(void)
Stops drawing the selection screen.
void Resource_ClearOwnerListAndCounters(void)
Empties the selection screen's list of entries.
s32 Resource_LoadByMode(s32 mode, s32 value)
Loads the icon of an entry of kind mode (1 and 6 commands, 2 items, 4 Psynergy, 9 fixed images) into ...
void SelectionScreen_LoadLargeIcon(void)
Loads the large icon of the command under the cursor, zooming in.
void Resource_PushPendingPair(u32 kind, u32 base)
Adds an entry (kind and id) to the selection screen's list, up to 16.
UNUSED void Menu_MoveSelectionForward(struct SelectionScreen *screen)
Moves the cursor one entry right, scrolling the row at its fourth place.
UNUSED void UiTextResource_NoOpCallback2(void)
s32 Resource_LoadByModeIntoSlot(s32 mode, s32 value, s32 result, s32 option)
Loads the icon of an entry of kind mode into sprite tile slot result (a free slot when -1) and return...
void Menu_SetNodeCoordinates(u32 x, u32 y)
Moves the row of icons to start at pixel (x, y), 16 pixels apart.
void Menu_StepRight(struct SelectionScreen *state)
Moves the cursor one entry right, scrolling the row at its edge and wrapping from the last entry to t...
u32 Menu_RunSelectionForValue(u32 initialIndex)
Runs a selection row with the cursor on entry initialIndex, cancellable, and returns the entry chosen...
void Resource_ResetPendingTransfer(void)
Frees the large command icon, if it is shown.
void UiTextResource_Initialize(struct MenuSprite *sprite, s32 *slot)
Sets up a sprite as the right-pointing arrow, in a free tile slot (returned in *slot).
void SelectionScreen_DrawArrow(struct SelectionScreen *state, s32 side)
Draws the selection screen's left (index 0) or right (1) arrow, nudged outwards while it flashes afte...
u32 Menu_ConfirmSelection(struct SelectionScreen *screen)
Chooses the entry under the cursor: the other icons gather into it and vanish, and it joins the chose...
void SelectionScreen_RedrawIcon(struct SelectionScreen *state, u32 rowIndex)
Redraws the command icon at row place rowIndex in its plain state.
void UiTextResource_Release(s32 value)
Frees an arrow sprite's tile slot.
void UiTextResource_SetPosition(struct MenuSprite *sprite, s32 x, s32 y)
Places an arrow sprite at (x, y) and queues it for drawing.
void MenuSelection_BuildEntries(u32 unused)
Creates icons for the first five listed entries in a row along the bottom of the screen.
struct SelectionNode * SelectionScreen_FindFreeIcon(s32 kind)
Returns a free selection icon record: one of the seven row icons (kind 0) or of the five chosen icons...
void UiTextResource_NoOpCallback4(void)
struct SelectionNode * Selection_GetCursorNode(struct SelectionScreen *screen)
Returns the node at the selection screen's cursor index.
void Menu_ScrollSelectionList(struct SelectionScreen *screen, s32 forward)
Scrolls the row one entry: forward brings an icon in from the right as the leftmost shrinks away,...
void SelectionScreen_SetupArrow(struct SelectionScreen *state, s32 side)
Sets up the left (index 0) or right (1) arrow of the selection row, shown when there are entries beyo...
void SelectionScreen_SetupIcon(u32 kind, s32 base, struct SelectionNode *node, s32 reuse)
Sets up a selection icon for an entry: its icon tiles (in its old slot when reuse is set),...
void UiWork_CloseAndRelease(void)
Closes the window kept in heap block 16 and frees the block.
UNUSED void SelectionScreen_CreateEmpty(void)
Sets up an empty selection screen and waits a frame.
void Resource_ScheduleOwnerResetDelayed(void)
Starts drawing the selection screen each frame.
UNUSED void UiTextResource_NoOpCallback3(void)
s32 Menu_SelectionLoop(s32 mode)
Runs the selection row until the player chooses (the chosen entry's index) or, when mode allows it,...
void UiTextResource_NoOpCallbackBank(void)
void Resource_ResetOwnerEntries(void)
Closes the selection screen and frees its icons, tiles and work block.
void UiWindow_OpenMode1AndWaitFrame(void)
Opens the field menu's window and waits a frame.
void SelectionScreen_Draw(void)
The selection screen's per-frame callback: slides and draws the row of icons, the large icon over the...
u32 Menu_WaitForSelectionInput(u32 mode)
As Menu_SelectionLoop, with the menu sounds.
void UiWork_ReservedNoOp(void)
s32 Menu_RunTopSelection(void)
Runs the field menu until the player picks something that leaves it, and returns that choice's result...
void Menu_SendNodeCountList(struct SelectionScreen *screen)
Tells the battle presentation how many icons the row shows.
void UiTextResource_NoOpCallback1(void)
UNUSED void UiTextResource_NoOpCallback(void)
Six empty functions; nothing calls the first, the fourth or the fifth.
void SelectionScreen_HighlightIcon(struct SelectionScreen *state, u32 rowIndex)
Redraws the command icon at row place rowIndex and loads its large icon.
void Menu_StepLeft(struct SelectionScreen *state)
Moves the cursor one entry left, scrolling the row at its edge and wrapping from the first entry to t...
s32 Party_ListPsynergy(struct AbilityListEntry *output)
Lists every Psynergy of the party's active members as (owner, Psynergy) pairs in output and returns h...
void Debug_SelectAbilityPair(void)
Lets the player pick two Psynergy shortcuts from all the party's Psynergy, showing each one's cost an...
UNUSED void Menu_AllocateSelectionWorkspace(void)
Allocates the work block of heap slot 19 and clears its two icon flags.
UNUSED void OptionMenu_StepWindowHue(s32 keys)
Steps the window hue one step: back when keys contains LEFT, on otherwise.
void Menu_FindShortcutEntries(u32 *firstIndex, u32 *secondIndex, const struct AbilityListEntry *entries)
Finds the two Psynergy shortcuts in a list from Party_ListPsynergy, and returns their indexes (0 for ...
void UiTimedNotice_Create(void)
Shows the area's name in a window near the top of the screen for 90 frames.
void Menu_RunSelectionHook(void)
Runs the Psynergy shortcut picker.
s32 Item_ReturnTrue(void)
void UiTimedNotice_CloseIfActive(void)
Closes the area name at once, if it is shown.
void UiTimedNotice_Tick(void)
Counts the area name down, and closes it at 0.
s32 Item_RemoveFromInventory(s32 unused, s32 itemId)
UNUSED void Menu_ReleaseSelectionWorkspace(void)
Closes the window of heap slot 19's work block, frees its two icons and frees the block.
A Psynergy the debug shortcut picker lists: its owner and the Psynergy.
An ability's definition, a row of gBattleAction_DefinitionTable: its targeting, kind,...
A unit's chosen action for the turn: its command, the command's parameter, its target and range,...
A compact palette shared by a selection's command icons: the slot each icon colour was given,...
An entry in a unit's action list: the action's id (OWNER_ACTION_ID_MASK) and marks for an action its ...
A list of render outputs: its first output and the link to append after.
A render output: a sprite in a window's output list (a character, an icon or a portrait),...
A save file's summary for the file screen: the leader's name, level and class, the area,...
An icon of the selection screen: its list links, the entry it shows, its place and its slide toward a...
u16 kind
the entry's kind, as listed in SelectionScreen.kinds; 0 free
u16 base
the entry's id, as listed in SelectionScreen.bases
u16 slot
VRAM cache slot of its picture.
The selection screen (heap block 18): the row of icons the player picks from, with arrows at each end...
The command icon row's work block: the icons' shared palette, up to six icons, the label window,...
A position in a Huffman-coded message: the previous code, which picks the next symbol's tree,...
A text channel, one of three, which types decoded text into a window a few characters a frame and run...
u16 y
pen, 8.8 fixed-point pixels
u16 flags
nonzero keeps the window's size from page to page
u16 x
pen, 8.8 fixed-point pixels
u16 entry
next code in UiRenderWork.entries
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
u16 flags
UI_WINDOW_ flags; 0 once closing or free.
struct RenderOutputList output
the sprites the window carries
The option screen's work (heap block 20): the settings being edited and how many values each takes,...
void UiText_DrawStringInWindow(const u8 *text, struct UiWindow *window, u32 x, u32 y)
Draws a byte string into a window's tilemap at pixel (x, y) of its interior, rounded down to tiles.
void UiText_DrawResource(s32 message, struct UiWindow *window, s32 x, s32 y)
Decodes a message and draws it into a text canvas window at pixel (x, y).
void UiText_DrawString(const u8 *text, struct UiWindow *window, s32 x, s32 y)
Draws a byte string into a text canvas window at pixel (x, y).
void UiWork_SetRenderWord(u16 value)
Sets the text style (UiRenderWork.outline) of drawn text.
void UiWindow_DrawDividerLine(struct UiWindow *win, u32 x1, u32 y1, u32 x2, u32 y2)
Draws a straight divider line inside a window from tile (x1, y1) to (x2, y2), horizontal or vertical:...
void UiText_DrawStringAtOffset(const u8 *text, const struct UiWindow *work, s32 offsetX, s32 offsetY)
Draws a byte string as tiles in window work at pixel (offsetX, offsetY) of its interior.
void UiWork_SetAltFlagAndClearTable(s32 allowAlternateTiles)
Frees every text tile, and with flag set lets text tiles take the second tile range (0x200 to 0x27f) ...
void UiText_DrawNumberInWindow(s32 value, s32 width, struct UiWindow *window, s32 x, s32 y)
Draws a number (width as UiText_FormatNumber) into a window's tilemap at pixel (x,...
void UiText_DrawNumberAtOffset(s32 value, s32 width, const struct UiWindow *window, s32 x, s32 y)
Draws a number (width as UiText_FormatNumber) as tiles in a window at pixel (x, y) of its interior.
UNUSED void UiWindow_OverlayTilePattern(u16 *entry, u16 *mirror, s32 pattern, u8 *remap)
Draws window tile pattern over the tile of tilemap entry *entry, with its colours mapped through rema...
void UiWindow_MarkVisibleTileAttributes(void)
Marks the text tiles the tilemap shows, and frees those it no longer shows.
UNUSED void UiRender_ReservedNoOp(void)
Nothing calls it.
s32 UiText_RenderStringTiles(u16 *text, u16 *tiles, u16 *mirror, s32 x)
Draws a string of 16-bit character codes with the window font into tiles of their own,...
void UiWork_SetParamNibble(s32 param)
Sets the text colour (0 to 15) of drawn text.
void UiText_DrawCharacterAtOffset(s32 message, const struct UiWindow *window, u32 offsetX, u32 offsetY)
Decodes a message and draws it as tiles in a window at pixel (offsetX, offsetY) of its interior.
void UiText_DrawNumber(s32 value, s32 width, struct UiWindow *window, s32 x, s32 y)
Draws a number (width as UiText_FormatNumber) into a text canvas window at pixel (x,...
The integer types, TRUE, UNUSED and the fixed-address macros.
void UiWork_ProcessRenderChannels(void)
The per-frame message update: each message channel whose window is fully open runs its window effect ...
s32 UiWork_StepChannelScript(struct UiChannelSlot *channel)
Types one frame's share of a channel's text: runs control codes (new line, new page,...
void UiText_ScrollCanvasUp(s32 step)
Scrolls the battle message canvas up by 6 pixel rows per step, below its top 8 rows,...
s32 UiText_GetResourceDimensions(s32 no, s32 *x, s32 *y, u32 *width, u32 *height)
@ UI_SPRITE_SHAKE
jitters by a pixel every other frame
@ UI_SPRITE_PAGE_ARROW
the animated next-page arrow, bobbing
@ UI_SPRITE_POP
shown at double size, then normal size
@ UI_SPRITE_HOP_DOWN_LEFT
@ UI_SPRITE_WOBBLE
swings along a small arc
@ UI_SPRITE_HIDDEN
not drawn
@ UI_SPRITE_SHRINK_HALF
the same at half the scale
@ UI_SPRITE_SHRINK
shrinks from 1.5 times to its size, once
@ UI_SPRITE_HOP_DOWN
14 to 16: hops down and back
@ UI_SPRITE_SWELL
pulses between 1 and 1.5 times its size
@ UI_SPRITE_SWELL_HALF
the same at half the scale
@ UI_SPRITE_PULSE
shown at 1.25 times, then normal size
@ UI_SPRITE_SPIN
turns while circling its place
#define UI_TILE(tile)
A tilemap entry of palette 15, the UI palette.
@ UI_WINDOW_TEXT_CANVAS
text is drawn into a canvas of bitmap tiles (UiWindow_MapTextCanvasTiles)
@ UI_WINDOW_FIXED_X
when a new page resizes the window, its left edge stays put
@ UI_WINDOW_FRAMED_CANVAS
the canvas has a frame and a filled background; without it the canvas is transparent and frameless
@ UI_WINDOW_ANCHOR_BOTTOM
when a new page resizes the window, its bottom edge stays put
@ UI_WINDOW_OUTLINED_TEXT
the canvas text gets an outline
@ UI_WINDOW_OPEN
the window slot is in use
@ UI_WINDOW_INSTANT
opens and closes at once, with no zoom
s32 UiText_GetResourceDimensionsAlt(s32 no, s32 *x, s32 *y, u32 *width, u32 *height)
@ UI_TILE_FRAME_RIGHT_TEE
the right edge meeting a line
@ UI_TILE_BATTLE_FRAME_BOTTOM_LEFT
In battle, the bottom frame tiles' lower rows, which UiWork_Initialize copies to tiles 128 to 130.
@ UI_TILE_DIVIDER_HORIZONTAL
@ UI_TILE_FRAME_LEFT_TEE
the left edge meeting a line
@ UI_TILE_FRAME_BOTTOM_TEE
the bottom edge meeting a line
@ UI_TILE_BATTLE_FRAME_BOTTOM
@ UI_TILE_DIVIDER_TEE_LEFT
a horizontal line leaving left
@ UI_TILE_BATTLE_FRAME_BOTTOM_RIGHT
@ UI_TILE_FRAME_TOP_TEE
the top edge meeting a line
@ UI_TILE_FRAME_BOTTOM_LEFT
@ UI_TILE_FRAME_ROUND_CORNER
@ UI_TILE_DIVIDER_TEE_DOWN
a vertical line leaving below
@ UI_TILE_DIVIDER_TEE_RIGHT
a horizontal line leaving right
@ UI_TILE_FRAME_TOP_RIGHT
@ UI_TILE_DIVIDER_TEE_UP
a vertical line leaving above
@ UI_TILE_DIVIDER_VERTICAL
@ UI_TILE_FRAME_BOTTOM_RIGHT
void UiIcon_Decode(GlyphTransfer *glyph, s32 outlined)
Decodes a compressed icon into the glyph buffer and expands it to tiles, opaque for the first layer o...
void UiIcon_BuildAbilityIconTiles(u32 glyph, s32 withBase, s32 *cacheSlot, s32 *tileOut, s32 reuse)
Builds the Psynergy icon glyph, over the icon frame when withBase is set, and loads it into *cacheSlo...
void UiGlyph_ReservedNoOp(void)
s32 Ui_BuildPatternToSlot(s32 icon, s32 unused, s32 cacheSlot)
Builds one of the other icons and loads it into sprite tile slot cacheSlot.
s32 UiIcon_CopyResourceToSlot(s32 inventoryCode, s32 layers, s32 cacheSlot)
Composes an inventory icon with the requested layers and loads it into cacheSlot.
s32 ItemIcon_Compose(u32 code, u32 layers)
Draws an item's icon into the glyph work buffer from its inventory code (item id in the low 9 bits,...
void Ability_RequestGlyph(s32 action, s32 withBase, s32 *slot, s32 *tile, s32 reuse)
Builds the icon of a battle action's item (its first operand) into a slot, as UiIcon_BuildItemIconTil...
s32 RenderResource_LoadTableEntry(u32 value, s32 unused, u32 slot)
Loads one of four small fixed images into the sprite tile slot named by slot.
s32 UiIcon_CountPsynergyIcons(void)
void Ui_PrepareTransferForItem(s32 code)
Draws an item's icon from its inventory code into the glyph work buffer.
void Ui_BuildPairedPatternsToSlot(s32 overlayIcon, s32 frameIcon, s32 *slot, s32 *tileOut, s32 reuse)
Builds a command icon (overlay overlayIcon over frame frameIcon) and loads it into a sprite tile slot...
void Ability_LoadGlyph(s32 action, s32 withBase, s32 *slot, s32 *tile, s32 reuse)
Builds the Psynergy icon of a battle action, as UiIcon_BuildAbilityIconTiles.
void Ui_PrepareTransferFromTableEntry(u32 iconIndex)
Draws one of the other icons into the glyph work buffer.
void UiIcon_BuildItemIconTiles(u32 glyph, s32 withBase, s32 *cacheSlot, s32 *tileOut, s32 reuse)
Builds the item icon glyph, over the icon frame when withBase is set, and loads it into *cacheSlot (a...
void UiGlyph_LoadEntryWithPalette(u32 icon, s32 unused, s32 *slot, s32 *tile, s32 palette, s32 reuse)
Loads a 32x32 icon from the icon resource into sprite tile slot *slot (a free slot unless reuse is se...
s32 UiIcon_CountItemIcons(void)
s32 Localization_LookupEntryId(u32 value)
Returns the portrait of a character (ids below 20) or another speaker's sprite (128 and up for those)...
UNUSED s32 UiText_DecodeSymbol(struct TextReader *reader)
Decodes the next symbol of a message.
void UiWork_PushValueSlot(u32 value, u32 kind)
Adds a message argument of kind (MSG_ARG_) with value to the first free place of the argument table; ...
s32 UiText_CopyMessageString(s32 message, u16 *destination, u32 capacity)
Decodes message into destination as a zero-terminated string of at most capacity entries,...
void UiText_LookupMessage(struct TextReader *reader, s32 message)
Points reader at the start of message (its compressed bits and first context), running the ARM lookup...
s32 UiText_CheckPauseSkipped(struct UiChannelSlot *channel)
Ends a channel's pause early: when the message waits on a sound that has finished (busy),...
s32 UiText_CheckTextDismissed(struct UiChannelSlot *channel)
As UiText_CheckPauseSkipped, but on a newly pressed button: the latched presses while UiRenderWork....
s32 UiText_BuildRenderEntriesMode1(s32 message)
Decodes message and empties the argument table; returns where its decoded text starts.
u32 UiText_LookupArgument(u32 kind, u32 clear)
Returns the value of the first message argument of kind (MSG_ARG_), or 0 when there is none.
void UiWork_FinalizePendingCore(void)
Closes each message channel's window whose text has ended, then waits ten frames.
void UiWork_DrainPending(s32 unused)
Closes every window: first the message channels' windows, waiting until they have closed,...
void Ui_AdjustValueWithoutLimit(s32 message, u16 *text)
Decodes message into text (a u16 string) with no length limit.
void UiText_ShowCenteredMessage(s32 message, s32 mode, s32 yOffset)
Shows a message centred on the screen (yOffset tiles lower) and waits until it is typed out,...
void UiWork_ClearPortraitSlots(void)
Marks both portrait slots free (999).
void UiText_DecodeMessage(s32 message, u16 *text, s32 capacity)
Decodes message into text as a zero-terminated string of 16-bit codes, with at most capacity entries,...
void UiWork_FinalizeEntityMatchingLocalizedId(u32 speaker)
Closes the portrait window showing speaker entry, if one is open.
void UiWork_ClearValueNameTables(void)
Empties the table of message arguments.
struct UiWindow * UiWindow_CreateWithSideObject(s32 speaker, s32 portraitOption, s32 x, s32 y)
Opens a portrait window at tile (x, y) showing the speaker's portrait.
void UiWindow_StepSwellEffect(struct UiChannelSlot *channel)
Steps a channel's window effect (UI_WINDOW_EFFECT_SWELL): the frame is drawn a tile bigger on every s...
s32 * Runtime_ClearWordIfSet(s32 *p)
void UiWork_AnimateSpriteSlots(void)
The per-frame sprite update: moves each sprite that an open window carries by its animation mode (UI_...
void RenderOutput_UpdateScaleAnimation(struct RenderOutput *output)
Steps a scaling sprite's animation (UI_SPRITE_SWELL to UI_SPRITE_SHRINK_HALF) and sets its affine sca...
s32 UiText_DrawGlyph(struct UiWindow *window, s32 character, s32 x, s32 y, s32 mode)
Draws a character of a window's text with its top-left corner at pixel (x, y) of the window's interio...
void UiWindow_SetTilemapEntry(struct UiWindow *window, s32 value, s32 x, s32 y, u32 mode)
Writes value into a window's tilemap at tile (x, y) of its interior, with the palette mode names (TIL...
void RenderOutput_InitFreeList(void)
Links all 64 render outputs of the pool into the free list.
void RenderOutput_PrepareForRedraw(struct UiWindow *window)
Clears a window's contents: redraws its empty frame and releases the render outputs it carries.
void RenderOutput_Release(struct RenderOutput *entry)
Frees a render output: returns it to the free list, releases its resource, and for a kind-2 output fr...
void UiWork_ResetFreeChannel(void)
Resets the pen and text style of the first idle message channel, clearing the canvas when the channel...
s32 Ui_ClearVramBlock(void)
Clears the text canvas to transparent.
s32 Ui_FillVramBlockPattern(void)
Fills the text canvas with the window background colour (4).
void UiText_ApplyChannelStyle(struct UiChannelSlot *channel)
Copies the channel's text colour, outline and line spacing into the shared glyph renderer before that...
void UiWindow_EraseBorderRect(s32 x, s32 y, u32 width, u32 height)
Erases a window's rectangle of the tilemap (x, y, width and height in tiles), clamped to the screen.
void UiWindow_WaitZoom(struct UiWindow *window)
Waits until a zooming window has finished opening or closing.
struct UiChannelSlot * UiText_StartBattleMessage(struct UiWindow *window, s32 entry, s32 keepPosition)
Starts a channel typing the decoded text at entry into the battle message window.
void UiWork_UploadDirtyBlocks(void)
The per-frame tilemap upload: copies each 256-byte band of the tilemap (four tile rows) marked in the...
void UiWindow_DrawOpened(struct UiWindow *window)
Draws a window at its full size: its frame, and for a text canvas window the canvas,...
void UiWork_Initialize(s32 loadGlyphTiles)
Sets up the window system for battle, as UiWork_InitializeWithResourceCounters does for the field,...
void UiWork_Finalize(struct UiWindow *window, s32 instant)
Closes a window: clears its contents and remembers its last rectangle.
void RenderOutput_ReleaseFree(struct RenderOutput *out)
Returns a render output to the end of the free list.
void UiText_StartCanvasScroll(struct UiChannelSlot *channel)
Starts a channel scrolling its canvas up a line, over two frames.
UNUSED void RenderOutputList_UpdateTail(struct RenderOutputList *list)
Points a list's tail link back at its last output, after the list has been edited by hand.
void RenderOutput_ClearList(void *outputs)
Releases every render output in a list and empties it.
struct RenderOutput * RenderOutput_AcquireFree(void)
Takes the first render output from the free list, or returns NULL when every output is in use.
void UiWork_InitializeWithResourceCounters(void)
Sets up the window system for the field (and the other screens outside battle): allocates and clears ...
void UiWindow_ClearInteriorTiles(const struct UiWindow *window, u32 left, u32 top, u32 right, u32 bottom)
Clears an area of a window's interior to the window fill.
void RenderOutput_RedrawSavedRect(struct UiWindow *window)
Redraws a window's empty frame at its current rectangle.
struct UiWindow * UiWindow_Create(s32 x, s32 y, s32 width, s32 height, s32 attrs)
Opens a window at tile (x, y) of width by height tiles in the first free window slot,...