Alchemy
Loading...
Searching...
No Matches

djinn_menu.c

Go to the documentation of this file.
1/// @file
2/// The battle Djinn menu.
3/// Part of battle_command.c, the menu object, compiled only through it.
4
6
7// A recovering Djinni's turns left: its digits and their x in the list, in
8// pixels.
9#if TBS_PATCH_1
10#define TURNS_DIGITS 1
11#define TURNS_X 48
12#else
13#define TURNS_DIGITS 2
14#define TURNS_X 40
15#endif
16
17#define CURSOR_OWNER (*(struct PartyStatusWindow **)gPartyStatusWork)
18
19// A selected Djinni packs its element/index, standby bit and recovery turns.
20#define DJINN_ENTRY_STANDBY 0x10000
21#define DJINN_ENTRY_RECOVERY_MASK 0x3e0000
22#define DJINN_ENTRY_RECOVERY_SHIFT 17
23#define DJINN_ENTRY_END 0x80000000
24
25/// Selects a Djinni for the current battle command. Entries encode its element,
26/// index, standby state and recovery turns; -1 means cancel. R opens the
27/// stat/Psynergy preview, and tutorial input follows the normal input path.
29 struct CursorSprite cursor;
30 u16 messageText[64];
31 struct UiRenderWork *render;
32 struct UiWindow *previewWindow;
33 s32 drawnRow;
34 s32 cursorSlot;
35 u32 *djinnEntries;
36 s32 djinnCount;
37 s32 drawnFirstEntry;
38 struct UiWindow *messageWindow;
39 s32 standbyElements;
40 s32 preferredRow;
41 s32 previewPage;
42 s32 redraw;
43 s32 alreadySelected;
44 s32 previewPages;
45 struct BattleMenuWork *navigation;
46 struct BattleUnit *unit;
47 struct DjinnRecoveryList *recovery;
48 struct UiWindow *listWindow;
49 struct UiWindow *iconWindow;
50 struct PartyStatusWindow *partyStatus;
51 u32 *entryCursor;
52 u32 selectedDjinn;
53 u32 blinkPhase;
54 s32 firstEntry;
55 s32 selectedRow;
56 u32 encodedDjinn;
57 s32 listPages;
58 s32 palette;
59 struct MenuPoint cursorPos;
60 s32 pressed;
61 s32 repeated;
62 s32 held;
63 s32 element;
64 s32 djinnIndex;
65 s32 i;
66 s32 j;
67 struct CursorSprite *cursorSprite;
68
69 render = UI_WORK;
70 previewWindow = 0;
71 drawnRow = -1;
72 cursorSlot = VramCache_AllocEntry(0x80);
73 djinnEntries = Runtime_BumpAllocateAlternatePool(0xa8 * 2);
74 djinnCount = 0;
75 drawnFirstEntry = -1;
76 encodedDjinn = 0;
77 standbyElements = 0;
78 previewPage = 0;
79 previewPages = 0;
80 redraw = 0;
81 alreadySelected = 0;
82 messageWindow = UiWindow_Create(0, 4, 30, 4, 42);
84 listWindow = UiWindow_Create(21, 9, 9, 11, 6);
85 BATTLE_MENU_GET_CURSOR(firstEntry, selectedRow, preferredRow);
86 unit = UnitGetFar(owner);
87
88 // Pack Djinn state and recovery turns before paging the selection list.
89 for (element = 0; element <= 3; element++) {
90 for (djinnIndex = 0,
91 entryCursor = (u32 *)((djinnCount << 2) + (u32)djinnEntries);
92 djinnIndex <= 19; djinnIndex++) {
93 if (unit->djinnActive[element] & (u32)(1 << djinnIndex)) {
94 *entryCursor = (u32)((element << 8) | djinnIndex);
95 entryCursor++;
96 djinnCount++;
97 } else if (unit->djinnAvailable[element] & (u32)(1 << djinnIndex)) {
98 u32 v;
99 s32 k;
100 recovery = &((struct DjinnRecoveryTable *)Djinn_GetRecoveryTableFar(
101 (u32)owner > 7 ? 1 : 0))
102 ->list;
103 for (k = 0; k < recovery->count; k++) {
104 if (recovery->entries[k].unitId == owner &&
105 recovery->entries[k].element == element &&
106 recovery->entries[k].index == djinnIndex) {
107 break;
108 }
109 }
110 v = (u32)((element << 8) | djinnIndex | DJINN_ENTRY_STANDBY);
111 *entryCursor = v;
112 if (recovery->entries[k].turns > 0) {
113 v |= (u32)(recovery->entries[k].turns << DJINN_ENTRY_RECOVERY_SHIFT);
114 *entryCursor = v;
115 }
116 djinnCount++;
117 entryCursor++;
118 }
119 }
120 }
121 djinnEntries[djinnCount] = DJINN_ENTRY_END;
122 render->dirty = 1;
123
124 /* FAKEMATCH(dead): cursorSprite set before the loop, which sets it again,
125 * keeps the native allocation; without it, 197 of 1201 instructions differ
126 * in tbs-en. */
127 cursorSprite = &cursor;
128 for (;;) {
129 // Rebuild descriptions only when the selection or preview page changes.
130 if (firstEntry != drawnFirstEntry || selectedRow != drawnRow ||
131 redraw != 0) {
132 selectedDjinn = djinnEntries[firstEntry + selectedRow];
133 standbyElements = 0;
134 render->menuBusy = 1;
135 Ui_SetRectHighlight(listWindow->x + 1, listWindow->y + drawnRow * 2 + 1,
136 listWindow->width - 2, 1, 15);
137 if (previewPage != 0) {
138 UiWork_Finalize(messageWindow, 1);
139 messageWindow = UiWindow_Create(0, 4, 30, 4, 42);
141 }
142 redraw = 0;
143 if (djinnCount != 0) {
144 s32 k;
145 u32 selected;
147 alreadySelected = 0;
148 /* FAKEMATCH(one-pass): a loop that runs once keeps the redraw reload
149 * after the selected-entry load, and none of its instructions
150 * survive; as k = redraw, 3 of 1201 instructions differ in tbs-en. */
151 selected = gLinkCountdownWork->chosenDjinn[redraw];
152 for (k = redraw; k == redraw;) {
153 k = redraw;
154 break;
155 }
156 if (selected == selectedDjinn) {
157 alreadySelected = 1;
158 } else {
159 for (;;) {
160 /* FAKEMATCH: the flag, zero on every continuation, keeps k an
161 * index rather than a pointer; as k++, 35 instructions differ in
162 * tbs-en. */
163 k += 1 - alreadySelected;
164 if (k > 7)
165 break;
166 if ((u32)gLinkCountdownWork->chosenDjinn[k] == selectedDjinn) {
167 alreadySelected = 1;
168 break;
169 }
170 }
171 }
172 if (alreadySelected != 0) {
173 BATTLE_MENU_MESSAGE_COPY(MsgBattleDjinnTwice, messageText,
175 if (previewWindow != 0) {
176 UiWork_Finalize(previewWindow, 1);
177 previewWindow = 0;
178 previewPage = 0;
179 }
180 } else if (selectedDjinn & DJINN_ENTRY_STANDBY) {
181 if (selectedDjinn & DJINN_ENTRY_RECOVERY_MASK) {
183 (s32)((selectedDjinn & DJINN_ENTRY_RECOVERY_MASK) >>
185 5);
186 BATTLE_MENU_MESSAGE_COPY((s32)(((selectedDjinn & 0xf00) >> 8) * 20 +
187 (selectedDjinn & 0xff)) +
188 MsgDjinnEffect,
189 messageText, BATTLE_MENU_MESSAGE_CAPACITY);
190 if (previewWindow != 0) {
191 UiWork_Finalize(previewWindow, 1);
192 previewWindow = 0;
193 previewPage = 0;
194 }
195 } else {
196 previewWindow = (struct UiWindow *)DjinnMenu_ShowChangePreview(
197 previewWindow, owner, (s32)selectedDjinn, previewPage,
198 &previewPages);
199 UiText_CopyMessageString(MsgBattleSummonStandby, messageText,
201 standbyElements = 1 << ((selectedDjinn & 0xf00) >> 8);
202 }
203 } else {
204 previewWindow = (struct UiWindow *)DjinnMenu_ShowChangePreview(
205 previewWindow, owner, (s32)selectedDjinn, previewPage,
206 &previewPages);
207 BATTLE_MENU_MESSAGE_COPY((s32)(((selectedDjinn & 0xf00) >> 8) * 20 +
208 (selectedDjinn & 0xff)) +
209 MsgDjinnEffect,
210 messageText, BATTLE_MENU_MESSAGE_CAPACITY);
211 }
212 } else {
213 BATTLE_MENU_MESSAGE_COPY(MsgBattleNoDjinn, messageText,
215 }
216 render->menuBusy = 0;
217 if (previewPage == 0) {
218 render->menuBusy = 1;
219 UiWork_Finalize(messageWindow, 1);
220 messageWindow = UiWindow_Create(0, 4, 30, 4, 42);
221 render->menuBusy = (u8)previewPage;
222 }
223 UiText_RenderWideStringAtOffset(messageText, messageWindow, 0, 4);
224 drawnRow = selectedRow;
225 if (firstEntry != drawnFirstEntry) {
227 j = 0;
228 while ((encodedDjinn = djinnEntries[firstEntry + j]) !=
230 UiWindow_SetTilemapEntry(listWindow,
231 (s32)((encodedDjinn & 0xf00) >> 8) + 0x5001,
232 0, j * 2, 0);
233 if (encodedDjinn & DJINN_ENTRY_RECOVERY_MASK) {
235 } else if (encodedDjinn & DJINN_ENTRY_STANDBY) {
237 }
239 (s32)(((encodedDjinn & 0xf00) >> 8) * 20 +
240 (encodedDjinn & 0xff)) +
241 MsgDjinnName,
242 listWindow, 8, j * 16);
243 if (encodedDjinn & DJINN_ENTRY_RECOVERY_MASK) {
245 (s32)((encodedDjinn & DJINN_ENTRY_RECOVERY_MASK) >>
247 TURNS_DIGITS, listWindow, TURNS_X, j * 16);
248 }
250 j++;
251 if (j >= BATTLE_LIST_ROWS) {
252 break;
253 }
254 }
255 drawnFirstEntry = firstEntry;
256 }
257 if (djinnCount > BATTLE_LIST_ROWS) {
258 for (j = 0; j < (listPages = ((djinnCount + 4) / BATTLE_LIST_ROWS));
259 j++) {
260 s32 tile = j + 0xf301;
261 if (j == (firstEntry / BATTLE_LIST_ROWS)) {
262 tile = j + 0xf30b;
263 }
265 listWindow, tile, listWindow->width - listPages + j - 2, -1, 0);
266 }
267 }
268 Ui_SetRectHighlight(listWindow->x + 1,
269 listWindow->y + selectedRow * 2 + 1,
270 listWindow->width - 2, 1, 14);
271 render->dirty = 1;
272 render->menuBusy = 0;
273 }
274
275 if (djinnCount > BATTLE_LIST_ROWS) {
276 for (j = 0; j < (djinnCount + 4) / BATTLE_LIST_ROWS; j++) {
277 s32 tile = j + 0xf301;
278 if ((gKeysHeld & KEY_R) || (gFrameCount & 15) <= 11) {
279 if (j == (firstEntry / BATTLE_LIST_ROWS)) {
280 tile = j + 0xf30b;
281 }
282 }
284 listWindow, tile,
285 listWindow->width - ((djinnCount + 4) / BATTLE_LIST_ROWS) + j - 2,
286 -1, 0);
287 }
288 if ((gKeysHeld & KEY_R) == 0) {
290 listWindow, 0xf334,
291 listWindow->width - (djinnCount + 4) / BATTLE_LIST_ROWS - 3, -1, 0);
292 UiWindow_SetTilemapEntry(listWindow, 0xf335, listWindow->width - 2, -1,
293 0);
294 } else {
296 listWindow, UI_TILE_FRAME_TOP,
297 listWindow->width - (djinnCount + 4) / BATTLE_LIST_ROWS - 3, -1, 0);
299 listWindow->width - 2, -1, 0);
300 }
301 UiRender_MarkRow(render, listWindow->y - 1);
302 }
303
304 // Tutorial input replaces live keys but uses the same navigation below.
305 pressed = gKeysPressed;
306 repeated = gKeysRepeat;
307 held = gKeysHeld;
308 navigation = gLinkCountdownWork;
309 if (navigation->tutorialStep != 0) {
310 repeated = 0;
311 pressed = 0;
312 held = 0;
313 if (navigation->tutorialDelay == 0) {
314 navigation->tutorialDelay = 60;
315 repeated = 1;
316 pressed = 1;
317 } else {
318 navigation->tutorialDelay--;
319 }
320 }
321 navigation = gLinkCountdownWork;
322 if (navigation->timer == 0 || (pressed & KEY_B)) {
324 encodedDjinn = -1;
325 break;
326 }
327 if (pressed & KEY_A) {
328 u32 selection;
329 u32 turns;
330 if (djinnCount != 0) {
331 selection = djinnEntries[firstEntry + selectedRow];
332 turns = selection & DJINN_ENTRY_RECOVERY_MASK;
333 if (turns == 0) {
334 if (alreadySelected == 0) {
335 navigation->page = firstEntry;
336 navigation->row = selectedRow;
337 navigation->preferredRow = preferredRow;
338 encodedDjinn = selection;
339 break;
340 }
341 } else if (alreadySelected == 0) {
346 5);
347 UiText_CopyMessageString(MsgBattleDjinnRecovering, messageText,
349 UiText_RenderWideStringAtOffset(messageText, messageWindow, 0, 4);
350 }
352 } else {
353 encodedDjinn = -1;
354 break;
355 }
356 }
357
358 if (djinnCount != 0) {
359 if (repeated & KEY_DOWN) {
361 selectedRow++;
362 if (selectedRow == BATTLE_LIST_ROWS ||
363 firstEntry + selectedRow == djinnCount) {
364 selectedRow = 0;
365 }
366 preferredRow = selectedRow;
367 } else if (repeated & KEY_UP) {
369 selectedRow--;
370 if (selectedRow < 0) {
371 if (firstEntry ==
372 ((djinnCount - 1) / BATTLE_LIST_ROWS) * BATTLE_LIST_ROWS) {
373 selectedRow = djinnCount - firstEntry - 1;
374 } else {
375 selectedRow = 4;
376 }
377 }
378 preferredRow = selectedRow;
379 } else if (held & KEY_R) {
380 if (previewWindow != 0) {
381 for (i = 0; i < previewPages; i++) {
382 s32 tile = i + 0xf301;
383 if ((gFrameCount & 15) <= 11 && i == previewPage - 1) {
384 tile = previewPage - 1 + 0xf30b;
385 }
387 previewWindow, tile,
388 previewWindow->width - previewPages + i - 2, -1, 0);
389 }
390 UiWindow_SetTilemapEntry(previewWindow, 0xf334,
391 previewWindow->width - previewPages - 3, -1,
392 0);
393 UiWindow_SetTilemapEntry(previewWindow, 0xf335,
394 previewWindow->width - 2, -1, 0);
395 UiRender_MarkRow(render, previewWindow->y);
396 }
397 if (previewPage == 0 && previewPages != 0) {
398 if (previewWindow != 0) {
399 RenderOutput_ClearList(previewWindow);
400 }
401 previewPage = 1;
402 redraw = 1;
403 } else {
404 if (previewPage > previewPages) {
405 previewPage = previewPages;
406 }
407 if (previewPage != 0) {
408 if (repeated & KEY_RIGHT) {
410 previewPage++;
411 if (previewPage > previewPages) {
412 previewPage = 1;
413 }
414 redraw = 1;
415 } else if (repeated & KEY_LEFT) {
417 previewPage--;
418 if (previewPage <= 0) {
419 previewPage = previewPages;
420 }
421 redraw = 1;
422 }
423 }
424 }
425 } else if (previewPage != 0) {
426 if (previewWindow != 0) {
427 RenderOutput_ClearList(previewWindow);
428 }
429 previewPage = 0;
430 redraw = 1;
431 } else if (repeated & KEY_RIGHT) {
434 if (firstEntry + BATTLE_LIST_ROWS >= djinnCount) {
435 if (firstEntry != 0) {
436 firstEntry = 0;
437 selectedRow = preferredRow;
438 }
439 } else {
440 firstEntry += BATTLE_LIST_ROWS;
441 selectedRow = preferredRow;
442 if (firstEntry ==
443 ((djinnCount - 1) / BATTLE_LIST_ROWS) * BATTLE_LIST_ROWS) {
444 selectedRow = djinnCount - firstEntry - 1;
445 if (selectedRow > preferredRow) {
446 selectedRow = preferredRow;
447 }
448 }
449 }
450 } else if (repeated & KEY_LEFT) {
453 if (firstEntry != 0) {
454 firstEntry -= BATTLE_LIST_ROWS;
455 selectedRow = preferredRow;
456 } else {
457 firstEntry = ((djinnCount - 1) / BATTLE_LIST_ROWS) * BATTLE_LIST_ROWS;
458 selectedRow = preferredRow;
459 if (firstEntry != 0) {
460 selectedRow = djinnCount - firstEntry - 1;
461 if (selectedRow > preferredRow) {
462 selectedRow = preferredRow;
463 }
464 }
465 }
466 }
467 }
468
469 {
470 s32 cx;
471
472 /* FAKEMATCH(one-pass): the x computed in a block of its own keeps the
473 * row's reload after the x shift; as no block, 2 of 1201 instructions
474 * differ in tbs-en. */
475 do {
476 cx = listWindow->x * 8;
477 } while (0);
478 /* FAKEMATCH(barrier): an empty asm reading the row in a low register
479 * reloads it before the subtract; without it, 2 of 1201 instructions
480 * differ in tbs-en. */
481 asm("" : : "l"(selectedRow));
482 cursorPos.x = cx - 2;
483 }
484 cursorPos.y = (selectedRow * 2 + listWindow->y) * 8 + 20;
485 /* FAKEMATCH(dead): cursorSprite set again to the cursor it already points
486 * at keeps the native reload; without it, 18 of 1201 instructions differ
487 * in tbs-en. */
488 cursorSprite = &cursor;
489 ((u32 *)cursorSprite)[1] = MENU_SPRITE_SIZE_16;
490 ((u32 *)cursorSprite)[2] = 0;
491 cursorSprite->tile =
493 cursorSprite->x = cursorPos.x + ((gFrameCount & 4) >> 1) - 6;
494 cursorSprite->y = cursorPos.y - ((gFrameCount & 4) >> 2) - 8;
495 if (djinnCount != 0) {
496 Runtime_PushSlotEntry(cursorSprite, 242);
497 }
498 partyStatus = CURSOR_OWNER;
499 blinkPhase = gFrameCount & 4;
500 iconWindow = partyStatus->window;
501 if (partyStatus->flags & 2) {
502 for (i = 0; i <= 3; i++) {
503 palette = 15 - (blinkPhase != 0);
504 if (((1 << i) & standbyElements) == 0) {
505 palette = 15;
506 }
508 iconWindow->y + gDjinnMenu_ElementYOffsets[i] + 1,
509 2, 2, palette);
510 }
511 }
512 if (gFrameCount & 4) {
513 Iwram_CopyWords((void *)0x06006500, gDjinnMenu_BlinkTile, 32);
514 Iwram_CopyWords((void *)0x06006520, gDjinnMenu_BlinkTile, 32);
515 } else {
516 Iwram_FillWords((void *)0x06006500, 32, 0x44444444);
517 Iwram_CopyWords((void *)0x06006520, gDjinnMenu_BlinkTile, 32);
518 }
519 WaitFrames(1);
520 }
521
522 if (CURSOR_OWNER->flags & 2) {
523 Ui_SetRectHighlight(CURSOR_OWNER->window->x + 1,
524 CURSOR_OWNER->window->y + 1, 4, 4, 15);
525 }
526 // Restore the party strip before releasing the Djinn menu's resources.
527 Resource_ResetEntry(cursorSlot);
528 UiWork_Finalize(messageWindow, 1);
529 UiWork_Finalize(previewWindow, 1);
530 UiWork_Finalize(listWindow, 1);
533 MemFree(djinnEntries);
534 WaitFrames(1);
535 return (s32)encodedDjinn;
536}
What every part of the menu object shares: its includes, edition values, macros and the link round st...
const u8 gDjinnMenu_BlinkTile[32]
#define BATTLE_MENU_MESSAGE_COPY
const u8 gDjinnMenu_ElementYOffsets[4]
#define BATTLE_MENU_MESSAGE_CAPACITY
const u8 gDjinnMenu_ElementXOffsets[4]
void Ui_SetRectHighlight(s32 x, s32 y, s32 width, s32 height, s32 paletteBit)
Sets bit 12 of each tile in a screen-space rectangle, preserving the other tile attributes.
s32 Battle_SelectAbility(s32 owner, s32 unused)
Selects a Djinni for the current battle command.
Definition djinn_menu.c:28
#define DJINN_ENTRY_RECOVERY_MASK
Definition djinn_menu.c:21
#define DJINN_ENTRY_END
Definition djinn_menu.c:23
#define CURSOR_OWNER
Definition djinn_menu.c:17
#define TURNS_DIGITS
Definition djinn_menu.c:10
#define DJINN_ENTRY_STANDBY
Definition djinn_menu.c:20
#define DJINN_ENTRY_RECOVERY_SHIFT
Definition djinn_menu.c:22
#define TURNS_X
Definition djinn_menu.c:11
struct BattleUnit * UnitGetFar(u32 owner)
void * Djinn_GetRecoveryTableFar(s32 arg0)
void AudioCommand_PlayFar(s32 id)
void Input_ResetKeyRepeat(void)
Restarts the key repeat delay, so held keys wait the full delay again.
Definition frame.c:289
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
Definition frame.c:97
volatile u32 gFrameCount
Frames WaitFrames has finished.
void UiText_RenderWideStringAtOffset(u16 *text, struct UiWindow *window, s32 x, s32 y)
Draws a zero-terminated string of 16-bit character codes into a text canvas window at pixel (x,...
Definition glyphs.c:258
u8 gResource_FixedBlockBTiles[]
void * Runtime_BumpAllocateAlternatePool(s32 size)
As MemAlloc, but tries EWRAM first.
Definition heap.c:140
@ KEY_UP
Definition io_reg.h:249
@ KEY_B
Definition io_reg.h:244
@ KEY_LEFT
Definition io_reg.h:248
@ KEY_RIGHT
Definition io_reg.h:247
@ KEY_R
Definition io_reg.h:251
@ KEY_A
Definition io_reg.h:243
@ KEY_DOWN
Definition io_reg.h:250
static s32 Iwram_CopyWords(volatile void *destination, const volatile void *source, s32 size)
Definition iwram_call.h:85
static s32 Iwram_FillWords(void *destination, s32 size, u32 value)
Definition iwram_call.h:59
volatile u32 gKeysHeld
Keys down now.
volatile u32 gKeysPressed
Keys that went down this frame.
volatile u32 gKeysRepeat
Pressed keys, repeating while held: after 19 frames, then every 6.
void MemFree(void *buffer)
struct BattleMenuWork * gLinkCountdownWork
#define MENU_SPRITE_SIZE_16
Definition menu_list.h:67
#define BATTLE_MENU_GET_CURSOR(page_, row_, preferred_)
Restores the previous selection: page, row and return row.
Definition menu_list.h:163
@ BATTLE_LIST_ROWS
Definition menu_list.h:20
void Runtime_PushSlotEntry(void *slotEntry, s32 slot)
Links a sprite entry into depth slot slot (clamped to 0..255) for this frame.
Definition render.c:79
#define SE_MENU_CANCEL
Definition songs.h:106
#define SE_MENU_CURSOR_MOVE
Definition songs.h:104
#define SE_MENU_ERROR
Definition songs.h:107
The battle command menus' work, heap slot 57 (0x104 bytes), reached as gLinkCountdownWork.
Definition menu_list.h:107
s32 page
the list page chosen last
Definition menu_list.h:118
s32 tutorialDelay
frames until the tutorial's next key press
Definition menu_list.h:142
s32 preferredRow
the row to return to
Definition menu_list.h:119
s32 timer
Frames left to choose commands in a link battle; -1 outside link battles.
Definition menu_list.h:131
s32 row
the list row chosen last
Definition menu_list.h:117
s32 tutorialStep
The Djinn tutorial's step: 0 off, 1 from the start of each round while FLAG_DJINN_TUTORIAL is set,...
Definition menu_list.h:141
u32 chosenDjinn[8]
The Djinni each command has chosen, element << 8 | index, or 0x80000000.
Definition menu_list.h:146
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u32 djinnActive[4]
The Djinn set, one bit per Djinni; only these add their stat bonuses.
u32 djinnAvailable[4]
The Djinn held, one bit per Djinni (by its index) in each element's word.
A cursor or prompt sprite: a list link and its OAM attributes as fields.
Definition menu_list.h:50
u8 unitId
its owner
s8 turns
Turns until it is set again; -1 on standby (DJINN_RECOVERY_AFTER_BATTLE), -2 while a summon uses it.
u8 element
enum Element
u8 index
the Djinni within its element, 0 to 19
One side's Djinn recovery list: up to 64 entries and their count.
struct DjinnRecoveryEntry entries[64]
s32 count
entries in use
One side's Djinn recovery table, as Djinn_GetRecoveryTable returns it.
struct DjinnRecoveryList list
A point on the screen where a menu shows its cursor.
Definition menu_list.h:97
s32 y
screen pixels
Definition menu_list.h:99
s32 x
screen pixels
Definition menu_list.h:98
The party status window's layout: its window, its place and size, and what it shows (PARTY_STATUS_ fl...
Definition menu_list.h:84
u16 flags
PARTY_STATUS_ flags.
Definition menu_list.h:90
struct UiWindow * window
Definition menu_list.h:85
The window system's work: the windows' tilemap, the windows, the three text channels,...
Definition window.h:19
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 menuBusy
while set, the tilemap is not uploaded
Definition window.h:40
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
Definition uiwindow.h:11
u16 y
tiles
Definition uiwindow.h:16
u16 x
tiles
Definition uiwindow.h:15
u16 width
tiles
Definition uiwindow.h:13
void UiWork_SetAltFlagAndClearTable(s32 allowAlternateTiles)
Frees every text tile, and with flag set lets text tiles take the second tile range (0x200 to 0x27f) ...
Definition text_tiles.c:329
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.
Definition text_tiles.c:668
void UiWindow_MarkVisibleTileAttributes(void)
Marks the text tiles the tilemap shows, and frees those it no longer shows.
Definition text_tiles.c:299
void UiWork_SetParamNibble(s32 param)
Sets the text colour (0 to 15) of drawn text.
Definition text_tiles.c:524
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.
Definition text_tiles.c:552
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11
#define UiRender_MarkRow(render, y)
Requests transfer of the four-row tilemap band containing window row y.
Definition uiwindow.h:73
#define UI_WORK
Definition window.h:267
@ UI_TILE_FRAME_TOP
Definition window.h:75
@ UI_TILE_FRAME_TOP_RIGHT
Definition window.h:76
s32 VramCache_AllocEntry(s32 size)
Takes a free cache entry, gives it size bytes of sprite VRAM and returns its number.
Definition vram_cache.c:227
s32 VramCache_Reload(s32 no, s32 src)
Copies src again into entry no's VRAM, keeping its size.
Definition vram_cache.c:238
s32 Resource_ResetEntry(u32 no)
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).
Definition vram_cache.c:106
struct UiWindow * DjinnMenu_ShowChangePreview(struct UiWindow *win, s32 owner, s32 encodedDjinn, s32 page, s32 *pageCount)
Temporarily toggle a Djinni and recalculate its owner's stats to show the change.
void UiWork_PushValueSlot(u32 value, u32 kind)
Adds a message argument of kind (MSG_ARG_) with value to the first free place of the argument table; ...
Definition messages.c:216
s32 UiText_CopyMessageString(s32 message, u16 *destination, u32 capacity)
Decodes message into destination as a zero-terminated string of at most capacity entries,...
Definition messages.c:15
void UiWork_ClearValueNameTables(void)
Empties the table of message arguments.
Definition messages.c:199
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...
Definition sprites.c:345
s32 Ui_FillVramBlockPattern(void)
Fills the text canvas with the window background colour (4).
Definition windows.c:619
void UiWork_Finalize(struct UiWindow *window, s32 instant)
Closes a window: clears its contents and remembers its last rectangle.
Definition windows.c:349
void RenderOutput_ClearList(void *outputs)
Releases every render output in a list and empties it.
Definition windows.c:406
void RenderOutput_RedrawSavedRect(struct UiWindow *window)
Redraws a window's empty frame at its current rectangle.
Definition windows.c:400
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,...
Definition windows.c:279