Skip to Content
The Alchemy Project

src/menu/menu_djinn_preview.c

The Djinn menu's preview of a set, standby, give or trade before it is made, the party member's "Char. More…

Included by menu.c.

Macros

NameDescription
#defineDJINN_PREVIEW_HOP_PERIOD 60The Djinni figures of a give or trade preview hop across between the two party members once every DJINN_PREVIEW_HOP_PERIOD ticks, a few ticks into it: a hop takes DJINN_PREVIEW_HOP_TICKS ticks along half a sine wave of DJINN_PREVIEW_HOP_SINE_HEIGHT pixels, cut flat at DJINN_PREVIEW_HOP_HEIGHT.
#defineDJINN_PREVIEW_HOP_TICKS 30
#defineDJINN_PREVIEW_HOP_DELAY 5
#defineDJINN_PREVIEW_HOP_SINE_HEIGHT 16
#defineDJINN_PREVIEW_HOP_HEIGHT 6
#defineDJINN_PREVIEW_HOP_DEPTH 12
#defineDJINN_PREVIEW_SLIDE_STEPS 35
#defineDJINN_PREVIEW_PSYNERGY_ROWS 6The Psynergy one page of the preview lists: a row fewer when the change has its gains and losses to sum up below them.
#defineDJINN_TUTORIAL_COVERED_ROWS 8The tilemap rows at the top of the screen that a tutorial message covers, saved before it opens and put back after it closes.
#defineDJINN_DIFFERENCE_ENTRIES 48The most Psynergy mnPsynergyListDifference lists, gained and lost together.
#defineDJINN_PREVIEW_REDRAW 1What mnDjinnMenuRunPreview redraws on its next pass: both windows, or both windows a tick later.
#defineDJINN_PREVIEW_REDRAW_LATER 2
#defineDJINN_TUTORIAL_SET_CURSOR (menu, value)Shows or hides the menu's cursor while a line of the Djinn tutorial points at the preview.

Functions

