Alchemy
Loading...
Searching...
No Matches

frames.c File Reference

Window zoom and frames, and opening and waiting on message windows. More...

Go to the source code of this file.

Data Structures

struct  UiWindowInterpolationScratch
 Scratch values for a step of a window's zoom: the scaled part of a side, the scaled duration and their ratio. More...

Functions

void UiWork_ProcessDirectWork (void)
 The per-frame window update: steps each window's zoom while it opens or closes, draws it in full once open, and frees its slot once closed.
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 frame counts down to 0.
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_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_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).
s32 UiWork_IsComplete (void)
 Returns 1 when every message channel has finished its text (or is idle), and 0 while one is still typing.
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_ResetCounters (void)
 Resets the text style glyphs are drawn with: colour 15, no outline, line spacing 10.
void UiWork_InitCountersWithResourceAndScheduleRefresh (void)
 Loads the glyph tiles, resets the text style and starts the per-frame window update (UiWork_ProcessAll).
void UiWork_InitCountersAndScheduleRefresh (s32 loadGlyphTiles)
 Resets the text style and starts the per-frame window update (UiWork_ProcessAll), loading the glyph tiles first when loadGlyphTiles is set.
void UiWork_FinalizeSharedSlot (void)
 Closes the battle message window, if one is open.
void UiText_PrepareMessageWork (s32 argument)
 Shows a message in the battle message window, opening the window (a full-width text canvas along the bottom of the screen) if it is not open.
void UiText_ShowMessageAndWaitCore (s32 argument)
 Shows a message in the battle message window and waits until it has been typed out.
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 (spacingBefore) makes it halting speech, a short pause before each character, broken off with an ellipsis after the first word; bit 1 (spacingAfter) puts code 222 after certain characters in English and Japanese.
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.
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 UiWork_ProcessAll (void)
 The window system's per-frame callback: windows, then message channels, then sprite animation.

Detailed Description

Window zoom and frames, and opening and waiting on message windows.

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

Definition in file frames.c.

Function Documentation

◆ UiWork_ProcessDirectWork()

void UiWork_ProcessDirectWork ( void )

The per-frame window update: steps each window's zoom while it opens or closes, draws it in full once open, and frees its slot once closed.

Definition at line 17 of file frames.c.

Referenced by UiWork_ProcessAll(), and UiWork_ProcessDirectWork().

◆ UiWindow_DrawZoomFrame()

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 frame counts down to 0.

With savePosition set (when closing) the drawn rectangle is remembered, for the next frame to erase.

Definition at line 74 of file frames.c.

Referenced by UiWindow_DrawZoomFrame(), and UiWork_ProcessDirectWork().

◆ Memory_FillHalfwordsDma()

u16 * Memory_FillHalfwordsDma ( u16 * dst,
s32 value,
s32 count )

Fills count halfwords at dst with value by DMA, and returns the position after them.

value holds the halfword in both its halves.

Definition at line 121 of file frames.c.

Referenced by Memory_FillHalfwordsDma(), and UiWindow_DrawFrame().

◆ UiWindow_DrawFrame()

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.

Sizes outside 2 to 30 tiles draw nothing.

Definition at line 131 of file frames.c.

Referenced by PartyStatusDraw(), RenderOutput_RedrawSavedRect(), UiWindow_DrawFrame(), UiWindow_DrawOpened(), UiWindow_DrawZoomFrame(), UiWindow_StepSwellEffect(), and UiWork_StepChannelScript().

◆ UiWindow_MapTextCanvasTiles()

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

With fullWidth set the canvas covers the side frame columns too.

Definition at line 176 of file frames.c.

Referenced by Ui_RunOwnerStatusScreen(), UiText_PrepareMessageWork(), UiWindow_DrawOpened(), and UiWindow_MapTextCanvasTiles().

◆ UiWork_IsComplete()

◆ UiWork_IsIdle()

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.

Definition at line 224 of file frames.c.

Referenced by Menu_ReleaseSelectionWorkspace(), UiText_ShowCenteredMessage(), UiText_ShowPositionedMessageAndWait(), and UiWork_IsIdle().

◆ UiWork_ResetCounters()

void UiWork_ResetCounters ( void )

Resets the text style glyphs are drawn with: colour 15, no outline, line spacing 10.

Definition at line 236 of file frames.c.

Referenced by UiText_RenderWideStringAtOffset(), UiWindow_Create(), and UiWork_ResetCounters().

◆ UiWork_InitCountersWithResourceAndScheduleRefresh()

void UiWork_InitCountersWithResourceAndScheduleRefresh ( void )

Loads the glyph tiles, resets the text style and starts the per-frame window update (UiWork_ProcessAll).

Definition at line 248 of file frames.c.

