Skip to Content
The Alchemy Project

src/menu/menu_psynergy.c

The Psynergy menu: the field menu's Psynergy screen, the party member and Psynergy lists, targets, and the L and R shortcuts. More…

Included by menu.c.

Macros

NameDescription
#defineABILITY_DESCRIPTION_MASK 0x1ffThe bits of a listed Psynergy the info window's description is found by: nine, where the list's other reads take PSYNERGY_ABILITY_MASK's fourteen.
#definePSYNERGY_MENU_SHORTCUT_HELP 2PSYNERGY_MENU_STATE.flags: the Psynergy list shows the shortcut help (Select held).
#defineMENU_TARGET_WHOLE_PARTY 9memberIds[1] for the whole party
#definePSYNERGY_MENU_USED 1PSYNERGY_MENU_STATE.flags: set after a use or a cancelled target.
#defineCOLON_NAME_WIDTH_LIMIT 11Japanese drops the colon after "L" and "R" and draws the ability's name 8 pixels further left when that name is wider than this.
#defineOWNER_NAME_WIDTH_LIMIT 10German, Spanish, French and Italian leave out the owner's name when the ability's name is wider than this.
#definePSYNERGY_PAGE_ICONS_X JAPANESE_OR(120, 112)The Japanese page draws its page icons, PP heading and names at other columns.
#definePSYNERGY_PP_HEADING_X JAPANESE_OR(72, 96)
#definePSYNERGY_NAME_X JAPANESE_OR(32, 16)
#definePSYNERGY_LIST_CURSOR_X JAPANESE_OR(98, 88)The Japanese list puts its cursor further right.
#definePSYNERGY_ABILITY_OF (entry) (((Uint32)(entry) << 18) >> 18)A Psynergy entry's action id, its PSYNERGY_ABILITY_MASK bits, taken out by shifts.

Enumerations

NameDescription
enumPSYNERGY_MENU_STEP { PSYNERGY_STEP_MEMBER, PSYNERGY_STEP_LIST, PSYNERGY_STEP_CLAS … }The steps of the Psynergy menu (mnPsynergyMenuRunSteps).
enumPSYNERGY_SHORTCUT { PSYNERGY_SHORTCUT_L, PSYNERGY_SHORTCUT_R }The Psynergy shortcut a choice sets (mnPsynergyMenuSetShortcut).
enumPSYNERGY_MENU_MODE { PSYNERGY_MODE_USE, PSYNERGY_MODE_SET_L, PSYNERGY_MODE_SET_R }What the Psynergy menu is open for (PSYNERGY_MENU_STATE.mode).

Functions

