84 iconSprite = &sprites[i];
86 iconSprite->
oam.f.x = window->
x * 8 + 8;
87 iconSprite->
oam.f.y = (y + window->
y) * 8 + 4;
101 cursorSprite = &cursor;
103 if (firstEntry != drawnFirstEntry || selectedRow != drawnRow) {
106 window->
width - 2, 1, 15);
124 drawnRow = selectedRow;
127 if (firstEntry != drawnFirstEntry) {
130 item = entries[firstEntry + i];
147 drawnFirstEntry = firstEntry;
163 window->
width - 2, 1, 14);
189 for (i = 0; i < iconCount; i++) {
190 iconSprite = &sprites[i];
194 cursorPosition.
x = window->
x * 8 - 2;
195 cursorPosition.
y = (selectedRow * 2 + window->
y) * 8 + 20;
199 cursorSprite = &cursor;
201 ((
u32 *)cursorSprite)[2] = 0;
204 cursorSprite->
x = cursorPosition.
x + ((
gFrameCount & 4) >> 1) - 4;
205 cursorSprite->
y = cursorPosition.
y - ((
gFrameCount & 4) >> 2) - 8;
215 result = firstEntry + selectedRow;
220 if (unusableReason == 0) {
225 if (unusableReason == 2) {
252 firstEntry + selectedRow == count) {
255 preferredRow = selectedRow;
259 if (selectedRow < 0) {
261 selectedRow = count - firstEntry - 1;
266 preferredRow = selectedRow;
271 if (firstEntry != 0) {
273 selectedRow = preferredRow;
277 selectedRow = preferredRow;
279 selectedRow = count - firstEntry - 1;
280 if (selectedRow > preferredRow) {
281 selectedRow = preferredRow;
288 if (firstEntry != 0) {
290 selectedRow = preferredRow;
293 selectedRow = preferredRow;
294 if (firstEntry != 0) {
295 selectedRow = count - firstEntry - 1;
296 if (selectedRow > preferredRow) {
297 selectedRow = preferredRow;
What every part of the menu object shares: its includes, edition values, macros and the link round st...
#define BATTLE_MENU_MESSAGE_COPY
@ LIST_TILE_PAGES_RIGHT
Right arrow.
@ LIST_TILE_PAGE_NUMBER
Page number.
@ LIST_TILE_PAGES_LEFT
Left arrow.
@ LIST_TILE_PAGE_NUMBER_LIT
Current page number.
#define BATTLE_MENU_MESSAGE_CAPACITY
#define BATTLE_OK
flags: usable in battle
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.
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...
struct ItemDefinition * Item_GetDirectFar(s32 item)
struct BattleAct * BattleActGet(s32 actionId)
Far call to BattleAction_GetDirect.
s32 Item_CanOwnerEquip(s32 unit, s32 item)
Far call to Item_CanOwnerEquipDirect.
void AudioCommand_PlayFar(s32 id)
void Input_ResetKeyRepeat(void)
Restarts the key repeat delay, so held keys wait the full delay again.
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
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,...
u8 gResource_FixedBlockBTiles[]
volatile u32 gKeysPressed
Keys that went down this frame.
volatile u32 gKeysRepeat
Pressed keys, repeating while held: after 19 frames, then every 6.
s32 ItemIcon_LoadIntoSlot(s32 resource, s32 index)
Composes the item icon with style 0x1a in temporary transfer work and reload the requested cache slot...
void Runtime_PushSlotEntry(void *slotEntry, s32 slot)
Links a sprite entry into depth slot slot (clamped to 0..255) for this frame.
#define SE_MENU_CURSOR_MOVE
u8 flags
bits: 7 usable in battle | 6 usable in the field | 5..4 clear in every row | 3..0 kind (ABILITY_KIND_...
A cursor or prompt sprite: a list link and its OAM attributes as fields.
An item's definition: its price, type, who can equip it, its bonuses and unleash, its effects and the...
u8 useType
what using it costs (ITEM_USE_), or 0 for nothing
u8 type
enum ItemType; 0 for an item that is not equipment
u16 actionId
the ability used, or taught as Psynergy
The window system's work: the windows' tilemap, the windows, the three text channels,...
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 UiWork_SetParamNibble(s32 param)
Sets the text colour (0 to 15) of drawn text.
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 DMA_COPY32(count)
The DMA control word that copies count words.
@ UI_TILE_FRAME_BOTTOM_TEE
the bottom edge meeting a line
@ UI_TILE_FRAME_TOP_TEE
the top edge meeting a line
s32 VramCache_AllocEntry(s32 size)
Takes a free cache entry, gives it size bytes of sprite VRAM and returns its number.
s32 VramCache_Reload(s32 no, s32 src)
Copies src again into entry no's VRAM, keeping its size.
s32 Resource_ResetEntry(u32 no)
Frees cache entry no: its blocks go back and the entry is marked free (offset 0xffff).
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...
s32 Ui_FillVramBlockPattern(void)
Fills the text canvas with the window background colour (4).
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,...