src/window/screens_battle_djinn_preview.c
The preview of what setting or removing a Djinni changes. More…
Included by screens.c.
Macros
| Name | Description | |
|---|---|---|
#define | NUMBER_TEXT_WIDE_LENGTH 14 | How many bytes of NumberTextBuffer are widened: the eleven characters syStringFormatDecimal writes, its terminator and the two bytes after. |
#define | DJINN_PREVIEW_STAT_DIGIT_OFFSET 7 | Where a stat's last four characters start in its widened text. |
#define | PREVIEW_STAT_ARROW_X 80 | A changed stat's arrow, right of its value on window tile row row (HP on row 1 to Luck on row 6). |
#define | PREVIEW_STAT_ARROW_Y (row) ((row) * 8 + 6) | |
#define | DJINN_PREVIEW_ABILITY_CAPACITY 48 | Entries of the change list: the new list's 32 and the lost ones after. |
#define | DJINN_PREVIEW_ABILITY_GAINED 0x8000 | The marks mnBattleDjinnMenuListChangedPsynergy gives an ability in its list. |
#define | DJINN_PREVIEW_ABILITY_LOST 0x4000 | gone with the change |
#define | TOTAL_LABEL_X FRENCH_OR(24, 32) | Where the line at the bottom starts: further left in French. |
#define | STAT_WINDOW_WIDTH JAPANESE_OR(21, 20) | The stats page: Japanese makes its window a tile wider, draws the old values a column further left, Defense and Agility in four places as HP, PP and Attack (the other editions give those two three places from the next column), and starts the prompt under them (MsgBattleAdditionalPsynergyHelp) 16 pixels further right. |
#define | OLD_VALUE_X JAPANESE_OR(4, 5) | |
#define | OLD_DEFENSE_AGILITY_TEXT JAPANESE_OR(7, 8) | |
#define | OLD_DEFENSE_AGILITY_X JAPANESE_OR(4, 6) | |
#define | PSYNERGY_PROMPT_X JAPANESE_OR(40, 24) |
Functions
| Name | Description | |
|---|---|---|
Sint32 | mnStringFormatNumberToHalfwords (Sint16 *out, Sint32 value) | Writes value into out as syStringFormatDecimal's eleven-character, right-aligned decimal text, widened to halfwords for mnTextDrawWideStringInWindow. |
Sint32 | mnBattleDjinnMenuListChangedPsynergy (const PSYNERGY_ENTRY *oldGrid, const PSYNERGY_ENTRY *newGrid, Uint16 *out, Sint32 *gained, Sint32 *lost) | Lists into out the abilities usable in battle (ABILITY_USABLE_IN_BATTLE) of the action list newGrid, in its order, marking with DJINN_PREVIEW_ABILITY_GAINED those oldGrid lacks; then appends those of oldGrid that newGrid lacks, marked DJINN_PREVIEW_ABILITY_LOST. |
Sint32 | mnWindowSpriteCreateAbilityIcon (WINDOW *window, Sint32 x, Sint32 y, Sint32 abilityId) | Loads ability abilityId's icon into a free VRAM cache slot and draws it as a 16x16 sprite at (x, y) of window, in pixels; does nothing when no slot is free. |
WINDOW * | mnBattleDjinnMenuShowChangePreview (WINDOW *window, Sint32 member, Sint32 encodedDjinn, Sint32 page, Sint32 *pageCount) | Shows what setting or removing Djinni encodedDjinn (element << 8 | index) would change for member: closes the preview window window, opens a new one and returns it, or NULL when none could be opened. |
Description
The preview of what setting or removing a Djinni changes. Part of screens.c.
Macros in detail
NUMBER_TEXT_WIDE_LENGTH
#define NUMBER_TEXT_WIDE_LENGTH 14
How many bytes of NumberTextBuffer are widened: the eleven characters
syStringFormatDecimal writes, its terminator and the two bytes after.
Referenced by mnStringFormatNumberToHalfwords().
Definition at line 7 of file screens_battle_djinn_preview.c.
DJINN_PREVIEW_STAT_DIGIT_OFFSET
#define DJINN_PREVIEW_STAT_DIGIT_OFFSET 7
Where a stat's last four characters start in its widened text.
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 9 of file screens_battle_djinn_preview.c.
PREVIEW_STAT_ARROW_X
#define PREVIEW_STAT_ARROW_X 80
A changed stat's arrow, right of its value on window tile row row (HP on
row 1 to Luck on row 6).
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 32 of file screens_battle_djinn_preview.c.
PREVIEW_STAT_ARROW_Y
#define PREVIEW_STAT_ARROW_Y(row) ((row) * 8 + 6)
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 33 of file screens_battle_djinn_preview.c.
DJINN_PREVIEW_ABILITY_CAPACITY
#define DJINN_PREVIEW_ABILITY_CAPACITY 48
Entries of the change list: the new list's 32 and the lost ones after.
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 36 of file screens_battle_djinn_preview.c.
DJINN_PREVIEW_ABILITY_GAINED
#define DJINN_PREVIEW_ABILITY_GAINED 0x8000
The marks mnBattleDjinnMenuListChangedPsynergy gives an ability in its list.
new with the change
Referenced by mnBattleDjinnMenuListChangedPsynergy() and mnBattleDjinnMenuShowChangePreview().
Definition at line 39 of file screens_battle_djinn_preview.c.
DJINN_PREVIEW_ABILITY_LOST
#define DJINN_PREVIEW_ABILITY_LOST 0x4000
gone with the change
Referenced by mnBattleDjinnMenuListChangedPsynergy() and mnBattleDjinnMenuShowChangePreview().
Definition at line 40 of file screens_battle_djinn_preview.c.
TOTAL_LABEL_X
#define TOTAL_LABEL_X FRENCH_OR(24, 32)
Where the line at the bottom starts: further left in French.
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 130 of file screens_battle_djinn_preview.c.
STAT_WINDOW_WIDTH
#define STAT_WINDOW_WIDTH JAPANESE_OR(21, 20)
The stats page: Japanese makes its window a tile wider, draws the old values
a column further left, Defense and Agility in four places as HP, PP and
Attack (the other editions give those two three places from the next column),
and starts the prompt under them (MsgBattleAdditionalPsynergyHelp) 16 pixels
further right.
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 137 of file screens_battle_djinn_preview.c.
OLD_VALUE_X
#define OLD_VALUE_X JAPANESE_OR(4, 5)
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 138 of file screens_battle_djinn_preview.c.
OLD_DEFENSE_AGILITY_TEXT
#define OLD_DEFENSE_AGILITY_TEXT JAPANESE_OR(7, 8)
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 139 of file screens_battle_djinn_preview.c.
OLD_DEFENSE_AGILITY_X
#define OLD_DEFENSE_AGILITY_X JAPANESE_OR(4, 6)
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 140 of file screens_battle_djinn_preview.c.
PSYNERGY_PROMPT_X
#define PSYNERGY_PROMPT_X JAPANESE_OR(40, 24)
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 141 of file screens_battle_djinn_preview.c.
Functions in detail
mnStringFormatNumberToHalfwords
Sint32 mnStringFormatNumberToHalfwords(Sint16 *out, Sint32 value)
Writes value into out as syStringFormatDecimal's eleven-character,
right-aligned decimal text, widened to halfwords for
mnTextDrawWideStringInWindow. out needs room for NUMBER_TEXT_WIDE_LENGTH
halfwords.
References NumberTextBuffer, Sint32 and syStringFormatDecimal().
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 15 of file screens_battle_djinn_preview.c.
mnBattleDjinnMenuListChangedPsynergy
Sint32 mnBattleDjinnMenuListChangedPsynergy(const PSYNERGY_ENTRY *oldGrid, const PSYNERGY_ENTRY *newGrid, Uint16 *out, Sint32 *gained, Sint32 *lost)
Lists into out the abilities usable in battle (ABILITY_USABLE_IN_BATTLE) of
the action list newGrid, in its order, marking with
DJINN_PREVIEW_ABILITY_GAINED those oldGrid lacks; then appends those of
oldGrid that newGrid lacks, marked DJINN_PREVIEW_ABILITY_LOST. Both lists
are 32 slots, ended early by a 0 action. Returns the entries written, and the
gained and lost counts through gained and lost.
References gmAbilityGetDefinitionStub() and Sint32.
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 48 of file screens_battle_djinn_preview.c.
mnWindowSpriteCreateAbilityIcon
Sint32 mnWindowSpriteCreateAbilityIcon(WINDOW *window, Sint32 x, Sint32 y, Sint32 abilityId)
Loads ability abilityId's icon into a free VRAM cache slot and draws it as
a 16x16 sprite at (x, y) of window, in pixels; does nothing when no slot is
free.
References mnAbilityIconLoadIntoSlot(), mnWindowSpriteCreate(), Sint32 and syVRAMCacheFindFreeEntry().
Referenced by mnBattleDjinnMenuShowChangePreview().
Definition at line 113 of file screens_battle_djinn_preview.c.
mnBattleDjinnMenuShowChangePreview
WINDOW *mnBattleDjinnMenuShowChangePreview(WINDOW *window, Sint32 member, Sint32 encodedDjinn, Sint32 page, Sint32 *pageCount)
Shows what setting or removing Djinni encodedDjinn (element << 8 | index)
would change for member: closes the preview window window, opens a new
one and returns it, or NULL when none could be opened. Page 0 compares the
class and stats, old against new, with an arrow by each stat that rises or
falls; pages 1 on list, five a page, the unit's battle abilities after the
change (unchanged ones in TEXT_COLOR_WHITE, new ones in TEXT_COLOR_YELLOW)
and then those it would lose (TEXT_COLOR_RED), and *pageCount is set to their
number (at least 1). The Djinni is toggled and the unit recalculated
(gmUnitCalculateStub) only to measure: the unit is restored from a copy
before it returns. mnBattleDjinnMenuRun calls it as the cursor moves.
References DjinnMenuArrowDownTiles, DjinnMenuArrowUpTiles, gmAbilityGetDefinitionStub(), gmDjinnIsSetStub(), gmDjinnPutOnStandbyStub(), gmDjinnSetStub(), gmUnitCalculateStub(), gmUnitGet(), mnBattleDjinnMenuListChangedPsynergy(), mnRangeIconDraw(), mnStringFormatNumberToHalfwords(), mnTextDrawMessageAsTiles(), mnTextDrawNumberInWindow(), mnTextDrawWideStringInWindow(), mnTextSetColor(), mnWindowClose(), mnWindowCreate(), mnWindowDrawDividerLine(), mnWindowSetTilemapEntry(), mnWindowSpriteAcquireFree(), mnWindowSpriteAppendToList(), mnWindowSpriteCreateAbilityIcon(), MsgClassName, Sint32, syHeapAllocate(), syHeapAllocateEWRAM(), syHeapRelease(), syVRAMCacheAllocateEntry() and syVRAMCacheReload().
Referenced by mnBattleDjinnMenuRun().
Definition at line 153 of file screens_battle_djinn_preview.c.