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. | |
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.
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().
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().
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().
Definition at line 102 of file messages.c.
Referenced by Runtime_ClearWordIfSet(), and UiText_GetResourceDimensionsAlt().
| 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().
| 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().
| void UiWork_ClearValueNameTables | ( | void | ) |
Empties the table of message arguments.
Definition at line 199 of file messages.c.
Referenced by Battle_SelectAbility(), LinkLobby_ReportWinTallies(), UiText_BuildRenderEntries(), UiText_GetResourceDimensionsAlt(), and UiWork_ClearValueNameTables().
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.
Kind 0 denotes an empty slot.
Definition at line 216 of file messages.c.
Referenced by Battle_SelectAbility(), Colosso_GreetAtStage(), Colosso_OfferCheeringSpot(), Colosso_RepeatStageNumber(), ColossoLog_CollectFinishEquipment(), ColossoRiver_CollectFinishItem(), ColossoWall_ApproachFinishAndTakeItem(), DebugMenu_BrowseMessageRange(), Djinn_ShowJoinedMessage(), Event_BagMercuryStar(), Event_BagVenusStar(), Event_MeetFlint(), Event_TakeMarsStar(), KalayTolbiDocks_TalkToTicketSeller(), MercuryLighthouse_FillHermesWaterBottle(), Party_ShowJoinedMessage(), Party_ShowPairJoinedMessage(), SolSanctumElementalStarRoom_BagJupiterStar(), TolbiSpring_Initialize(), TolbiSpring_OfferLuckyDice(), TolbiSpring_OfferLuckyWheels(), TolbiSpring_RunSpringGame(), Ui_RunOwnerStatusScreen(), UiText_GetResourceDimensionsAlt(), and UiWork_PushValueSlot().
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().
| 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().
| 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().
| void UiWork_FinalizePendingCore | ( | void | ) |
Closes each message channel's window whose text has ended, then waits ten frames.
Definition at line 302 of file messages.c.
Referenced by DebugMenu_BrowseMessageRange(), Event_UsePsynergyStone(), Save_WriteSelectedSlot(), SaveMenu_Run(), SaveState_ConfirmAndProcessSelectedSlot(), SaveState_DeleteSelectedSlot(), SceneDialogue_ShowMessageAndWait(), TolbiSpring_RunSpringGame(), UiText_GetResourceDimensionsAlt(), and UiWork_FinalizePendingCore().
Shows a message centred on the screen (yOffset tiles lower) and waits until it is typed out, then closes it.
With mode 0 the window has no frame or size and opens and closes at once; otherwise it is a zooming window sized to the message.
Definition at line 325 of file messages.c.
Referenced by Event_DoraWakesIsaac(), Event_LeaveAfterRefusing(), Event_MendingTheRoof(), Kalay_WatchTourGroupDeparture(), MercuryLighthouse_Initialize(), MercuryLighthouseEntrance_Initialize(), SaveMenu_Run(), SolSanctumElementalStarRoom_AlexTakesStars(), SolSanctumElementalStarRoom_UnmaskFelix(), TolbiShipDeck_MonsterLandsOnDeck(), TolbiShipDeck_MonstersAttackCrew(), TolbiShipDeck_MonstersBoard(), TolbiShipInteriors_ReportMonstersBelowdecks(), TolbiShipInteriors_TurnBackFromStairs(), UiText_GetResourceDimensionsAlt(), UiText_ShowCenteredMessage(), and VenusLighthouseAerie_PlayShebasFall().
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().
| 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().
| 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().
| 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().
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.
Definition at line 486 of file messages.c.
Referenced by CreateSideObject(), Djinn_ShowJoinedMessage(), Localization_LookupEntryId(), NameEntry_EditOwnerName(), Party_ShowJoinedMessage(), Party_ShowPairJoinedMessage(), Ui_LoadCharacterEntryForSlot(), UiText_GetResourceDimensionsAlt(), UiWindow_CreateWithSideObject(), and UiWork_FinalizeEntityMatchingLocalizedId().
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().
| 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().