NameDescription
BoolmnPsynergyMenuIsActionRestricted (Sint32 actionEntry)Returns 1 when actionEntry cannot be used from the menu: it has no field effect and is not usable both in the field and in battle.
Sint32mnPsynergyMenuRunSteps (Sint32 *outMember, Sint32 *unused, Sint32 *outAction)Runs the Psynergy menu's steps: choose a party member and one of their Psynergy, then use it on a member (or the whole party), or, in the shortcut modes, set it as the L or R shortcut.
Sint32mnPsynergyMenuRun (void)The field menu's Psynergy screen (mnFieldMenuRun, FIELD_MENU_PSYNERGY), over the field, which stops meanwhile.
Sint32fdHasPsynergyCueStub (Sint32 type)Returns whether the scene has a cue for field Psynergy type on what it would act on.
Sint16gmUnitAddPpStub (Sint32 unit, Sint32 amount)Adds amount to the unit's PP, kept between 0 and its maximum, updates its gauges and returns the new PP.
Sint32mnPsynergyMenuSetShortcut (Sint32 memberId, Sint32 id, Sint32 second)Sets the L Psynergy shortcut, or the R one when second is set, to the Psynergy id used by party member memberId.
Sint32mnPsynergyMenuClassifySelectedPsynergy (void)Says how the selected Psynergy is used from the menu (ITEM_USE_MODE): on the field once the menu closes when the scene has a script for its field Psynergy on what the leader faces, on the whole party for ABILITY_RANGE_ALL, on one chosen party member when it targets ABILITY_TARGET_ALLIES, and otherwise on the field.
Sint32mnPsynergyMenuSelectPartySlot (Sint32 paneIndex)Shows side partySlot's icon, collects the actions of the member chosen there last (the first when none was) and runs mnPsynergyMenuSelectMember on them.
Sint32mnPsynergyMenuSelectTarget (Sint32 browseOnly)Chooses the party member to use the selected Psynergy on, showing each one's status and the Psynergy's description unless browseOnly is set.
Sint32mnPsynergyMenuRunList (Sint32 paneIndex)The Psynergy list of the party member in side paneIndex, five a page.
Sint32mnPsynergyMenuCollectActions (UNIT *unit, Uint16 *actions, Sint32 mode)Lists a unit's Psynergy into actions (cleared first) by mode (enum PSYNERGY_LIST_MODE) and returns how many.
Sint32mnPsynergyMenuSelectMember (Uint16 *ownerIds, Uint16 *unused)The party member row of the Psynergy menu: moving shows each member's Psynergy, status and shortcuts; A chooses a member who has Psynergy, L or R one to set that shortcut from, and B backs out.
voidmnPsynergyMenuRefreshMemberPsynergy (Sint32 ownerId)Collects the owner's Psynergy and redraws the list, saying when it is empty.
Sint32mnPsynergyMenuDrawShortcuts (Sint32 window, Sint32 owner)Draws the L and R shortcuts into window: a heading, then for each its Psynergy and the party member who uses it, or how to set it.
voidmnPsynergyMenuDrawPsynergyIcons (Uint16 *psynergies)Loads each listed Psynergy's icon into its icon sprite (32 entries) and hides the icons of empty entries.
Sint32mnPsynergyMenuBuildPagedList (PAGED_LIST *result, Sint32 index)Sets list up over the Psynergy listed for the party member in side index, five a page, its cursor on the one chosen last there (or the last one).
Sint32mnPsynergyMenuShowSelectedRow (Sint32 window, Sint32 *scratch, PAGED_LIST *state)Updates the Psynergy list for the row under the cursor: puts the Psynergy's description in the info window, unless a kept message is there, and highlights its row of the five. window and scratch are not used.
Sint32mnPsynergyMenuDrawPage (Sint32 window, Sint32 unused, const PAGED_LIST *state)Draws one page of the Psynergy list: each name and PP cost, red when the PP is short and yellow when it cannot be used from the menu.

Variables

NameDescription
extern const Uint8MenuShortcutLString []L, before a wide shortcut name.
extern const Uint8MenuShortcutLColonString []L:, before the L shortcut's name.
extern const Uint8MenuShortcutRString []R, before a wide shortcut name.
extern const Uint8MenuShortcutRColonString []R:, before the R shortcut's name.

Description

The Psynergy menu: the field menu's Psynergy screen, the party member and Psynergy lists, targets, and the L and R shortcuts. Part of menu.c.

Macros in detail

ABILITY_DESCRIPTION_MASK

#define ABILITY_DESCRIPTION_MASK 0x1ff

The bits of a listed Psynergy the info window's description is found by: nine, where the list's other reads take PSYNERGY_ABILITY_MASK's fourteen.

Referenced by mnPsynergyMenuShowSelectedRow().

Definition at line 6 of file menu_psynergy.c.

PSYNERGY_MENU_SHORTCUT_HELP

#define PSYNERGY_MENU_SHORTCUT_HELP 2

PSYNERGY_MENU_STATE.flags: the Psynergy list shows the shortcut help (Select held).

Referenced by mnPsynergyMenuDrawPage() and mnPsynergyMenuRunList().

Definition at line 97 of file menu_psynergy.c.

#define MENU_TARGET_WHOLE_PARTY 9

memberIds[1] for the whole party

Referenced by mnAbilityApplyToTargets() and mnPsynergyMenuRunSteps().

Definition at line 99 of file menu_psynergy.c.

PSYNERGY_MENU_USED

#define PSYNERGY_MENU_USED 1

PSYNERGY_MENU_STATE.flags: set after a use or a cancelled target. The Item screen's command grid reads the same bit; nothing in the Psynergy screen does.

Referenced by mnPsynergyMenuRunSteps().

Definition at line 104 of file menu_psynergy.c.

COLON_NAME_WIDTH_LIMIT

#define COLON_NAME_WIDTH_LIMIT 11

