Alchemy
Loading...
Searching...
No Matches

window.h

Go to the documentation of this file.
1#ifndef ALCHEMY_WINDOW_H
2#define ALCHEMY_WINDOW_H
3
4/// @file
5/// The window renderer's work.
6
9#include "types.h"
10#include "tbs_edition.h"
11#include "static_assert.h"
12#include "uiflow.h"
13#include "output.h"
14
15enum { UI_OUTPUT_COUNT = 64 };
16
17/// The window system's work: the windows' tilemap, the windows, the three text
18/// channels, the 64 render outputs, and the decoded message and its arguments.
20 u16 tilemap[640]; ///< the windows' BG tilemap, 32 by 20 tiles
24 struct RenderOutputList freeOutputs; ///< the outputs not in any window
25 /// Per text tile (tiles 0x80 to 0xFF, then 0x200 to 0x27F): bit 0 once
26 /// allocated, bit 1 while the tilemap shows it, 0 when free. The first
27 /// three hold the bottom frame tiles' lower rows and are 4.
29 u16 tileCursor; ///< the text tile the next search for a free one starts at
30 u8 alt; ///< 1 lets text use 256 tiles, adding tiles 0x200 to 0x27F
31 /// The tilemap's 4-row bands to upload: bit 0 for all, bit n + 1 for band n.
33 /// Set while Mind Read shows thoughts: round frame corners, colour 8 text
34 /// with no shadow, and latched button presses to dismiss text.
36 /// 1 from the work's setup; 2 while a battle message is decoded. While
37 /// nonzero, typing speeds up with the lag frames shown and the bottom rows
38 /// of a cleared rectangle keep the battle tile.
40 u8 menuBusy; ///< while set, the tilemap is not uploaded
41 u8 level; ///< text tiles' palette; 15 by default, 14 or 5 for low HP
42 u16 lineSpacing; ///< the current channel's, copied in to draw
43 u16 unknownAfterLineSpacing; ///< set to 1 with the text style; not read
44 u16 outline; ///< the current channel's, copied in to draw
45 u16 colour; ///< the current channel's, copied in to draw
46 u16 entries[RENDER_ENTRY_MASK + 1]; ///< decoded text, a ring of codes
47 u16 letterSpacing; ///< pixels between sprite glyphs; 9
48 u16 count; ///< where the next code goes in entries
49 u16 messageStart; ///< where the last decoded message began in entries
50 u16 glyphResource; ///< VRAM cache slot of the page arrow; 99 when none
51 u16 glyphTiles; ///< first sprite tile of the glyph sheet (picture 95)
52 /// Not named by TBS code.
54 /// Message argument values (UiWork_PushValueSlot). A portrait's release
55 /// writes its palette slot state at RENDER_PALETTE_TABLE_OFFSET, in here.
57 u16 names[8]; ///< the MSG_ARG_ kind of each value; 0 for a free slot
58 u16 resourceIds[2]; ///< picture shown in each portrait slot; 999 when free
59 u16 outputIds[2]; ///< VRAM cache slot of each portrait slot's picture
60 u16 speakerVoiceSound; ///< first of four voice blip sounds; 0 for none
61 u16 speakerVoiceCountdown; ///< characters until the next voice blip
62 u8 pageArrowShown; ///< 1 while the next-page arrow is shown
63 /// Set while a message waits on its sound: the text ends its pauses and
64 /// pages once the sound is over.
66 /// 1 for halting speech: a pause before each character, broken off with an
67 /// ellipsis after the first word (UiWork_SetBusyFlags bit 0).
69 /// 1 puts code 222 after certain characters in English and Japanese
70 /// (UiWork_SetBusyFlags bit 1).
72};
73
74STATIC_ASSERT(offsetof(struct UiRenderWork, windows) == 0x500);
78STATIC_ASSERT(offsetof(struct UiRenderWork, freeOutputs.head) ==
80STATIC_ASSERT(offsetof(struct UiRenderWork, freeOutputs.tailLink) ==
82STATIC_ASSERT(offsetof(struct UiRenderWork, tileAttributes) ==
84STATIC_ASSERT(offsetof(struct UiRenderWork, tileCursor) ==
85 (RENDER_ALT_OFFSET - 2));
88STATIC_ASSERT(offsetof(struct UiRenderWork, lineSpacing) ==
94STATIC_ASSERT(offsetof(struct UiRenderWork, messageStart) ==
98STATIC_ASSERT(offsetof(struct UiRenderWork, glyphResource) ==
100STATIC_ASSERT(offsetof(struct UiRenderWork, glyphTiles) ==
105STATIC_ASSERT(offsetof(struct UiRenderWork, resourceIds) ==
109STATIC_ASSERT(offsetof(struct UiRenderWork, speakerVoiceSound) ==
111STATIC_ASSERT(offsetof(struct UiRenderWork, speakerVoiceCountdown) ==
114STATIC_ASSERT(offsetof(struct UiRenderWork, spacingBefore) ==
115 (RENDER_BUSY_OFFSET + 1));
116STATIC_ASSERT(offsetof(struct UiRenderWork, spacingAfter) ==
117 (RENDER_BUSY_OFFSET + 2));
119
120extern u8 *gWindowWork[];
121
122#endif
Declares nothing of its own: it only includes edition.h and render_input.h.
u8 gWindowWork[]
STATIC_ASSERT, a compile-time check that emits nothing.
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
Definition stddef.h:19
A list of render outputs: its first output and the link to append after.
A render output: a sprite in a window's output list (a character, an icon or a portrait),...
A text channel, one of three, which types decoded text into a window a few characters a frame and run...
Definition uiwindow.h:43
The window system's work: the windows' tilemap, the windows, the three text channels,...
Definition window.h:19
struct UiWindow windows[WINDOW_COUNT]
Definition window.h:21
u8 mode
Set while Mind Read shows thoughts: round frame corners, colour 8 text with no shadow,...
Definition window.h:35
u16 speakerVoiceCountdown
characters until the next voice blip
Definition window.h:61
u32 values[8]
Message argument values (UiWork_PushValueSlot).
Definition window.h:56
struct RenderOutput outputs[UI_OUTPUT_COUNT]
Definition window.h:23
u8 spacingBefore
1 for halting speech: a pause before each character, broken off with an ellipsis after the first word...
Definition window.h:68
u16 tilemap[640]
the windows' BG tilemap, 32 by 20 tiles
Definition window.h:20
u16 unknownAfterLineSpacing
set to 1 with the text style; not read
Definition window.h:43
u8 alt
1 lets text use 256 tiles, adding tiles 0x200 to 0x27F
Definition window.h:30
u8 dirty
The tilemap's 4-row bands to upload: bit 0 for all, bit n + 1 for band n.
Definition window.h:32
u8 level
text tiles' palette; 15 by default, 14 or 5 for low HP
Definition window.h:41
u16 entries[RENDER_ENTRY_MASK+1]
decoded text, a ring of codes
Definition window.h:46
u16 speakerVoiceSound
first of four voice blip sounds; 0 for none
Definition window.h:60
u16 tileCursor
the text tile the next search for a free one starts at
Definition window.h:29
struct UiChannelSlot channels[3]
Definition window.h:22
u16 count
where the next code goes in entries
Definition window.h:48
u8 unknownBeforeValues[RENDER_VALUE_TABLE_OFFSET - RENDER_COUNTER_OFFSET - 4]
Not named by TBS code.
Definition window.h:53
u16 glyphResource
VRAM cache slot of the page arrow; 99 when none.
Definition window.h:50
u16 colour
the current channel's, copied in to draw
Definition window.h:45
u16 letterSpacing
pixels between sprite glyphs; 9
Definition window.h:47
u16 outputIds[2]
VRAM cache slot of each portrait slot's picture.
Definition window.h:59
u16 resourceIds[2]
picture shown in each portrait slot; 999 when free
Definition window.h:58
u16 names[8]
the MSG_ARG_ kind of each value; 0 for a free slot
Definition window.h:57
u16 outline
the current channel's, copied in to draw
Definition window.h:44
u8 busy
Set while a message waits on its sound: the text ends its pauses and pages once the sound is over.
Definition window.h:65
u8 tileAttributes[256]
Per text tile (tiles 0x80 to 0xFF, then 0x200 to 0x27F): bit 0 once allocated, bit 1 while the tilema...
Definition window.h:28
u8 menuState
1 from the work's setup; 2 while a battle message is decoded.
Definition window.h:39
u8 spacingAfter
1 puts code 222 after certain characters in English and Japanese (UiWork_SetBusyFlags bit 1).
Definition window.h:71
u8 pageArrowShown
1 while the next-page arrow is shown
Definition window.h:62
u16 glyphTiles
first sprite tile of the glyph sheet (picture 95)
Definition window.h:51
u8 menuBusy
while set, the tilemap is not uploaded
Definition window.h:40
struct RenderOutputList freeOutputs
the outputs not in any window
Definition window.h:24
u16 lineSpacing
the current channel's, copied in to draw
Definition window.h:42
u16 messageStart
where the last decoded message began in entries
Definition window.h:49
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
Definition uiwindow.h:11
Values that differ by patch level or language, chosen once for their code.
#define RENDER_OUTPUT_TABLE_OFFSET
Definition tbs_edition.h:55
#define RENDER_ALT_OFFSET
Definition tbs_edition.h:59
#define RENDER_VALUE_TABLE_OFFSET
Definition tbs_edition.h:52
#define RENDER_SLOT_VALUE_OFFSET
Definition tbs_edition.h:75
#define RENDER_SLOT_ID_OFFSET
Definition tbs_edition.h:74
#define RENDER_FREE_HEAD_OFFSET
Definition tbs_edition.h:64
#define RENDER_WORK_SIZE
Definition tbs_edition.h:72
#define RENDER_TILE_ATTR_OFFSET
Definition tbs_edition.h:63
#define RENDER_FREE_TAIL_OFFSET
Definition tbs_edition.h:65
#define RENDER_RESULT_OFFSET
Definition tbs_edition.h:67
#define RENDER_COUNTER_OFFSET
Definition tbs_edition.h:71
#define RENDER_BUSY_OFFSET
Definition tbs_edition.h:51
#define RENDER_PARAM_OFFSET
Definition tbs_edition.h:62
#define RENDER_DIRTY_OFFSET
Definition tbs_edition.h:49
#define RENDER_WORD_OFFSET
Definition tbs_edition.h:60
#define WINDOW_COUNT
Definition tbs_edition.h:69
#define RENDER_ENTRY_COUNT_OFFSET
Definition tbs_edition.h:66
#define RENDER_ENTRY_TABLE_OFFSET
Definition tbs_edition.h:56
#define RENDER_WORD2_OFFSET
Definition tbs_edition.h:61
#define RENDER_CHANNEL_OFFSET
Definition tbs_edition.h:54
#define RENDER_NAME_TABLE_OFFSET
Definition tbs_edition.h:53
#define RENDER_ENTRY_MASK
Definition tbs_edition.h:68
The integer types, TRUE, UNUSED and the fixed-address macros.
unsigned int u32
Definition types.h:15
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11
Declares nothing of its own: it only includes edition.h and uiwindow.h.
@ UI_OUTPUT_COUNT
Definition window.h:15