33 s32 stripDirty, tradeCount, pulseScale, command;
44 for (i = 255; i >= 0; i--)
66 for (i = 0; i <= 3; i++)
67 tradeCount += party[i];
77 for (entryIndex = 0; entryIndex <= 5; entryIndex++) {
89 if (entryIndex < selectionUi->iconCount) {
97 }
while (entryIndex < selectionUi->iconCount);
104 pulseScale = (pulseScale - 256) / 4 + 304;
108 if (stripDirty != 0) {
114 for (panel = 0; panel < 6 - selectionUi->
iconCount; panel++) {
115 for (entryIndex = 0; entryIndex <= 2; entryIndex++) {
117 for (col = 0; col <= 2; col++)
118 *(render->
tilemap + (entryIndex + 17) * 32 + panel * 3 +
122 for (panel = 0; panel < selectionUi->
iconCount; panel++) {
124 for (entryIndex = 0; entryIndex <= 2; entryIndex++) {
126 for (col = 0; col <= 2; col++) {
138 vram[panel * 3 + entryIndex * 32 + (col & mask) - count * 3] =
139 tmp = panel * 16 + entryIndex * 4 + col + offset;
141 *(render->
tilemap + (entryIndex + 17) * 32 + panel * 3 + tmp -
149 for (panel = 0; panel < 6 - selectionUi->
iconCount; panel++) {
150 for (entryIndex = 0; entryIndex <= 2; entryIndex++) {
152 for (col = 0; col <= 2; col++)
153 *(render->
tilemap + (entryIndex + 17) * 32 + panel * 3 + 2 +
157 for (panel = 0; panel < selectionUi->
iconCount; panel++) {
164 for (entryIndex = 0; entryIndex <= 2; entryIndex++) {
166 for (col = 0; col <= 2; col++) {
171 volatile u16 *vram = (
volatile u16 *)0x0600f800 + 21 * 32 + 20;
176 vram[panel * 3 + entryIndex * 32 + (col & mask) - count * 3] =
177 tmp = panel * 16 + entryIndex * 4 + col + offset;
179 *(render->
tilemap + (entryIndex + 17) * 32 + panel * 3 + tmp -
191 selectionUi->
window, 0, 0);
199 for (entryIndex = 0; entryIndex < selectionUi->
iconCount; entryIndex++) {
204 entry->
sprite.
oam.f.x = entry->
posX + pulseScale * 7 / 512 - 14;
205 entry->
sprite.
oam.f.y = entry->
posY + pulseScale * 3 / 256 - 20;
229 if (
kind == 16 || (tradeCount == 0 &&
kind == 15)) {
234 MsgDjinnTutorialUnleashCommand, 15, 8);
237 MsgDjinnTutorialSummon, 15, 8);
266 if (mode != 0 && (keys &
KEY_B)) {
294 for (entryIndex = 0; entryIndex < selectionUi->
iconCount; entryIndex++)
300 for (panel = 0; panel <= 6; panel++) {
301 for (entryIndex = 0; entryIndex <= 2; entryIndex++) {
306 for (col = 0; col <= 2; col++)
307 *(
volatile u16 *)(render->
tilemap + (entryIndex + 17) * 32 +
308 panel * 3 + 5 + (col & 3)) =
UI_TILE(0x7f);
339 if (x + width > 29) {
346 if (y + height > 29) {
350 if (width > 0 && height > 0) {
353 s32 remaining = width;
355 if (remaining != 0) {
358 tile = (tile & ~0x1000) | paletteBit;
362 }
while (remaining != 0);
368 }
while (height != 0);
384 if (ids[0] != 0xff) {
386 for (j = 0; j < 4 && battle->
partyUnits[j] != ids[i]; j++) {
394 if (++i < 4 && ids[i] != 0xff)
What every part of the menu object shares: its includes, edition values, macros and the link round st...
struct BattleWork * gBattleWork
s32 Menu_RunCommandRow(s32 mode)
Selects a command icon, returning its kind, -1 for cancel or -2 for a shoulder-button switch.
struct UiWindow * UiText_ShowMessageAndWaitComplete(s32 message, s32 x, s32 y)
Opens a message at (x, y), waits for its text to finish, and returns its window so the caller can hol...
s32 BattleLayout_HighlightPartyPanels(u16 *ids)
Dims the party strip, then highlight the actor IDs up to the 0xff terminator.
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 BattleParty_ListActorIdsFar(s32 groups, u16 *dst)
s32 BattleParty_CountStandbyDjinnFar(u32 unitId, u8 *counts)
s32 BattlePresentation_WaitForPromptAtFar(s32 x, s32 y)
void * Djinn_GetRecoveryTableFar(s32 arg0)
void AudioCommand_PlayFar(s32 id)
void Runtime_SetIrqHandler(u32 irq, s32 vcount, InterruptHandler handler)
Installs handler for interrupt irq and enables that interrupt, or with a null handler disables it and...
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
volatile u32 gFrameCount
Frames WaitFrames has finished.
struct UiWindow * UiText_OpenMessageWindow(s32 message, s32 x, s32 y, u32 packed)
Opens a window sized to a message near tile (x, y) and starts typing the message into it.
s32 UiWork_IsComplete(void)
Returns 1 when every message channel has finished its text (or is idle), and 0 while one is still typ...
void * Runtime_BumpAllocateAlternatePool(s32 size)
As MemAlloc, but tries EWRAM first.
void IoWriteQueue_Store16(u32 address, u32 value)
Queues a halfword store.
@ DISPCNT_MODE_1
BG0 and BG1 text, BG2 affine.
#define IO_WRITE_QUEUE_PUSH(address, value, control)
Disables interrupts to add one register write or DMA to the queue; a write to a full queue is dropped...
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)
void UiText_DrawCharacter(struct SelectionWork *work, s32 index, u32 icon)
Loads a selection icon, initializes its sprite and binds the decoded tiles.
void Graphics_SetBg1Priority3(void)
Puts BG1 behind the other priority levels while the command strip is active.
void Graphics_SetBg1Priority0(void)
Restores BG1 priority 0; the VCount handler applies this below the strip.
s32 AffineMatrix_BuildForEffect(struct AffineTransform *source)
Hands out the next OAM affine matrix for a sprite drawn with source's scale and rotation and fills it...
void Runtime_PushSlotEntry(void *slotEntry, s32 slot)
Links a sprite entry into depth slot slot (clamped to 0..255) for this frame.
const u16 gUi_BounceScales[32]
A sprite's pulse, as a scale where 256 is its normal size: it swells to 1.5 times and back over 32 st...
s32 Scheduler_AddOrUpdateCallback(SchedulerCallback callback, s32 order)
Schedules callback with order, or gives a task already running it the new order, and re-sorts the tab...
s32 Scheduler_RemoveCallback(SchedulerCallback callback)
Unschedules the task running callback: clears its routine and gives it order 0x7fff,...
#define SE_MENU_CURSOR_MOVE
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
The command icon row's work block and one of its icons: pictures.c loads the icons,...
The command icon row's work block: the icons' shared palette, up to six icons, the label window,...
struct GlyphPalette palette
struct SelectionEntry entries[6]
struct AffineTransform affine
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 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_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.
#define UiRender_MarkRow(render, y)
Requests transfer of the four-row tilemap band containing window row y.
#define UI_TILE(tile)
A tilemap entry of palette 15, the UI palette.
s32 VramCache_AllocEntry(s32 size)
Takes a free cache entry, gives it size bytes of sprite VRAM and returns its number.
s32 Resource_ResetEntry(u32 no)
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).
void RenderOutput_PrepareForRedraw(struct UiWindow *window)
Clears a window's contents: redraws its empty frame and releases the render outputs it carries.
void UiWork_Finalize(struct UiWindow *window, s32 instant)
Closes a window: clears its contents and remembers its last 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,...