Alchemy
Loading...
Searching...
No Matches

text_tiles.c File Reference

Text drawn as tiles, text tile ownership and divider lines. More...

Go to the source code of this file.

Functions

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 remap (0 leaves a pixel as it was).
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, starting x pixels into the first tile, and points tiles (and the same entries in mirror) at them.
void UiWindow_ClearTileAttributesInRect (s32 x, s32 y, u32 width, u32 height)
 Marks the text tiles under a tilemap rectangle (x, y, width and height in tiles) as no longer shown, for reuse.
void UiWindow_MarkVisibleTileAttributes (void)
 Marks the text tiles the tilemap shows, and frees those it no longer shows.
void UiWork_SetAltFlagAndClearTable (s32 allowAlternateTiles)
 Frees every text tile, and with flag set lets text tiles take the second tile range (0x200 to 0x27f) too.
UNUSED void UiRender_ReservedNoOp (void)
 Nothing calls it.
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: its ends join the frame or the lines they meet, and it crosses the lines it passes over.
void UiWork_SetParamNibble (s32 param)
 Sets the text colour (0 to 15) of drawn text.
void UiWork_SetRenderWord (u16 value)
 Sets the text style (UiRenderWork.outline) of drawn text.
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_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.
static __inline__ void UiText_WidenByteString (const u8 *input, u16 *output)
 Copies a zero-terminated byte string into the text renderer's halfwords.
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 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 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_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, y).
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.
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, y) of its interior.
void UiText_DrawPrefixedNumberAtOffset (s32 value, const struct UiWindow *work, s32 offsetX, s32 offsetY, s32 variant)
 Draws a four-digit number after a two-glyph sign (window tiles 0x1d and 0x1e, or 0x1f and 0x1e with variant set) as tiles in window work at pixel (offsetX, offsetY) of its interior.

Detailed Description

Text drawn as tiles, text tile ownership and divider lines.

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

Definition in file text_tiles.c.

Function Documentation

◆ UiWindow_OverlayTilePattern()

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 remap (0 leaves a pixel as it was).

A shared tile first gets a free tile of its own, which entry and mirror then point to. Only nonzero remap entries replace pixels; shared tiles become private before upload. Nothing calls it.

Definition at line 12 of file text_tiles.c.

Referenced by UiWindow_OverlayTilePattern().

◆ UiText_RenderStringTiles()

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, starting x pixels into the first tile, and points tiles (and the same entries in mirror) at them.

Colour codes change the text colour. Returns how many tiles the text covers. The canvas is eight rows of 256 pixels; the pen must stay within each row.

Definition at line 82 of file text_tiles.c.

Referenced by UiText_DrawCharacterAtOffset(), UiText_DrawPrefixedNumberAtOffset(), UiText_DrawStringAtOffset(), UiText_RenderGlyphTileAtWorkOffset(), and UiText_RenderStringTiles().

◆ UiWindow_ClearTileAttributesInRect()

void UiWindow_ClearTileAttributesInRect ( s32 x,
s32 y,
u32 width,
u32 height )

Marks the text tiles under a tilemap rectangle (x, y, width and height in tiles) as no longer shown, for reuse.

Only the dynamic text-tile ranges have allocation attributes to clear.

Definition at line 276 of file text_tiles.c.

Referenced by UiWindow_ClearInteriorTiles(), UiWindow_ClearTileAttributesInRect(), UiWindow_DrawDividerLine(), UiWindow_DrawFrame(), and UiWindow_EraseBorderRect().

◆ UiWindow_MarkVisibleTileAttributes()

void UiWindow_MarkVisibleTileAttributes ( void )

Marks the text tiles the tilemap shows, and frees those it no longer shows.

Definition at line 299 of file text_tiles.c.

Referenced by Battle_CollectPartyCommands(), Battle_SelectAbility(), Ui_RunOwnerStatusScreen(), and UiWindow_MarkVisibleTileAttributes().

◆ UiWork_SetAltFlagAndClearTable()

void UiWork_SetAltFlagAndClearTable ( s32 allowAlternateTiles)

Frees every text tile, and with flag set lets text tiles take the second tile range (0x200 to 0x27f) too.

The second range extends text capacity from 128 to 256 tiles.

Definition at line 329 of file text_tiles.c.

Referenced by Battle_SelectAbility(), and UiWork_SetAltFlagAndClearTable().

◆ UiRender_ReservedNoOp()

