src/window/window_text_tiles.c
Text drawn as tilemap tiles of its own (the menus' labels, names and numbers), the text tiles taken and freed, divider lines, and the functions that draw a message, string or number into a window. More…
Included by window.c.
Macros
| Name | Description | |
|---|---|---|
#define | TEXT_TILE_TAKEN 1 | A text tile's bits in WIN_STATE.textTileState; 0 is free. |
#define | TEXT_TILE_SHOWN 2 | seen on the tilemap by mnWindowMarkVisibleTextTiles |
#define | TEXT_TILE_STATE_INDEX (tile) (((tile) & 0xFF) ^ TEXT_TILE_FIRST) | A text tile's place in WIN_STATE.textTileState: the TEXT_TILES tiles from TEXT_TILE_FIRST take the first places, those from TEXT_EXTRA_TILE_FIRST the next TEXT_TILES. |
#define | TILE_TEXT_CANVAS_WIDTH 256 | Tile text is drawn into a canvas of one byte a pixel, a tile tall, then packed into 4bpp tiles in place: row row of its tile tile is then a word of eight pixels. |
#define | TILE_TEXT_CANVAS_SIZE (TILE_TEXT_CANVAS_WIDTH * 8) | |
#define | TILE_TEXT_PACKED_ROW (tile, row) | |
#define | TILE_TEXT_NEWLINE_WIDTH JAPANESE_OR(8, FontGlyphWidths[0]) | A new line in tile text advances by a space's width: tile text is one line. |
#define | TILE_TEXT_NARROW_LAST 128 | In Japanese, the codes above TILE_TEXT_NARROW_LAST (the kana) are a whole tile wide; a kana's mark is drawn from a tile glyph of its own, TILE_TEXT_MARK_GLYPH for the voiced mark and the one after it for the semi-voiced, three pixels wide and three pixels back over its kana. |
#define | TILE_TEXT_MARK_GLYPH 254 | |
#define | TILE_TEXT_MARK_WIDTH 3 | |
#define | TEXT_IS_NARROW_TILE (code) |
Functions
| Name | Description | |
|---|---|---|
void | mnWindowOverlayTilePattern (Uint16 *entry, Uint16 *mirror, Sint32 pattern, Uint8 *remap) | Unused: draws window tile pattern over the tile of tilemap entry *entry, its colors mapped through remap (0 leaves a pixel as it was), first giving the entry (and the same entry in mirror, the tilemap in VRAM) a text tile of its own. |
Sint32 | mnTextDrawStringAsTiles (Uint16 *text, Uint16 *tiles, Uint16 *mirror, Sint32 x) | Draws a string of 16-bit character codes with the window font into text tiles of its own, starting x pixels into the first tile, points the tilemap entries at tiles (and the same entries in mirror, the tilemap in VRAM) at them, and returns how many tiles it covers. |
void | mnWindowClearTextTilesInRect (Sint32 x, Sint32 y, Uint32 width, Uint32 height) | Frees the text tiles under a tilemap rectangle (x, y, width and height in tiles) for reuse: their taken and shown bits are cleared. |
void | mnWindowMarkVisibleTextTiles (void) | Marks the text tiles the tilemap shows, and frees those it no longer shows: a tile taken but not marked shown (its state exactly TEXT_TILE_TAKEN). |
void | mnTextUseExtraTiles (Sint32 allow) | Frees the text tiles of the second range (the TEXT_TILES tiles from TEXT_EXTRA_TILE_FIRST), and with allow set lets text take that range too; the first range's tiles keep their state. |
void | mnWindowReservedNoOperation (void) | Unused: an empty function between the text tiles and the dividers. |
void | mnWindowDrawDividerLine ( WINDOW *window, Uint32 x1, Uint32 y1, Uint32 x2, Uint32 y2) | Draws a divider from tile (x1, y1) to (x2, y2) of a window, along a row or a column, joining it to the border and the dividers already on the tilemap with tees and crosses, and frees the text tiles under it. |
void | mnTextSetColor (Sint32 color) | Sets the color (TEXT_COL) of the text drawn after it. |
void | mnTextSetStyle (Sint32 style) | Sets the style (TXT_STYLE) of the text drawn after it: outlined, or a motion of the glyph sprites. |
void | mnTextDrawMessage (Sint32 msg, Sint32 window, Sint32 x, Sint32 y) | Decodes a message and draws it into a text canvas window at pixel (x, y), all at once. |
void | mnTextDrawMessageAsTiles (Sint32 msg, WINDOW *window, Uint32 offsetX, Uint32 offsetY) | Decodes a message and draws it as tiles in a window at pixel (offsetX, offsetY) of its interior. offsetY is rounded down to a tile row; offsetX picks the tile, and its remainder is where the text starts in it. |
static __inline__ void | mnTextWidenByteString (const Uint8 *input, Uint16 *output) | Copies a zero-terminated byte string into the halfwords the text drawers take. |
void | mnTextDrawString (Uint8 *text, Sint32 window, Sint32 x, Sint32 y) | Draws a byte string into a text canvas window at pixel (x, y). |
void | mnTextDrawStringAtOffset (Uint8 *text, WINDOW *window, Sint32 offsetX, Sint32 offsetY) | Draws a byte string as tiles in window at pixel (offsetX, offsetY) of its interior. |
void | mnTextDrawStringInWindow (Uint8 *text, Sint32 window, Uint32 x, Uint32 y) | Draws a byte string into a window's tilemap at pixel (x, y) of its interior, rounded down to tiles. |
void | mnTextDrawNumber ( Sint32 value, Sint32 width, Sint32 window, Sint32 x, Sint32 y) | Draws a number (width as mnStringFormatNumber) into a text canvas window at pixel (x, y). |
void | mnTextDrawNumberAtOffset ( Sint32 value, Sint32 width, WINDOW *window, Sint32 x, Sint32 y) | Draws a number (width as mnStringFormatNumber) as tiles in a window at pixel (x, y) of its interior. |
void | mnTextDrawNumberInWindow ( Sint32 value, Sint32 width, Sint32 window, Sint32 x, Sint32 y) | Draws a number (width as mnStringFormatNumber) into a window's tilemap at pixel (x, y) of its interior. |
void | mnTextDrawPrefixedNumberAtOffset ( Sint32 value, WINDOW *window, Sint32 offsetX, Sint32 offsetY, Sint32 label) | Draws a four-digit number after a two-tile label as tiles in window at pixel (offsetX, offsetY): the HP label for NUMBER_LABEL_HP, the party status window's HP; the PP label for NUMBER_LABEL_PP, its PP. |
Variables
| Name | Description | |
|---|---|---|
extern const Uint8 | FontColorPens [] | The window palette's color for each text color (TEXT_COL), in text_tables.c. |
Description
Text drawn as tilemap tiles of its own (the menus' labels, names and
numbers), the text tiles taken and freed, divider lines, and the functions
that draw a message, string or number into a window. Part of window.c.
Macros in detail
TEXT_TILE_TAKEN
#define TEXT_TILE_TAKEN 1
A text tile's bits in WIN_STATE.textTileState; 0 is free.
taken by some text
Referenced by mnTextDrawStringAsTiles(), mnWindowClearTextTilesInRect(), mnWindowMarkVisibleTextTiles() and mnWindowOverlayTilePattern().
Definition at line 6 of file window_text_tiles.c.
TEXT_TILE_SHOWN
#define TEXT_TILE_SHOWN 2
seen on the tilemap by mnWindowMarkVisibleTextTiles
Referenced by mnWindowClearTextTilesInRect() and mnWindowMarkVisibleTextTiles().
Definition at line 7 of file window_text_tiles.c.
TEXT_TILE_STATE_INDEX
#define TEXT_TILE_STATE_INDEX(tile) (((tile) & 0xFF) ^ TEXT_TILE_FIRST)
A text tile's place in WIN_STATE.textTileState: the TEXT_TILES tiles from
TEXT_TILE_FIRST take the first places, those from TEXT_EXTRA_TILE_FIRST the
next TEXT_TILES.
Referenced by mnWindowClearTextTilesInRect() and mnWindowMarkVisibleTextTiles().
Definition at line 11 of file window_text_tiles.c.
TILE_TEXT_CANVAS_WIDTH
#define TILE_TEXT_CANVAS_WIDTH 256
Tile text is drawn into a canvas of one byte a pixel, a tile tall, then
packed into 4bpp tiles in place: row row of its tile tile is then a word
of eight pixels.
Referenced by mnTextDrawStringAsTiles().
Definition at line 16 of file window_text_tiles.c.
TILE_TEXT_CANVAS_SIZE
#define TILE_TEXT_CANVAS_SIZE (TILE_TEXT_CANVAS_WIDTH * 8)
Referenced by mnTextDrawStringAsTiles().
Definition at line 17 of file window_text_tiles.c.
TILE_TEXT_PACKED_ROW
#define TILE_TEXT_PACKED_ROW(tile, row)
Referenced by mnTextDrawStringAsTiles().
Definition at line 18 of file window_text_tiles.c.
TILE_TEXT_NEWLINE_WIDTH
#define TILE_TEXT_NEWLINE_WIDTH JAPANESE_OR(8, FontGlyphWidths[0])
A new line in tile text advances by a space's width: tile text is one line.
Referenced by mnTextDrawStringAsTiles().
Definition at line 109 of file window_text_tiles.c.
TILE_TEXT_NARROW_LAST
#define TILE_TEXT_NARROW_LAST 128
In Japanese, the codes above TILE_TEXT_NARROW_LAST (the kana) are a whole
tile wide; a kana's mark is drawn from a tile glyph of its own,
TILE_TEXT_MARK_GLYPH for the voiced mark and the one after it for the
semi-voiced, three pixels wide and three pixels back over its kana.
Referenced by mnTextDrawStringAsTiles().
Definition at line 115 of file window_text_tiles.c.
TILE_TEXT_MARK_GLYPH
#define TILE_TEXT_MARK_GLYPH 254
Referenced by mnTextDrawStringAsTiles().
Definition at line 116 of file window_text_tiles.c.
TILE_TEXT_MARK_WIDTH
#define TILE_TEXT_MARK_WIDTH 3
Referenced by mnTextDrawStringAsTiles().
Definition at line 117 of file window_text_tiles.c.
TEXT_IS_NARROW_TILE
#define TEXT_IS_NARROW_TILE(code)
#define TEXT_IS_NARROW_TILE(code) ((code) == WINDOW_TILE_HP_LABEL_END)
Referenced by mnTextDrawStringAsTiles().
Definition at lines 123 and 127 of file window_text_tiles.c.
Functions in detail
mnWindowOverlayTilePattern
void mnWindowOverlayTilePattern(Uint16 *entry, Uint16 *mirror, Sint32 pattern, Uint8 *remap)
Unused: draws window tile pattern over the tile of tilemap entry *entry, its
colors mapped through remap (0 leaves a pixel as it was), first giving the
entry (and the same entry in mirror, the tilemap in VRAM) a text tile of its
own.
References Sint32, syDMAXCopy() and syResourceGetTableEntry().
Definition at line 25 of file window_text_tiles.c.
mnTextDrawStringAsTiles
Sint32 mnTextDrawStringAsTiles(Uint16 *text, Uint16 *tiles, Uint16 *mirror, Sint32 x)
Draws a string of 16-bit character codes with the window font into text tiles
of its own, starting x pixels into the first tile, points the tilemap entries
at tiles (and the same entries in mirror, the tilemap in VRAM) at them, and
returns how many tiles it covers.
References FontColorPens, FontGlyphWidths, Sint32, syHeapAllocate(), syHeapRelease(), syResourceGetTableEntry(), syWordsClear() and syWordsFill().
Referenced by mnTextDrawMessageAsTiles(), mnTextDrawPrefixedNumberAtOffset(), mnTextDrawStringAtOffset() and mnTextDrawWideStringAsTiles().
Definition at line 134 of file window_text_tiles.c.
mnWindowClearTextTilesInRect
void mnWindowClearTextTilesInRect(Sint32 x, Sint32 y, Uint32 width, Uint32 height)
Frees the text tiles under a tilemap rectangle (x, y, width and height in tiles) for reuse: their taken and shown bits are cleared.
References Sint32.
Referenced by mnWindowClearInteriorTiles(), mnWindowDrawBorder(), mnWindowDrawDividerLine(), mnWindowDrawFlashBorder() and mnWindowEraseBorderRect().
Definition at line 360 of file window_text_tiles.c.
mnWindowMarkVisibleTextTiles
void mnWindowMarkVisibleTextTiles(void)
Marks the text tiles the tilemap shows, and frees those it no longer shows: a
tile taken but not marked shown (its state exactly TEXT_TILE_TAKEN).
References Sint32.
Referenced by mnBattleCollectPartyCommands(), mnBattleDjinnMenuRun() and mnBattleStatusScreenRun().
Definition at line 394 of file window_text_tiles.c.
mnTextUseExtraTiles
void mnTextUseExtraTiles(Sint32 allow)
Frees the text tiles of the second range (the TEXT_TILES tiles from
TEXT_EXTRA_TILE_FIRST), and with allow set lets text take that range too; the
first range's tiles keep their state.
References Sint32.
Referenced by mnBattleDjinnMenuRun().
Definition at line 438 of file window_text_tiles.c.
mnWindowReservedNoOperation
void mnWindowReservedNoOperation(void)
Unused: an empty function between the text tiles and the dividers.
Definition at line 458 of file window_text_tiles.c.
mnWindowDrawDividerLine
void mnWindowDrawDividerLine( WINDOW *window, Uint32 x1, Uint32 y1, Uint32 x2, Uint32 y2)
Draws a divider from tile (x1, y1) to (x2, y2) of a window, along a row or a column, joining it to the border and the dividers already on the tilemap with tees and crosses, and frees the text tiles under it.
References mnWindowClearTextTilesInRect().
Referenced by mnBattleDjinnMenuShowChangePreview(), mnBattleStatusScreenRun(), mnDebugMenuOpen(), mnDebugShortcutOpen(), mnDebugSoundTestRun(), mnDebugWarpOpen(), mnDjinnShowJoinedMessage(), mnFileListDrawSummary(), mnFileListSelectFile(), mnNameEntryEditMemberName(), mnPartyShowJoinedMessage(), mnPartyShowPairJoinedMessage(), mnPauseMenuOpen(), mnSettingsMenuOpen() and scClearEnterPassword().
Definition at line 465 of file window_text_tiles.c.
mnTextSetColor
void mnTextSetColor(Sint32 color)
Sets the color (TEXT_COL) of the text drawn after it. The menus color the HP
figures with it, and set TEXT_COLOR_WHITE back after.
References Sint32.
Referenced by mnBattleCollectPartyCommands(), mnBattleDjinnMenuRun(), mnBattleDjinnMenuShowChangePreview(), mnBattleItemMenuRun(), mnBattlePsynergyMenuRun(), mnBattleStatusScreenRun(), mnBattleSummonMenuRun(), mnBattleTargetRunSelection() and mnPartyStatusDraw().
Definition at line 631 of file window_text_tiles.c.
mnTextSetStyle
void mnTextSetStyle(Sint32 style)
Sets the style (TXT_STYLE) of the text drawn after it: outlined, or a motion
of the glyph sprites. Other code reaches it only through the window stub
table.
References Sint32.
Definition at line 641 of file window_text_tiles.c.
mnTextDrawMessage
void mnTextDrawMessage(Sint32 msg, Sint32 window, Sint32 x, Sint32 y)
Decodes a message and draws it into a text canvas window at pixel (x, y), all at once.
References mnMessageDecode(), mnTextDrawWideStringAtOffset() and Sint32.
Referenced by dbIncreaseItemAndLevelRunLevelEditor(), dbIncreaseItemAndLevelSelectItem(), dbShopTestRunLevelEditor(), dbShopTestSelectItem(), mnAreaNameWindowShow(), mnDebugMenuOpen(), mnDebugSceneSelectDrawRow(), mnFileListSelectFile(), mnIconMenuChooseSendOption(), mnPauseMenuOpen(), mnSaveProgressOpen(), mnSettingsMenuRun(), mnTransferMethodMenuDrawHelp() and scClearReceiveByLink().
Definition at line 650 of file window_text_tiles.c.
mnTextDrawMessageAsTiles
void mnTextDrawMessageAsTiles(Sint32 msg, WINDOW *window, Uint32 offsetX, Uint32 offsetY)
Decodes a message and draws it as tiles in a window at pixel (offsetX, offsetY) of its interior. offsetY is rounded down to a tile row; offsetX picks the tile, and its remainder is where the text starts in it.
References mnMessageDecode(), mnTextDrawStringAsTiles() and Sint32.
Referenced by dbIncreaseItemAndLevelSelectItem(), dbShopTestSelectItem(), mnBattleCollectPartyCommands(), mnBattleCommandRowRun(), mnBattleDjinnMenuRun(), mnBattleDjinnMenuShowChangePreview(), mnBattleItemMenuRun(), mnBattlePsynergyMenuRun(), mnBattleStatusScreenRun(), mnBattleSummonMenuRun(), mnBattleTargetRunSelection(), mnDebugBrowserPortraits(), mnDebugShortcutDrawAbility(), mnFileListDrawSummary(), mnIconMenuAnimateTo(), mnIconMenuRun(), mnPasswordLevelMenuDrawContents(), mnSelectionMenuOpenNameWindow(), mnSettingsMenuOpen(), mnSettingsMenuRun(), scClearEnterPassword() and scLemuriaSpringRunSpringGame().
Definition at line 664 of file window_text_tiles.c.
mnTextWidenByteString
static __inline__ void mnTextWidenByteString(const Uint8 *input, Uint16 *output)
Copies a zero-terminated byte string into the halfwords the text drawers take. The destination needs one halfword per input byte, including the terminator.
Referenced by mnTextDrawString(), mnTextDrawStringAtOffset() and mnTextDrawStringInWindow().
Definition at line 702 of file window_text_tiles.c.
mnTextDrawString
void mnTextDrawString(Uint8 *text, Sint32 window, Sint32 x, Sint32 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.
References mnTextDrawWideStringAtOffset(), mnTextWidenByteString(), Sint32, syHeapAllocateEWRAM() and syHeapRelease().
Referenced by mnDebugSceneSelectDrawRow(), mnFileListSelectFile(), mnNameEntryDrawName() and mnTextDrawNumber().
Definition at line 715 of file window_text_tiles.c.
mnTextDrawStringAtOffset
void mnTextDrawStringAtOffset(Uint8 *text, WINDOW *window, Sint32 offsetX, Sint32 offsetY)
Draws a byte string as tiles in window at pixel (offsetX, offsetY) of its interior.
References mnTextDrawStringAsTiles(), mnTextWidenByteString(), Sint32, syHeapAllocateEWRAM() and syHeapRelease().
Referenced by dbIncreaseItemAndLevelRunLevelEditor(), dbShopTestRunLevelEditor(), mnBattleStatusScreenRun(), mnBattleTargetRunSelection(), mnFileListDrawSummary(), mnLinkCreateCountdownLabelWindow(), mnPartyStatusDraw() and mnTextDrawNumberAtOffset().
Definition at line 726 of file window_text_tiles.c.
mnTextDrawStringInWindow
void mnTextDrawStringInWindow(Uint8 *text, Sint32 window, Uint32 x, Uint32 y)
Draws a byte string into a window's tilemap at pixel (x, y) of its interior, rounded down to tiles.
References mnTextDrawWideStringInWindow(), mnTextWidenByteString(), Sint32, syHeapAllocateEWRAM() and syHeapRelease().
Referenced by dbIncreaseItemAndLevelRunLevelEditor(), dbIncreaseItemAndLevelSelectItem(), dbShopTestRunLevelEditor(), dbShopTestSelectItem(), mnDebugBrowserIcons(), mnDebugFlagEditorDrawTable(), mnDebugShortcutDrawAbility(), mnDebugSoundTestRun(), mnDebugWarpOpen(), mnFileListDrawSummary(), mnNameEntryEditMemberName() and mnTextDrawNumberInWindow().
Definition at line 767 of file window_text_tiles.c.
mnTextDrawNumber
void mnTextDrawNumber( Sint32 value, Sint32 width, Sint32 window, Sint32 x, Sint32 y)
Draws a number (width as mnStringFormatNumber) into a text canvas window at
pixel (x, y).
References mnStringFormatNumber(), mnTextDrawString() and Sint32.
Referenced by mnDebugSceneSelectDrawRow(), scLinkLobbyChooseDebugParamSet() and scLinkLobbyTakeSongRequest().
Definition at line 780 of file window_text_tiles.c.
mnTextDrawNumberAtOffset
void mnTextDrawNumberAtOffset( Sint32 value, Sint32 width, WINDOW *window, Sint32 x, Sint32 y)
Draws a number (width as mnStringFormatNumber) as tiles in a window at pixel
(x, y) of its interior.
References mnStringFormatNumber(), mnTextDrawStringAtOffset() and Sint32.
Referenced by dbIncreaseItemAndLevelSelectItem(), dbShopTestSelectItem(), mnBattleCollectPartyCommands(), mnBattleDjinnMenuRun(), mnBattlePsynergyMenuRun(), mnBattleStatusScreenRun(), mnFileListDrawDjinnCounts() and mnFileListDrawSummary().
Definition at line 791 of file window_text_tiles.c.
mnTextDrawNumberInWindow
void mnTextDrawNumberInWindow( Sint32 value, Sint32 width, Sint32 window, Sint32 x, Sint32 y)
Draws a number (width as mnStringFormatNumber) into a window's tilemap at
pixel (x, y) of its interior.
References mnStringFormatNumber(), mnTextDrawStringInWindow() and Sint32.
Referenced by dbIncreaseItemAndLevelRunLevelEditor(), dbShopTestRunLevelEditor(), mnBattleDjinnMenuShowChangePreview(), mnBattleMenuUpdateEachTick(), mnBattleStatusScreenRun(), mnBattleTargetRunSelection(), mnDebugBrowserIcons(), mnDebugBrowserPortraits(), mnDebugSoundTestRun(), mnFileListDrawSummary() and scLemuriaSpringRunSpringGame().
Definition at line 802 of file window_text_tiles.c.
mnTextDrawPrefixedNumberAtOffset
void mnTextDrawPrefixedNumberAtOffset( Sint32 value, WINDOW *window, Sint32 offsetX, Sint32 offsetY, Sint32 label)
Draws a four-digit number after a two-tile label as tiles in window at pixel
(offsetX, offsetY): the HP label for NUMBER_LABEL_HP, the party status
window's HP; the PP label for NUMBER_LABEL_PP, its PP.
References mnStringFormatNumber(), mnTextDrawStringAsTiles() and Sint32.
Referenced by mnPartyStatusDraw().
Definition at line 820 of file window_text_tiles.c.