window.h
games/tbs/include/window.h on GitHub
Structures
UiRenderWork
struct UiRenderWork
The window system's work: the windows' tilemap, the windows, the three text channels, the 64 render outputs, and the decoded message and its arguments.
| Field | Declared as | |
|---|---|---|
tilemap | u16 tilemap[640] | the windows' BG tilemap, 32 by 20 tiles |
windows | struct UiWindow windows[WINDOW_COUNT] | |
channels | struct UiChannelSlot channels[3] | |
outputs | struct RenderOutput outputs[UI_OUTPUT_COUNT] | |
freeOutputs | struct RenderOutputList freeOutputs | the outputs not in any window |
tileAttributes | u8 tileAttributes[256] | Per text tile (tiles 0x80 to 0xFF, then 0x200 to 0x27F): bit 0 once allocated, bit 1 while the tilemap shows it, 0 when free. The first three hold the bottom frame tiles' lower rows and are 4. |
tileCursor | u16 tileCursor | the text tile the next search for a free one starts at |
alt | u8 alt | 1 lets text use 256 tiles, adding tiles 0x200 to 0x27F |
dirty | u8 dirty | The tilemap's 4-row bands to upload: bit 0 for all, bit n + 1 for band n. |
mode | u8 mode | Set while Mind Read shows thoughts: round frame corners, colour 8 text with no shadow, and latched button presses to dismiss text. |
menuState | u8 menuState | 1 from the work's setup; 2 while a battle message is decoded. While nonzero, typing speeds up with the lag frames shown and the bottom rows of a cleared rectangle keep the battle tile. |
menuBusy | u8 menuBusy | while set, the tilemap is not uploaded |
level | u8 level | text tiles' palette; 15 by default, 14 or 5 for low HP |
lineSpacing | u16 lineSpacing | the current channel's, copied in to draw |
unknownAfterLineSpacing | u16 unknownAfterLineSpacing | set to 1 with the text style; not read |
outline | u16 outline | the current channel's, copied in to draw |
colour | u16 colour | the current channel's, copied in to draw |
entries | u16 entries[RENDER_ENTRY_MASK + 1] | decoded text, a ring of codes |
letterSpacing | u16 letterSpacing | pixels between sprite glyphs; 9 |
count | u16 count | where the next code goes in entries |
messageStart | u16 messageStart | where the last decoded message began in entries |
glyphResource | u16 glyphResource | VRAM cache slot of the page arrow; 99 when none |
glyphTiles | u16 glyphTiles | first sprite tile of the glyph sheet (picture 95) |
unknownBeforeValues | u8 unknownBeforeValues[RENDER_VALUE_TABLE_OFFSET - RENDER_COUNTER_OFFSET - 4] | Not named by TBS code. |
values | u32 values[8] | Message argument values (UiWork_PushValueSlot). A portrait's release writes its palette slot state at RENDER_PALETTE_TABLE_OFFSET, in here. |
names | u16 names[8] | the MSG_ARG_ kind of each value; 0 for a free slot |
resourceIds | u16 resourceIds[2] | picture shown in each portrait slot; 999 when free |
outputIds | u16 outputIds[2] | VRAM cache slot of each portrait slot's picture |
speakerVoiceSound | u16 speakerVoiceSound | first of four voice blip sounds; 0 for none |
speakerVoiceCountdown | u16 speakerVoiceCountdown | characters until the next voice blip |
pageArrowShown | u8 pageArrowShown | 1 while the next-page arrow is shown |
busy | u8 busy | Set while a message waits on its sound: the text ends its pauses and pages once the sound is over. |
spacingBefore | u8 spacingBefore | 1 for halting speech: a pause before each character, broken off with an ellipsis after the first word (UiWork_SetBusyFlags bit 0). |
spacingAfter | u8 spacingAfter | 1 puts code 222 after certain characters in English and Japanese (UiWork_SetBusyFlags bit 1). |
Used by BattleMenu_RunActionSelection, Battle_CollectPartyCommands, Battle_SelectAbility, CreateSideObject, DjinnMenu_ShowHelp, DjinnMenu_ShowOwnerStatus, Djinn_ShowJoinedMessage, ItemList_SelectEntry, ItemMenu_Run, Menu_RunCommandRow, NameEntry_EditOwnerName, OwnerAction_RunCompareLoop, Party_ShowJoinedMessage, Party_ShowPairJoinedMessage, PsynergyMenu_Run, RenderOutput_AcquireFree, RenderOutput_InitFreeList, RenderOutput_ReleaseFree, Render_SetTilemapFlagRect, SaveMenu_FillTileBlock, SaveMenu_FillTileGrid, SaveMenu_Run, SaveMenu_SelectSlot, StatusMenu_Run, SummonMenu_SelectSummon, UiText_ApplyChannelStyle, UiText_CheckPauseSkipped, UiText_CheckTextDismissed, UiText_CopyMessageString, UiText_DrawCharacterAtOffset, UiText_DrawGlyph, UiText_DrawPrefixedNumberAtOffset, UiText_DrawResource, UiText_DrawStringAtOffset, UiText_LookupArgument, UiText_MeasureAllPages, UiText_MeasureEntryDimensions, UiText_OpenEntryMessage, UiText_OpenMessageAtObject, UiText_OpenMessageWindow and 52 more.
Globals, without a comment: offsetof, offsetof, gWindowWork.