Alchemy
Loading...
Searching...
No Matches

messages.c File Reference

Message strings and arguments, symbol decoding and portrait windows. More...

Go to the source code of this file.

Functions

void Ui_AdjustValueWithoutLimit (s32 message, u16 *text)
 Decodes message into text (a u16 string) with no length limit.
s32 UiText_CopyMessageString (s32 message, u16 *destination, u32 capacity)
 Decodes message into destination as a zero-terminated string of at most capacity entries, and returns its length.
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, keeping style codes with their operands.
s32 * Runtime_ClearWordIfSet (s32 *p)
void UiWork_DrainPending (s32 unused)
 Closes every window: first the message channels' windows, waiting until they have closed, then the windows opened directly.
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 side until the countdown ends, then back to normal.
void UiWork_ClearValueNameTables (void)
 Empties the table of message arguments.
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; when all eight are in use it is dropped.
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.
s32 UiText_CheckPauseSkipped (struct UiChannelSlot *channel)
 Ends a channel's pause early: when the message waits on a sound that has finished (busy), or while A, B, L or R is held.
s32 UiText_CheckTextDismissed (struct UiChannelSlot *channel)
 As UiText_CheckPauseSkipped, but on a newly pressed button: the latched presses while UiRenderWork.mode is set.
void UiWork_FinalizePendingCore (void)
 Closes each message channel's window whose text has ended, then waits ten frames.
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, then closes it.
s32 UiText_BuildRenderEntriesMode1 (s32 message)
 Decodes message and empties the argument table; returns where its decoded text starts.
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 routine from a RAM copy.
UNUSED s32 UiText_DecodeSymbol (struct TextReader *reader)
 Decodes the next symbol of a message.
void UiWork_ClearPortraitSlots (void)
 Marks both portrait slots free (999).
s32 Localization_LookupEntryId (u32 value)
 Returns the portrait of a character (ids below 20) or another speaker's sprite (128 and up for those), or -1 when it has none.
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 UiWork_FinalizeEntityMatchingLocalizedId (u32 speaker)
 Closes the portrait window showing speaker entry, if one is open.

Detailed Description

Message strings and arguments, symbol decoding and portrait windows.

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

Definition in file messages.c.

Function Documentation

◆ Ui_AdjustValueWithoutLimit()

void Ui_AdjustValueWithoutLimit ( s32 message,
u16 * text )

Decodes message into text (a u16 string) with no length limit.

Definition at line 8 of file messages.c.

Referenced by FieldUi_AdjustValueWithoutLimit(), Ui_AdjustValueWithoutLimit(), and UiText_GetResourceDimensionsAlt().

◆ UiText_CopyMessageString()

s32 UiText_CopyMessageString ( s32 message,
u16 * destination,
u32 capacity )

Decodes message into destination as a zero-terminated string of at most capacity entries, and returns its length.

capacity counts halfwords including the terminator and must be at least 1.

Definition at line 15 of file messages.c.

Referenced by Battle_SelectAbility(), Ui_RunOwnerStatusScreen(), UiText_CopyMessageString(), and UiText_GetResourceDimensionsAlt().

◆ UiText_DecodeMessage()

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, keeping style codes with their operands.

capacity includes the terminating halfword; the unbounded wrapper supplies -1.

Definition at line 39 of file messages.c.

Referenced by Ui_AdjustValueWithoutLimit(), UiText_BuildRenderEntries(), UiText_DecodeMessage(), and UiText_GetResourceDimensionsAlt().

◆ Runtime_ClearWordIfSet()

s32 * Runtime_ClearWordIfSet ( s32 * p)

Definition at line 102 of file messages.c.

Referenced by Runtime_ClearWordIfSet(), and UiText_GetResourceDimensionsAlt().

◆ UiWork_DrainPending()

void UiWork_DrainPending ( s32 unused)

Closes every window: first the message channels' windows, waiting until they have closed, then the windows opened directly.

Channel references are cleared only after their windows finish closing.

Definition at line 114 of file messages.c.

Referenced by UiText_GetResourceDimensionsAlt(), and UiWork_DrainPending().

◆ UiWindow_StepSwellEffect()

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 side until the countdown ends, then back to normal.

Definition at line 177 of file messages.c.

Referenced by UiText_GetResourceDimensionsAlt(), UiWindow_StepSwellEffect(), and UiWork_ProcessRenderChannels().

◆ UiWork_ClearValueNameTables()

void UiWork_ClearValueNameTables ( void )

