Skip to Content
The Alchemy Project

src/menu/menu_djinn_preview.c

Previewing a Djinn change before it is made, the chosen party member's status, and the checks that keep the party members' Djinn counts even. More…

Included by menu.c.

Macros

NameDescription
#defineDJINN_PREVIEW_HOP_TICKS 30The Djinni figures of a give or trade preview hop across between the two party members once a second, 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_DELAY 5
#defineDJINN_PREVIEW_HOP_SINE_HEIGHT 16
#defineDJINN_PREVIEW_HOP_HEIGHT 6
#defineDJINN_PREVIEW_HOP_DEPTH 12
#defineDJINN_PREVIEW_SLIDE_TICKS 35
#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_TUTORIAL_SET_CURSOR (menu, value)Shows or hides the menu's cursor around a line of the Djinn tutorial.

Functions

NameDescription
Sint32mnDjinnMenuRunPreview (Uint32 mode)The Djinn menu's preview of a give, trade, set or standby (mode, enum DJINN_COMPARE_OPERATION): both party members' stats and Psynergy as the change would leave them, paged with R, the Djinni figures hopping across, and "Is this OK?".
Sint32mnDjinnMenuShowMemberStatus (void)L on the Djinn list: the chosen party member's stats and Psynergy as they are now, the Psynergy paged with Left and Right, until A, B, L or R goes back (DJINN_RESULT_BACK) or Start closes the menu (DJINN_RESULT_START).
Sint32mnDjinnMarkTradeOnlyRecipients (Sint8 *requiresTrade, Sint32 srcMemberColumn)Marks in requiresTrade, by list column, each party member the one in srcMemberColumn cannot give a Djinni to without two party members' Djinn counts ending more than one apart: with them it can only trade.
Sint32mnDjinnCheckGiveBalance (Sint32 srcMemberColumn, Sint32 targetMemberColumn)Returns 1 when a Djinni given from the party member in srcMemberColumn to the one in targetMemberColumn would leave every two party members within one Djinni of each other, else 0.
voidmnDjinnCountOwned (Uint8 *ownedCounts)Writes each party member's Djinn count, set or not, into ownedCounts by list column.

Description

Previewing a Djinn change before it is made, the chosen party member's status, and the checks that keep the party members' Djinn counts even. Part of menu.c.

Macros in detail

DJINN_PREVIEW_HOP_TICKS

#define DJINN_PREVIEW_HOP_TICKS 30

The Djinni figures of a give or trade preview hop across between the two party members once a second, 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. It would dip no deeper than DJINN_PREVIEW_HOP_DEPTH below its line, and its slide would start over after DJINN_PREVIEW_SLIDE_TICKS ticks; a hop reaches neither.

Referenced by mnDjinnMenuRunPreview() and mnDjinnMenuShowMemberStatus().

Definition at line 14 of file menu_djinn_preview.c.

DJINN_PREVIEW_HOP_DELAY

#define DJINN_PREVIEW_HOP_DELAY 5

Referenced by mnDjinnMenuRunPreview() and mnDjinnMenuShowMemberStatus().

Definition at line 15 of file menu_djinn_preview.c.

DJINN_PREVIEW_HOP_SINE_HEIGHT

#define DJINN_PREVIEW_HOP_SINE_HEIGHT 16

Referenced by mnDjinnMenuRunPreview().

Definition at line 16 of file menu_djinn_preview.c.

DJINN_PREVIEW_HOP_HEIGHT

#define DJINN_PREVIEW_HOP_HEIGHT 6

Referenced by mnDjinnMenuRunPreview().

Definition at line 17 of file menu_djinn_preview.c.

DJINN_PREVIEW_HOP_DEPTH

#define DJINN_PREVIEW_HOP_DEPTH 12

Referenced by mnDjinnMenuRunPreview().

Definition at line 18 of file menu_djinn_preview.c.

DJINN_PREVIEW_SLIDE_TICKS

#define DJINN_PREVIEW_SLIDE_TICKS 35

Referenced by mnDjinnMenuRunPreview().

Definition at line 19 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 23 of file menu_djinn_preview.c.

DJINN_TUTORIAL_SET_CURSOR

#define DJINN_TUTORIAL_SET_CURSOR(menu, value)

Shows or hides the menu's cursor around a line of the Djinn tutorial.

Referenced by mnDjinnMenuRunPreview().

Definition at line 26 of file menu_djinn_preview.c.

Functions in detail

mnDjinnMenuRunPreview

Sint32 mnDjinnMenuRunPreview(Uint32 mode)