Japanese drops the colon after "L" and "R" and draws the ability's name 8 pixels further left when that name is wider than this.

Referenced by mnPsynergyMenuDrawShortcuts().

Definition at line 711 of file menu_psynergy.c.

OWNER_NAME_WIDTH_LIMIT

#define OWNER_NAME_WIDTH_LIMIT 10

German, Spanish, French and Italian leave out the owner's name when the ability's name is wider than this.

Referenced by mnPsynergyMenuDrawShortcuts().

Definition at line 715 of file menu_psynergy.c.

PSYNERGY_PAGE_ICONS_X

#define PSYNERGY_PAGE_ICONS_X JAPANESE_OR(120, 112)

The Japanese page draws its page icons, PP heading and names at other columns.

Referenced by mnPsynergyMenuDrawPage().

Definition at line 1110 of file menu_psynergy.c.

PSYNERGY_PP_HEADING_X

#define PSYNERGY_PP_HEADING_X JAPANESE_OR(72, 96)

Referenced by mnPsynergyMenuDrawPage().

Definition at line 1111 of file menu_psynergy.c.

PSYNERGY_NAME_X

#define PSYNERGY_NAME_X JAPANESE_OR(32, 16)

Referenced by mnPsynergyMenuDrawPage().

Definition at line 1112 of file menu_psynergy.c.

PSYNERGY_LIST_CURSOR_X

#define PSYNERGY_LIST_CURSOR_X JAPANESE_OR(98, 88)

The Japanese list puts its cursor further right.

Referenced by mnPsynergyMenuRunList().

Definition at line 1210 of file menu_psynergy.c.

PSYNERGY_ABILITY_OF

#define PSYNERGY_ABILITY_OF(entry) (((Uint32)(entry) << 18) >> 18)

A Psynergy entry's action id, its PSYNERGY_ABILITY_MASK bits, taken out by shifts.

Referenced by mnPsynergyMenuIsActionRestricted().

Definition at line 1496 of file menu_psynergy.c.

Enumerations in detail

PSYNERGY_MENU_STEP

enum PSYNERGY_MENU_STEP

The steps of the Psynergy menu (mnPsynergyMenuRunSteps).

EnumeratorValueDescription
PSYNERGY_STEP_MEMBER
PSYNERGY_STEP_LIST
PSYNERGY_STEP_CLASSIFYhow the Psynergy is used (mnPsynergyMenuClassifySelectedPsynergy)
PSYNERGY_STEP_TARGET
PSYNERGY_STEP_APPLY

Definition at line 107 of file menu_psynergy.c.

PSYNERGY_SHORTCUT

enum PSYNERGY_SHORTCUT

The Psynergy shortcut a choice sets (mnPsynergyMenuSetShortcut).

EnumeratorValueDescription
PSYNERGY_SHORTCUT_L
PSYNERGY_SHORTCUT_R

Definition at line 118 of file menu_psynergy.c.

PSYNERGY_MENU_MODE

enum PSYNERGY_MENU_MODE

What the Psynergy menu is open for (PSYNERGY_MENU_STATE.mode).

EnumeratorValueDescription
PSYNERGY_MODE_USE
PSYNERGY_MODE_SET_L
PSYNERGY_MODE_SET_R

Definition at line 125 of file menu_psynergy.c.

Functions in detail

mnPsynergyMenuIsActionRestricted

Bool mnPsynergyMenuIsActionRestricted(Sint32 actionEntry)

Returns 1 when actionEntry cannot be used from the menu: it has no field effect and is not usable both in the field and in battle.

References gmAbilityGetDefinitionStub() and Sint32.

Referenced by mnPsynergyMenuDrawPage() and mnPsynergyMenuRunList().

Definition at lines 8, 1212 and 1500 of file menu_psynergy.c.

mnPsynergyMenuRunSteps

Sint32 mnPsynergyMenuRunSteps(Sint32 *outMember, Sint32 *unused, Sint32 *outAction)

Runs the Psynergy menu's steps: choose a party member and one of their Psynergy, then use it on a member (or the whole party), or, in the shortcut modes, set it as the L or R shortcut. Returns 1 with the member and Psynergy in the out parameters when the chosen Psynergy works on the field, to be used once the menu closes; -1 when the player backs out or presses Start; otherwise the result of the last use.