Referenced by UiWork_InitCountersWithResourceAndScheduleRefresh(), and UiWork_InitializeWithResourceCounters().

◆ UiWork_InitCountersAndScheduleRefresh()

void UiWork_InitCountersAndScheduleRefresh ( s32 loadGlyphTiles)

Resets the text style and starts the per-frame window update (UiWork_ProcessAll), loading the glyph tiles first when loadGlyphTiles is set.

Definition at line 266 of file frames.c.

Referenced by UiWork_InitCountersAndScheduleRefresh(), and UiWork_Initialize().

◆ UiWork_FinalizeSharedSlot()

void UiWork_FinalizeSharedSlot ( void )

Closes the battle message window, if one is open.

Definition at line 283 of file frames.c.

Referenced by UiWork_FinalizeSharedSlot().

◆ UiText_PrepareMessageWork()

void UiText_PrepareMessageWork ( s32 argument)

Shows a message in the battle message window, opening the window (a full-width text canvas along the bottom of the screen) if it is not open.

Definition at line 295 of file frames.c.

Referenced by UiText_PrepareMessageWork(), and UiText_ShowMessageAndWaitCore().

◆ UiText_ShowMessageAndWaitCore()

void UiText_ShowMessageAndWaitCore ( s32 argument)

Shows a message in the battle message window and waits until it has been typed out.

Definition at line 338 of file frames.c.

Referenced by UiText_ShowMessageAndWaitCore().

◆ UiText_OpenEntryMessage()

s32 UiText_OpenEntryMessage ( struct UiWindow * window,
s32 message )

Types a message into an open window from its top left.

Returns the channel typing it (as an integer), or 0 when the message is empty, window is NULL or no channel is free. The result is the channel pointer encoded as a word, not a message-completion status.

Definition at line 349 of file frames.c.

Referenced by UiText_OpenEntryMessage().

◆ UiWork_SetBusyFlags()

void UiWork_SetBusyFlags ( s32 flags)

Sets the effects the next message is decoded with (UiText_BuildRenderEntries): flags bit 0 (spacingBefore) makes it halting speech, a short pause before each character, broken off with an ellipsis after the first word; bit 1 (spacingAfter) puts code 222 after certain characters in English and Japanese.

UiText_OpenMessageWindow clears both.

Definition at line 376 of file frames.c.

Referenced by UiWork_SetBusyFlags().

◆ UiText_OpenMessageWindow()

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.

packed holds the window options in its low bits (bit 0: zoom open rather than appear at once; bit 3: a text canvas; bit 4: keep the bottom edge; bit 5: keep the left edge) and the speaker's voice sound in bits 16 to 27. Returns the window, or NULL when the message is empty or no window or channel is free.

Definition at line 396 of file frames.c.

Referenced by LinkLobby_EnterBattle(), LinkLobby_SaveBattleResults(), LinkLobby_SaveMonsterBattleResults(), SaveState_ConfirmAndProcessSelectedSlot(), SaveState_DeleteSelectedSlot(), SceneDialogue_ShowMessageAndWait(), Tolbi_MeetSearchingSoldiers(), UiText_OpenMessageWindow(), UiText_ShowMessageAndWaitComplete(), and UiText_ShowPositionedMessageAndWait().

◆ UiText_ShowPositionedMessageAndWait()

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.

flags: bit 0 zooms the window, bit 1 sets busy while it shows, bit 2 leaves the window open, bit 3 puts it 4 tiles lower, bit 5 holds the tilemap upload off afterwards, bit 6 puts it 12 tiles lower. Without bit 3 or 6 the window goes above or below the player's character, away from where it stands on screen.

Definition at line 447 of file frames.c.

Referenced by DebugMenu_DamageAndAfflictParty(), DebugMenu_GiveConsumableTestStock(), DebugMenu_GiveEquipmentTestStock(), DebugMenu_GivePartyDjinn(), DebugMenu_GiveTreasureTestStock(), DebugMenu_RaisePartyLevels(), Menu_RunWorkspaceResultLoop(), Save_WriteSelectedSlot(), SaveMenu_Run(), SaveState_ConfirmAndProcessSelectedSlot(), SaveState_CopySlotPair(), SaveState_DeleteSelectedSlot(), SaveState_LoadRecordIntoWork(), SaveState_ProcessSelectedSlot(), SaveState_WriteCurrentSlotPair(), SaveState_WriteSlotPair(), and UiText_ShowPositionedMessageAndWait().

◆ UiWork_ProcessAll()

void UiWork_ProcessAll ( void )

The window system's per-frame callback: windows, then message channels, then sprite animation.

Definition at line 515 of file frames.c.

Referenced by UiWork_InitCountersAndScheduleRefresh(), UiWork_InitCountersWithResourceAndScheduleRefresh(), and UiWork_ProcessAll().