src/menu/menu_djinn.c
The Djinn menu: its backdrop screen, the Djinn list and the screen's loop. More…
Included by menu.c.
Macros
| Name | Description | |
|---|---|---|
#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_FIGURE_Y 54 | The y of the chosen Djinni's figure over its column, and its y while the Djinni is being chosen. |
#define | DJINN_FIGURE_CHOOSING_Y 62 | |
#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_BACKDROP_DIGIT_TILE 128 | The tile of BG character block 1 the backdrop's digits are copied to. |
#define | DJINN_CURSOR_ROW_STRIDE 10 | The cursor packed in DJINN_MENU_STATE.selection: column + row * 10. |
#define | DJINN_RESELECT_PAIR_ENTRY (menu, i) | Finds the moved Djinni in the list and puts the cursor on it. |
#define | DJINN_WINDOW_COPY_PALETTE 7 | The Djinn screen's own BG palettes. |
#define | DJINN_DIM_PALETTE 6 | |
#define | DJINN_DIM_LEVELS 12 | |
#define | DJINN_HELP_TOPICS 7 | The Djinn help's topics: Djinn, Set, Standby, Summon, Recovery, Class and Psynergy. |
#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 | GRID_CELL_WIDTH JAPANESE_OR(5, 6) | A grid cell's highlight is a tile narrower in Japanese. |
#define | TRADE_HELP_DJINNI_FIRST 1 | |
#define | DJINN_TUTORIAL_MESSAGE (window, offset) | Shows one tutorial message and waits for its text to finish. |
#define | DJINN_ENTRY_SET (-DJINN_ENTRY_IS_SET) | DJINN_ENTRY_IS_SET as a negative int, for entries built in Sint32. |
#define | DJINN_PREVIEW_DIGITS 3 | |
#define | DJINN_PREVIEW_CURRENT_X 48 | |
#define | DJINN_PREVIEW_LUCK_X 56 | |
#define | DJINN_PREVIEW_POOL_ARROW_X 62 | beside HP and PP |
#define | DJINN_PREVIEW_STAT_ARROW_X 70 | beside the other stats |
#define | DJINN_PREVIEW_PP_X 88 | |
#define | STAT_LABELS_MESSAGE ((Sint32)MsgPreviewStatLabel) | |
#define | PSYNERGY_GAINED_MESSAGE ((Sint32)MsgPsynergyGained) | |
#define | PSYNERGY_LOST_MESSAGE ((Sint32)MsgPsynergyLost) | |
#define | NO_CHANGE_MESSAGE ((Sint32)MsgPsynergyUnchanged) | |
#define | DJINN_PREVIEW_POOL_X 32 | HP and PP, four digits wide in every edition, and their maximum and the slash before it when nothing changes. |
#define | DJINN_PREVIEW_MAX_X 72 | |
#define | DJINN_PREVIEW_SLASH_X 64 | |
#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_PREVIEW_STAT_CHANGE (stat, digits, valueX, arrowX, row) | A stat on row row that the change moves: its new value, digits wide at valueX, and an arrow at arrowX pointing up or down. |
Enumerations
| Name | Description | |
|---|---|---|
enum | DJINN_MENU_STEP { DJINN_STEP_HANDLE_RESULT, DJINN_STEP_SELECT_DJINN, DJINN_STE … } | The Djinn screen's steps: choose a Djinni and what to do with it, confirm the change on its preview, then apply it. |
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_CURSOR, DJINN_REDRAW_DJINNI, DJINN_REDRAW_PAGE } | What mnDjinnMenuSelectDjinn redraws on its next pass. |
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, 56 pixels apart from x 32, at screen y 61 plus yOffset. |
Sint32 | mnGetDjinnGiveMessage (void) | Returns the Djinn tutorial's first line: the second copy's once FLAG_ALREADY_KNOWS_DJINN is set. |
void | mnLoadDjinnArrows (void) | Loads the Djinn preview's up and down stat arrows, the pictures djinn_arrow_up and djinn_arrow_down, into free VRAM cache slots, the state's resourceSlots 0 and 1, for mnIconCreateDjinnArrow. |
Sint32 | mnDjinnMenuRunScreen (void) | The Djinn menu's screen loop, one step at a time: choose a Djinni, then what to do with it (set it, put it on standby, give it or trade it), preview the change and apply it; L shows the party member's status and Select the help. |
Sint32 | mnDjinnMenuRun (void) | Runs the Djinn menu over the field: the field menu's Djinn screen (mnFieldMenuRun, FIELD_MENU_DJINN), and the Djinn tutorial. |
void | mnOpenBackdropScreen (void) | Opens the Djinn menu's backdrop screen: saves the tiles and palettes it covers, draws the backdrop, lists the party's Djinn (mnDjinnMenuBuildLists), then makes the list's cursor and the two page arrows and places the arrows at the list window's corners. |
Sint32 | mnDjinnMenuSelectDjinn (Sint32 mode) | The Djinn list's two choosers (DJINN_SELECT_MODE). |
Sint32 | mnDjinnMenuShowMemberStatus (void) | Shows the chosen party member's current stats and paged Psynergy list. |
Sint32 | mnDjinnMenuShowHelp (void) | The Djinn menu's help, opened by Select on the first chooser: a list of seven topics (Djinn, Set, Standby, Summon, Recovery, Class, Psynergy) with the chosen one's text typed beside it. |
Sint32 | mnDjinnMenuRunPreview (Uint32 mode) | Previews a give, trade, set or standby (mode, DJINN_COMPARE_OPERATION) before it is made: each party member's stats and Psynergy as they would be, the given Djinni hopping across, and "Is this OK?". |
Sint32 | gmDjinnTransferStub (Sint32 owner, Sint32 element, Sint32 index, Sint32 recipient) | Moves a Djinni from owner to recipient, set or on standby as it was; returns -1 when it cannot. |
void | mnDjinnMenuBuildLists (DJINN_MENU_BACKDROP *backdrop) | Lists each party member's Djinn of every element (mnDjinnListUnitEntries) into the backdrop's lists, with their counts. |
void | mnDjinnMenuAdjustPalettes (Sint32 brightnessDelta) | Makes the lighter and darker palettes the Djinn screen swaps a cell's palette for: each of WINDOW_PALETTE and BASIC_COLORS_PALETTE, brightnessDelta levels lighter in every channel, into the palette before it (HIGHLIGHT_PALETTE, for the chosen row, and palette 4), and DJINN_WINDOW_COPY_PALETTE, DJINN_DIM_LEVELS darker, into DJINN_DIM_PALETTE. |
Sint32 | mnPsynergyListDifference (PSYNERGY_ENTRY *before, PSYNERGY_ENTRY *after, Uint16 *actionsOut, Sint32 *gainedCountOut, Sint32 *lostCountOut) | Lists the Psynergy a party member has after a Djinn change, marking with DJINN_PREVIEW_GAINED those they lacked before, then appends what they had and lose, marked DJINN_PREVIEW_LOST. |
Sint32 | mnDjinnListUnitEntries (Uint16 *entriesOut, Sint32 memberId, Sint32 element) | Lists party member memberId's Djinn of element as list entries, set ones marked; for element -1, every element's, each entry with its party member. |
Sint32 | gmDjinnCanSetStub (Sint32 owner, Sint32 element, Sint32 index) | Returns 1 when the unit holds the Djinni and it can be set. |
Sint32 | gmDjinnIsSetStub (Sint32 owner, Sint32 element, Sint32 index) | Returns 1 when the Djinni is set on the unit. |
Sint32 | mnDjinnMenuGetEntryState (Uint32 entry) | The state of a Djinni's list entry (DJINNI_STATE): recovering when it can be neither set nor is set, otherwise set or on standby by DJINN_ENTRY_IS_SET. |
void | mnDjinnMenuDrawEntry (Sint32 window, Sint32 x, Sint32 y, Sint32 entry) | Draws a Djinni's list entry in a window: its name 8 pixels right of (x, y) and its element's icon tile at the tile under (x, y), then resets the text colour. |
void | mnDjinnMenuDrawPage (DJINN_MENU_BACKDROP *backdrop, Sint32 page) | Draws four party members' Djinn into the list window, a column of DJINN_COLUMN_WIDTH pixels each from party member page on: each member's Djinn grouped by element, standby in red, set in white and the rest in yellow. |
void | mnDjinnMenuDrawFirstPage (DJINN_MENU_BACKDROP *backdrop) | Draws the Djinn list's first page, the first four party members. |
void | mnWindowSetInteriorPaletteBitRect (WINDOW *panel, Sint32 x, Sint32 y, Sint32 width, Sint32 height, Sint32 palette) | Sets the palette of a rectangle of panel's interior, (x, y) and its size in tiles from the interior's corner, through mnWindowHighlightRectStub. |
void | mnUiPanelHighlightGridCell (WINDOW *panel, Sint32 index, Sint32 row, Sint32 selected) | Highlights the cell of a four-column grid at index's column and row's line, in HIGHLIGHT_PALETTE when selected and WINDOW_PALETTE otherwise. |
void | mnWindowSetRectPalette ( Sint32 x, Sint32 y, Sint32 width, Sint32 height, Sint32 palette) | Gives every cell of a tile rectangle that uses WINDOW_PALETTE the palette given instead, clipped to the screen, and marks its rows for upload. |
void | mnWindowSetInteriorRectPalette (WINDOW *panel, 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 | mnDjinnMarkTradeOnlyRecipients (Sint8 *table, Sint32 self) | Marks the party members the second Djinn chooser offers only Trade: requiresTrade[i] becomes 1 for each other party member i who, given one of srcMemberColumn's Djinn, would hold two Djinn or more beyond the giver's (mnDjinnCheckGiveBalance), else 0. |
void | mnSetPageArrowsLeftRight (Sint32 index, Sint32 count) | As mnSetPageArrowsUpDown, with the arrows hopping left and right: the Djinn menu's columns of party members. |
void | btDjinnRecoveryCountDownStub (void) | Brings the party's recovering Djinn one turn nearer, setting each that is ready, and returns 1 when any was set. |
Sint32 | mnDjinnMenuDrawStatPreview (Sint32 window, Sint32 x, Sint32 y, Sint32 memberId, Sint32 removePairSlot, Sint32 addPairSlot, Sint32 previewMode, Sint32 page, Sint32 side) | Previews a Djinn change on a member's status: the unit is saved, the change applied and the unit recalculated; page 0 draws the stats with an arrow beside each one that changes, later pages the Psynergy gained and lost; then the saved unit is copied back. |
Sint32 | mnDjinnMenuDrawPairPreview (Sint32 mode, Sint32 pageIndex) | Draws both sides of a Djinn preview for page pageIndex: the second member in the second window and the first in the first. |
void | mnIconCreatePsynergyIcon (WINDOW *window, Sint32 x, Sint32 y, Sint32 abilityId) | Shows ability abilityId's Psynergy icon at (x, y) of window, for the Djinn preview's Psynergy lists, when a VRAM cache slot is free. |
Sint32 | mnIconCreateDjinnArrow (WINDOW *window, Sint32 x, Sint32 y, Sint32 variant) | As mnIconCreateStatChangeArrow, with the up arrow raised 3 pixels and the down arrow 4. |
Variables
| Name | Description | |
|---|---|---|
extern Uint8 | DjinnMenuTextLevel [] | The level label: Lv; Nv. in Spanish, Niv in French. |
extern const char | DjinnMenuTextSlash [] | / between the current and the maximum HP and PP in the Djinn preview. |
Description
The Djinn menu: its backdrop screen, the Djinn list and the screen's loop.
Part of menu.c.
Macros in detail
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 mnDjinnMenuSelectDjinn() and mnUiPanelHighlightGridCell().
Definition at line 6 of file menu_djinn.c.
DJINN_COLUMN_WIDTH
#define DJINN_COLUMN_WIDTH (DJINN_COLUMN_TILES * 8)
Referenced by mnDjinnMenuDrawPage(), mnDjinnMenuPlacePartyFigures() and mnDjinnMenuSelectDjinn().
Definition at line 7 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 8 of file menu_djinn.c.
DJINN_FIGURE_Y
#define DJINN_FIGURE_Y 54
The y of the chosen Djinni's figure over its column, and its y while the Djinni is being chosen.
Referenced by mnDjinnMenuRunScreen() and mnDjinnMenuSelectDjinn().
Definition at line 11 of file menu_djinn.c.
DJINN_FIGURE_CHOOSING_Y
#define DJINN_FIGURE_CHOOSING_Y 62
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 12 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 16 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 19 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 22 of file menu_djinn.c.
DJINN_RESELECT_PAIR_ENTRY
#define DJINN_RESELECT_PAIR_ENTRY(menu, i)
Finds the moved Djinni in the list and puts the cursor on it.
Referenced by mnDjinnMenuRunScreen().
Definition at line 163 of file menu_djinn.c.
DJINN_WINDOW_COPY_PALETTE
#define DJINN_WINDOW_COPY_PALETTE 7
The Djinn screen's own BG palettes. DJINN_WINDOW_COPY_PALETTE keeps a copy of
WINDOW_PALETTE, and DJINN_DIM_PALETTE, before it, is that copy
DJINN_DIM_LEVELS colour levels darker: the greyed-out look of the Djinn list
behind the help and of the column a Djinni is taken from.
Referenced by mnDjinnMenuAdjustPalettes() and mnOpenBackdropScreen().
Definition at line 455 of file menu_djinn.c.
DJINN_DIM_PALETTE
#define DJINN_DIM_PALETTE 6
Referenced by mnDjinnMenuSelectDjinn(), mnDjinnMenuShowHelp() and mnOpenBackdropScreen().
Definition at line 456 of file menu_djinn.c.
DJINN_DIM_LEVELS
#define DJINN_DIM_LEVELS 12
Referenced by mnDjinnMenuAdjustPalettes().
Definition at line 457 of file menu_djinn.c.
DJINN_HELP_TOPICS
#define DJINN_HELP_TOPICS 7
The Djinn help's topics: Djinn, Set, Standby, Summon, Recovery, Class and Psynergy.
Referenced by mnDjinnMenuShowHelp().
Definition at line 460 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 602 of file menu_djinn.c.
DJINN_PREVIEW_LOST
#define DJINN_PREVIEW_LOST 0x4000
Referenced by mnDjinnMenuDrawStatPreview() and mnPsynergyListDifference().
Definition at line 603 of file menu_djinn.c.
GRID_CELL_WIDTH
#define GRID_CELL_WIDTH JAPANESE_OR(5, 6)
A grid cell's highlight is a tile narrower in Japanese.
Referenced by mnDjinnMenuSelectDjinn() and mnUiPanelHighlightGridCell().
Definition at line 814 of file menu_djinn.c.
TRADE_HELP_DJINNI_FIRST
#define TRADE_HELP_DJINNI_FIRST 1
#define TRADE_HELP_DJINNI_FIRST 0
Definition at lines 1077 and 1079 of file menu_djinn.c.
DJINN_TUTORIAL_MESSAGE
#define DJINN_TUTORIAL_MESSAGE(window, offset)
Shows one tutorial message and waits for its text to finish.
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 1093 of file menu_djinn.c.
DJINN_ENTRY_SET
#define DJINN_ENTRY_SET (-DJINN_ENTRY_IS_SET)
DJINN_ENTRY_IS_SET as a negative int, for entries built in Sint32.
Referenced by mnDjinnListUnitEntries().
Definition at line 1919 of file menu_djinn.c.
DJINN_PREVIEW_DIGITS
#define DJINN_PREVIEW_DIGITS 3
#define DJINN_PREVIEW_DIGITS 4
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 2046 and 2057 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 2047 and 2058 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 2048 and 2059 of file menu_djinn.c.
DJINN_PREVIEW_POOL_ARROW_X
#define DJINN_PREVIEW_POOL_ARROW_X 62
#define DJINN_PREVIEW_POOL_ARROW_X 64
beside HP and PP
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 2049 and 2060 of file menu_djinn.c.
DJINN_PREVIEW_STAT_ARROW_X
#define DJINN_PREVIEW_STAT_ARROW_X 70
#define DJINN_PREVIEW_STAT_ARROW_X 64
beside the other stats
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 2050 and 2061 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 2051 and 2062 of file menu_djinn.c.
STAT_LABELS_MESSAGE
#define STAT_LABELS_MESSAGE ((Sint32)MsgPreviewStatLabel)
#define STAT_LABELS_MESSAGE ((Sint32)MsgLuckRises + 13)
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 2052 and 2063 of file menu_djinn.c.
PSYNERGY_GAINED_MESSAGE
#define PSYNERGY_GAINED_MESSAGE ((Sint32)MsgPsynergyGained)
#define PSYNERGY_GAINED_MESSAGE ((Sint32)MsgDjinnStatusHelp + 1)
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 2053 and 2064 of file menu_djinn.c.
PSYNERGY_LOST_MESSAGE
#define PSYNERGY_LOST_MESSAGE ((Sint32)MsgPsynergyLost)
#define PSYNERGY_LOST_MESSAGE ((Sint32)MsgDjinnStatusHelp + 2)
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 2054 and 2065 of file menu_djinn.c.
NO_CHANGE_MESSAGE
#define NO_CHANGE_MESSAGE ((Sint32)MsgPsynergyUnchanged)
#define NO_CHANGE_MESSAGE ((Sint32)MsgDjinnCompareTrade + 1)
Referenced by mnDjinnMenuDrawStatPreview().
Definition at lines 2055 and 2066 of file menu_djinn.c.
DJINN_PREVIEW_POOL_X
#define DJINN_PREVIEW_POOL_X 32
HP and PP, four digits wide in every edition, and their maximum and the slash before it when nothing changes.
Referenced by mnDjinnMenuDrawStatPreview().
Definition at line 2071 of file menu_djinn.c.
DJINN_PREVIEW_MAX_X
#define DJINN_PREVIEW_MAX_X 72
Referenced by mnDjinnMenuDrawStatPreview().
Definition at line 2072 of file menu_djinn.c.
DJINN_PREVIEW_SLASH_X
#define DJINN_PREVIEW_SLASH_X 64
Referenced by mnDjinnMenuDrawStatPreview().
Definition at line 2073 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 2076 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 2079 of file menu_djinn.c.
DJINN_PREVIEW_STAT_CHANGE
#define DJINN_PREVIEW_STAT_CHANGE(stat, digits, valueX, arrowX, row)
A stat on row row that the change moves: its new value, digits wide at
valueX, and an arrow at arrowX pointing up or down.
Referenced by mnDjinnMenuDrawStatPreview().
Definition at line 2093 of file menu_djinn.c.
Enumerations in detail
DJINN_MENU_STEP
enum DJINN_MENU_STEP
The Djinn screen's steps: choose a Djinni and what to do with it, confirm the change on its preview, then apply it. Steps 1, 4 and 8, The Broken Seal's second choice for a trade, are gone.
| Enumerator | Value | Description |
|---|---|---|
DJINN_STEP_HANDLE_RESULT | 0 | After a chooser: a negative result closes |
DJINN_STEP_SELECT_DJINN | 2 | the screen, any other goes back to choosing a Djinni. |
DJINN_STEP_SELECT_ACTION | 3 | what to do with the chosen Djinni |
DJINN_STEP_CONFIRM_SET | 5 | |
DJINN_STEP_CONFIRM_STANDBY | 6 | |
DJINN_STEP_CONFIRM_GIVE | 7 | |
DJINN_STEP_CONFIRM_TRADE | 9 | |
DJINN_STEP_SHOW_STATUS | 10 | The status of the chosen column's party member. |
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 187 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 1104 of file menu_djinn.c.
DJINN_REDRAW
enum DJINN_REDRAW
What mnDjinnMenuSelectDjinn redraws on its next pass.
| Enumerator | Value | Description |
|---|---|---|
DJINN_REDRAW_CURSOR | 1 | the cursor, the figure and the help lines |
DJINN_REDRAW_DJINNI | 2 | as for the cursor, the figure from its start |
DJINN_REDRAW_PAGE | 4 | the four columns of the page as well |
Definition at line 1112 of file menu_djinn.c.
Functions in detail
mnWrapIndex
Sint32 mnWrapIndex(Sint32 value, Sint32 modulus)
Sint32 mnWrapIndex(Sint32 value, Sint32 modulus) __attribute__((const))
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 lines 27 and 1090 of file menu_djinn.c.
mnDjinnMenuPlacePartyFigures
Sint32 mnDjinnMenuPlacePartyFigures(Sint32 yOffset)
Places the four party figures over their Djinn columns, 56 pixels apart from x 32, at screen y 61 plus yOffset. Returns that y.
References Sint32.
Referenced by mnDjinnMenuRun() and mnDjinnMenuRunScreen().
Definition at line 34 of file menu_djinn.c.
mnGetDjinnGiveMessage
Sint32 mnGetDjinnGiveMessage(void)
Returns the Djinn tutorial's first line: the second copy's once
FLAG_ALREADY_KNOWS_DJINN is set.
References Sint32 and syGameFlagGet().
Referenced by mnDjinnMenuRunPreview() and mnDjinnMenuSelectDjinn().
Definition at line 54 of file menu_djinn.c.
mnDjinnMenuRunScreen
Sint32 mnDjinnMenuRunScreen(void)
The Djinn menu's screen loop, one step at a time: choose a Djinni, then what to do with it (set it, put it on standby, give it or trade it), preview the change and apply it; L shows the party member's status and Select the help. Returns -1 when B or Start leaves the Djinn list, and 0 when Start closes the menu from any other screen.
References gmDjinnPutOnStandbyStub(), gmDjinnRecoveryAddStandbyStub(), gmDjinnRecoveryRemoveStub(), gmDjinnSetStub(), gmDjinnTransferStub(), gmUnitCalculateStub(), mnDjinnFiguresSetSlotPos(), mnDjinnMenuBuildLists(), mnDjinnMenuPlacePartyFigures(), mnDjinnMenuRunPreview(), mnDjinnMenuSelectDjinn(), mnDjinnMenuShowHelp(), mnDjinnMenuShowMemberStatus(), mnOpenBackdropScreen(), mnWindowSpriteClearListStub(), result, Sint32, sySoundPlayStub() and sySynch().
Referenced by mnDjinnMenuRun().
Definition at lines 63 and 212 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. Types messages at
MESSAGE_SPEED_FAST while it runs (the tutorial's steps set
MESSAGE_SPEED_NORMAL for their messages, which stays until the menu closes)
and puts the player's speed back. Takes the menu state (HEAP_SLOT_MENU) and
the backdrop (DJINN_MENU_BACKDROP, from the EWRAM pool), and frees both
before returning, after putting back the field tiles and palettes the
backdrop saved. Returns 1, which makes the field menu open again.
References fdPartyClearUnusableShortcutsStub(), gmPartyListMembersStub(), MainRoutineStateWork, mnDjinnFiguresInitTopRow(), mnDjinnFiguresReleaseTopRow(), mnDjinnMenuPlacePartyFigures(), mnDjinnMenuRunScreen(), mnFreeArrows(), mnInitState(), mnItemMenuClose(), mnItemMenuInit(), mnLoadDjinnArrows(), mnPageArrowsDrawStub(), mnPaletteLightenHighlight(), mnResumeFieldEvents(), mnSuspendFieldEvents(), mnTextUseExtraTilesStub(), mnWindowCreateStub(), mnWindowDrawBorderStub(), mnWindowEraseBorderRectStub(), mnWindowMarkVisibleTextTilesStub(), Sint32, syGameFlagGet(), syHeapAllocateEWRAM(), syHeapRelease(), syHeapSlotAllocate(), syHeapSlotRelease(), sySynch() and syWordsCopy().
Referenced by scWorldMapExplainGivingDjinn() and scWorldMapMeetEcho().
Definition at line 73 of file menu_djinn.c.
mnOpenBackdropScreen
void mnOpenBackdropScreen(void)
Opens the Djinn menu's backdrop screen: saves the tiles and palettes it
covers, draws the backdrop, lists the party's Djinn (mnDjinnMenuBuildLists),
then makes the list's cursor and the two page arrows and places the arrows at
the list window's corners.
References MenuBackdropBorderTile, mnDjinnMenuAdjustPalettes(), mnDjinnMenuBuildLists(), mnGraphicsExpandVRAMTilesByColorTableStub(), mnIconCreateHandCursor(), mnVRAMBlockLoadResourceStub(), mnWindowSpriteClearListStub(), mnWindowSpriteCreateStub(), mnWindowUpdateOrCreate(), Sint32, syDMAXCopy(), syPaletteGetBasicSpriteColors(), sySynch(), syVRAMCacheFindFreeEntry(), syWordsCopy() and syWordsFill().
Referenced by mnDjinnMenuRunScreen().
Definition at lines 147 and 525 of file menu_djinn.c.
mnDjinnMenuSelectDjinn
Sint32 mnDjinnMenuSelectDjinn(Sint32 mode)
The Djinn list's two choosers (DJINN_SELECT_MODE). Choosing a Djinni, the
d-pad moves over every party member's column, R sets the Djinni or puts it on
standby at once, R held with Select does so to them all, L shows the party
member's status and Select the help. Choosing what to do with it, the cursor
picks its own column to set it or put it on standby, another member's header
to give it, or one of their Djinn to trade. While the tutorial runs, it
presses the keys itself. Returns a DJINN_MENU_RESULT.
References btDjinnRecoveryCountDownStub(), DjinnMenuTextLevel, gmDjinnPutOnStandbyStub(), gmDjinnRecoveryAddStandbyStub(), gmDjinnRecoveryRemoveStub(), gmDjinnSetStub(), gmUnitCalculateStub(), gmUnitGet(), MainRoutineStateWork, mnCreatePartyFigures(), mnCursorPos(), mnCursorSlide(), mnDjinnFiguresReplaceSlot(), mnDjinnFiguresSetSlotFacing(), mnDjinnFiguresSetSlotPhase(), mnDjinnFiguresSetSlotPos(), mnDjinnMarkTradeOnlyRecipients(), mnDjinnMenuDrawFirstPage(), mnDjinnMenuDrawPage(), mnDjinnMenuGetEntryState(), mnGetDjinnGiveMessage(), mnMessageAllTypedStub(), mnMessageArgumentPushStub(), mnMessageOpenWindowStub(), mnSetPageArrowsLeftRight(), mnTextDrawMessageAsTilesStub(), mnTextDrawMessageStub(), mnTextDrawNumberInWindowStub(), mnTextDrawStringAtOffsetStub(), mnUiPanelHighlightGridCell(), mnWindowClearInteriorTilesStub(), mnWindowCloseStub(), mnWindowSetInteriorRectPalette(), mnWindowSetTilemapEntryStub(), mnWindowSpriteClearListStub(), mnWindowSpriteRedrawSavedRectStub(), mnWrapIndex(), MsgClassName, PerWork, result, Sint32, sySoundPlayStub() and sySynch().
Referenced by mnDjinnMenuRunScreen().
Definition at lines 149 and 1126 of file menu_djinn.c.
mnDjinnMenuShowHelp
Sint32 mnDjinnMenuShowHelp(void)
The Djinn menu's help, opened by Select on the first chooser: a list of seven
topics (Djinn, Set, Standby, Summon, Recovery, Class, Psynergy) with the
chosen one's text typed beside it. The d-pad moves through the topics, and A
moves on once the text has finished. Returns DJINN_RESULT_BACK for B or
Select, back to the list, or DJINN_RESULT_START for Start, which closes the
Djinn menu.
References mnCursorPos(), mnMessageAllTypedStub(), mnMessageOpenDecodedStub(), mnTextDrawMessageAsTilesStub(), mnTextDrawMessageStub(), mnUpdatePartyFigures(), mnWindowCloseStub(), mnWindowCreateStub(), mnWindowMarkVisibleTextTilesStub(), mnWindowSetInteriorPaletteBitRect(), mnWindowSetInteriorRectPalette(), mnWindowSetRectPalette(), mnWindowSpriteClearListStub(), mnWindowSpritePrepareForRedrawStub(), mnWrapIndex(), PerWork, result, Sint32, sySetEvent(), sySoundPlayStub(), sySynch() and syVRAMCacheFreeEntry().
Referenced by mnDjinnMenuRunScreen().
Definition at lines 151 and 942 of file menu_djinn.c.
gmDjinnTransferStub
Sint32 gmDjinnTransferStub(Sint32 owner, Sint32 element, Sint32 index, Sint32 recipient)
Moves a Djinni from owner to recipient, set or on standby as it was; returns -1 when it cannot.
Referenced by mnDjinnMenuRunScreen().
Definition at line 155 of file menu_djinn.c.
mnDjinnMenuBuildLists
void mnDjinnMenuBuildLists(DJINN_MENU_BACKDROP *backdrop)
Lists each party member's Djinn of every element (mnDjinnListUnitEntries)
into the backdrop's lists, with their counts.
References mnDjinnListUnitEntries() and Sint32.
Referenced by mnDjinnMenuDrawPage(), mnDjinnMenuRunScreen() and mnOpenBackdropScreen().
Definition at lines 160 and 676 of file menu_djinn.c.
mnDjinnMenuAdjustPalettes
void mnDjinnMenuAdjustPalettes(Sint32 brightnessDelta)
Makes the lighter and darker palettes the Djinn screen swaps a cell's palette
for: each of WINDOW_PALETTE and BASIC_COLORS_PALETTE, brightnessDelta levels
lighter in every channel, into the palette before it (HIGHLIGHT_PALETTE, for
the chosen row, and palette 4), and DJINN_WINDOW_COPY_PALETTE,
DJINN_DIM_LEVELS darker, into DJINN_DIM_PALETTE. Channels stay within 0 to
31.
References Sint32.
Referenced by mnOpenBackdropScreen().
Definition at line 468 of file menu_djinn.c.
mnPsynergyListDifference
Sint32 mnPsynergyListDifference(PSYNERGY_ENTRY *before, PSYNERGY_ENTRY *after, Uint16 *actionsOut, Sint32 *gainedCountOut, Sint32 *lostCountOut)
Lists the Psynergy a party member has after a Djinn change, marking with
DJINN_PREVIEW_GAINED those they lacked before, then appends what they had and
lose, marked DJINN_PREVIEW_LOST. Returns how many it wrote, and the gains and
losses in the two counts.
References Sint32.
Referenced by mnDjinnMenuDrawStatPreview(), mnDjinnMenuRunPreview() and mnDjinnMenuShowMemberStatus().
Definition at line 609 of file menu_djinn.c.
mnDjinnListUnitEntries
Sint32 mnDjinnListUnitEntries(Uint16 *entriesOut, Sint32 memberId, Sint32 element)
Lists party member memberId's Djinn of element as list entries, set ones marked; for element -1, every element's, each entry with its party member.
References gmUnitGet() and Sint32.
Referenced by mnDjinnMenuBuildLists().
Definition at lines 671 and 1923 of file menu_djinn.c.
mnDjinnMenuGetEntryState
Sint32 mnDjinnMenuGetEntryState(Uint32 entry)
The state of a Djinni's list entry (DJINNI_STATE): recovering when it can be
neither set nor is set, otherwise set or on standby by DJINN_ENTRY_IS_SET.
mnDjinnMenuDrawPage colours each name by it.
References gmDjinnCanSetStub(), gmDjinnIsSetStub() and Sint32.
Referenced by mnDjinnMenuDrawPage() and mnDjinnMenuSelectDjinn().
Definition at line 696 of file menu_djinn.c.
mnDjinnMenuDrawEntry
void mnDjinnMenuDrawEntry(Sint32 window, Sint32 x, Sint32 y, Sint32 entry)
Draws a Djinni's list entry in a window: its name 8 pixels right of (x, y) and its element's icon tile at the tile under (x, y), then resets the text colour. The names run 20 to an element.
References mnTextDrawMessageAsTilesStub(), mnTextSetColorStub(), mnWindowSetTilemapEntryStub() and Sint32.
Referenced by mnDjinnMenuDrawPage() and mnDjinnMenuRunPreview().
Definition at line 721 of file menu_djinn.c.
mnDjinnMenuDrawPage
void mnDjinnMenuDrawPage(DJINN_MENU_BACKDROP *backdrop, Sint32 page)
Draws four party members' Djinn into the list window, a column of
DJINN_COLUMN_WIDTH pixels each from party member page on: each member's
Djinn grouped by element, standby in red, set in white and the rest in
yellow. Over the list it labels the unleash effects when the party has few
enough Djinn to show them.
References gmPartyCountMembersStub(), gmPartySumDjinnCountsStub(), mnDjinnMenuBuildLists(), mnDjinnMenuDrawEntry(), mnDjinnMenuGetEntryState(), mnTextDrawMessageAsTilesStub(), mnTextSetColorStub(), mnWindowDrawDividerLineStub(), mnWindowSpriteRedrawSavedRectStub(), Sint32 and sySynch().
Referenced by mnDjinnMenuDrawFirstPage() and mnDjinnMenuSelectDjinn().
Definition at line 741 of file menu_djinn.c.
mnDjinnMenuDrawFirstPage
void mnDjinnMenuDrawFirstPage(DJINN_MENU_BACKDROP *backdrop)
Draws the Djinn list's first page, the first four party members.
References mnDjinnMenuDrawPage().
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 817 of file menu_djinn.c.
mnWindowSetInteriorPaletteBitRect
void mnWindowSetInteriorPaletteBitRect(WINDOW *panel, Sint32 x, Sint32 y, Sint32 width, Sint32 height, Sint32 palette)
Sets the palette of a rectangle of panel's interior, (x, y) and its size in
tiles from the interior's corner, through mnWindowHighlightRectStub.
References mnWindowHighlightRectStub() and Sint32.
Referenced by mnDjinnMenuShowHelp() and mnUiPanelHighlightGridCell().
Definition at line 824 of file menu_djinn.c.
mnUiPanelHighlightGridCell
void mnUiPanelHighlightGridCell(WINDOW *panel, Sint32 index, Sint32 row, Sint32 selected)
Highlights the cell of a four-column grid at index's column and row's line,
in HIGHLIGHT_PALETTE when selected and WINDOW_PALETTE otherwise.
References mnWindowSetInteriorPaletteBitRect() and Sint32.
Referenced by mnDjinnMenuSelectDjinn().
Definition at line 837 of file menu_djinn.c.
mnWindowSetRectPalette
void mnWindowSetRectPalette( Sint32 x, Sint32 y, Sint32 width, Sint32 height, Sint32 palette)
Gives every cell of a tile rectangle that uses WINDOW_PALETTE the palette
given instead, clipped to the screen, and marks its rows for upload.
References Sint32.
Referenced by mnDjinnMenuShowHelp() and mnWindowSetInteriorRectPalette().
Definition at line 858 of file menu_djinn.c.
mnWindowSetInteriorRectPalette
void mnWindowSetInteriorRectPalette(WINDOW *panel, 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() and Sint32.
Referenced by mnDjinnMenuSelectDjinn() and mnDjinnMenuShowHelp().
Definition at line 925 of file menu_djinn.c.
mnDjinnMenuDrawStatPreview
Sint32 mnDjinnMenuDrawStatPreview(Sint32 window, Sint32 x, Sint32 y, Sint32 memberId, Sint32 removePairSlot, Sint32 addPairSlot, Sint32 previewMode, Sint32 page, Sint32 side)
Previews a Djinn change on a member's status: the unit is saved, the change applied and the unit recalculated; page 0 draws the stats with an arrow beside each one that changes, later pages the Psynergy gained and lost; then the saved unit is copied back.
References DjinnMenuTextLevel, DjinnMenuTextSlash, gmAbilityGetDefinitionStub(), gmDjinnGiveStub(), gmDjinnPutOnStandbyStub(), gmDjinnSetStub(), gmUnitCalculateStub(), gmUnitGet(), mnIconCreatePsynergyIcon(), mnPortraitCreateStub(), mnPsynergyListDifference(), mnTextDrawMessageAsTilesStub(), mnTextDrawNumberAtOffsetStub(), mnTextDrawNumberInWindowStub(), mnTextDrawStringAtOffsetStub(), mnTextSetColorStub(), mnWindowDrawDividerLineStub(), mnWindowSetTilemapEntryStub(), MsgClassName, Sint32, syHeapAllocate() and syHeapRelease().
Referenced by mnDjinnMenuDrawPairPreview(), mnDjinnMenuRunPreview() and mnDjinnMenuShowMemberStatus().
Definition at lines 1971 and 2114 of file menu_djinn.c.
mnDjinnMenuDrawPairPreview
Sint32 mnDjinnMenuDrawPairPreview(Sint32 mode, Sint32 pageIndex)
Draws both sides of a Djinn preview for page pageIndex: the second member
in the second window and the first in the first. DJINN_COMPARE_TRADE draws
the pair's members, both as a trade (DJINN_PREVIEW_TRADE); any other mode the
shown members, the second gaining the Djinni and the first losing it. Returns
1.
References mnDjinnMenuDrawStatPreview() and Sint32.
Referenced by mnDjinnMenuRunPreview().
Definition at line 1986 of file menu_djinn.c.
Variables in detail
DjinnMenuTextLevel
extern Uint8 DjinnMenuTextLevel[]
The level label: Lv; Nv. in Spanish, Niv in French.
Referenced by mnDjinnMenuDrawStatPreview() and mnDjinnMenuSelectDjinn().
Definition at line 1083 of file menu_djinn.c.