NameDescription
voidmnCreatePairFigures (Sint32 first, Sint32 second)mnCreatePartyFigures for two characters (-1 for none): their figures in entries 0 and 1, as the Djinn preview shows the pair a Djinni passes between.
Sint32mnDjinnMenuRunPreview (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?".
Sint32mnDjinnMenuShowMemberStatus (void)Shows the chosen party member's current stats and paged Psynergy list.
Sint32mnDjinnCheckGiveBalance (Sint32 self, Sint32 other)Returns whether column from could give column to a Djinni: not when the receiver would then hold two Djinn or more beyond the giver's.
Sint32mnDjinnMarkTradeOnlyRecipients (Sint8 *requiresTrade, Sint32 srcMemberColumn)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.
voidmnDjinnCountOwned (Uint8 *counts)Writes how many Djinn each party member holds, set or not, into ownedCounts by list column.

Description

The Djinn menu's preview of a set, standby, give or trade before it is made, the party member's "Char. Status" page, and the check that keeps the party's Djinn balanced. Part of menu.c.

Macros in detail

DJINN_PREVIEW_HOP_PERIOD

#define DJINN_PREVIEW_HOP_PERIOD 60

The Djinni figures of a give or trade preview hop across between the two party members once every DJINN_PREVIEW_HOP_PERIOD ticks, a few ticks into it: a hop takes DJINN_PREVIEW_HOP_TICKS ticks along half a sine wave of DJINN_PREVIEW_HOP_SINE_HEIGHT pixels, cut flat at DJINN_PREVIEW_HOP_HEIGHT. A figure may sink to DJINN_PREVIEW_HOP_DEPTH below its line, which the half sine never does, and its slide would wrap after DJINN_PREVIEW_SLIDE_STEPS steps, which a hop never reaches.

Referenced by mnDjinnMenuRunPreview() and mnDjinnMenuShowMemberStatus().

Definition at line 14 of file menu_djinn_preview.c.

DJINN_PREVIEW_HOP_TICKS

#define DJINN_PREVIEW_HOP_TICKS 30

Referenced by mnDjinnMenuRunPreview() and mnDjinnMenuShowMemberStatus().

Definition at line 15 of file menu_djinn_preview.c.

DJINN_PREVIEW_HOP_DELAY

#define DJINN_PREVIEW_HOP_DELAY 5

Referenced by mnDjinnMenuRunPreview() and mnDjinnMenuShowMemberStatus().

Definition at line 16 of file menu_djinn_preview.c.

DJINN_PREVIEW_HOP_SINE_HEIGHT

#define DJINN_PREVIEW_HOP_SINE_HEIGHT 16

Referenced by mnDjinnMenuRunPreview().

Definition at line 17 of file menu_djinn_preview.c.

DJINN_PREVIEW_HOP_HEIGHT

#define DJINN_PREVIEW_HOP_HEIGHT 6

Referenced by mnDjinnMenuRunPreview().

Definition at line 18 of file menu_djinn_preview.c.

DJINN_PREVIEW_HOP_DEPTH

#define DJINN_PREVIEW_HOP_DEPTH 12

Referenced by mnDjinnMenuRunPreview().

Definition at line 19 of file menu_djinn_preview.c.

DJINN_PREVIEW_SLIDE_STEPS

#define DJINN_PREVIEW_SLIDE_STEPS 35

Referenced by mnDjinnMenuRunPreview().

Definition at line 20 of file menu_djinn_preview.c.

DJINN_PREVIEW_PSYNERGY_ROWS

#define DJINN_PREVIEW_PSYNERGY_ROWS 6

The Psynergy one page of the preview lists: a row fewer when the change has its gains and losses to sum up below them.

Referenced by mnDjinnMenuRunPreview() and mnDjinnMenuShowMemberStatus().

Definition at line 24 of file menu_djinn_preview.c.

DJINN_TUTORIAL_COVERED_ROWS

#define DJINN_TUTORIAL_COVERED_ROWS 8

The tilemap rows at the top of the screen that a tutorial message covers, saved before it opens and put back after it closes.

Referenced by mnDjinnMenuRunPreview().

Definition at line 28 of file menu_djinn_preview.c.

DJINN_DIFFERENCE_ENTRIES

#define DJINN_DIFFERENCE_ENTRIES 48

The most Psynergy mnPsynergyListDifference lists, gained and lost together.

Referenced by mnDjinnMenuRunPreview() and mnDjinnMenuShowMemberStatus().

Definition at line 31 of file menu_djinn_preview.c.

DJINN_PREVIEW_REDRAW

#define DJINN_PREVIEW_REDRAW 1

What mnDjinnMenuRunPreview redraws on its next pass: both windows, or both windows a tick later.

Referenced by mnDjinnMenuRunPreview().

Definition at line 35 of file menu_djinn_preview.c.

DJINN_PREVIEW_REDRAW_LATER

#define DJINN_PREVIEW_REDRAW_LATER 2

Referenced by mnDjinnMenuRunPreview().

Definition at line 36 of file menu_djinn_preview.c.

DJINN_TUTORIAL_SET_CURSOR

#define DJINN_TUTORIAL_SET_CURSOR(menu, value)

Shows or hides the menu's cursor while a line of the Djinn tutorial points at the preview.

Referenced by mnDjinnMenuRunPreview().

Definition at line 40 of file menu_djinn_preview.c.

Functions in detail

mnDjinnMenuRunPreview

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?". R turns between both members' stats and each one's Psynergy, Left and Right their pages. Returns DJINN_RESULT_CONFIRMED for Yes, DJINN_RESULT_BACK for No or B, and DJINN_RESULT_START for Start.

References gmDjinnGiveStub(), gmDjinnPutOnStandbyStub(), gmDjinnSetStub(), gmPartyListMembersStub(), gmUnitCalculateStub(), gmUnitGet(), MainRoutineStateWork, MenuBackdropBorderTile, mnCreatePairFigures(), mnCursorPos(), mnCursorSlide(), mnDjinnFiguresSetSlotPhase(), mnDjinnFiguresSetSlotPos(), mnDjinnMenuDrawEntry(), mnDjinnMenuDrawPairPreview(), mnDjinnMenuDrawStatPreview(), mnGetDjinnGiveMessage(), mnMessageAllTypedStub(), mnMessageArgumentPushStub(), mnMessageOpenWindowStub(), mnPsynergyListDifference(), mnTextDrawMessageAsTilesStub(), mnTextSetColorStub(), mnUpdatePartyFigures(), mnWindowClearInteriorTilesStub(), mnWindowCloseIfOpen(), mnWindowCloseStub(), mnWindowMarkVisibleTextTilesStub(), mnWindowSetTilemapEntryStub(), mnWindowSpriteClearListStub(), mnWindowSpritePrepareForRedrawStub(), mnWindowSpriteRedrawSavedRectStub(), mnWindowUpdateOrCreate(), mnWrapIndex(), PerWork, result, Sint32, syHeapAllocateEWRAM(), syHeapRelease(), syInputResetKeyRepeat(), sySetEvent(), sySin(), sySoundPlayStub(), sySynch(), syWordsCopy() and syWordsFill().

Referenced by mnDjinnMenuRunScreen().

Definition at line 52 of file menu_djinn_preview.c.

mnDjinnMenuShowMemberStatus

Sint32 mnDjinnMenuShowMemberStatus(void)

Shows the chosen party member's current stats and paged Psynergy list. Opened by L on the Djinn list ("Char. Status"): the party member's stats on the left, their Psynergy six to a page on the right, which Left and Right turn. Returns DJINN_RESULT_BACK for A, B, L or R, and DJINN_RESULT_START for Start, which closes the Djinn menu.

References gmUnitGet(), MenuBackdropBorderTile, mnDjinnFiguresSetSlotPos(), mnDjinnMenuDrawStatPreview(), mnPsynergyListDifference(), mnTextDrawMessageAsTilesStub(), mnUpdatePartyFigures(), mnWindowCloseIfOpen(), mnWindowSetTilemapEntryStub(), mnWindowSpriteClearListStub(), mnWindowSpritePrepareForRedrawStub(), mnWindowSpriteRedrawSavedRectStub(), mnWindowUpdateOrCreate(), mnWrapIndex(), PerWork, result, Sint32, syHeapAllocateEWRAM(), syHeapRelease(), syInputResetKeyRepeat(), sySetEvent(), sySoundPlayStub() and sySynch().

Referenced by mnDjinnMenuRunScreen().

Definition at line 627 of file menu_djinn_preview.c.

mnDjinnCheckGiveBalance

Sint32 mnDjinnCheckGiveBalance(Sint32 self, Sint32 other)

Sint32 mnDjinnCheckGiveBalance(Sint32 from, Sint32 to)

Returns whether column from could give column to a Djinni: not when the receiver would then hold two Djinn or more beyond the giver's.

References mnDjinnCountOwned() and Sint32.

Referenced by mnDjinnMarkTradeOnlyRecipients().

Definition at lines 818 and 860 of file menu_djinn_preview.c.

mnDjinnMarkTradeOnlyRecipients

Sint32 mnDjinnMarkTradeOnlyRecipients(Sint8 *requiresTrade, Sint32 srcMemberColumn)

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. Returns how many there are.

References mnDjinnCheckGiveBalance() and Sint32.

Referenced by mnDjinnMenuSelectDjinn().

Definition at line 824 of file menu_djinn_preview.c.

mnDjinnCountOwned

void mnDjinnCountOwned(Uint8 *counts)

void mnDjinnCountOwned(Uint8 *ownedCounts)

Writes how many Djinn each party member holds, set or not, into ownedCounts by list column.

References gmUnitGet() and Sint32.

Referenced by mnDjinnCheckGiveBalance().

Definition at lines 856 and 876 of file menu_djinn_preview.c.