src/menu/menu_djinn.c
The Djinn menu: its screen, the Djinn list, help, and choosing the Djinn to set, put on standby, give or trade. More…
Included by menu.c.
Macros
| Name | Description | |
|---|---|---|
#define | DJINN_CURSOR_WIDTH JAPANESE_OR(5, 6) | The highlight over a Djinni's name in the Djinn list, in tiles: wider outside Japanese, for the longer names. |
#define | DJINN_ENTRY_NONE (DJINN_ENTRY_ELEMENT | DJINN_ENTRY_INDEX) | DJINN_MENU_STATE.pairEntries before a Djinni is chosen: every element and number bit set, which no list entry has. |
#define | DJINN_OF_ENTRY (entry) | The Djinni of a list entry as gmDjinnSetStub and the other Djinn routines take it: its party member, element and number. |
#define | DJINN_CAN_SET (entry) gmDjinnCanSetStub(DJINN_OF_ENTRY(entry)) | Whether a list entry's Djinni can be set now, and whether it is set or can be: the Djinn the list does not show in yellow as recovering. |
#define | DJINN_NOT_RECOVERING (entry) | |
#define | DJINN_SET_ENTRY (entry) | Sets a list entry's Djinni, taking it off its side's standby and recovery list, or puts it on standby, at the end of that list. |
#define | DJINN_PUT_ENTRY_ON_STANDBY (entry) | |
#define | DJINN_LIST_ALL_ELEMENTS (-1) | mnDjinnListUnitEntries's element for every element's Djinn, each entry carrying its party member. |
#define | DJINN_BACKDROP_DIGIT_TILE 128 | The tile of BG character block 1 the backdrop's digits are copied to. |
#define | DJINN_BACKDROP_PALETTE 4 | The palettes the Djinn menu takes over, kept in DJINN_MENU_BACKDROP.palette while it is open: from DJINN_BACKDROP_PALETTE, a highlighted row's element icons (the highlight's palette bit turns BASIC_COLORS_PALETTE into it, as it turns WINDOW_PALETTE into HIGHLIGHT_PALETTE), the element icons' own, the dimmed window colours a chooser puts behind it and the copy of the window colours they are darkened from. |
#define | DJINN_DIM_PALETTE 6 | |
#define | DJINN_WINDOW_COPY_PALETTE 7 | |
#define | DJINN_GIVE_RECEIVER_PREVIEW_MODE | How a give preview's two-sided page works out the receiver's stats: as a trade where DJINN_GIVE_PREVIEW_RECEIVER_AS_TRADE says so, else as the Djinni simply added. |
#define | DJINN_PREVIEW_DIGITS 3 | |
#define | DJINN_PREVIEW_CURRENT_X 48 | |
#define | DJINN_PREVIEW_MAX_X 80 | |
#define | DJINN_PREVIEW_SLASH_X 72 | |
#define | DJINN_PREVIEW_LUCK_X 56 | |
#define | DJINN_PREVIEW_ARROW_X (x, iconX) (iconX) | |
#define | DJINN_PREVIEW_PP_X 88 | |
#define | DJINN_PREVIEW_STAT_Y (y, row) ((y) * 8 + 56 + (row) * 8) | The y of the preview's stat row row (0 to 5: HP, PP, Attack, Defense, Agility and Luck) in a window whose top is tile row y. |
#define | DJINN_PREVIEW_VALUE_X (x) ((x) * 8 + 72) | The x of a changed stat's new value on that row, for a window whose left is tile column x. |
#define | DJINN_COLUMN_TILES 7 | The party's Djinn columns, one a member, 7 tiles wide, and the x of a column's figure. |
#define | DJINN_COLUMN_WIDTH (DJINN_COLUMN_TILES * 8) | |
#define | DJINN_FIGURE_X (column) ((column) * DJINN_COLUMN_WIDTH + 48) | |
#define | DJINN_CURSOR_ROW_STRIDE 10 | The cursor packed in DJINN_MENU_STATE.selection: column + row * 10. |
#define | DJINN_MEMBER_FIGURE_X 32 | Where the first party figure stands, over its Djinn column. |
#define | DJINN_MEMBER_FIGURE_Y 61 | |
#define | DJINN_RESELECT_PAIR_ENTRY (menu, i) | Finds the moved Djinni in the list and selects its new position. |
#define | DJINN_PREVIEW_GAINED 0x8000 | mnPsynergyListDifference's marks on an action id: Psynergy the change gives, drawn in TEXT_COLOR_YELLOW, and Psynergy it takes away, in TEXT_COLOR_RED. |
#define | DJINN_PREVIEW_LOST 0x4000 | |
#define | DJINN_HELP_TOPICS 7 | The help's topics: Djinn, Set, Standby, Summon, Recovery, Class and Psynergy. |
#define | DJINN_LIST_COLOR_NAME (window, column, row, palette) | Colours the name of the Djinni at column and row of the Djinn list in window: HIGHLIGHT_PALETTE under the cursor, WINDOW_PALETTE once it leaves. |
#define | DJINN_ENTRY_SET ((Sint16)DJINN_ENTRY_IS_SET) | DJINN_ENTRY_IS_SET read as a signed halfword, for entries built in Sint32. |
#define | DJINN_PACK_ELEMENT (e) ((e) << 5) | A list entry's element and party member in their places (DJINN_ENTRY_ELEMENT and _MEMBER). |
#define | DJINN_PACK_MEMBER (member) ((member) << 8) | |
#define | DJINN_CURSOR_MOVE_COLUMN (key, step) | Left and Right in mnDjinnMenuSelectDjinn: the cursor moves step columns, wrapping, and on past empty columns while a Djinni is being chosen, back to the row Up or Down last left it on, wrapped into the column. |
#define | DJINN_TUTORIAL_SAY (msg) | The tutorial's speech in mnDjinnMenuSelectDjinn, statements for a block of their own: message msg in a window over the list, which closes once its text is all out or, for the second form, once A is pressed after. |
#define | DJINN_TUTORIAL_SAY_UNTIL_A (msg) | |
#define | DJINN_REFUSE_RECOVERING (window) | The error sound and "Now recovering" in place of the unleash effect, for a Djinni chosen while it recovers. |
#define | DJINN_PREVIEW_DRAW_CHANGE (stat, digits, valueX, row) | On a stat preview's row row for a stat that changes: its new value, digits wide at valueX, and an arrow up or down. |
Enumerations
| Name | Description | |
|---|---|---|
enum | DJINN_MENU_STEP { DJINN_STEP_HANDLE_RESULT, DJINN_STEP_RESERVED, DJINN_STEP_SE … } | The Djinn menu's steps (mnDjinnMenuRunScreen): choose a Djinni, then what to do with it, preview the change (the CONFIRM steps), and make it (the APPLY steps). |
enum | DJINN_COLUMN_FLAG { DJINN_COLUMN_ON_HEADER, DJINN_COLUMN_HEADER_CHOOSABLE, DJINN … } | The flags mnDjinnMenuSelectDjinn keeps for each party member's column. |
enum | DJINN_REDRAW { DJINN_REDRAW_ALL, DJINN_REDRAW_MOVED } | What mnDjinnMenuSelectDjinn redraws: everything, or after a cursor move, which also makes the Djinni figure grow in again. |
Functions
| Name | Description | |
|---|---|---|
Sint32 | mnWrapIndex (Sint32 value, Sint32 modulus) | Wraps a cursor index that has stepped one past either end of modulus entries: -1 becomes modulus - 1 and modulus becomes 0. |
Sint32 | mnDjinnMenuPlacePartyFigures (Sint32 yOffset) | Places the four party figures over their Djinn columns, at screen y DJINN_MEMBER_FIGURE_Y plus yOffset. |
Sint32 | mnDjinnMenuRun (void) | Runs the Djinn menu over the field: the field menu's Djinn screen (mnFieldMenuRun, FIELD_MENU_DJINN), and the Djinn tutorial, which the world map opens when Flint joins. |
Sint32 | mnDjinnMenuRunScreen (void) | The Djinn menu's screen: choose a Djinni and what to do with it, see the change previewed, and set it, put it on standby, give it or trade it, until B or Start closes the menu. |
void | mnDjinnMenuAdjustPalettes (Sint32 brightnessDelta) | Writes copies of WINDOW_PALETTE, BASIC_COLORS_PALETTE and DJINN_WINDOW_COPY_PALETTE, each brightnessDelta lighter in every channel (clamped to 0 to RGB_LEVEL_MAX), into the palette before each: HIGHLIGHT_PALETTE, DJINN_BACKDROP_PALETTE and DJINN_DIM_PALETTE. |
MENU_BACKDROP_RESULT | mnOpenBackdropScreen (void) | Opens the Djinn menu's list window and takes over the tiles and palettes it needs, saving the old ones in the backdrop, then draws the Djinn list. |
Sint32 | mnPsynergyListDifference (PSYNERGY_ENTRY *before, PSYNERGY_ENTRY *after, Uint16 *actionsOut, Sint32 *gainedCountOut, Sint32 *lostCountOut) | Lists into actionsOut the Psynergy a change leaves (after), those it gives marked DJINN_PREVIEW_GAINED, then those it takes away (in before, not after) marked DJINN_PREVIEW_LOST. |
Sint32 | mnDjinnMenuBuildLists (void *table) | Rebuilds the Djinn lists in table: each party member's packed Djinn entries and their count. |
void | mnDjinnMenuDrawElementList (DJINN_LIST_TABLE *table) | Draws each party member's Djinn column, including set and recovering entries. |
Sint32 | mnWindowSetInteriorPaletteBitRect (const WINDOW *window, Sint32 x, Sint32 y, Sint32 width, Sint32 height, Sint32 palette) | Sets the palette of a rectangle of window's interior, (x, y) and its size in tiles from the interior's corner, through mnWindowHighlightRectStub. |
void | mnWindowSetRectPalette ( Sint32 x, Sint32 y, Sint32 width, Sint32 height, Sint32 palette) | Moves each tile of a screen rectangle (in tiles) that shows WINDOW_PALETTE to palette, and marks each row changed for upload. |
void | mnWindowSetInteriorRectPalette (void *window, Sint32 x, Sint32 y, Sint32 width, Sint32 height, Sint32 palette) | mnWindowSetRectPalette on a rectangle of window's interior, (x, y) and its size in tiles from the interior's corner. |
Sint32 | mnDjinnMenuShowHelp (void) | The Djinn menu's help, opened by Select on the first chooser: the list of topics with the chosen one's text typed beside it. |
Sint32 | mnDjinnMenuSelectDjinn (Sint32 mode) | The Djinn list's chooser. |
Sint32 | mnDjinnListUnitEntries (Uint16 *entriesOut, Sint32 memberId, Sint32 element) | Lists party member memberId's Djinn into entriesOut as Djinn list entries, the set ones marked DJINN_ENTRY_IS_SET: every element's with the party member in each (DJINN_ENTRY_MEMBER) for DJINN_LIST_ALL_ELEMENTS, else only that element's. |
Sint32 | mnDjinnMenuDrawPairPreview (Sint32 mode, Sint32 pageIndex) | Draws both sides of the give or trade preview for the selected page: the receiver in the second window and the giver in the first. mode is a DJINN_COMPARE_OPERATION; only DJINN_COMPARE_TRADE differs, swapping the two Djinn. |
static __inline__ void | mnUnitCopy (UNIT *dest, UNIT *src) | Copies a full unit for a temporary Djinn-stat preview. |
Sint32 | mnDjinnMenuDrawStatPreview (WINDOW *window, Sint32 x, Sint32 y, Sint32 memberId, Sint32 removePairSlot, Sint32 addPairSlot, Sint32 previewMode, Sint32 page, Sint32 side) | Draws one side of a Djinn preview into window for memberId, with the change previewMode makes of pair slots removePairSlot and addPairSlot: on page 0 their stats, class and set Djinn counts after it, each changed stat's new value beside the old with an up or down arrow; on page n the nth page of their Psynergy after it, gained in yellow and lost in red. |
Description
The Djinn menu: its screen, the Djinn list, help, and choosing the Djinn to
set, put on standby, give or trade. Part of menu.c.
Macros in detail
DJINN_CURSOR_WIDTH
#define DJINN_CURSOR_WIDTH JAPANESE_OR(5, 6)
The highlight over a Djinni's name in the Djinn list, in tiles: wider outside Japanese, for the longer names.
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 8 of file menu_djinn.c.
DJINN_ENTRY_NONE
#define DJINN_ENTRY_NONE (DJINN_ENTRY_ELEMENT | DJINN_ENTRY_INDEX)
DJINN_MENU_STATE.pairEntries before a Djinni is chosen: every element and
number bit set, which no list entry has.
Referenced by mnDjinnMenuRun().
Definition at line 12 of file menu_djinn.c.
DJINN_OF_ENTRY
#define DJINN_OF_ENTRY(entry)
The Djinni of a list entry as gmDjinnSetStub and the other Djinn routines
take it: its party member, element and number.
Definition at line 16 of file menu_djinn.c.
DJINN_CAN_SET
#define DJINN_CAN_SET(entry) gmDjinnCanSetStub(DJINN_OF_ENTRY(entry))
Whether a list entry's Djinni can be set now, and whether it is set or can be: the Djinn the list does not show in yellow as recovering.
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 21 of file menu_djinn.c.
DJINN_NOT_RECOVERING
#define DJINN_NOT_RECOVERING(entry)
Referenced by mnDjinnMenuDrawElementList() and mnDjinnMenuSelectDjinn().
Definition at line 22 of file menu_djinn.c.
DJINN_SET_ENTRY
#define DJINN_SET_ENTRY(entry)
Sets a list entry's Djinni, taking it off its side's standby and recovery list, or puts it on standby, at the end of that list.
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 27 of file menu_djinn.c.
DJINN_PUT_ENTRY_ON_STANDBY
#define DJINN_PUT_ENTRY_ON_STANDBY(entry)
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 30 of file menu_djinn.c.
DJINN_LIST_ALL_ELEMENTS
#define DJINN_LIST_ALL_ELEMENTS (-1)
mnDjinnListUnitEntries's element for every element's Djinn, each entry
carrying its party member.
Referenced by mnDjinnListUnitEntries(), mnDjinnMenuBuildLists() and mnDjinnMenuDrawElementList().
Definition at line 36 of file menu_djinn.c.
DJINN_BACKDROP_DIGIT_TILE
#define DJINN_BACKDROP_DIGIT_TILE 128
The tile of BG character block 1 the backdrop's digits are copied to.
Referenced by mnOpenBackdropScreen().
Definition at line 39 of file menu_djinn.c.
DJINN_BACKDROP_PALETTE
#define DJINN_BACKDROP_PALETTE 4
The palettes the Djinn menu takes over, kept in DJINN_MENU_BACKDROP.palette
while it is open: from DJINN_BACKDROP_PALETTE, a highlighted row's element
icons (the highlight's palette bit turns BASIC_COLORS_PALETTE into it, as it
turns WINDOW_PALETTE into HIGHLIGHT_PALETTE), the element icons' own, the
dimmed window colours a chooser puts behind it and the copy of the window
colours they are darkened from.
Referenced by mnDjinnMenuRun() and mnOpenBackdropScreen().
Definition at line 47 of file menu_djinn.c.
DJINN_DIM_PALETTE
#define DJINN_DIM_PALETTE 6
Referenced by mnDjinnMenuSelectDjinn(), mnDjinnMenuShowHelp() and mnOpenBackdropScreen().
Definition at line 48 of file menu_djinn.c.
DJINN_WINDOW_COPY_PALETTE
#define DJINN_WINDOW_COPY_PALETTE 7
Referenced by mnDjinnMenuAdjustPalettes() and mnOpenBackdropScreen().
Definition at line 49 of file menu_djinn.c.
DJINN_GIVE_RECEIVER_PREVIEW_MODE
#define DJINN_GIVE_RECEIVER_PREVIEW_MODE
How a give preview's two-sided page works out the receiver's stats: as a
trade where DJINN_GIVE_PREVIEW_RECEIVER_AS_TRADE says so, else as the Djinni
simply added.
Referenced by mnDjinnMenuDrawPairPreview().
Definition at line 54 of file menu_djinn.c.
DJINN_PREVIEW_DIGITS
#define DJINN_PREVIEW_DIGITS 3
#define DJINN_PREVIEW_DIGITS 4
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 62 and 70 of file menu_djinn.c.
DJINN_PREVIEW_CURRENT_X
#define DJINN_PREVIEW_CURRENT_X 48
#define DJINN_PREVIEW_CURRENT_X 32
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 63 and 71 of file menu_djinn.c.
DJINN_PREVIEW_MAX_X
#define DJINN_PREVIEW_MAX_X 80
#define DJINN_PREVIEW_MAX_X 72
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 64 and 72 of file menu_djinn.c.
DJINN_PREVIEW_SLASH_X
#define DJINN_PREVIEW_SLASH_X 72
#define DJINN_PREVIEW_SLASH_X 64
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 65 and 73 of file menu_djinn.c.
DJINN_PREVIEW_LUCK_X
#define DJINN_PREVIEW_LUCK_X 56
#define DJINN_PREVIEW_LUCK_X 48
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 66 and 74 of file menu_djinn.c.
DJINN_PREVIEW_ARROW_X
#define DJINN_PREVIEW_ARROW_X(x, iconX) (iconX)
#define DJINN_PREVIEW_ARROW_X(x, iconX) ((x) * 8 + 64)
Definition at lines 67 and 75 of file menu_djinn.c.
DJINN_PREVIEW_PP_X
#define DJINN_PREVIEW_PP_X 88
#define DJINN_PREVIEW_PP_X 56
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 68 and 76 of file menu_djinn.c.
DJINN_PREVIEW_STAT_Y
#define DJINN_PREVIEW_STAT_Y(y, row) ((y) * 8 + 56 + (row) * 8)
The y of the preview's stat row row (0 to 5: HP, PP, Attack, Defense,
Agility and Luck) in a window whose top is tile row y.
Referenced by mnDjinnMenuDrawStatPreview().
Definition at line 81 of file menu_djinn.c.
DJINN_PREVIEW_VALUE_X
#define DJINN_PREVIEW_VALUE_X(x) ((x) * 8 + 72)
The x of a changed stat's new value on that row, for a window whose left is tile column x.
Referenced by mnDjinnMenuDrawStatPreview().
Definition at line 84 of file menu_djinn.c.
DJINN_COLUMN_TILES
#define DJINN_COLUMN_TILES 7
The party's Djinn columns, one a member, 7 tiles wide, and the x of a column's figure.
Referenced by mnDjinnMenuDrawElementList() and mnDjinnMenuSelectDjinn().
Definition at line 88 of file menu_djinn.c.
DJINN_COLUMN_WIDTH
#define DJINN_COLUMN_WIDTH (DJINN_COLUMN_TILES * 8)
Referenced by mnDjinnMenuDrawElementList(), mnDjinnMenuPlacePartyFigures() and mnDjinnMenuSelectDjinn().
Definition at line 89 of file menu_djinn.c.
DJINN_FIGURE_X
#define DJINN_FIGURE_X(column) ((column) * DJINN_COLUMN_WIDTH + 48)
Referenced by mnDjinnMenuRunScreen() and mnDjinnMenuSelectDjinn().
Definition at line 90 of file menu_djinn.c.
DJINN_CURSOR_ROW_STRIDE
#define DJINN_CURSOR_ROW_STRIDE 10
The cursor packed in DJINN_MENU_STATE.selection: column + row * 10.
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 93 of file menu_djinn.c.
DJINN_MEMBER_FIGURE_X
#define DJINN_MEMBER_FIGURE_X 32
Where the first party figure stands, over its Djinn column.
Referenced by mnDjinnMenuPlacePartyFigures().
Definition at line 104 of file menu_djinn.c.
DJINN_MEMBER_FIGURE_Y
#define DJINN_MEMBER_FIGURE_Y 61
Referenced by mnDjinnMenuPlacePartyFigures().
Definition at line 105 of file menu_djinn.c.
DJINN_RESELECT_PAIR_ENTRY
#define DJINN_RESELECT_PAIR_ENTRY(menu, i)
Finds the moved Djinni in the list and selects its new position.
Referenced by mnDjinnMenuRunScreen().
Definition at line 203 of file menu_djinn.c.
DJINN_PREVIEW_GAINED
#define DJINN_PREVIEW_GAINED 0x8000
mnPsynergyListDifference's marks on an action id: Psynergy the change gives,
drawn in TEXT_COLOR_YELLOW, and Psynergy it takes away, in TEXT_COLOR_RED.
Referenced by mnDjinnMenuDrawStatPreview() and mnPsynergyListDifference().
Definition at line 558 of file menu_djinn.c.
DJINN_PREVIEW_LOST
#define DJINN_PREVIEW_LOST 0x4000
Referenced by mnDjinnMenuDrawStatPreview() and mnPsynergyListDifference().
Definition at line 559 of file menu_djinn.c.
DJINN_HELP_TOPICS
#define DJINN_HELP_TOPICS 7
The help's topics: Djinn, Set, Standby, Summon, Recovery, Class and Psynergy.
Referenced by mnDjinnMenuShowHelp().
Definition at line 875 of file menu_djinn.c.
DJINN_LIST_COLOR_NAME
#define DJINN_LIST_COLOR_NAME(window, column, row, palette)
Colours the name of the Djinni at column and row of the Djinn list in window:
HIGHLIGHT_PALETTE under the cursor, WINDOW_PALETTE once it leaves.
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 1012 of file menu_djinn.c.
DJINN_ENTRY_SET
#define DJINN_ENTRY_SET ((Sint16)DJINN_ENTRY_IS_SET)
DJINN_ENTRY_IS_SET read as a signed halfword, for entries built in Sint32.
Referenced by mnDjinnListUnitEntries().
Definition at line 1021 of file menu_djinn.c.
DJINN_PACK_ELEMENT
#define DJINN_PACK_ELEMENT(e) ((e) << 5)
A list entry's element and party member in their places (DJINN_ENTRY_ELEMENT
and _MEMBER).
Referenced by mnDjinnListUnitEntries().
Definition at line 1024 of file menu_djinn.c.
DJINN_PACK_MEMBER
#define DJINN_PACK_MEMBER(member) ((member) << 8)
Referenced by mnDjinnListUnitEntries().
Definition at line 1025 of file menu_djinn.c.
DJINN_CURSOR_MOVE_COLUMN
#define DJINN_CURSOR_MOVE_COLUMN(key, step)
Left and Right in mnDjinnMenuSelectDjinn: the cursor moves step columns,
wrapping, and on past empty columns while a Djinni is being chosen, back to
the row Up or Down last left it on, wrapped into the column.
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 1046 of file menu_djinn.c.
DJINN_TUTORIAL_SAY
#define DJINN_TUTORIAL_SAY(msg)
The tutorial's speech in mnDjinnMenuSelectDjinn, statements for a block of
their own: message msg in a window over the list, which closes once its text
is all out or, for the second form, once A is pressed after. The list is
redrawn after it.
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 1080 of file menu_djinn.c.
DJINN_TUTORIAL_SAY_UNTIL_A
#define DJINN_TUTORIAL_SAY_UNTIL_A(msg)
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 1087 of file menu_djinn.c.
DJINN_REFUSE_RECOVERING
#define DJINN_REFUSE_RECOVERING(window)
The error sound and "Now recovering" in place of the unleash effect, for a Djinni chosen while it recovers.
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 1101 of file menu_djinn.c.
DJINN_PREVIEW_DRAW_CHANGE
#define DJINN_PREVIEW_DRAW_CHANGE(stat, digits, valueX, row)
On a stat preview's row row for a stat that changes: its new value, digits
wide at valueX, and an arrow up or down. A whole if statement, written
without a semicolon after it.
Referenced by mnDjinnMenuDrawStatPreview().
Definition at line 1963 of file menu_djinn.c.
Enumerations in detail
DJINN_MENU_STEP
enum DJINN_MENU_STEP
The Djinn menu's steps (mnDjinnMenuRunScreen): choose a Djinni, then what to
do with it, preview the change (the CONFIRM steps), and make it (the APPLY
steps).
| Enumerator | Value | Description |
|---|---|---|
DJINN_STEP_HANDLE_RESULT | 0 | After a chooser: a negative result closes the screen, any other goes back to choosing a Djinni. |
DJINN_STEP_RESERVED | 1 | Nothing sets it. |
DJINN_STEP_SELECT_DJINN | 2 | |
DJINN_STEP_SELECT_ACTION | 3 | What to do with the chosen Djinni. |
DJINN_STEP_HANDLE_PAIR_RESULT | 4 | After a second choice: back to the Djinn, or on to a trade's second Djinni or a gift's confirmation. |
DJINN_STEP_CONFIRM_SET | 5 | |
DJINN_STEP_CONFIRM_STANDBY | 6 | |
DJINN_STEP_CONFIRM_GIVE | 7 | |
DJINN_STEP_SELECT_SECOND | 8 | The other Djinni of a trade. |
DJINN_STEP_CONFIRM_TRADE | 9 | |
DJINN_STEP_SHOW_STATUS | 10 | The status of the chosen column's party member (L). |
DJINN_STEP_APPLY_SET | 11 | |
DJINN_STEP_APPLY_STANDBY | 12 | |
DJINN_STEP_APPLY_GIVE | 13 | |
DJINN_STEP_APPLY_TRADE | 14 | |
DJINN_STEP_SHOW_HELP | 15 |
Definition at line 226 of file menu_djinn.c.
DJINN_COLUMN_FLAG
enum DJINN_COLUMN_FLAG
The flags mnDjinnMenuSelectDjinn keeps for each party member's column.
| Enumerator | Value | Description |
|---|---|---|
DJINN_COLUMN_ON_HEADER | 1 | the cursor is on the column's header |
DJINN_COLUMN_HEADER_CHOOSABLE | 2 | its header can be chosen |
DJINN_COLUMN_EMPTY | 4 | no Djinni to choose |
Definition at line 1028 of file menu_djinn.c.
DJINN_REDRAW
enum DJINN_REDRAW
What mnDjinnMenuSelectDjinn redraws: everything, or after a cursor move,
which also makes the Djinni figure grow in again.
| Enumerator | Value | Description |
|---|---|---|
DJINN_REDRAW_ALL | 1 | |
DJINN_REDRAW_MOVED | 2 |
Definition at line 1037 of file menu_djinn.c.
Functions in detail
mnWrapIndex
Sint32 mnWrapIndex(Sint32 value, Sint32 modulus)
Wraps a cursor index that has stepped one past either end of modulus entries: -1 becomes modulus
- 1 and modulus becomes 0.
References Sint32.
Referenced by mnDjinnMenuRunPreview(), mnDjinnMenuSelectDjinn(), mnDjinnMenuShowHelp() and mnDjinnMenuShowMemberStatus().
Definition at line 98 of file menu_djinn.c.
mnDjinnMenuPlacePartyFigures
Sint32 mnDjinnMenuPlacePartyFigures(Sint32 yOffset)
Places the four party figures over their Djinn columns, at screen y
DJINN_MEMBER_FIGURE_Y plus yOffset. Returns that y.
References Sint32.
Referenced by mnDjinnMenuRun() and mnDjinnMenuRunScreen().
Definition at line 109 of file menu_djinn.c.
mnDjinnMenuRun
Sint32 mnDjinnMenuRun(void)
Runs the Djinn menu over the field: the field menu's Djinn screen
(mnFieldMenuRun, FIELD_MENU_DJINN), and the Djinn tutorial, which the world
map opens when Flint joins.
References fdPartyClearUnusableShortcutsStub(), gmFlagGetStub(), gmPartyListMembersStub(), MainRoutineStateWork, mnDjinnFiguresInitBottomRow(), mnDjinnFiguresReleaseBottomRow(), mnDjinnMenuPlacePartyFigures(), mnDjinnMenuRunScreen(), mnIconMenuReleaseArrows(), mnInitState(), mnItemMenuClose(), mnItemMenuInit(), mnLoadDjinnArrows(), mnPageArrowsDrawStub(), mnPaletteLightenHighlight(), mnResumeFieldEvents(), mnSuspendFieldEvents(), mnTextUseExtraTilesStub(), mnWindowCreateStub(), mnWindowDrawBorderStub(), mnWindowEraseBorderRectStub(), mnWindowMarkVisibleTextTilesStub(), Sint32, syHeapAllocateEWRAM(), syHeapRelease(), syHeapSlotAllocate(), syHeapSlotRelease(), sySynch() and syWordsCopy().
Referenced by scWorldMapExplainSettingDjinn() and scWorldMapMeetFlint().
Definition at line 129 of file menu_djinn.c.
mnDjinnMenuRunScreen
Sint32 mnDjinnMenuRunScreen(void)
The Djinn menu's screen: choose a Djinni and what to do with it, see the change previewed, and set it, put it on standby, give it or trade it, until B or Start closes the menu.
References gmDjinnPutOnStandbyStub(), gmDjinnRecoveryAddStandbyStub(), gmDjinnRecoveryRemoveStub(), gmDjinnSetStub(), gmDjinnTransferStub(), gmUnitCalculateStub(), mnDjinnFiguresSetSlotPos(), mnDjinnMenuBuildLists(), mnDjinnMenuDrawElementList(), mnDjinnMenuPlacePartyFigures(), mnDjinnMenuRunPreview(), mnDjinnMenuSelectDjinn(), mnDjinnMenuShowHelp(), mnDjinnMenuShowMemberStatus(), mnOpenBackdropScreen(), mnWindowSpriteClearListStub(), Sint32, sySoundPlayStub() and sySynch().
Referenced by mnDjinnMenuRun().
Definition at line 254 of file menu_djinn.c.
mnDjinnMenuAdjustPalettes
void mnDjinnMenuAdjustPalettes(Sint32 brightnessDelta)
Writes copies of WINDOW_PALETTE, BASIC_COLORS_PALETTE and
DJINN_WINDOW_COPY_PALETTE, each brightnessDelta lighter in every channel
(clamped to 0 to RGB_LEVEL_MAX), into the palette before each:
HIGHLIGHT_PALETTE, DJINN_BACKDROP_PALETTE and DJINN_DIM_PALETTE. The last
copy is 12 levels darker instead.
References Sint32.
Referenced by mnOpenBackdropScreen().
Definition at line 503 of file menu_djinn.c.
mnOpenBackdropScreen
MENU_BACKDROP_RESULT mnOpenBackdropScreen(void)
Opens the Djinn menu's list window and takes over the tiles and palettes it needs, saving the old ones in the backdrop, then draws the Djinn list.
References MenuChangeArrowTile, mnDjinnMenuAdjustPalettes(), mnDjinnMenuDrawElementList(), mnGraphicsExpandVRAMTilesByColorTableStub(), mnWindowUpdateOrCreate(), syDMAXCopy(), syPaletteGetBasicSpriteColors(), sySynch(), syWordsCopy() and syWordsFill().
Referenced by mnDjinnMenuRunScreen().
Definition at line 563 of file menu_djinn.c.
mnPsynergyListDifference
Sint32 mnPsynergyListDifference(PSYNERGY_ENTRY *before, PSYNERGY_ENTRY *after, Uint16 *actionsOut, Sint32 *gainedCountOut, Sint32 *lostCountOut)
Lists into actionsOut the Psynergy a change leaves (after), those it gives
marked DJINN_PREVIEW_GAINED, then those it takes away (in before, not after)
marked DJINN_PREVIEW_LOST. Returns how many are listed, and how many were
gained and lost through the two counts.
References Sint32.
Referenced by mnDjinnMenuDrawStatPreview(), mnDjinnMenuRunPreview() and mnDjinnMenuShowMemberStatus().
Definition at line 614 of file menu_djinn.c.
mnDjinnMenuBuildLists
Sint32 mnDjinnMenuBuildLists(void *table)
Rebuilds the Djinn lists in table: each party member's packed Djinn entries and their count.
References mnDjinnListUnitEntries() and Sint32.
Referenced by mnDjinnMenuRunScreen().
Definition at line 678 of file menu_djinn.c.
mnDjinnMenuDrawElementList
void mnDjinnMenuDrawElementList(DJINN_LIST_TABLE *table)
Draws each party member's Djinn column, including set and recovering entries. Rebuilds table's lists first.
References mnDjinnListUnitEntries(), mnTextDrawMessageAsTilesStub(), mnTextSetColorStub(), mnWindowDrawDividerLineStub(), mnWindowSetTilemapEntryStub(), mnWindowSpriteRedrawSavedRectStub(), Sint32 and state.
Referenced by mnDjinnMenuRunScreen(), mnDjinnMenuSelectDjinn() and mnOpenBackdropScreen().
Definition at line 714 of file menu_djinn.c.
mnWindowSetInteriorPaletteBitRect
Sint32 mnWindowSetInteriorPaletteBitRect(const WINDOW *window, Sint32 x, Sint32 y, Sint32 width, Sint32 height, Sint32 palette)
Sets the palette of a rectangle of window's interior, (x, y) and its size in
tiles from the interior's corner, through mnWindowHighlightRectStub.
References mnWindowHighlightRectStub(), Sint32 and width.
Referenced by mnDjinnMenuShowHelp().
Definition at line 787 of file menu_djinn.c.
mnWindowSetRectPalette
void mnWindowSetRectPalette( Sint32 x, Sint32 y, Sint32 width, Sint32 height, Sint32 palette)
Moves each tile of a screen rectangle (in tiles) that shows WINDOW_PALETTE to
palette, and marks each row changed for upload.
References Sint32, state and width.
Referenced by mnDjinnMenuShowHelp() and mnWindowSetInteriorRectPalette().
Definition at line 803 of file menu_djinn.c.
mnWindowSetInteriorRectPalette
void mnWindowSetInteriorRectPalette(void *window, Sint32 x, Sint32 y, Sint32 width, Sint32 height, Sint32 palette)
mnWindowSetRectPalette on a rectangle of window's interior, (x, y) and its
size in tiles from the interior's corner.
References mnWindowSetRectPalette(), Sint32 and width.
Referenced by mnDjinnMenuSelectDjinn() and mnDjinnMenuShowHelp().
Definition at line 860 of file menu_djinn.c.
mnDjinnMenuShowHelp
Sint32 mnDjinnMenuShowHelp(void)
The Djinn menu's help, opened by Select on the first chooser: the list of topics with the chosen one's text typed beside it.
References mnCursorPos(), mnMessageAllTypedStub(), mnMessageOpenDecodedStub(), mnPlacePartyFigures(), mnTextDrawMessageAsTilesStub(), mnTextDrawMessageStub(), mnWindowCloseStub(), mnWindowCreateStub(), mnWindowMarkVisibleTextTilesStub(), mnWindowSetInteriorPaletteBitRect(), mnWindowSetInteriorRectPalette(), mnWindowSetRectPalette(), mnWindowSpriteClearListStub(), mnWindowSpritePrepareForRedrawStub(), mnWrapIndex(), PerPush, PerRepeat, Sint32, sySetEvent(), sySoundPlayStub(), sySynch() and syVRAMCacheFreeEntry().
Referenced by mnDjinnMenuRunScreen().
Definition at line 879 of file menu_djinn.c.
mnDjinnMenuSelectDjinn
Sint32 mnDjinnMenuSelectDjinn(Sint32 mode)
The Djinn list's chooser. DJINN_SELECT_DJINNI picks a Djinni in any party
member's column: R sets it or puts it on standby at once, R held with Select
does so for every Djinni, L shows the member's status and Select the help.
DJINN_SELECT_ACTION picks what to do with it, by the column chosen. While the
tutorial runs, its steps press the buttons.
References btDjinnRecoveryCountDownStub(), DjinnMenuTextLevel, gmDjinnPutOnStandbyStub(), gmDjinnRecoveryAddStandbyStub(), gmUnitCalculateStub(), gmUnitGetStub(), MainRoutineStateWork, mnCursorPos(), mnCursorSlide(), mnDjinnFiguresReplaceSlot(), mnDjinnFiguresSetSlotPhase(), mnDjinnFiguresSetSlotPos(), mnDjinnMarkTradeOnlyRecipients(), mnDjinnMenuDrawElementList(), mnMessageAllTypedStub(), mnMessageArgumentPushStub(), mnMessageOpenWindowStub(), mnTextDrawMessageAsTilesStub(), mnTextDrawNumberInWindowStub(), mnTextDrawStringAtOffsetStub(), mnWindowClearInteriorTilesStub(), mnWindowCloseStub(), mnWindowSetInteriorRectPalette(), mnWindowSetTilemapEntryStub(), mnWindowSpriteClearListStub(), mnWindowSpriteRedrawSavedRectStub(), mnWrapIndex(), PerData, PerPush, PerPushLatch, PerRepeat, Sint32, sySoundPlayStub() and sySynch().
Referenced by mnDjinnMenuRunScreen().
Definition at line 1112 of file menu_djinn.c.
mnDjinnListUnitEntries
Sint32 mnDjinnListUnitEntries(Uint16 *entriesOut, Sint32 memberId, Sint32 element)
Lists party member memberId's Djinn into entriesOut as Djinn list entries,
the set ones marked DJINN_ENTRY_IS_SET: every element's with the party member
in each (DJINN_ENTRY_MEMBER) for DJINN_LIST_ALL_ELEMENTS, else only that
element's. Returns how many.
References gmUnitGetStub() and Sint32.
Referenced by mnDjinnMenuBuildLists() and mnDjinnMenuDrawElementList().
Definition at line 1861 of file menu_djinn.c.
mnDjinnMenuDrawPairPreview
Sint32 mnDjinnMenuDrawPairPreview(Sint32 mode, Sint32 pageIndex)
Draws both sides of the give or trade preview for the selected page: the
receiver in the second window and the giver in the first. mode is a
DJINN_COMPARE_OPERATION; only DJINN_COMPARE_TRADE differs, swapping the two
Djinn. Returns 1.
References mnDjinnMenuDrawStatPreview() and Sint32.
Referenced by mnDjinnMenuRunPreview().
Definition at line 1910 of file menu_djinn.c.
mnUnitCopy
static __inline__ void mnUnitCopy(UNIT *dest, UNIT *src)
Copies a full unit for a temporary Djinn-stat preview.
References syWordsCopy().
Referenced by mnDjinnMenuDrawStatPreview().
Definition at line 1981 of file menu_djinn.c.
mnDjinnMenuDrawStatPreview
Sint32 mnDjinnMenuDrawStatPreview(WINDOW *window, Sint32 x, Sint32 y, Sint32 memberId, Sint32 removePairSlot, Sint32 addPairSlot, Sint32 previewMode, Sint32 page, Sint32 side)
Draws one side of a Djinn preview into window for memberId, with the change previewMode makes of pair slots removePairSlot and addPairSlot: on page 0 their stats, class and set Djinn counts after it, each changed stat's new value beside the old with an up or down arrow; on page n the nth page of their Psynergy after it, gained in yellow and lost in red. The unit is changed only to be measured and is put back. side is the portrait's slot. Returns 1.
References DjinnMenuTextLevel, DjinnMenuTextSlash, gmAbilityGetDefinitionStub(), gmDjinnGiveStub(), gmDjinnPutOnStandbyStub(), gmDjinnSetStub(), gmUnitCalculateStub(), gmUnitGetStub(), line, mnIconCreatePsynergyIcon(), mnPortraitCreateStub(), mnPsynergyListDifference(), mnTextDrawMessageAsTilesStub(), mnTextDrawNumberAtOffsetStub(), mnTextDrawNumberInWindowStub(), mnTextDrawStringAtOffsetStub(), mnTextSetColorStub(), mnUnitCopy(), mnWindowDrawDividerLineStub(), mnWindowSetTilemapEntryStub(), Sint32, syHeapAllocate() and syHeapRelease().
Referenced by mnDjinnMenuDrawPairPreview(), mnDjinnMenuRunPreview() and mnDjinnMenuShowMemberStatus().
Definition at line 1993 of file menu_djinn.c.