The Djinn menu's preview of a give, trade, set or standby (mode, enum DJINN_COMPARE_OPERATION): both party members' stats and Psynergy as the change would leave them, paged with R, the Djinni figures hopping across, and "Is this OK?". Each unit is changed, measured and put back; nothing is applied.

References firstIndex, gmDjinnGiveStub(), gmDjinnPutOnStandbyStub(), gmDjinnSetStub(), gmUnitCalculateStub(), gmUnitGetStub(), MainRoutineStateWork, MenuChangeArrowTile, mnCursorPos(), mnCursorSlide(), mnDjinnFiguresSetSlotPhase(), mnDjinnFiguresSetSlotPos(), mnDjinnMenuDrawPairPreview(), mnDjinnMenuDrawStatPreview(), mnMessageAllTypedStub(), mnMessageArgumentPushStub(), mnMessageOpenWindowStub(), mnPlacePartyFigures(), mnPsynergyListDifference(), mnTextDrawMessageAsTilesStub(), mnTextSetColorStub(), mnWindowClearInteriorTilesStub(), mnWindowCloseIfOpen(), mnWindowCloseStub(), mnWindowMarkVisibleTextTilesStub(), mnWindowSetTilemapEntryStub(), mnWindowSpriteClearListStub(), mnWindowSpritePrepareForRedrawStub(), mnWindowSpriteRedrawSavedRectStub(), mnWindowUpdateOrCreate(), mnWrapIndex(), PerPush, PerRepeat, secondIndex, Sint32, state, syHeapAllocateEWRAM(), syHeapRelease(), syInputResetKeyRepeat(), syMulFX(), sySetEvent(), sySin(), sySoundPlayStub(), sySynch(), syWordsCopy() and syWordsFill().

Referenced by mnDjinnMenuRunScreen().

Definition at line 37 of file menu_djinn_preview.c.

mnDjinnMenuShowMemberStatus

Sint32 mnDjinnMenuShowMemberStatus(void)

L on the Djinn list: the chosen party member's stats and Psynergy as they are now, the Psynergy paged with Left and Right, until A, B, L or R goes back (DJINN_RESULT_BACK) or Start closes the menu (DJINN_RESULT_START).

References gmUnitGetStub(), MenuChangeArrowTile, mnDjinnFiguresSetSlotPos(), mnDjinnMenuDrawStatPreview(), mnPlacePartyFigures(), mnPsynergyListDifference(), mnTextDrawMessageAsTilesStub(), mnWindowCloseIfOpen(), mnWindowSetTilemapEntryStub(), mnWindowSpriteClearListStub(), mnWindowSpritePrepareForRedrawStub(), mnWindowSpriteRedrawSavedRectStub(), mnWindowUpdateOrCreate(), mnWrapIndex(), PerPush, PerRepeat, Sint32, state, syHeapAllocateEWRAM(), syHeapRelease(), syInputResetKeyRepeat(), sySetEvent(), sySoundPlayStub(), sySynch(), syWordsCopy() and syWordsFill().

Referenced by mnDjinnMenuRunScreen().

Definition at line 737 of file menu_djinn_preview.c.

mnDjinnMarkTradeOnlyRecipients

Sint32 mnDjinnMarkTradeOnlyRecipients(Sint8 *requiresTrade, Sint32 srcMemberColumn)

Marks in requiresTrade, by list column, each party member the one in srcMemberColumn cannot give a Djinni to without two party members' Djinn counts ending more than one apart: with them it can only trade. Returns how many there are.

References mnDjinnCheckGiveBalance() and Sint32.

Referenced by mnDjinnMenuSelectDjinn().

Definition at line 938 of file menu_djinn_preview.c.

mnDjinnCheckGiveBalance

Sint32 mnDjinnCheckGiveBalance(Sint32 srcMemberColumn, Sint32 targetMemberColumn)

Returns 1 when a Djinni given from the party member in srcMemberColumn to the one in targetMemberColumn would leave every two party members within one Djinni of each other, else 0.

References mnDjinnCountOwned() and Sint32.

Referenced by mnDjinnMarkTradeOnlyRecipients().

Definition at line 973 of file menu_djinn_preview.c.

mnDjinnCountOwned

void mnDjinnCountOwned(Uint8 *ownedCounts)

Writes each party member's Djinn count, set or not, into ownedCounts by list column.

References gmUnitGetStub() and Sint32.

Referenced by mnDjinnCheckGiveBalance().

Definition at line 1013 of file menu_djinn_preview.c.