◆ UiWork_PushValueSlot()

◆ UiText_LookupArgument()

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.

With clear set the argument is removed from the table. Repeated kinds are allowed: only the first matching slot is read or consumed.

Definition at line 235 of file messages.c.

Referenced by UiText_BuildRenderEntries(), UiText_GetResourceDimensionsAlt(), and UiText_LookupArgument().

◆ UiText_CheckPauseSkipped()

s32 UiText_CheckPauseSkipped ( struct UiChannelSlot * channel)

Ends a channel's pause early: when the message waits on a sound that has finished (busy), or while A, B, L or R is held.

Clears the countdown and returns 1 if it ended. This path uses held keys; dismissal below uses newly pressed keys instead.

Definition at line 257 of file messages.c.

Referenced by UiText_CheckPauseSkipped(), UiText_GetResourceDimensionsAlt(), and UiWork_StepChannelScript().

◆ UiText_CheckTextDismissed()

s32 UiText_CheckTextDismissed ( struct UiChannelSlot * channel)

As UiText_CheckPauseSkipped, but on a newly pressed button: the latched presses while UiRenderWork.mode is set.

Returns 1 when the player has dismissed the text. Mode chooses latched presses rather than changing which buttons dismiss text.

Definition at line 279 of file messages.c.

Referenced by UiText_CheckTextDismissed(), UiText_GetResourceDimensionsAlt(), and UiWork_StepChannelScript().

◆ UiWork_FinalizePendingCore()

◆ UiText_ShowCenteredMessage()

void UiText_ShowCenteredMessage ( s32 message,
s32 mode,
s32 yOffset )

◆ UiText_BuildRenderEntriesMode1()

s32 UiText_BuildRenderEntriesMode1 ( s32 message)

Decodes message and empties the argument table; returns where its decoded text starts.

Definition at line 372 of file messages.c.

Referenced by Djinn_ShowJoinedMessage(), Party_ShowJoinedMessage(), Party_ShowPairJoinedMessage(), UiText_BuildRenderEntriesMode1(), and UiText_GetResourceDimensionsAlt().

◆ UiText_LookupMessage()

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 routine from a RAM copy.

The RAM routine initializes reader state; symbols are decoded separately.

Definition at line 379 of file messages.c.

Referenced by UiText_BuildRenderEntries(), UiText_DecodeMessage(), UiText_GetResourceDimensionsAlt(), and UiText_LookupMessage().

◆ UiText_DecodeSymbol()

UNUSED s32 UiText_DecodeSymbol ( struct TextReader * reader)

Decodes the next symbol of a message.

Messages are Huffman coded with one tree per previous symbol: the previous code picks the tree, the message's bits walk it to a leaf, and the leaf's 12-bit symbol is returned and becomes the next context. Tree traversal consumes bytes; reader->words retains that byte position between calls. Nothing calls it.

Definition at line 394 of file messages.c.

Referenced by UiText_DecodeSymbol(), and UiText_GetResourceDimensionsAlt().

◆ UiWork_ClearPortraitSlots()

void UiWork_ClearPortraitSlots ( void )

Marks both portrait slots free (999).

Definition at line 474 of file messages.c.

Referenced by UiText_GetResourceDimensionsAlt(), UiWork_ClearPortraitSlots(), and UiWork_InitializeWithResourceCounters().

◆ Localization_LookupEntryId()

s32 Localization_LookupEntryId ( u32 value)

◆ UiWindow_CreateWithSideObject()

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.

portraitOption is passed on to the portrait object. Returns the window, or 0 when the speaker has no portrait. Portrait offsets are in pixels; the enclosing window bounds are in tiles.

Definition at line 525 of file messages.c.

Referenced by DebugMenu_BrowseEntryGlyphs(), DebugMenu_BrowseMessageRange(), NameEntry_EditOwnerName(), Tolbi_MeetSearchingSoldiers(), UiText_GetResourceDimensionsAlt(), and UiWindow_CreateWithSideObject().

◆ UiWork_FinalizeEntityMatchingLocalizedId()

void UiWork_FinalizeEntityMatchingLocalizedId ( u32 speaker)

Closes the portrait window showing speaker entry, if one is open.

resourceIds selects the portrait slot, then outputIds identifies its render output.

Definition at line 553 of file messages.c.

Referenced by NameEntry_EditOwnerName(), UiText_GetResourceDimensionsAlt(), and UiWork_FinalizeEntityMatchingLocalizedId().