UNUSED void UiRender_ReservedNoOp ( void )

Nothing calls it.

Definition at line 360 of file text_tiles.c.

Referenced by UiRender_ReservedNoOp().

◆ UiWindow_DrawDividerLine()

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: its ends join the frame or the lines they meet, and it crosses the lines it passes over.

Definition at line 365 of file text_tiles.c.

Referenced by Debug_SelectAbilityPair(), Djinn_ShowJoinedMessage(), DjinnMenu_ShowChangePreview(), NameEntry_EditOwnerName(), OptionMenu_Open(), Party_ShowJoinedMessage(), Party_ShowPairJoinedMessage(), SaveMenu_DrawFileSummary(), SaveMenu_Run(), SaveMenu_SelectSlot(), SystemMenu_Open(), Ui_RunOwnerStatusScreen(), and UiWindow_DrawDividerLine().

◆ UiWork_SetParamNibble()

◆ UiWork_SetRenderWord()

void UiWork_SetRenderWord ( u16 value)

Sets the text style (UiRenderWork.outline) of drawn text.

Definition at line 531 of file text_tiles.c.

Referenced by UiWork_SetRenderWord().

◆ UiText_DrawResource()

void UiText_DrawResource ( s32 message,
struct UiWindow * window,
s32 x,
s32 y )

◆ UiText_DrawCharacterAtOffset()

◆ UiText_WidenByteString()

__inline__ void UiText_WidenByteString ( const u8 * input,
u16 * output )
static

Copies a zero-terminated byte string into the text renderer's halfwords.

The destination needs one halfword per input byte, including the terminator.

Definition at line 585 of file text_tiles.c.

Referenced by UiText_DrawString(), UiText_DrawStringAtOffset(), UiText_DrawStringInWindow(), and UiText_WidenByteString().

◆ UiText_DrawString()

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

The 256-halfword scratch requires at most 255 input bytes before the terminator.

Definition at line 599 of file text_tiles.c.

Referenced by Menu_DrawSelectionRow(), SaveMenu_Run(), SaveMenu_SelectSlot(), UiText_DrawNumber(), UiText_DrawPaddedLabel(), and UiText_DrawString().

◆ UiText_DrawStringAtOffset()

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.

The conversion scratch has the same 255-byte input limit as UiText_DrawString.

Definition at line 614 of file text_tiles.c.

Referenced by BattleTarget_RunSelection(), ItemLevel_RunLevelEditor(), PartyStatusDraw(), SaveMenu_DrawFileSummary(), Ui_RunOwnerStatusScreen(), UiText_DrawNumberAtOffset(), and UiText_DrawStringAtOffset().

◆ UiText_DrawStringInWindow()

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.

Bytes widen to character codes; pixel coordinates round down to tile coordinates.

Definition at line 646 of file text_tiles.c.

Referenced by DebugMenu_BrowseIcons(), DebugMenu_SelectItem(), ItemLevel_RunLevelEditor(), ItemLevel_SelectAbility(), ItemLevel_SelectItem(), ItemLevel_ShowGlyphCaptions(), Menu_DrawFlagBitTable(), NameEntry_EditOwnerName(), SaveMenu_DrawFileSummary(), UiText_DrawNumberInWindow(), and UiText_DrawStringInWindow().

◆ UiText_DrawNumber()

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

Definition at line 658 of file text_tiles.c.

Referenced by LinkLobby_ChooseDebugPartyPreset(), Menu_DrawSelectionRow(), and UiText_DrawNumber().

◆ UiText_DrawNumberAtOffset()

void UiText_DrawNumberAtOffset ( s32 value,
s32 width,
const struct UiWindow * window,
s32 x,
s32 y )

◆ UiText_DrawNumberInWindow()

void UiText_DrawNumberInWindow ( s32 value,
s32 width,
struct UiWindow * window,
s32 x,
s32 y )

◆ UiText_DrawPrefixedNumberAtOffset()

void UiText_DrawPrefixedNumberAtOffset ( s32 value,
const struct UiWindow * work,
s32 offsetX,
s32 offsetY,
s32 variant )

Draws a four-digit number after a two-glyph sign (window tiles 0x1d and 0x1e, or 0x1f and 0x1e with variant set) as tiles in window work at pixel (offsetX, offsetY) of its interior.

Definition at line 689 of file text_tiles.c.

Referenced by PartyStatusDraw(), and UiText_DrawPrefixedNumberAtOffset().