49 iconSprite = &sprites[i];
51 iconSprite->
oam.f.x = window->
x * 8 + 8;
52 iconSprite->
oam.f.y = (y + window->
y) * 8 + 4;
68 if (firstEntry != drawnFirstEntry || selectedRow != drawnRow) {
71 window->
width - 2, 1, 15);
76 MsgAbilityDescription,
83 drawnRow = selectedRow;
86 if (firstEntry != drawnFirstEntry) {
91 encodedAction = actions[firstEntry + i];
92 if (encodedAction == 0) {
101 sprites[i].
oam.f.tile = glyph;
105 }
else if (action->
ppCost > unit->
pp) {
107 }
else if (unit->
psySeal != 0) {
123 rangePattern = action->
range;
132 drawnFirstEntry = firstEntry;
137 iconTile = i + 0xf301;
139 iconTile = i + 0xf30b;
148 window->
width - 2, 1, 14);
155 iconTile = i + 0xf301;
158 iconTile = i + 0xf30b;
173 for (i = 0; i < iconCount; i++) {
177 cursorPosition.
x = window->
x * 8 - 4;
178 cursorPosition.
y = (selectedRow * 2 + window->
y) * 8 + 20;
179 ((
u32 *)iconSprite)[1] = 0x40000000;
180 ((
u32 *)iconSprite)[2] = 0;
181 iconSprite->
oam.f.tile =
194 result = firstEntry + selectedRow;
218 firstEntry + selectedRow == count) {
221 preferredRow = selectedRow;
225 if (selectedRow < 0) {
227 selectedRow = count - firstEntry - 1;
232 preferredRow = selectedRow;
237 if (firstEntry != 0) {
239 selectedRow = preferredRow;
243 selectedRow = preferredRow;
245 selectedRow = count - firstEntry - 1;
246 if (selectedRow > preferredRow) {
247 selectedRow = preferredRow;
254 if (firstEntry != 0) {
255 selectedRow = preferredRow;
259 selectedRow = preferredRow;
260 if (firstEntry != 0) {
261 selectedRow = count - firstEntry - 1;
262 if (selectedRow > preferredRow) {
263 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
#define PSYNERGY_COST_SECOND_TILE
#define BATTLE_MENU_MESSAGE_CAPACITY
#define ABILITY_RANGE_ALL
BattleAct.range of an ability that reaches every unit on the side, each as if aimed at.
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.
struct BattleUnit * UnitGetFar(u32 owner)
struct BattleAct * BattleActGet(s32 actionId)
Far call to BattleAction_GetDirect.
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.
int UiWindow_DrawThreeTileColumn(struct UiWindow *window, s32 x, s32 y, s32 pattern, s32 unused)
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
An ability's definition, a row of gBattleAction_DefinitionTable: its targeting, kind,...
u8 ppCost
PP the ability costs.
u8 range
the aimed unit and range - 1 either side, or ABILITY_RANGE_ALL
u8 flags
bits: 7 usable in battle | 6 usable in the field | 5..4 clear in every row | 3..0 kind (ABILITY_KIND_...
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u8 psySeal
bits: 7..3 Luff (16 when cast, minus 8 a turn) | 2..0 Bind's turns (7 when cast).
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 level
text tiles' palette; 15 by default, 14 or 5 for low HP
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_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.
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.
@ 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 Ability_LoadGlyph(s32 action, s32 withBase, s32 *slot, s32 *tile, s32 reuse)
Builds the Psynergy icon of a battle action, as UiIcon_BuildAbilityIconTiles.
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,...