References gmAbilityGetDefinitionStub(), gmUnitAddPpStub(), gmUnitCalculateStub(), gmUnitGet(), mnAbilityApplyToTargets(), mnAbilityPlayUseSound(), mnHideEntryIcons(), mnItemMenuDrawMessage(), mnItemMenuShowMessage(), mnPsynergyMenuClassifySelectedPsynergy(), mnPsynergyMenuRunList(), mnPsynergyMenuSelectPartySlot(), mnPsynergyMenuSelectTarget(), mnPsynergyMenuSetShortcut(), mnStatusPanelDraw(), mnWindowSpriteClearListStub(), mnWindowSpriteRedrawSavedRectStub(), Sint32, syGameFlagGet(), sySoundPlayStub() and sySynch().

Referenced by mnPsynergyMenuRun().

Definition at lines 10 and 147 of file menu_psynergy.c.

mnPsynergyMenuRun

Sint32 mnPsynergyMenuRun(void)

The field menu's Psynergy screen (mnFieldMenuRun, FIELD_MENU_PSYNERGY), over the field, which stops meanwhile. A Psynergy chosen to use on the field goes to FIELD_STATE.psynergy with the party member who uses it. Returns mnPsynergyMenuRunSteps' result.

References fdPartyClearUnusableShortcutsStub(), gmAbilityGetDefinitionStub(), gmPartyListMembersStub(), mnInitState(), mnItemMenuClose(), mnItemMenuInit(), mnPageArrowsDrawStub(), mnPaletteLightenHighlight(), mnPsynergyMenuRunSteps(), mnResumeFieldEvents(), mnStartWatchingStart(), mnStopWatchingStart(), mnSuspendFieldEvents(), mnTextUseExtraTilesStub(), mnWindowCreateStub(), mnWindowDrawBorderStub(), mnWindowEraseBorderRectStub(), mnWindowMarkVisibleTextTilesStub(), mnWindowSpriteClearListStub(), result, Sint32, syHeapAllocateEWRAM(), syHeapRelease(), syHeapSlotAllocate(), syHeapSlotRelease(), sySynch(), syWordsCopy() and syWordsFill().

Definition at line 17 of file menu_psynergy.c.

fdHasPsynergyCueStub

Sint32 fdHasPsynergyCueStub(Sint32 type)

Returns whether the scene has a cue for field Psynergy type on what it would act on.

Referenced by mnPsynergyMenuClassifySelectedPsynergy().

Definition at line 93 of file menu_psynergy.c.

mnPsynergyMenuSetShortcut

Sint32 mnPsynergyMenuSetShortcut(Sint32 memberId, Sint32 id, Sint32 second)

Sets the L Psynergy shortcut, or the R one when second is set, to the Psynergy id used by party member memberId. Returns 1.

References MainRoutineStateWork and Sint32.

Referenced by mnPsynergyMenuRunList() and mnPsynergyMenuRunSteps().

Definition at lines 134 and 693 of file menu_psynergy.c.

mnPsynergyMenuClassifySelectedPsynergy

Sint32 mnPsynergyMenuClassifySelectedPsynergy(void)

Says how the selected Psynergy is used from the menu (ITEM_USE_MODE): on the field once the menu closes when the scene has a script for its field Psynergy on what the leader faces, on the whole party for ABILITY_RANGE_ALL, on one chosen party member when it targets ABILITY_TARGET_ALLIES, and otherwise on the field.

References fdHasPsynergyCueStub(), gmAbilityGetDefinitionStub() and Sint32.

Referenced by mnPsynergyMenuRunSteps().

Definition at lines 136 and 370 of file menu_psynergy.c.

mnPsynergyMenuSelectPartySlot

Sint32 mnPsynergyMenuSelectPartySlot(Sint32 paneIndex)

Sint32 mnPsynergyMenuSelectPartySlot(Sint32 partySlot)

Shows side partySlot's icon, collects the actions of the member chosen there last (the first when none was) and runs mnPsynergyMenuSelectMember on them. Returns its result.

References gmUnitGet(), mnCursorSlide(), mnIconShow(), mnPsynergyMenuCollectActions(), mnPsynergyMenuSelectMember(), result, Sint32 and sySynch().

