8#define OWNER_STATUS_TEXT_MAX 0x80
9#define OWNER_STATUS_VALUE_X 184
11#define OWNER_STATUS_TEXT_MAX 0x40
12#define OWNER_STATUS_VALUE_X 176
15#if (LANGUAGE == LANGUAGE_SPANISH) || (LANGUAGE == LANGUAGE_ITALIAN)
16#define OWNER_STATUS_LABEL(row) (MsgOwnerStatusAttack + (row))
18#define OWNER_STATUS_LABEL(row) (MsgOwnerStatusExp - 10 + (row))
21#define STATUS_CURSOR_GENERAL 0
22#define STATUS_CURSOR_COMBAT_STATS 1
23#define STATUS_CURSOR_CONDITIONS 2
92 for (i = 4; i >= 0; i--) {
100 for (i = 0; i <= 10; i++) {
105 if (listCount != 0) {
106 for (i = 0; i <= 5; i++) {
121 cursorPosition.
x = 0;
122 cursorPosition.
y = 0;
131 nameSprite.
oam.word.attr01 = 0x80000400;
132 nameSprite.
oam.word.attr23 = 0;
134 nameSprite.
oam.f.x = 8;
135 nameSprite.
oam.f.y = 24;
136 nameSprite.
oam.f.palette = 14;
178 statusWindow->
height, 15);
180 if (statusCount != 0) {
194 }
else if ((keys &
KEY_UP) != 0) {
198 if (groupPosition < 0) {
205 }
else if ((keys & 0x31) != 0) {
213 groupPosition = statusCount - 1;
224 if (groupPosition < 0) {
235 }
else if ((keys &
KEY_LEFT) != 0) {
238 if (groupPosition < 0) {
243 }
else if ((keys & 0xC1) != 0) {
262 cursor.
row = cursorStop->
row;
292 cursorPosition.
x = cursor.
column * 8;
293 cursorPosition.
y = cursor.
row * 8;
298 portraitSprite.
oam.word.attr01 = 0xC0002400;
299 portraitSprite.
oam.word.attr23 = 0;
306 portraitSprite.
oam.f.tile = face->
oam.f.tile;
307 portraitSprite.
oam.f.x = 0xAC;
308 portraitSprite.
oam.f.y = 56;
312 cursorSprite.
oam.word.attr01 = 0x40000400;
313 cursorSprite.
oam.word.attr23 = 0;
318 cursorSprite.
oam.f.tile =
320 cursorSprite.
oam.f.x =
321 (cursorPosition.
x + statusWindow->
x * 8 - ((
gFrameCount & 4) >> 2)) +
323 cursorSprite.
oam.f.y = (
u8)((cursorPosition.
y + statusWindow->
y * 8 -
326 cursorSprite.
oam.f.affineIndex = 8;
336 if ((redraw & 1) != 0) {
342#if (LANGUAGE == LANGUAGE_SPANISH) || (LANGUAGE == LANGUAGE_ITALIAN)
359 statusWindow, 56, 0);
372#if (LANGUAGE == LANGUAGE_SPANISH) || (LANGUAGE == LANGUAGE_ITALIAN)
424 statusWindow, 0, 48);
436 for (j = 0; j <= 3; j++) {
447 statusWindow, 40 + j * 32, 72);
449 statusWindow, 48 + j * 32, 72);
451 statusWindow, 48 + j * 32 + 8, 72);
454 statusWindow, 48 + j * 32, 80);
458 statusWindow, 40 + j * 32, 96);
468 statusKinds[i++] = 15;
474 statusKinds[i++] = 8;
480 statusKinds[i++] = 1;
486 statusKinds[i++] = 2;
492 statusKinds[i++] = 4;
497 if (unit->
stun != 0) {
498 statusKinds[i++] = 3;
503 if (unit->
sleep != 0) {
504 statusKinds[i++] = 5;
509 if (unit->
haunt != 0) {
510 statusKinds[i++] = 7;
516 statusKinds[i++] = 6;
523 statusKinds[i++] = 9;
526 statusKinds[i++] = 10;
534 statusKinds[i++] = 11;
537 statusKinds[i++] = 12;
545 statusKinds[i++] = 13;
548 statusKinds[i++] = 14;
555 statusKinds[i++] = 17;
558 statusKinds[i++] = 18;
562 for (j = 0; j < i; j++) {
570 for (j = i; j < 11; j++) {
575 if (statusKinds[0] == 0) {
577 : MsgOwnerStatusDowned,
578 statusWindow, 112, 0);
584 statusKind = statusKinds[cursor.
helpEntry - 14];
585 if (statusKind == 0 && unit->
hp == 0) {
594 attackDelta = unit->
atk;
595 defenseDelta = unit->
def;
596 agilityDelta = unit->
agi;
601 attackDelta -= unit->
atk;
602 defenseDelta -= unit->
def;
603 agilityDelta -= unit->
agi;
607 switch (statusKind) {
612 helpValue = attackDelta;
615 helpValue = -attackDelta;
618 helpValue = defenseDelta;
621 helpValue = -defenseDelta;
624 helpValue = agilityDelta;
627 helpValue = -agilityDelta;
632#if (LANGUAGE == LANGUAGE_SPANISH) || (LANGUAGE == LANGUAGE_ITALIAN)
634 helpValue = -helpValue;
663 statusSprite = statusSprites;
664 statusSlot = statusSlots;
669 statusSprite->
oam.word.attr01 = 0x40000400;
670 statusSprite->
oam.word.attr23 = 0;
671 statusSprite->
oam.f.tile = cache[*statusSlot++].
offset >> 5;
672 statusSprite->
oam.f.x = iconX;
673 statusSprite->
oam.f.y = (
u8)(statusWindow->
y * 8 + 8);
674 if (statusKinds[i] > 0) {
689 if (listCount != 0) {
690 if ((keys &
KEY_R) != 0) {
692 if (ownerIndex >= listCount) {
695 owner = list[ownerIndex];
698 }
else if ((keys &
KEY_L) != 0) {
700 if (ownerIndex < 0) {
701 ownerIndex = listCount - 1;
703 owner = list[ownerIndex];
712 s32 *statusSlotCursor = statusSlots;
714 for (i = 10; i >= 0; i--) {
What every part of the menu object shares: its includes, edition values, macros and the link round st...
#define OWNER_STATUS_LEVEL_X
struct BattleWork * gBattleWork
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 BattleObj * GetBattleObjectSlotFar(s32 objectId)
Far call to BattleObjGet.
struct BattleUnit * UnitGetFar(u32 owner)
s32 Unit_GetElementLevelFar(s32 owner, s32 index)
s32 Party_SumDjinnCountsFar(s32 index)
u32 Unit_GetExperienceForLevelFar(s32 owner, s32 level)
void UnitCalcFar(s32 owner)
void AudioCommand_PlayFar(s32 id)
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
volatile u32 gFrameCount
Frames WaitFrames has finished.
void UiWindow_MapTextCanvasTiles(s32 x, s32 y, u32 width, u32 height, s32 fullWidth)
Maps the text canvas tiles into the interior of a window at tile (x, y).
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[]
void * MemAlloc(s32 size)
Allocates size bytes (rounded up to words) with no slot, from IWRAM when they fit and EWRAM otherwise...
static s32 Iwram_CopyWords(volatile void *destination, const volatile void *source, s32 size)
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 PartyStatusDraw(s32 flags)
Draws the party status window with flags (see PARTY_STATUS_*): each member's name,...
s32 Resource_LoadTableEntryToBuffer(s32 resource, s32 index)
Composes a table-entry glyph in temporary transfer work, reloads its cache slot, then releases the te...
s32 UiGlyph_LoadPortrait(u32 member, s32 cacheSlot)
Loads a party portrait into the supplied cache slot and returns its tile.
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
s16 resistance
Elemental resistance to it.
s16 power
Elemental power in the element.
struct MotionObject * object
NULL once released.
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u8 luck
0 to 99 (UnitCalc)
u8 djinnOwnedCounts[4]
the Djinn held in each element, at most 10
u8 grimReaper
The Grim Reaper's countdown: 7 when cursed, down one at each turn's end; at 0 the unit falls.
u8 psySeal
bits: 7..3 Luff (16 when cast, minus 8 a turn) | 2..0 Bind's turns (7 when cast).
s16 maxPp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
s8 poison
1 poisoned, 2 deadly poison
u8 djinnActiveCounts[4]
the Djinn set in each element; the class's element levels are read from these
u8 name[0x0f]
The name, one byte a character, ending in 0.
u8 haunt
set while an evil spirit grips the unit
s16 hp
current HP, 0 when downed
struct BattleElementStats element[4]
Power and resistance in each element, 0 to 200, after equipment, element levels and Resistance stages...
s16 maxHp
0 to 1999 for a character, 9999 for an enemy (UnitCalc)
u32 experience
a character's experience points
s8 agilityStage
The Agility stage: -4 (Vine) to 8 (Zephyr, twice the Agility).
u8 classIndex
The character's class, worked out from its Djinn (Unit_UpdateClass); 0 marks an enemy,...
u16 atk
Attack, 0 to 999 (UnitCalc).
u8 level
1 to 99 for a character
u8 attackTurns
Each stat change: the turns it has left, and its stage (UnitCalc: an eighth of Attack,...
u16 agi
Agility, 0 to 999: the order of the round's actions.
u16 def
Defense, 0 to 999 (UnitCalc).
u8 delusion
Delusion to sleep: the turns each status has left, 7 when it lands; each may end sooner at the end of...
u8 partyStatus
PARTY_STATUS_SUMMONS or PARTY_STATUS_NO_SUMMONS.
void * records
one sprite, or a table of up to four (recordStorageKind)
A cursor stop among the status screen's stats: its help entry, where the cursor points and the run of...
The status screen's cursor: its place in each group, the help entry it shows and where it points.
s8 groupPositions[5]
XOR2 navigation can transiently use index3; keep all five positions.
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.
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...
A sprite slot of the VRAM cache: the size of its block and where the block starts in OBJ VRAM.
u16 offset
bytes from the start of OBJ VRAM
void UiWindow_DrawDividerLine(struct UiWindow *win, u32 x1, u32 y1, u32 x2, u32 y2)
Draws a straight divider line inside a window from tile (x1, y1) to (x2, y2), horizontal or vertical:...
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 UiText_DrawNumberInWindow(s32 value, s32 width, struct UiWindow *window, s32 x, s32 y)
Draws a number (width as UiText_FormatNumber) into a window's tilemap at pixel (x,...
void UiWindow_MarkVisibleTileAttributes(void)
Marks the text tiles the tilemap shows, and frees those it no longer shows.
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.
const u8 gOwnerStatus_HpString[]
const u8 gOwnerStatus_LevelString[]
const struct OwnerStatusCursor gOwnerStatus_EquipmentCursors[]
const u8 gOwnerStatus_PpString[]
const struct OwnerStatusStatCursor gOwnerStatus_StatCursors[]
const u8 gOwnerStatus_SlashString[]
const struct OwnerStatusCursor gOwnerStatus_ConditionCursors[]
s32 System_GetLanguage(void)
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).
struct VramBlockCacheEntry gVramBlockCache[]
#define OWNER_STATUS_LABEL(row)
#define STATUS_CURSOR_CONDITIONS
s32 Ui_RunOwnerStatusScreen(u16 *list, s32 listCount, s32 owner)
Shows a party member's stats and condition help until B or the link session ends.
#define OWNER_STATUS_VALUE_X
#define STATUS_CURSOR_GENERAL
#define STATUS_CURSOR_COMBAT_STATS
#define OWNER_STATUS_TEXT_MAX
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; ...
s32 UiText_CopyMessageString(s32 message, u16 *destination, u32 capacity)
Decodes message into destination as a zero-terminated string of at most capacity entries,...
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,...