Alchemy
Loading...
Searching...
No Matches

psynergy.c File Reference

The Psynergy menu: the screen events open, the member and Psynergy lists, targets, and the L and R shortcuts. More...

Go to the source code of this file.

Macros

#define PSYNERGY_DETAIL_ROW_X   0
#define PSYNERGY_DETAIL_ROW_WIDTH   15
#define PSYNERGY_PAGE_ICONS_X   112
#define PSYNERGY_PP_LABEL_X   96
#define PSYNERGY_NAME_X   16
#define PSYNERGY_LIST_CURSOR_X   88
#define PSYNERGY_SHORTCUT_OWNER_SHIFT   10
 A Psynergy shortcut: its owner above bit 10, the Psynergy's id below.
#define PSYNERGY_SHORTCUT_ID_MASK   0x3ff
#define PSYNERGY_MENU_SHORTCUT_HELP   2
 PsynergyMenuState.flags: the Psynergy list shows the shortcut help (Select held).

Enumerations

enum  PsynergyMenuStep {
  PSYNERGY_STEP_OWNER , PSYNERGY_STEP_LIST , PSYNERGY_STEP_CLASSIFY , PSYNERGY_STEP_TARGET ,
  PSYNERGY_STEP_APPLY
}
 The steps of the Psynergy menu (Menu_ResolveSelectedAction). More...

Functions

s32 PsynergyMenu_Run (void)
 The Psynergy menu an event opens (window command 1): the field menu's Psynergy screen over the field, which stops meanwhile.
s32 Menu_ResolveSelectedAction (s32 *outOwner, s32 *unused, s32 *outAction)
 Runs the Psynergy menu: 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.
s32 PsynergyMenu_ClassifySelectedPsynergy (void)
 Says how the selected Psynergy is used from the menu: 0 on the field once the menu closes (its effect has a field event), 2 on the whole party (range 0xff), 1 on one chosen member when its target mode is 2, and 0 otherwise.
s32 PsynergyMenu_SelectPartySlot (s32 partySlot)
 Lets the player choose a party member in pane partySlot (0 or 1), starting from the one chosen last, with each member's Psynergy shown as the cursor passes.
s32 PsynergyMenu_SelectMember (u16 *ownerIds, u16 *unused)
 The party member row of the Psynergy menu.
void PsynergyMenu_RefreshOwnerPsynergy (s32 ownerId)
 Shows member ownerId's Psynergy icons in the Psynergy window, eight to a row, or "no Psynergy" when they have none.
UNUSED s32 PsynergyMenu_ReturnTrue (void)
 Nothing calls them.
UNUSED void PsynergyMenu_NoOp (void)
s32 PsynergyMenu_SelectTarget (s32 targetMode)
 Chooses the party member to use the selected Psynergy on.
s32 PsynergyMenu_SetShortcut (s32 ownerId, s32 actionId, s32 shortcutIndex)
 Sets the L (shortcutIndex 0) or R (shortcutIndex 1) Psynergy shortcut: ownerId << 10 | the Psynergy's id.
s32 PsynergyMenu_DrawShortcuts (struct UiWindow *window, s32 ownerId)
void PsynergyMenu_CreateEntryGrid (void)
 Sets up a Psynergy grid screen: the cursor window with the party's figures, a 30 by 15 window below with a hidden grid cursor and a portrait, and 16 Psynergy icon sprites in two rows of eight from (96, 8), on an 8 by 2 grid.
void PsynergyMenu_CloseWindows (void)
 Releases the party figures and closes the Psynergy grid screen's windows.
void PsynergyMenu_DrawPsynergyIcons (u16 *psynergies)
 Loads each listed Psynergy's icon into its icon sprite (32 entries) and hides the icons of empty entries.
s32 PsynergyMenu_CollectActions (struct BattleUnit *unit, u16 *actions, s32 mode)
 Lists unit's Psynergy into actions (32 entries, cleared first) and returns how many there are.
s32 PsynergyMenu_BuildPageResult (struct MenuResult *result, s32 index)
 Fills result with the Psynergy list of the member in pane index: their unit, how many Psynergy are listed, and the page and row of the one chosen last for them (kept within the list), five to a page.