Referenced by mnPsynergyMenuRunSteps().

Definition at lines 137 and 395 of file menu_psynergy.c.

mnPsynergyMenuSelectTarget

Sint32 mnPsynergyMenuSelectTarget(Sint32 browseOnly)

Chooses the party member to use the selected Psynergy on, showing each one's status and the Psynergy's description unless browseOnly is set.

References gmUnitGet(), mnCreatePartyFigures(), mnCursorPos(), mnCursorSlide(), mnIconShow(), mnMarkChosenMember(), mnMoveGridCursor(), mnReloadMemberPortrait(), mnStatusPanelDraw(), mnTextDrawMessageStub(), mnWindowSpriteRedrawSavedRectStub(), PerWork, result, Sint32, syGameFlagClear(), syGameFlagGet(), sySoundPlayStub() and sySynch().

Referenced by mnPsynergyMenuRunSteps().

Definition at lines 138 and 582 of file menu_psynergy.c.

mnPsynergyMenuRunList

Sint32 mnPsynergyMenuRunList(Sint32 paneIndex)

The Psynergy list of the party member in side paneIndex, five a page. Up and Down move the cursor, Left and Right turn pages, L and R change party member, and Select held shows how to set a shortcut, L or R then setting it. Returns the chosen Psynergy entry, or -1 when the player backs out.

References fdSpriteStartAnimationStub(), gmAbilityGetDefinitionStub(), gmUnitGet(), mnCreatePartyFigures(), mnCursorPos(), mnIconShow(), mnMarkChosenMember(), mnPagedListHandleInput(), mnPsynergyMenuBuildPagedList(), mnPsynergyMenuCollectActions(), mnPsynergyMenuDrawPage(), mnPsynergyMenuDrawPsynergyIcons(), mnPsynergyMenuIsActionRestricted(), mnPsynergyMenuSetShortcut(), mnPsynergyMenuShowSelectedRow(), mnReloadMemberPortrait(), mnStatusPanelDraw(), mnTextDrawMessageAsTilesStub(), mnWindowClearInteriorTilesStub(), mnWindowUpdateOrCreate(), PerWork, result, Sint32, syGameFlagGet(), sySoundPlayStub() and sySynch().

Referenced by mnPsynergyMenuRunSteps().

Definition at lines 139 and 1218 of file menu_psynergy.c.

mnPsynergyMenuCollectActions

Sint32 mnPsynergyMenuCollectActions(UNIT *unit, Uint16 *actions, Sint32 mode)

Lists a unit's Psynergy into actions (cleared first) by mode (enum PSYNERGY_LIST_MODE) and returns how many.

References gmAbilityGetDefinitionStub() and Sint32.

Referenced by mnPartyMemberChooserChooseMember(), mnPsynergyMenuRefreshMemberPsynergy(), mnPsynergyMenuRunList(), mnPsynergyMenuSelectMember(), mnPsynergyMenuSelectPartySlot() and mnStatusScreenRunPsynergyPage().

Definition at lines 389 and 928 of file menu_psynergy.c.

mnPsynergyMenuSelectMember

Sint32 mnPsynergyMenuSelectMember(Uint16 *ownerIds, Uint16 *unused)

The party member row of the Psynergy menu: moving shows each member's Psynergy, status and shortcuts; A chooses a member who has Psynergy, L or R one to set that shortcut from, and B backs out. Returns the chosen member's id, or -1.

References gmUnitGet(), mnCreatePartyFigures(), mnCursorPos(), mnDrawCoins(), mnMarkChosenMember(), mnMoveGridCursor(), mnPsynergyMenuCollectActions(), mnPsynergyMenuDrawShortcuts(), mnPsynergyMenuRefreshMemberPsynergy(), mnReloadMemberPortrait(), mnSpawnIconEntries(), mnStatusPanelDraw(), mnWindowSpriteClearListStub(), mnWindowSpriteCreateFromResourceStub(), mnWindowSpriteRedrawSavedRectStub(), mnWindowUpdateOrCreate(), PerWork, result, Sint32, syGameFlagClear(), syGameFlagGet(), syHeapAllocate(), syHeapRelease(), sySoundPlayStub() and sySynch().

