11#define PARTY_STATUS_PUT_DIGIT(window, glyph, x, y) \
12 UiWindow_PutGlyph(window, glyph, x, y, 0)
14#define PARTY_STATUS_PUT_DIGIT(window, glyph, x, y) \
15 UiWindow_PutGlyph(window, glyph, x, y)
22#define PARTY_STATUS_SHOW_PP 1
23#define PARTY_STATUS_SHOW_DJINN 2
24#define PARTY_STATUS_CLOSED 9
25#define PARTY_STATUS_KEEP_FLAGS -1
26#define PARTY_STATUS_COLUMN_WIDTH 6
27#define PARTY_STATUS_DJINN_WIDTH 5
30#define PARTY_STATUS_BLOCK 16
34#define TILE_ROW_FROM_BOTTOM(tile, up) \
35 ((u32 *)((tile) * 32 - (up) * 4 + 0x0600001c))
78 layout->
width = width;
80 layout->
flags = flags;
126 if (column < lastColumn) {
127 for (row = 0; row != rows; row++) {
128 cell = (
u16 *)(((window->
y + row) * 32 + (window->
x + column)) * 2 +
132 else if (row == rows - 1)
141 cell = work->
tilemap + (window->
y + window->
height - 1) * 32 + window->
x;
144 while (column < lastColumn) {
170 s32 fullLength = length;
186 for (i = 0; i < 5; i++, x++) {
188 tile = work->
tilemap[y * 32 + x];
199 }
else if (length > 0) {
201 }
else if (length >= 0) {
204 bar |= 0x88888888U >> (32 - length * 4);
205 shadow <<= length * 4;
206 shadow |= 0xddddddddU >> (32 - length * 4);
208 for (row = 0; row <= (fullLength != 0 ? 2 : 0); row++) {
211 for (column = 0; column <= 7; column++) {
215 recoloured |= bar & (15U << (column * 4));
217 recoloured |= shadow & (15U << (column * 4));
219 recoloured |=
colour << (column * 4);
260 for (i = 0; i <
count; i++) {
262 if (members[i] == 255)
267 for (i = 0; i <
count; i++)
274 flags = layout->
flags;
287 if (layout->
flags == flags) {
296 window->
x = layout->
x;
304 for (i = 0; i !=
count; i++) {
326 if (unit->
maxHp != 0) {
329 barLength = ((current * 40) / unit->
maxHp);
330 if (barLength == 0 && current != 0)
342 if (unit->
maxPp != 0) {
344 barLength = ((current * 40) / unit->
maxPp);
345 if (barLength == 0 && current != 0)
406 if (x + width > 29) {
413 if (y + height > 29) {
416 if (width > 0 && height > 0) {
422 s32 remaining = width;
423 while (remaining != 0) {
433 }
while (height != 0);
438#undef PARTY_STATUS_PUT_DIGIT
What every part of the menu object shares: its includes, edition values, macros and the link round st...
@ SUMMON_ELEMENT_TILE
Element icon.
struct BattleWork * gBattleWork
static __inline__ void Dma_Set(const volatile void *source, volatile void *destination, u32 control, volatile u32 *channel)
Starts a DMA transfer: stores the source, destination and control words into channel's registers with...
s32 BattleParty_PrepareActiveOwnersFar(u16 *owners)
s32 BattleParty_CountStandbyDjinnFar(u32 unitId, u8 *counts)
struct BattleUnit * UnitGetFar(u32 owner)
s32 Party_CountActiveOwnersFar(void)
void UiWindow_DrawFrame(s32 x, s32 y, u32 width, u32 height)
Draws an empty window: a frame around a filled interior, at tile (x, y) of width by height tiles.
struct GameState gGameState
const s8 gUiWindow_PartyColumnOffsets[]
void * Runtime_AllocateBlock(s32 kind, s32 size)
As Runtime_AllocateHeapBlock, but tries EWRAM first, for blocks that need room more than speed: the b...
#define WORK_SLOT(n)
Reads slots through their own addresses; adjacent slots are reached by offsets.
#define BG_PLTT_COLOR(palette, color)
s32 Palette_GetBasicObjColors(void)
void Runtime_ReleaseHeapBlock(s32 slot)
void UiWindow_SetTileAttributeBitRect(const struct UiWindow *window, s32 x, s32 y, s32 width, s32 height, u32 set)
Sets (set 1) or clears (0) bit 12 of the tilemap entries of the width x height tile rectangle at (x,...
void UiWindow_BuildLayoutBounds(s32 flags)
Works out where the party status window goes for flags: one column per party member (those in battle ...
#define PARTY_STATUS_KEEP_FLAGS
redraw with the flags it has
s32 UiWindow_DrawStatusBarTiles(struct UiWindow *window, s32 x, s32 y, s32 length)
void UiWindow_CreateWithLayoutBounds(s32 flags)
Opens the party status window with flags (see PARTY_STATUS_*) in a new heap block and draws it.
#define PARTY_STATUS_CLOSED
erase the window
#define PARTY_STATUS_PUT_DIGIT(window, glyph, x, y)
void PartyStatusDraw(s32 flags)
Draws the party status window with flags (see PARTY_STATUS_*): each member's name,...
#define PARTY_STATUS_COLUMN_WIDTH
#define PARTY_STATUS_SHOW_DJINN
add the Djinn column (needs the PP row)
#define TILE_ROW_FROM_BOTTOM(tile, up)
The address of pixel row 7 - up of BG tile tile (4bpp, 32 bytes a tile, 4 bytes a row): the status ba...
void PartyStatus_Close(void)
Closes the party status window and frees its heap block.
#define PARTY_STATUS_DJINN_WIDTH
#define PARTY_STATUS_SHOW_PP
add the PP row
#define PARTY_STATUS_BLOCK
The heap block the party status window's layout lives in.
void UiWindow_DrawColumnBorders(struct UiWindow *window, u32 flags)
Draws the vertical lines between the members' columns of the party status window, with their top and ...
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
s16 maxPp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
u8 name[0x0f]
The name, one byte a character, ending in 0.
s16 hp
current HP, 0 when downed
s16 maxHp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
The battle's own work: its enemies, units and their objects, the turn's actions, the spoils,...
s16 partyUnits[7]
ends with BATTLE_UNIT_LIST_END
u8 activeOwners[8]
the party in order
The party status window's layout: its window, its place and size, and what it shows (PARTY_STATUS_ fl...
u16 flags
PARTY_STATUS_ flags.
The window system's work: the windows' tilemap, the windows, the three text channels,...
u16 tilemap[640]
the windows' BG tilemap, 32 by 20 tiles
u8 dirty
The tilemap's 4-row bands to upload: bit 0 for all, bit n + 1 for band n.
u8 level
text tiles' palette; 15 by default, 14 or 5 for low HP
u16 count
where the next code goes in entries
u16 colour
the current channel's, copied in to draw
u8 menuState
1 from the work's setup; 2 while a battle message is decoded.
u8 menuBusy
while set, the tilemap is not uploaded
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
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 v...
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 UiWork_SetParamNibble(s32 param)
Sets the text colour (0 to 15) of drawn text.
#define DMA_COPY16(count)
The DMA control word that copies count halfwords.
@ UI_TILE_BATTLE_FRAME_BOTTOM_LEFT
In battle, the bottom frame tiles' lower rows, which UiWork_Initialize copies to tiles 128 to 130.
@ UI_TILE_FRAME_BOTTOM_TEE
the bottom edge meeting a line
@ UI_TILE_BATTLE_FRAME_BOTTOM
@ UI_TILE_BATTLE_FRAME_BOTTOM_RIGHT
@ UI_TILE_FRAME_TOP_TEE
the top edge meeting a line
@ UI_TILE_DIVIDER_VERTICAL
void UiWindow_SetTilemapEntry(struct UiWindow *window, s32 value, s32 x, s32 y, u32 mode)
Writes value into a window's tilemap at tile (x, y) of its interior, with the palette mode names (TIL...
void UiWindow_EraseBorderRect(s32 x, s32 y, u32 width, u32 height)
Erases a window's rectangle of the tilemap (x, y, width and height in tiles), clamped to the screen.
void UiWork_Finalize(struct UiWindow *window, s32 instant)
Closes a window: clears its contents and remembers its last rectangle.
void RenderOutput_RedrawSavedRect(struct UiWindow *window)
Redraws a window's empty frame at its current rectangle.
struct UiWindow * UiWindow_Create(s32 x, s32 y, s32 width, s32 height, s32 attrs)
Opens a window at tile (x, y) of width by height tiles in the first free window slot,...