s32 PsynergyMenu_DrawDetailPage (struct UiWindow *window, s32 *work, struct MenuResult *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.
s32 PsynergyMenu_DrawActionPage (struct UiWindow *window, s32 unused, const struct MenuResult *pageState)
 Draws one page of the Psynergy list into window: up to five names with their icons and PP costs, Psynergy the member cannot afford in the no-HP colour and one restricted here in the low-HP colour, the page numbers, and the help line (how to set a shortcut while Select is held, else how to change member).
s32 PsynergyMenu_RunList (s32 paneIndex)
 The Psynergy list of the member in paneIndex, five a page.
s32 PsynergyMenu_IsActionRestricted (s32 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.

Detailed Description

The Psynergy menu: the screen events open, the member and Psynergy lists, targets, and the L and R shortcuts.

Part of menu.c, the menu object, compiled only through it.

Definition in file psynergy.c.

Macro Definition Documentation

◆ PSYNERGY_DETAIL_ROW_X

#define PSYNERGY_DETAIL_ROW_X   0

Definition at line 17 of file psynergy.c.

Referenced by PsynergyMenu_DrawDetailPage().

◆ PSYNERGY_DETAIL_ROW_WIDTH

#define PSYNERGY_DETAIL_ROW_WIDTH   15

Definition at line 18 of file psynergy.c.

Referenced by PsynergyMenu_DrawDetailPage().

◆ PSYNERGY_PAGE_ICONS_X

#define PSYNERGY_PAGE_ICONS_X   112

Definition at line 26 of file psynergy.c.

Referenced by PsynergyMenu_DrawActionPage().

◆ PSYNERGY_PP_LABEL_X

#define PSYNERGY_PP_LABEL_X   96

Definition at line 27 of file psynergy.c.

Referenced by PsynergyMenu_DrawActionPage().

◆ PSYNERGY_NAME_X

#define PSYNERGY_NAME_X   16

Definition at line 28 of file psynergy.c.

Referenced by PsynergyMenu_DrawActionPage().

◆ PSYNERGY_LIST_CURSOR_X

#define PSYNERGY_LIST_CURSOR_X   88

Definition at line 29 of file psynergy.c.

Referenced by PsynergyMenu_RunList().

◆ PSYNERGY_SHORTCUT_OWNER_SHIFT

#define PSYNERGY_SHORTCUT_OWNER_SHIFT   10

A Psynergy shortcut: its owner above bit 10, the Psynergy's id below.

Definition at line 605 of file psynergy.c.

Referenced by PsynergyMenu_DrawShortcuts(), and PsynergyMenu_SetShortcut().

◆ PSYNERGY_SHORTCUT_ID_MASK

#define PSYNERGY_SHORTCUT_ID_MASK   0x3ff

Definition at line 606 of file psynergy.c.

Referenced by PsynergyMenu_DrawShortcuts().

◆ PSYNERGY_MENU_SHORTCUT_HELP

#define PSYNERGY_MENU_SHORTCUT_HELP   2

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

Definition at line 945 of file psynergy.c.

Referenced by PsynergyMenu_DrawActionPage(), and PsynergyMenu_RunList().

Enumeration Type Documentation

◆ PsynergyMenuStep

The steps of the Psynergy menu (Menu_ResolveSelectedAction).

Enumerator
PSYNERGY_STEP_OWNER 
PSYNERGY_STEP_LIST 
PSYNERGY_STEP_CLASSIFY 
PSYNERGY_STEP_TARGET 
PSYNERGY_STEP_APPLY 

Definition at line 104 of file psynergy.c.

Function Documentation

◆ PsynergyMenu_Run()

s32 PsynergyMenu_Run ( void )

The Psynergy menu an event opens (window command 1): the field menu's Psynergy screen over the field, which stops meanwhile.

When the player picks Psynergy to use on the field, it is recorded in the event work's psynergyRequest (owner << 10 | Psynergy) and 1 is returned; -1 when the player backs out.

Definition at line 42 of file psynergy.c.

Referenced by PsynergyMenu_Run().

◆ Menu_ResolveSelectedAction()

s32 Menu_ResolveSelectedAction ( s32 * outOwner,
s32 * unused,
s32 * outAction )

Runs the Psynergy menu: 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 owner 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.

Definition at line 118 of file psynergy.c.

Referenced by Menu_ResolveSelectedAction(), and PsynergyMenu_Run().

◆ PsynergyMenu_ClassifySelectedPsynergy()

s32 PsynergyMenu_ClassifySelectedPsynergy ( void )

Says how the selected Psynergy is used from the menu: 0 on the field once the menu closes (its effect has a field event), 2 on the whole party (range 0xff), 1 on one chosen member when its target mode is 2, and 0 otherwise.

Definition at line 306 of file psynergy.c.

Referenced by Menu_ResolveSelectedAction(), and PsynergyMenu_ClassifySelectedPsynergy().

◆ PsynergyMenu_SelectPartySlot()

s32 PsynergyMenu_SelectPartySlot ( s32 partySlot)

Lets the player choose a party member in pane partySlot (0 or 1), starting from the one chosen last, with each member's Psynergy shown as the cursor passes.

Returns the chosen member's id, or -1 when the player backs out.

Definition at line 331 of file psynergy.c.

Referenced by Menu_ResolveSelectedAction(), and PsynergyMenu_SelectPartySlot().

◆ PsynergyMenu_SelectMember()

s32 PsynergyMenu_SelectMember ( u16 * ownerIds,
u16 * unused )

The party member row of the Psynergy menu.

Left and Right move between members, showing each one's Psynergy, status and shortcuts; A chooses a member who has Psynergy to use, L or R one who has field Psynergy to set as that shortcut (menu mode 1 or 2), and B backs out. Returns the chosen member's id, or -1.

Definition at line 391 of file psynergy.c.

Referenced by PsynergyMenu_SelectMember(), and PsynergyMenu_SelectPartySlot().

◆ PsynergyMenu_RefreshOwnerPsynergy()

void PsynergyMenu_RefreshOwnerPsynergy ( s32 ownerId)

Shows member ownerId's Psynergy icons in the Psynergy window, eight to a row, or "no Psynergy" when they have none.

Definition at line 501 of file psynergy.c.

Referenced by PsynergyMenu_RefreshOwnerPsynergy(), and PsynergyMenu_SelectMember().

◆ PsynergyMenu_ReturnTrue()

UNUSED s32 PsynergyMenu_ReturnTrue ( void )

Nothing calls them.

Definition at line 520 of file psynergy.c.

Referenced by PsynergyMenu_ReturnTrue().

◆ PsynergyMenu_NoOp()

UNUSED void PsynergyMenu_NoOp ( void )

Definition at line 522 of file psynergy.c.

Referenced by PsynergyMenu_NoOp().

◆ PsynergyMenu_SelectTarget()

s32 PsynergyMenu_SelectTarget ( s32 targetMode)

Chooses the party member to use the selected Psynergy on.

In mode 0 each member's status shows as the cursor passes, with the Psynergy's description once. Returns the chosen member's id, or -1 when the player backs out.

Definition at line 527 of file psynergy.c.

Referenced by Menu_ResolveSelectedAction(), and PsynergyMenu_SelectTarget().

◆ PsynergyMenu_SetShortcut()

s32 PsynergyMenu_SetShortcut ( s32 ownerId,
s32 actionId,
s32 shortcutIndex )

Sets the L (shortcutIndex 0) or R (shortcutIndex 1) Psynergy shortcut: ownerId << 10 | the Psynergy's id.

Returns 1.

Definition at line 610 of file psynergy.c.

Referenced by Menu_ResolveSelectedAction(), PsynergyMenu_RunList(), and PsynergyMenu_SetShortcut().

◆ PsynergyMenu_DrawShortcuts()

s32 PsynergyMenu_DrawShortcuts ( struct UiWindow * window,
s32 ownerId )

Definition at line 628 of file psynergy.c.

Referenced by PsynergyMenu_DrawShortcuts(), and PsynergyMenu_SelectMember().

◆ PsynergyMenu_CreateEntryGrid()

void PsynergyMenu_CreateEntryGrid ( void )

Sets up a Psynergy grid screen: the cursor window with the party's figures, a 30 by 15 window below with a hidden grid cursor and a portrait, and 16 Psynergy icon sprites in two rows of eight from (96, 8), on an 8 by 2 grid.

Definition at line 765 of file psynergy.c.

Referenced by PsynergyMenu_CreateEntryGrid().

◆ PsynergyMenu_CloseWindows()

void PsynergyMenu_CloseWindows ( void )

Releases the party figures and closes the Psynergy grid screen's windows.

Definition at line 813 of file psynergy.c.

Referenced by PsynergyMenu_CloseWindows().

◆ PsynergyMenu_DrawPsynergyIcons()

void PsynergyMenu_DrawPsynergyIcons ( u16 * psynergies)

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

Definition at line 825 of file psynergy.c.

Referenced by PsynergyMenu_DrawPreparedPsynergyIcons(), PsynergyMenu_DrawPsynergyIcons(), PsynergyMenu_RefreshOwnerPsynergy(), PsynergyMenu_RunList(), and PsynergyMenu_SelectOwner().

◆ PsynergyMenu_CollectActions()

s32 PsynergyMenu_CollectActions ( struct BattleUnit * unit,
u16 * actions,
s32 mode )

Lists unit's Psynergy into actions (32 entries, cleared first) and returns how many there are.

mode 1 lists only the Psynergy that work on the field (those that can be shortcuts); mode 2 those with a field effect or usable in the field; any other mode those first, then the rest.

Definition at line 849 of file psynergy.c.

Referenced by PsynergyMenu_CollectActions(), PsynergyMenu_RefreshOwnerPsynergy(), PsynergyMenu_RunList(), PsynergyMenu_SelectAction(), PsynergyMenu_SelectMember(), PsynergyMenu_SelectOwner(), and PsynergyMenu_SelectPartySlot().

◆ PsynergyMenu_BuildPageResult()

s32 PsynergyMenu_BuildPageResult ( struct MenuResult * result,
s32 index )

Fills result with the Psynergy list of the member in pane index: their unit, how many Psynergy are listed, and the page and row of the one chosen last for them (kept within the list), five to a page.

Returns 1.

Definition at line 911 of file psynergy.c.

Referenced by PsynergyMenu_BuildPageResult(), and PsynergyMenu_RunList().

◆ PsynergyMenu_DrawDetailPage()

s32 PsynergyMenu_DrawDetailPage ( struct UiWindow * window,
s32 * work,
struct MenuResult * 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 work are not used.

Definition at line 950 of file psynergy.c.

Referenced by PsynergyMenu_DrawDetailPage(), and PsynergyMenu_RunList().

◆ PsynergyMenu_DrawActionPage()

s32 PsynergyMenu_DrawActionPage ( struct UiWindow * window,
s32 unused,
const struct MenuResult * pageState )

Draws one page of the Psynergy list into window: up to five names with their icons and PP costs, Psynergy the member cannot afford in the no-HP colour and one restricted here in the low-HP colour, the page numbers, and the help line (how to set a shortcut while Select is held, else how to change member).

Definition at line 1006 of file psynergy.c.

Referenced by PsynergyMenu_DrawActionPage(), and PsynergyMenu_RunList().

◆ PsynergyMenu_RunList()

s32 PsynergyMenu_RunList ( s32 paneIndex)

The Psynergy list of the member in paneIndex, five a page.

The cursor's Psynergy is described in the info window and its icon animates; L and R switch to the previous or next member who has Psynergy to list. In the use mode (menu mode 0), A chooses Psynergy the member can use and afford; holding Select shows the shortcut help, and L or R with Select set the Psynergy as that shortcut. In the shortcut modes (1 and 2) only field Psynergy are listed and A chooses one. Returns the chosen Psynergy, or -1 when the player backs out.

Definition at line 1080 of file psynergy.c.

Referenced by Menu_ResolveSelectedAction(), and PsynergyMenu_RunList().

◆ PsynergyMenu_IsActionRestricted()

s32 PsynergyMenu_IsActionRestricted ( s32 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.

Definition at line 1316 of file psynergy.c.

Referenced by PsynergyMenu_DrawActionPage(), PsynergyMenu_IsActionRestricted(), and PsynergyMenu_RunList().