Referenced by mnPsynergyMenuSelectPartySlot().

Definition at lines 390 and 440 of file menu_psynergy.c.

mnPsynergyMenuRefreshMemberPsynergy

void mnPsynergyMenuRefreshMemberPsynergy(Sint32 ownerId)

Collects the owner's Psynergy and redraws the list, saying when it is empty.

References gmUnitGet(), mnPsynergyMenuCollectActions(), mnPsynergyMenuDrawPsynergyIcons(), mnPsynergyMenuPlaceEntryIcons(), mnTextDrawMessageAsTilesStub(), mnWindowSpriteRedrawSavedRectStub() and Sint32.

Referenced by mnPsynergyMenuSelectMember().

Definition at lines 432 and 559 of file menu_psynergy.c.

mnPsynergyMenuDrawShortcuts

Sint32 mnPsynergyMenuDrawShortcuts(Sint32 window, Sint32 owner)

Draws the L and R shortcuts into window: a heading, then for each its Psynergy and the party member who uses it, or how to set it. German, Spanish, French and Italian leave out the party member's name beside a wide Psynergy name. Returns 1; owner is not used.

Japanese: draws "L" or "L:" and "R" or "R:" itself before each shortcut's name, dropping the colon for a wide name. Returns 1.

References gmUnitGet(), MainRoutineStateWork, MenuShortcutLColonString, MenuShortcutLString, MenuShortcutRColonString, MenuShortcutRString, mnMessageArgumentPushStub(), mnTextDrawMessageAsTilesStub(), mnTextDrawStringAtOffsetStub(), mnTextGetMessageSizeStub() and Sint32.

Referenced by mnPsynergyMenuSelectMember().

Definition at lines 434, 734 and 821 of file menu_psynergy.c.

mnPsynergyMenuDrawPsynergyIcons

void mnPsynergyMenuDrawPsynergyIcons(Uint16 *psynergies)

Loads each listed Psynergy's icon into its icon sprite (32 entries) and hides the icons of empty entries.

References mnHideEmptyEntryIcons(), mnSelectionIconLoadIntoSlotStub() and Sint32.

Referenced by mnPartyMemberChooserChooseMember(), mnPsynergyMenuRefreshMemberPsynergy(), mnPsynergyMenuRunList() and mnStatusScreenRunPsynergyPage().

Definition at lines 556 and 904 of file menu_psynergy.c.

mnPsynergyMenuBuildPagedList

Sint32 mnPsynergyMenuBuildPagedList(PAGED_LIST *result, Sint32 index)

Sets list up over the Psynergy listed for the party member in side index, five a page, its cursor on the one chosen last there (or the last one).

References gmUnitGet(), result and Sint32.

Referenced by mnPsynergyMenuRunList().

Definition at line 996 of file menu_psynergy.c.

mnPsynergyMenuShowSelectedRow

Sint32 mnPsynergyMenuShowSelectedRow(Sint32 window, Sint32 *scratch, PAGED_LIST *state)

Updates the Psynergy list for the row under the cursor: puts the Psynergy's description in the info window, unless a kept message is there, and highlights its row of the five. window and scratch are not used.

References mnTextDrawMessageStub(), mnWindowSetHighlightRect(), mnWindowSpriteRedrawSavedRectStub(), Sint32, syGameFlagClear(), syGameFlagGet() and sySynch().

Referenced by mnPsynergyMenuRunList().

Definition at line 1034 of file menu_psynergy.c.

mnPsynergyMenuDrawPage

Sint32 mnPsynergyMenuDrawPage(Sint32 window, Sint32 unused, const PAGED_LIST *state)

Draws one page of the Psynergy list: each name and PP cost, red when the PP is short and yellow when it cannot be used from the menu.

References gmAbilityGetDefinitionStub(), gmUnitGet(), mnPagedListDrawPageNumbers(), mnPsynergyMenuIsActionRestricted(), mnSetPageIcons(), mnTextDrawMessageAsTilesStub(), mnTextDrawNumberAtOffsetStub(), mnTextSetColorStub(), mnWindowDrawDividerLineStub(), mnWindowSpriteRedrawSavedRectStub() and Sint32.

Referenced by mnPsynergyMenuRunList().

Definition at line 1116 of file menu_psynergy.c.