Skip to Content
The Alchemy Project

src/menu/menu_item.c

The item menu, as far as this object holds it: the field menu's Item screen, its command loop, Use, the first screen's setup and the item icons. More…

Included by menu.c.

Macros

NameDescription
#defineITEM_COMMAND_STATE_DISABLED (-1)Each item command's state in the grid.
#defineITEM_COMMAND_STATE_AVAILABLE 1
#defineMESSAGE_YOU_WERE_CURSED ((Sint32)MsgEquippedIt + 7)"You were cursed!", the message seven after MsgEquippedIt; "No", the one after MsgYes; and "View equipment", the help line after MsgArrangeItemsHelp.
#defineMESSAGE_NO ((Sint32)MsgYes + 1)
#defineMESSAGE_VIEW_EQUIPMENT_HELP ((Sint32)MsgArrangeItemsHelp + 1)
#defineITEM_MODAL_SHORT_X JAPANESE_OR(15, 14)Where the edition's text goes.
#defineITEM_MODAL_REMOVED_X JAPANESE_OR(17, 14)
#defineITEM_CANNOT_TRADE_X FRENCH_OR(11, 15)"Can't trade it!" starts four tiles further left in French, over the status window, which is redrawn after it.
#defineITEM_TRADED_X ITALIAN_OR(13, 15)The column "Traded" opens at, two tiles further left in Italian.
#defineICON_GRID_ROW 8mnSpawnIconEntries makes the icons a row of the eight-wide icon grid at a time (columnCount), as the Psynergy screen places its own.
#defineTRADE_LABEL_X 16
#defineIN_STOCK_LABEL_X 24
#definemnItemMenuDrawInfo mnTextDrawMessageStub
#definemnItemMenuClearInfo mnWindowSpriteRedrawSavedRectStub
#defineITEM_PREVIEW_ON_COPY (panelFlag, givenEntry)Draws target's stats with the entry given, on a copy: makes room in target's inventory, adds the entry and draws the panel with panelFlag at its new slot (at slot when it would not fit), then puts target back as it was.
#defineCOMMAND_CURSOR_X (column, row)
#defineCOMMAND_CURSOR_Y (column, row)
#defineITEM_COMMAND_TEXT_X 32
#defineTEXT_COLOR_DISABLED TEXT_COLOR_GREYThe grey of a command that refuses A.
#defineITEM_DETAILS_WINDOW_WIDTH JAPANESE_OR(13, 30)The Details window's width in tiles: Japanese opens it over the left part only, beside the item window, the other editions over the whole top half.
#defineITEM_DETAILS_HEADING_X 0
#defineITEM_DETAILS_USES_X 0
#defineITEM_DETAILS_NUMBER_X 0
#defineITEM_DETAILS_VALUE_X JAPANESE_OR(64, 72)Japanese draws the values nearer the names, and a multiplier further left to leave room for its suffix.
#defineITEM_DETAILS_MULTIPLIER_X JAPANESE_OR(48, 72)
#definemnTextDrawStringInWindowStubCalled here with signed x and y, the sign's x being reckoned back from the number's.
#defineITEM_MENU ((ITEM_MENU_STATE *)RamHeapSlots->menuState)
#defineHOW_MANY_MESSAGE ((Sint32)MsgShortcutHelp - 3)いくつ?, the message three before MsgShortcutHelp.
#defineHOW_MANY_X 0
#defineHOW_MANY_Y 32
#definePIECE_MESSAGE ((Sint32)MsgItemCommandUse - 1)こ, the counter after a count: the message before MsgItemCommandUse.
#defineHOW_MANY_CURSOR_X 88
#defineITEM_DROP_QUESTION_X FRENCH_OR(0, 8)The French question starts at the window's left edge.
#defineEQUIP_YES_X 24
#defineEQUIP_YES_Y 24
#defineEQUIP_NO_X 72
#defineEQUIP_NO_Y 24
#defineEQUIP_CURSOR_X (answer) ((answer) * 48 + 110)
#defineEQUIP_CURSOR_Y (answer) 32
#defineEQUIP_PREVIOUS_KEY KEY_LEFT
#defineEQUIP_NEXT_KEY KEY_RIGHT
#defineEQUIP_QUESTION_X JAPANESE_OR(8, 0)
#defineEQUIP_QUESTIONThe question is named in the English catalog alone; in every edition it is the second message after MsgConfirmDrop.
#defineITEM_PAGE_ICONS_X JAPANESE_OR(120, 116)The Japanese page draws its page icons and names further right.
#defineENTRY_X JAPANESE_OR(32, 24)

Enumerations

NameDescription
enumEQUIP_REFUSAL { EQUIP_REFUSED_CANNOT_WEAR, EQUIP_REFUSED_CURSED }What gmInventoryEquipStub returns when it does not equip the item.
enumITEM_TARGET_MODE { ITEM_TARGET_USE, ITEM_TARGET_GIVE }Whom mnItemMenuSelectTarget chooses.
enumITEM_MENU_COMMAND { ITEM_COMMAND_USE, ITEM_COMMAND_EQUIP, ITEM_COMMAND_DETAILS, … }The item command grid, by row * 3 + column: Use, Equip and Details on top, Give, Remove and Drop below.
enumITEM_MENU_STEP { ITEM_STEP_MEMBER, ITEM_STEP_ITEM, ITEM_STEP_USE, ITEM_STEP_E … }The steps of the item menu's command loop (mnItemMenuRunCommands).

Functions

NameDescription
Sint32mnItemMenuChooseCommand (void)Defined below or in later parts of the menu object.
Sint32mnItemMenuCollectItems (UNIT *owner, Uint16 *items, Sint32 mode)Copies the unit's items into the list items (32 entries), skipping empty slots and clearing the rest.
Sint32mnItemMenuConfirmDrop (Sint32 item)Asks whether to drop item (an inventory entry): its name, the question, and Yes or No, No first.
Sint32mnItemMenuConfirmEquip (Sint32 unused)After giving or trading the selected item to the party member in side 1, offers to equip it there, showing the stats it would give.
Sint32mnItemMenuCountItems (Sint32 ownerId)Counts the nonempty slots in the owner's inventory.
voidmnItemMenuDrawIcons (Uint16 *items, Sint32 style)Loads each listed item's icon into its item icon sprite, the first 15 entries of inventoryEntries, and hides the icons of empty entries. iconStyle 0 draws the list's icons (ICON_KIND_ITEM); any other iconStyle the equipment view's.
voidmnItemMenuDrawItemHead (void)Shows the selected item at the top of the message window: its icon, its party member's name and its name.
voidmnItemMenuDrawMessage (Sint32 unused, Sint32 msg)Clears the message window and writes message into it.
Sint32mnItemMenuGetItemQuantity (Sint32 owner, Sint32 item)Returns how many of item party member owner holds, adding up every stack of it in the inventory.
BoolmnItemMenuIsStatRaisingItem (Sint32 itemId)Returns 1 for the items that raise a stat for good (Apple, Hard Nut, Mint and Lucky Pepper), whose use shows the stats panel instead of HP and PP.
voidmnItemMenuRefreshMember (Sint32 ownerId, Sint32 mode)Shows party member ownerId's items in the item window, laid out for layout mode (see mnItemMenuPlaceIcons), or "no items" when there are none.
Sint32mnItemMenuRunList (Sint32 side)The item list of the party member in side (0: the holder, 1: the receiver of a trade), five items a page.
Sint32mnItemMenuSelectGiveQuantity (Sint32 baseQuantity, Sint32 quantityRange, Sint32 dropMode)Asks how many of the selected item stack to give or drop: Left and Right choose a number from 1 to quantityRange (shown as baseQuantity + 1 up to baseQuantity + quantityRange on a dial of digit sprites), with the party member's remaining count and, when giving (dropMode 0), the receiver's new count beside their names.
Sint32mnItemMenuSelectMember (Sint32 side)Lets the player choose a party member for side (0, the holder; 1, the receiver), starting from the party member chosen last.
Sint32mnItemMenuSelectTarget (Sint32 mode)Chooses the party member to use or give the selected item (enum ITEM_TARGET_MODE) to.
voidmnItemMenuPlaceItemWindowBelowQuestion (void)Moves the item window to row 3 of the right-hand side, below a one-line question.
voidmnItemMenuPlaceItemWindowBelowItemQuestion (void)Moves the item window to row 5 of the right-hand side.
voidmnItemMenuFitMessageWindowToQuestion (void)Makes the item menu's message window three tiles high.
voidmnItemMenuFitMessageWindowToItemQuestion (void)Makes the message window, along the top right, 5 rows tall: the item's name and a question below it.
Sint32mnItemMenuShowDetails (Sint32 entry)The item menu's Details screen: describes the item entry in a window over the top half (ITEM_DETAILS_WINDOW_WIDTH) and waits for A or B.
voidmnItemMenuTryBreak (void)After the selected item is used: an item that may break (ITEM_USE_MAY_BREAK) breaks one time in eight, with the break sound and "It broke!" in the info window.
Sint32mnItemMenuUse (void)Uses the selected item from the party member in side 0 on the one in side 1.
Sint32mnItemClassifyUseMode (Sint32 owner, Sint32 itemId)Says how memberId can use inventoryEntry from the item menu.
voidmnLoadStatArrows (void)Loads the small up and down arrows of the stat changes (mnIconCreateStatChangeArrow) into free VRAM cache slots.
voidmnItemMenuClose (void)Closes the item menu: releases the party figures, hides the icons and the status panel's portrait (the state's cursor), and closes every window the menu opened.
Sint32mnItemMenuRunCommands (Sint32 *ownerOut, Sint32 *targetOut, Sint32 *itemOut)Runs the item menu: choose a party member, one of their items and a command (Use, Equip, Give, Drop, Remove or Details), then carry it out, until the player backs out or presses Start.
voidmnItemMenuInit (Sint32 x, Sint32 y, Sint32 mode, Sint32 columns)Sets up the item menu's first screen: the cursor window with the party's figures (mnCursorCreate, mnShowPartyFigures), the info window along the bottom and an 8 by 2 cursor grid.
voidmnItemMenuHideAllIcons (void)Hides all 32 item icons.
Sint32mnItemMenuRun (void)The field menu's Item screen: choose a party member, one of their items and a command.
voidmnItemMenuDrawEquipPreview (Sint32 member, Sint32 slot, Sint32 mode, Sint32 target)Shows in the status panel what the item in owner's inventory slot would mean to party member target: for a usable item, target's status; for equipment, target's stats with it equipped; for a Psynergy item, the Psynergy it teaches.
voidmnItemMenuHideTradedIcons (void)Hides the item icons in every fifth slot, 0 to 30, after a trade.
Sint32mnItemUse (Sint32 slot, Sint32 owner, Sint32 target)Uses the item in memberId's inventory slot on targetId, or on the whole party when its ability's range is ABILITY_RANGE_ALL.
voidmnItemPlayUseSound (Sint32 item)Plays the sound of using item from the menu (mnAbilityPlayUseSound), after a use that changed something.
voidmnSpawnIconEntries (ITEM_MENU_STATE *menu, WINDOW *window)Creates the 32 item icon sprites in window, off screen until placed: slots 0 to 7 at MENU_ICON_HIDDEN_X, the rest 8 pixels further, all at MENU_ICON_HIDDEN_Y, each showing item graphic slot of the same number.
Sint32mnItemMenuRunMemberSelection (Uint16 *ownerIds, Uint16 *items)The party member row of the item menu: moving shows each member's items and status, holding R their equipment; L + A sorts the member's items, a new order each press; A chooses a member who has items and B backs out.
voidmnItemMenuShowEquipment (Sint32 ownerId)Shows the equipment view of party member ownerId's items in the item window.
voidmnEquipmentMenuUpdateCompatibilityIndicators (void)Event while mnItemMenuSelectTarget chooses a party member to use or give the item to, and while the command grid's cursor is on Give: every 32 ticks, has each party figure nod (ANIM_NOD) if that party member can equip the item, or stand (ANIM_STAND) if not.
voidmnEquipmentMenuStopCompatibilityIndicators (void)Ends mnEquipmentMenuUpdateCompatibilityIndicators: puts every party figure back to ANIM_STAND and removes the event.
voidmnHideEmptyEntryIcons (const Uint16 *items)Hides the icon of each of the 32 list entries whose item is 0.
Sint32mnInventoryMakeRoom (Sint32 memberId)Makes room in memberId's inventory: if no slot is free, removes the whole stack in the first slot that is not equipped.
Sint32mnItemMenuGetCommandCursorX (Sint32 column, Sint32 row)The cursor's x at the item command in column and row, from the table; 0 outside three columns and three rows.
Sint32mnItemMenuGetCommandCursorY (Sint32 column, Sint32 row)The cursor's y at the item command in row: 30 in the first row, 38 below.
voidmnItemMenuBuildCommands (Sint8 *commandStates)Fills commandStates (indexed by ITEM_MENU_COMMAND) with ITEM_COMMAND_STATE_AVAILABLE or _DISABLED for the selected item: Use for items mnItemClassifyUseMode accepts and are not broken, and for field items, Equip for equipment the party member can wear and is not wearing, Remove for worn equipment that is not cursed, Give with someone to give to, Drop unless the item is indispensable, and neither for cursed equipment being worn.
voidmnItemMenuFitMessageWindowToItemChoices (void)Makes the item menu's message window seven tiles high.
voidmnItemMenuDrawCommands (const Sint8 *commandStates, Sint32 window)Writes the six command names into window, the disabled ones in grey.
Sint32fdHasItemCueStub (Sint32 item)Returns whether the scene has a script for item on what the leader faces.
voidgmInventoryBreakStub (Sint32 owner, Sint32 slot)Marks the item in slot broken; returns -1 for an empty slot.
Sint32mnItemMenuOpenDetail (Sint32 itemIndex)Opens the details window (top left, 13 by 10 tiles) and describes the item in side itemIndex there.
voidmnItemMenuDrawItemDetails (Sint32 window, Sint32 item)Describes item in window with the entry's own count, through mnItemMenuDrawItemDetailsWithCount.
voidmnItemMenuDrawStat ( Sint32 delta, Sint32 unused, Sint32 window, Sint32 x, Sint32 y)Writes a signed stat change at (x, y) of window: the number, with a plus or minus sign just before its first digit.
voidmnItemMenuDrawItemDetailsWithCount (Sint32 window, Sint32 item, Sint32 count)Describes an item (an inventory entry) in window, one 8-pixel row a line: its equip bonuses and effects, a curse, the Psynergy it bestows, its uses and its count, or failing all of these whether it is rare or important. count is the count to show, which only Japanese reads; mnItemMenuDrawItemDetails passes -1, the entry's own.
voidmnItemMenuFitMessageWindowToLongItemQuestion (void)Makes the item menu's message window six tiles high.
voidmnQuantityBarFillStub (Sint32 count, Sint32 color, void *tiles)Colours the first count segments of the quantity bar in tiles, each two pixels wide: the left pixel in colour 1, the right in colour color.
Sint32mnItemMenuBuildPagedList (PAGED_LIST *list, Sint32 side)Sets list up over the items of the party member in side, five a page, its cursor on the item chosen last there (or the last item).
Sint32mnItemMenuShowSelectedRow (Sint32 listWindow, void *unused, PAGED_LIST *list)Describes the item under the list's cursor in the info window and highlights its row alone.
Sint32mnItemMenuDrawListPage (Sint32 window, Sint32 unused, const PAGED_LIST *list)Draws one page of the item list into window: a divider, the page's icons and page numbers, and up to five item names.

Variables

NameDescription
extern const Uint8ItemMenuArrangeKeysString []L+A:, the key name Japanese draws before the arrange help.
extern const Uint8ItemMenuEquipmentKeyString []R:, the key name Japanese draws before the equipment help.
extern Uint8MenuPointString []., the decimal point of a multiplier.
extern const Uint8MenuQuantityTiles []The item menu's quantity bar picture, which mnQuantityBarFillStub fills in under the "How many?" question.
extern Sint32ItemMenuCommandColumnXTable [6]The hand's x at each of the six item commands, in their two rows of three (mnItemMenuGetCommandCursorX): the middle column stands 9 pixels left of the even 40-pixel spacing the other editions use.

Description

The item menu, as far as this object holds it: the field menu's Item screen, its command loop, Use, the first screen's setup and the item icons. Part of menu.c.

Macros in detail

ITEM_COMMAND_STATE_DISABLED

#define ITEM_COMMAND_STATE_DISABLED (-1)

Each item command's state in the grid.

Referenced by mnItemMenuBuildCommands(), mnItemMenuChooseCommand() and mnItemMenuDrawCommands().

Definition at line 9 of file menu_item.c.

ITEM_COMMAND_STATE_AVAILABLE

#define ITEM_COMMAND_STATE_AVAILABLE 1

Referenced by mnItemMenuBuildCommands() and mnItemMenuChooseCommand().

Definition at line 10 of file menu_item.c.

MESSAGE_YOU_WERE_CURSED

#define MESSAGE_YOU_WERE_CURSED ((Sint32)MsgEquippedIt + 7)

"You were cursed!", the message seven after MsgEquippedIt; "No", the one after MsgYes; and "View equipment", the help line after MsgArrangeItemsHelp.

Referenced by mnItemMenuRunCommands().

Definition at line 56 of file menu_item.c.

MESSAGE_NO

#define MESSAGE_NO ((Sint32)MsgYes + 1)

Referenced by mnItemMenuConfirmEquip().

Definition at line 57 of file menu_item.c.

MESSAGE_VIEW_EQUIPMENT_HELP

#define MESSAGE_VIEW_EQUIPMENT_HELP ((Sint32)MsgArrangeItemsHelp + 1)

Referenced by mnItemMenuRunMemberSelection().

Definition at line 58 of file menu_item.c.

ITEM_MODAL_SHORT_X

#define ITEM_MODAL_SHORT_X JAPANESE_OR(15, 14)

Where the edition's text goes. The international editions have longer words, and some languages move a message to fit its own.

The x of the small message windows "You were cursed!" and "Removed".

Referenced by mnItemMenuRunCommands().

Definition at line 64 of file menu_item.c.

ITEM_MODAL_REMOVED_X

#define ITEM_MODAL_REMOVED_X JAPANESE_OR(17, 14)

Referenced by mnItemMenuRunCommands().

Definition at line 65 of file menu_item.c.

ITEM_CANNOT_TRADE_X

#define ITEM_CANNOT_TRADE_X FRENCH_OR(11, 15)

"Can't trade it!" starts four tiles further left in French, over the status window, which is redrawn after it.

Referenced by mnItemMenuRunCommands().

Definition at line 69 of file menu_item.c.

ITEM_TRADED_X

#define ITEM_TRADED_X ITALIAN_OR(13, 15)

The column "Traded" opens at, two tiles further left in Italian.

Referenced by mnItemMenuRunCommands().

Definition at line 72 of file menu_item.c.

ICON_GRID_ROW

#define ICON_GRID_ROW 8

mnSpawnIconEntries makes the icons a row of the eight-wide icon grid at a time (columnCount), as the Psynergy screen places its own.

Referenced by mnSpawnIconEntries().

Definition at line 979 of file menu_item.c.

TRADE_LABEL_X

#define TRADE_LABEL_X 16

#define TRADE_LABEL_X 0

Referenced by mnItemMenuSelectTarget().

Definition at lines 1277 and 1281 of file menu_item.c.

IN_STOCK_LABEL_X

#define IN_STOCK_LABEL_X 24

#define IN_STOCK_LABEL_X 30

#define IN_STOCK_LABEL_X 29

#define IN_STOCK_LABEL_X 32

Referenced by mnItemMenuSelectTarget().

Definition at lines 1278, 1294, 1296 and 1298 of file menu_item.c.

mnItemMenuDrawInfo

#define mnItemMenuDrawInfo mnTextDrawMessageStub

#define mnItemMenuDrawInfo mnTextDrawMessageAsTilesStub

Referenced by mnItemMenuSelectTarget() and mnItemMenuShowSelectedRow().

Definition at lines 1279 and 1282 of file menu_item.c.

mnItemMenuClearInfo

#define mnItemMenuClearInfo mnWindowSpriteRedrawSavedRectStub

#define mnItemMenuClearInfo mnWindowSpriteClearListStub

Referenced by mnItemMenuSelectTarget() and mnItemMenuShowSelectedRow().

Definition at lines 1288 and 1290 of file menu_item.c.

ITEM_PREVIEW_ON_COPY

#define ITEM_PREVIEW_ON_COPY(panelFlag, givenEntry)

Draws target's stats with the entry given, on a copy: makes room in target's inventory, adds the entry and draws the panel with panelFlag at its new slot (at slot when it would not fit), then puts target back as it was.

Referenced by mnItemMenuDrawEquipPreview().

Definition at line 1651 of file menu_item.c.

COMMAND_CURSOR_X

#define COMMAND_CURSOR_X(column, row)

#define COMMAND_CURSOR_X(column, row) ((column) * 40 + 86)

Referenced by mnItemMenuChooseCommand().

Definition at lines 1795 and 1800 of file menu_item.c.

COMMAND_CURSOR_Y

#define COMMAND_CURSOR_Y(column, row)

#define COMMAND_CURSOR_Y(column, row) ((row) * 8 + 30)

Referenced by mnItemMenuChooseCommand().

Definition at lines 1797 and 1801 of file menu_item.c.

ITEM_COMMAND_TEXT_X

#define ITEM_COMMAND_TEXT_X 32

#define ITEM_COMMAND_TEXT_X 40

Referenced by mnItemMenuDrawCommands().

Definition at lines 2078 and 2080 of file menu_item.c.

TEXT_COLOR_DISABLED

#define TEXT_COLOR_DISABLED TEXT_COLOR_GREY

The grey of a command that refuses A.

Referenced by mnItemMenuDrawCommands().

Definition at line 2084 of file menu_item.c.

ITEM_DETAILS_WINDOW_WIDTH

#define ITEM_DETAILS_WINDOW_WIDTH JAPANESE_OR(13, 30)

The Details window's width in tiles: Japanese opens it over the left part only, beside the item window, the other editions over the whole top half.

Referenced by mnItemMenuShowDetails().

Definition at line 2236 of file menu_item.c.

ITEM_DETAILS_HEADING_X

#define ITEM_DETAILS_HEADING_X 0

#define ITEM_DETAILS_HEADING_X 8

#define ITEM_DETAILS_HEADING_X 16

Referenced by mnItemMenuDrawItemDetailsWithCount().

Definition at lines 2340, 2344, 2348 and 2352 of file menu_item.c.

ITEM_DETAILS_USES_X

#define ITEM_DETAILS_USES_X 0

#define ITEM_DETAILS_USES_X 16

Referenced by mnItemMenuDrawItemDetailsWithCount().

Definition at lines 2341, 2345, 2349 and 2353 of file menu_item.c.

ITEM_DETAILS_NUMBER_X

#define ITEM_DETAILS_NUMBER_X 0

#define ITEM_DETAILS_NUMBER_X 16

Referenced by mnItemMenuDrawItemDetailsWithCount().

Definition at lines 2342, 2346, 2350 and 2354 of file menu_item.c.

ITEM_DETAILS_VALUE_X

#define ITEM_DETAILS_VALUE_X JAPANESE_OR(64, 72)

Japanese draws the values nearer the names, and a multiplier further left to leave room for its suffix.

Referenced by mnItemMenuDrawItemDetailsWithCount().

Definition at line 2359 of file menu_item.c.

ITEM_DETAILS_MULTIPLIER_X

#define ITEM_DETAILS_MULTIPLIER_X JAPANESE_OR(48, 72)

Referenced by mnItemMenuDrawItemDetailsWithCount().

Definition at line 2360 of file menu_item.c.

mnTextDrawStringInWindowStub

#define mnTextDrawStringInWindowStub

Called here with signed x and y, the sign's x being reckoned back from the number's.

Referenced by mnItemMenuDrawItemDetailsWithCount(), mnItemMenuDrawStat(), mnItemMenuRunMemberSelection(), mnPsynergyMenuDrawShortcuts(), mnStatusPanelDrawHpPp(), mnStatusScreenDrawStatusPage() and mnStatusScreenDrawTopRows().

Definition at line 2709 of file menu_item.c.

ITEM_MENU

#define ITEM_MENU ((ITEM_MENU_STATE *)RamHeapSlots->menuState)

Referenced by mnItemMenuFitMessageWindowToItemChoices(), mnItemMenuFitMessageWindowToItemQuestion(), mnItemMenuFitMessageWindowToLongItemQuestion(), mnItemMenuFitMessageWindowToQuestion(), mnItemMenuPlaceItemWindowBelowItemQuestion() and mnItemMenuPlaceItemWindowBelowQuestion().

Definition at line 2753 of file menu_item.c.

HOW_MANY_MESSAGE

#define HOW_MANY_MESSAGE ((Sint32)MsgShortcutHelp - 3)

#define HOW_MANY_MESSAGE ((Sint32)MsgHowMany)

いくつ?, the message three before MsgShortcutHelp.

Referenced by mnItemMenuSelectGiveQuantity().

Definition at lines 2801 and 2808 of file menu_item.c.

HOW_MANY_X

#define HOW_MANY_X 0

#define HOW_MANY_X 32

Referenced by mnItemMenuSelectGiveQuantity().

Definition at lines 2802 and 2809 of file menu_item.c.

HOW_MANY_Y

#define HOW_MANY_Y 32

#define HOW_MANY_Y 0

Referenced by mnItemMenuSelectGiveQuantity().

Definition at lines 2803 and 2810 of file menu_item.c.

PIECE_MESSAGE

#define PIECE_MESSAGE ((Sint32)MsgItemCommandUse - 1)

こ, the counter after a count: the message before MsgItemCommandUse.

Referenced by mnItemMenuSelectGiveQuantity().

Definition at line 2805 of file menu_item.c.

HOW_MANY_CURSOR_X

#define HOW_MANY_CURSOR_X 88

#define HOW_MANY_CURSOR_X 128

Referenced by mnItemMenuSelectGiveQuantity().

Definition at lines 2806 and 2811 of file menu_item.c.

ITEM_DROP_QUESTION_X

#define ITEM_DROP_QUESTION_X FRENCH_OR(0, 8)

The French question starts at the window's left edge.

Referenced by mnItemMenuConfirmDrop().

Definition at line 2969 of file menu_item.c.

EQUIP_YES_X

#define EQUIP_YES_X 24

#define EQUIP_YES_X 96

Referenced by mnItemMenuConfirmEquip().

Definition at lines 3047 and 3056 of file menu_item.c.

EQUIP_YES_Y

#define EQUIP_YES_Y 24

#define EQUIP_YES_Y 0

Referenced by mnItemMenuConfirmEquip().

Definition at lines 3048 and 3057 of file menu_item.c.

EQUIP_NO_X

#define EQUIP_NO_X 72

#define EQUIP_NO_X 96

Referenced by mnItemMenuConfirmEquip().

Definition at lines 3049 and 3058 of file menu_item.c.

EQUIP_NO_Y

#define EQUIP_NO_Y 24

#define EQUIP_NO_Y 16

Referenced by mnItemMenuConfirmEquip().

Definition at lines 3050 and 3059 of file menu_item.c.

EQUIP_CURSOR_X

#define EQUIP_CURSOR_X(answer) ((answer) * 48 + 110)

#define EQUIP_CURSOR_X(answer) 184

Referenced by mnItemMenuConfirmEquip().

Definition at lines 3051 and 3060 of file menu_item.c.

EQUIP_CURSOR_Y

#define EQUIP_CURSOR_Y(answer) 32

#define EQUIP_CURSOR_Y(answer) (((answer) << 4) + 5)

Referenced by mnItemMenuConfirmEquip().

Definition at lines 3052 and 3061 of file menu_item.c.

EQUIP_PREVIOUS_KEY

#define EQUIP_PREVIOUS_KEY KEY_LEFT

#define EQUIP_PREVIOUS_KEY KEY_UP

Referenced by mnItemMenuConfirmEquip().

Definition at lines 3053 and 3062 of file menu_item.c.

EQUIP_NEXT_KEY

#define EQUIP_NEXT_KEY KEY_RIGHT

#define EQUIP_NEXT_KEY KEY_DOWN

Referenced by mnItemMenuConfirmEquip().

Definition at lines 3054 and 3063 of file menu_item.c.

EQUIP_QUESTION_X

#define EQUIP_QUESTION_X JAPANESE_OR(8, 0)

Referenced by mnItemMenuConfirmEquip().

Definition at line 3065 of file menu_item.c.

EQUIP_QUESTION

#define EQUIP_QUESTION

The question is named in the English catalog alone; in every edition it is the second message after MsgConfirmDrop.

Referenced by mnItemMenuConfirmEquip().

Definition at line 3069 of file menu_item.c.

ITEM_PAGE_ICONS_X

#define ITEM_PAGE_ICONS_X JAPANESE_OR(120, 116)

The Japanese page draws its page icons and names further right.

Referenced by mnItemMenuDrawListPage().

Definition at line 3258 of file menu_item.c.

ENTRY_X

#define ENTRY_X JAPANESE_OR(32, 24)

Referenced by mnItemMenuDrawListPage().

Definition at line 3259 of file menu_item.c.

Enumerations in detail

EQUIP_REFUSAL

enum EQUIP_REFUSAL

What gmInventoryEquipStub returns when it does not equip the item.

EnumeratorValueDescription
EQUIP_REFUSED_CANNOT_WEAR-1the party member cannot wear it
EQUIP_REFUSED_CURSED-2what it would replace is cursed on

Definition at line 13 of file menu_item.c.

ITEM_TARGET_MODE

enum ITEM_TARGET_MODE

Whom mnItemMenuSelectTarget chooses.

EnumeratorValueDescription
ITEM_TARGET_USE0the party member to use the item on
ITEM_TARGET_GIVE1the party member to give it to

Definition at line 38 of file menu_item.c.

ITEM_MENU_COMMAND

enum ITEM_MENU_COMMAND

The item command grid, by row * 3 + column: Use, Equip and Details on top, Give, Remove and Drop below.

EnumeratorValueDescription
ITEM_COMMAND_USE
ITEM_COMMAND_EQUIP
ITEM_COMMAND_DETAILS
ITEM_COMMAND_GIVE
ITEM_COMMAND_REMOVE
ITEM_COMMAND_DROP

Definition at line 160 of file menu_item.c.

ITEM_MENU_STEP

enum ITEM_MENU_STEP

The steps of the item menu's command loop (mnItemMenuRunCommands).

EnumeratorValueDescription
ITEM_STEP_MEMBER0
ITEM_STEP_ITEM1
ITEM_STEP_USE2
ITEM_STEP_EQUIP3
ITEM_STEP_GIVE4
ITEM_STEP_DROP5
ITEM_STEP_TARGET6Give: choose whom to give it to
ITEM_STEP_TRADE7the receiver is full: choose what they give back
ITEM_STEP_IDLE8nothing sets it
ITEM_STEP_COMMAND9
ITEM_STEP_DETAILS10mnItemMenuShowDetails
ITEM_STEP_REMOVE11
ITEM_STEP_QUANTITY12nothing sets it

Definition at line 171 of file menu_item.c.

Functions in detail

mnItemMenuChooseCommand

Sint32 mnItemMenuChooseCommand(void)

Defined below or in later parts of the menu object.

The item command grid: Use, Equip and Details on the top row, Give, Remove and Drop below (grid index = row * 3 + column, as ITEM_MENU_COMMAND counts them).

References mnCursorPos(), mnCursorSlide(), mnEquipmentMenuStopCompatibilityIndicators(), mnEquipmentMenuUpdateCompatibilityIndicators(), mnItemMenuBuildCommands(), mnItemMenuDrawCommands(), mnItemMenuDrawEquipPreview(), mnItemMenuDrawItemHead(), mnItemMenuFitMessageWindowToItemChoices(), mnItemMenuHideAllIcons(), mnStatusPanelDraw(), mnWindowDrawDividerLineStub(), mnWindowSpriteRedrawSavedRectStub(), PerWork, Sint32, syGameFlagGet(), sySetEvent(), sySoundPlayStub() and sySynch().

Referenced by mnItemMenuRunCommands().

Definition at lines 20 and 1811 of file menu_item.c.

mnItemMenuCollectItems

Sint32 mnItemMenuCollectItems(UNIT *owner, Uint16 *items, Sint32 mode)

Copies the unit's items into the list items (32 entries), skipping empty slots and clearing the rest. Returns how many there are. mode is not used.

References Sint32.

Referenced by mnItemMenuRefreshMember(), mnItemMenuRunCommands(), mnItemMenuRunList(), mnItemMenuRunMemberSelection(), mnItemMenuSelectMember(), mnItemUse() and mnStatusScreenRunEquipmentPage().

Definition at lines 21 and 1571 of file menu_item.c.

mnItemMenuConfirmDrop

Sint32 mnItemMenuConfirmDrop(Sint32 item)

Asks whether to drop item (an inventory entry): its name, the question, and Yes or No, No first. Returns 0 for Yes and 1 for No, B or Start.

References gmItemGetDefinitionStub(), mnCursorPos(), mnCursorSlide(), mnTextDrawMessageAsTilesStub(), mnWindowCloseStub(), mnWindowCreateStub(), PerWork, Sint32, syGameFlagGet(), sySoundPlayStub() and sySynch().

Referenced by mnItemMenuRunCommands().

Definition at lines 22 and 2973 of file menu_item.c.

mnItemMenuConfirmEquip

Sint32 mnItemMenuConfirmEquip(Sint32 unused)

After giving or trading the selected item to the party member in side 1, offers to equip it there, showing the stats it would give.

References gmInventoryEquipStub(), gmUnitCalculateStub(), gmUnitGet(), gmUnitRefreshPsynergyStub(), mnCursorPos(), mnCursorSlide(), mnItemMenuDrawEquipPreview(), mnTextDrawMessageAsTilesStub(), mnWindowClearInteriorTilesStub(), PerWork, result, Sint32, syGameFlagGet(), syHeapAllocate(), syHeapRelease(), sySoundPlayStub(), sySynch() and syWordsCopy().

Referenced by mnItemMenuRunCommands().

Definition at lines 23 and 3074 of file menu_item.c.

mnItemMenuCountItems

Sint32 mnItemMenuCountItems(Sint32 ownerId)

Counts the nonempty slots in the owner's inventory.

References gmUnitGet() and Sint32.

Referenced by mnItemMenuBuildPagedList(), mnItemMenuRefreshMember(), mnItemMenuRunCommands(), mnItemMenuRunMemberSelection() and mnItemMenuSelectTarget().

Definition at lines 24 and 1530 of file menu_item.c.

mnItemMenuDrawIcons

void mnItemMenuDrawIcons(Uint16 *items, Sint32 style)

void mnItemMenuDrawIcons(Uint16 *inventoryEntries, Sint32 iconStyle)

Loads each listed item's icon into its item icon sprite, the first 15 entries of inventoryEntries, and hides the icons of empty entries. iconStyle 0 draws the list's icons (ICON_KIND_ITEM); any other iconStyle the equipment view's.

References mnHideEmptyEntryIcons(), mnSelectionIconLoadIntoSlotStub() and Sint32.

Referenced by mnItemMenuDrawEquipment(), mnItemMenuRefreshMember(), mnItemMenuRunCommands(), mnItemMenuRunList() and mnStatusScreenRunEquipmentPage().

Definition at lines 25 and 1596 of file menu_item.c.

mnItemMenuDrawItemHead

void mnItemMenuDrawItemHead(void)

Shows the selected item at the top of the message window: its icon, its party member's name and its name.

References gmUnitGet(), mnIconShow(), mnSelectionIconLoadIntoSlotStub(), mnTextDrawMessageAsTilesStub(), mnTextDrawStringAtOffsetStub() and Sint32.

Referenced by mnItemMenuChooseCommand() and mnItemMenuRunCommands().

Definition at lines 26 and 2947 of file menu_item.c.

mnItemMenuDrawMessage

void mnItemMenuDrawMessage(Sint32 unused, Sint32 msg)

Clears the message window and writes message into it.

References mnTextDrawMessageAsTilesStub(), mnWindowSpriteRedrawSavedRectStub() and Sint32.

Referenced by mnItemMenuRunCommands() and mnPsynergyMenuRunSteps().

Definition at lines 27 and 1503 of file menu_item.c.

mnItemMenuGetItemQuantity

Sint32 mnItemMenuGetItemQuantity(Sint32 owner, Sint32 item)

Returns how many of item party member owner holds, adding up every stack of it in the inventory.

References gmUnitGet() and Sint32.

Referenced by mnItemMenuRunCommands(), mnItemMenuSelectGiveQuantity() and mnItemMenuSelectTarget().

Definition at lines 28 and 1548 of file menu_item.c.

mnItemMenuIsStatRaisingItem

Bool mnItemMenuIsStatRaisingItem(Sint32 itemId)

Returns 1 for the items that raise a stat for good (Apple, Hard Nut, Mint and Lucky Pepper), whose use shows the stats panel instead of HP and PP.

References Sint32.

Referenced by mnItemMenuRunCommands() and mnItemMenuSelectTarget().

Definition at lines 29 and 1490 of file menu_item.c.

mnItemMenuRefreshMember

void mnItemMenuRefreshMember(Sint32 ownerId, Sint32 mode)

Shows party member ownerId's items in the item window, laid out for layout mode (see mnItemMenuPlaceIcons), or "no items" when there are none.

References gmUnitGet(), mnItemMenuCollectItems(), mnItemMenuCountItems(), mnItemMenuDrawIcons(), mnItemMenuPlaceIcons(), mnTextDrawMessageAsTilesStub(), mnWindowSpriteRedrawSavedRectStub() and Sint32.

Referenced by mnItemMenuRunCommands(), mnItemMenuRunMemberSelection() and mnItemMenuSelectTarget().

Definition at lines 30 and 1630 of file menu_item.c.

mnItemMenuRunList

Sint32 mnItemMenuRunList(Sint32 side)

The item list of the party member in side (0: the holder, 1: the receiver of a trade), five items a page. The cursor's item is named in the info window and previewed in the status panel, its icon animates, and the party members who can equip it move. Up and Down move the cursor, Left and Right turn pages, and in side 0 L and R switch to the previous or next party member who has items. Returns the chosen inventory entry, or -1 when the player backs out.

References fdSpriteStartAnimationStub(), gmItemCanUnitEquipStub(), gmUnitGet(), mnCreatePartyFigures(), mnCursorPos(), mnIconShow(), mnItemMenuBuildPagedList(), mnItemMenuCollectItems(), mnItemMenuDrawEquipPreview(), mnItemMenuDrawIcons(), mnItemMenuDrawListPage(), mnItemMenuShowSelectedRow(), mnMarkChosenMember(), mnPagedListHandleInput(), mnTextDrawMessageAsTilesStub(), mnWindowClearInteriorTilesStub(), mnWindowUpdateOrCreate(), PerWork, result, Sint32, syGameFlagGet(), sySoundPlayStub(), sySynch() and TickCount.

Referenced by mnItemMenuRunCommands().

Definition at lines 31 and 3320 of file menu_item.c.

mnItemMenuSelectGiveQuantity

Sint32 mnItemMenuSelectGiveQuantity(Sint32 baseQuantity, Sint32 quantityRange, Sint32 dropMode)

Asks how many of the selected item stack to give or drop: Left and Right choose a number from 1 to quantityRange (shown as baseQuantity + 1 up to baseQuantity + quantityRange on a dial of digit sprites), with the party member's remaining count and, when giving (dropMode 0), the receiver's new count beside their names.

References gmUnitGet(), MenuQuantityTiles, mnCursorPos(), mnCursorSlide(), mnItemMenuFitMessageWindowToItemChoices(), mnItemMenuGetItemQuantity(), mnQuantityBarFillStub(), mnTextDrawMessageAsTilesStub(), mnTextDrawNumberInWindowStub(), mnTextDrawStringAtOffsetStub(), mnWindowSpriteClearListStub(), mnWindowSpriteCreateStub(), mnWindowSpriteRedrawSavedRectStub(), PerWork, Sint32, syDMAXCopy(), syGameFlagGet(), syHeapSlotAllocateEWRAM(), syHeapSlotRelease(), sySoundPlayStub(), sySynch(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Referenced by mnItemMenuRunCommands().

Definition at lines 32 and 2827 of file menu_item.c.

mnItemMenuSelectMember

Sint32 mnItemMenuSelectMember(Sint32 side)

Lets the player choose a party member for side (0, the holder; 1, the receiver), starting from the party member chosen last.

References gmUnitGet(), mnCursorSlide(), mnIconShow(), mnItemMenuCollectItems(), mnItemMenuRunMemberSelection(), mnWindowSpriteClearListStub(), result, Sint32 and sySynch().

Referenced by mnItemMenuRunCommands().

Definition at lines 35 and 1098 of file menu_item.c.

mnItemMenuSelectTarget

Sint32 mnItemMenuSelectTarget(Sint32 mode)

Chooses the party member to use or give the selected item (enum ITEM_TARGET_MODE) to.

References gmUnitGet(), mnCreatePartyFigures(), mnCursorPos(), mnEquipmentMenuStopCompatibilityIndicators(), mnEquipmentMenuUpdateCompatibilityIndicators(), mnIconShow(), mnItemMenuCountItems(), mnItemMenuDrawEquipPreview(), mnItemMenuGetItemQuantity(), mnItemMenuIsStatRaisingItem(), mnItemMenuRefreshMember(), mnMarkChosenMember(), mnMoveGridCursor(), mnStatusPanelDraw(), mnTextDrawMessageAsTilesStub(), mnTextDrawNumberInWindowStub(), mnWindowClearInteriorTilesStub(), mnWindowDrawDividerLineStub(), mnWindowSetBounds(), mnWindowSpriteRedrawSavedRectStub(), PerWork, result, Sint32, syGameFlagClear(), syGameFlagGet(), sySetEvent(), sySoundPlayStub() and sySynch().

Referenced by mnItemMenuRunCommands().

Definition at lines 44 and 1306 of file menu_item.c.

mnItemMenuPlaceItemWindowBelowQuestion

void mnItemMenuPlaceItemWindowBelowQuestion(void)

Moves the item window to row 3 of the right-hand side, below a one-line question.

References mnWindowSetBounds().

Referenced by mnItemMenuRunCommands().

Definition at lines 45 and 2763 of file menu_item.c.

mnItemMenuPlaceItemWindowBelowItemQuestion

void mnItemMenuPlaceItemWindowBelowItemQuestion(void)

Moves the item window to row 5 of the right-hand side.

References mnWindowSetBounds().

Referenced by mnItemMenuRunCommands().

Definition at lines 46 and 2756 of file menu_item.c.

mnItemMenuFitMessageWindowToQuestion

void mnItemMenuFitMessageWindowToQuestion(void)

Makes the item menu's message window three tiles high.

References mnWindowSetBounds().

Referenced by mnItemMenuRunCommands().

Definition at lines 47 and 2788 of file menu_item.c.

mnItemMenuFitMessageWindowToItemQuestion

void mnItemMenuFitMessageWindowToItemQuestion(void)

Makes the message window, along the top right, 5 rows tall: the item's name and a question below it.

References mnWindowSetBounds().

Referenced by mnItemMenuRunCommands().

Definition at lines 48 and 2770 of file menu_item.c.

mnItemMenuShowDetails

Sint32 mnItemMenuShowDetails(Sint32 entry)

The item menu's Details screen: describes the item entry in a window over the top half (ITEM_DETAILS_WINDOW_WIDTH) and waits for A or B. Up and Down move an unused counter from 0 to 4. Returns the counter after A or Start, or -1 after B.

References mnItemMenuDrawItemDetails(), mnPaletteLightenHighlight(), mnPaletteLoadIconsIntoHighlight(), mnUpdatePartyFigures(), mnWindowCloseStub(), mnWindowCreateStub(), mnWindowDrawDividerLineStub(), mnWindowSpriteRedrawSavedRectStub(), PerWork, Sint32, syCloseEvent(), syGameFlagGet(), sySetEvent() and sySynch().

Referenced by mnItemMenuRunCommands().

Definition at lines 49 and 2242 of file menu_item.c.

mnItemMenuTryBreak

void mnItemMenuTryBreak(void)

After the selected item is used: an item that may break (ITEM_USE_MAY_BREAK) breaks one time in eight, with the break sound and "It broke!" in the info window. Called only after a successful use on a chosen party member.

References gmInventoryBreakStub(), gmItemGetDefinitionStub(), mnItemMenuShowMessage(), mnWindowSpriteRedrawSavedRectStub(), Sint32, syRandom() and sySoundPlayStub().

Referenced by mnItemMenuRunCommands().

Definition at lines 50 and 2196 of file menu_item.c.

mnItemMenuUse

Sint32 mnItemMenuUse(void)

Uses the selected item from the party member in side 0 on the one in side 1. On failure plays the error sound, shows why in the info window and returns -1; otherwise plays the item's animation, recalculates both party members and returns 1.

References gmUnitCalculateStub(), mnItemMenuShowMessage(), mnItemPlayUseSound(), mnItemUse(), mnWindowSpriteClearListStub(), mnWindowSpriteRedrawSavedRectStub(), result, Sint32 and sySoundPlayStub().

Referenced by mnItemMenuRunCommands().

Definition at lines 51 and 919 of file menu_item.c.

mnItemClassifyUseMode

Sint32 mnItemClassifyUseMode(Sint32 owner, Sint32 itemId)

Sint32 mnItemClassifyUseMode(Sint32 memberId, Sint32 inventoryEntry)

Says how memberId can use inventoryEntry from the item menu.

References fdHasItemCueStub(), gmAbilityGetDefinitionStub(), gmItemCanUnitEquipStub(), gmItemGetDefinitionStub(), result and Sint32.

Referenced by mnItemMenuBuildCommands() and mnItemMenuRunCommands().

Definition at lines 52 and 2131 of file menu_item.c.

mnLoadStatArrows

void mnLoadStatArrows(void)

Loads the small up and down arrows of the stat changes (mnIconCreateStatChangeArrow) into free VRAM cache slots.

References mnVRAMBlockLoadResourceStub(), Sint32 and syVRAMCacheFindFreeEntry().

Referenced by mnItemMenuRun().

Definition at lines 74 and 3160 of file menu_item.c.

mnItemMenuClose

void mnItemMenuClose(void)

Closes the item menu: releases the party figures, hides the icons and the status panel's portrait (the state's cursor), and closes every window the menu opened.

References mnItemMenuHideAllIcons(), mnReleasePartyFigures(), mnWindowCloseIfOpen() and sySynch().

Referenced by mnDjinnMenuRun(), mnItemMenuRun(), mnPartyMemberChooserOpen(), mnPsynergyMenuRun() and mnStatusScreenRun().

Definition at lines 75 and 1070 of file menu_item.c.

mnItemMenuRunCommands

Sint32 mnItemMenuRunCommands(Sint32 *ownerOut, Sint32 *targetOut, Sint32 *itemOut)

Runs the item menu: choose a party member, one of their items and a command (Use, Equip, Give, Drop, Remove or Details), then carry it out, until the player backs out or presses Start. Returns 1 when an item is to be used outside the menu, with its party member, target and item id in the out parameters; -1 when the player backed out or pressed Start; 0 otherwise.

References fdHasItemCueStub(), fdPartyClearUnusableShortcutsStub(), gmInventoryAddItemStub(), gmInventoryEquipStub(), gmInventoryRemoveStub(), gmItemAdjustRareItemStockStub(), gmItemGetDefinitionStub(), gmUnitCalculateStub(), gmUnitGet(), gmUnitRefreshPsynergyStub(), mnDrawCoins(), mnIconShow(), mnItemClassifyUseMode(), mnItemMenuChooseCommand(), mnItemMenuCollectItems(), mnItemMenuConfirmDrop(), mnItemMenuConfirmEquip(), mnItemMenuCountItems(), mnItemMenuDrawEquipPreview(), mnItemMenuDrawIcons(), mnItemMenuDrawItemHead(), mnItemMenuDrawMessage(), mnItemMenuFitMessageWindowToItemQuestion(), mnItemMenuFitMessageWindowToLongItemQuestion(), mnItemMenuFitMessageWindowToQuestion(), mnItemMenuGetItemQuantity(), mnItemMenuHideAllIcons(), mnItemMenuHideTradedIcons(), mnItemMenuIsStatRaisingItem(), mnItemMenuPlaceItemWindowBelowItemQuestion(), mnItemMenuPlaceItemWindowBelowQuestion(), mnItemMenuRefreshMember(), mnItemMenuRunList(), mnItemMenuSelectGiveQuantity(), mnItemMenuSelectMember(), mnItemMenuSelectTarget(), mnItemMenuShowDetails(), mnItemMenuShowMessage(), mnItemMenuTryBreak(), mnItemMenuUse(), mnSelectionIconLoadIntoSlotStub(), mnStatusPanelDraw(), mnTextDrawMessageAsTilesStub(), mnWindowClearInteriorTilesStub(), mnWindowSpriteClearListStub(), mnWindowSpriteRedrawSavedRectStub(), result, Sint32, syGameFlagGet(), syHeapAllocate() and 3 more.

Referenced by mnItemMenuRun().

Definition at lines 76 and 201 of file menu_item.c.

mnItemMenuInit

void mnItemMenuInit(Sint32 x, Sint32 y, Sint32 mode, Sint32 columns)

Sets up the item menu's first screen: the cursor window with the party's figures (mnCursorCreate, mnShowPartyFigures), the info window along the bottom and an 8 by 2 cursor grid. The parameters are not used.

References mnCursorCreate(), mnShowPartyFigures(), mnWindowCreateStub() and Sint32.

Referenced by mnDjinnMenuRun(), mnItemMenuRun() and mnPsynergyMenuRun().

Definition at lines 78 and 957 of file menu_item.c.

mnItemMenuHideAllIcons

void mnItemMenuHideAllIcons(void)

Hides all 32 item icons.

References Sint32.

Referenced by mnItemMenuChooseCommand(), mnItemMenuClose(), mnItemMenuDrawEquipment(), mnItemMenuRunCommands() and mnStatusScreenRunPsynergyPage().

Definition at lines 79 and 1031 of file menu_item.c.

mnItemMenuRun

Sint32 mnItemMenuRun(void)

The field menu's Item screen: choose a party member, one of their items and a command. Owns the menu state while it runs and frees it before returning. Returns mnItemMenuRunCommands' result: 1 when an item is to be used on the field, -1 when the player backed out or pressed Start.

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

Definition at line 85 of file menu_item.c.

mnItemMenuDrawEquipPreview

void mnItemMenuDrawEquipPreview(Sint32 member, Sint32 slot, Sint32 mode, Sint32 target)

void mnItemMenuDrawEquipPreview(Sint32 owner, Sint32 slot, Sint32 mode, Sint32 target)

Shows in the status panel what the item in owner's inventory slot would mean to party member target: for a usable item, target's status; for equipment, target's stats with it equipped; for a Psynergy item, the Psynergy it teaches. Given to someone else, equipment arrives unequipped. mode 1 redraws only the panel's lower part; every caller passes 0.

References gmItemGetDefinitionStub(), gmUnitGet(), mnStatusPanelDraw() and Sint32.

Referenced by mnItemMenuChooseCommand(), mnItemMenuConfirmEquip(), mnItemMenuRunCommands(), mnItemMenuRunList() and mnItemMenuSelectTarget().

Definition at lines 188 and 1687 of file menu_item.c.

mnItemMenuHideTradedIcons

void mnItemMenuHideTradedIcons(void)

Hides the item icons in every fifth slot, 0 to 30, after a trade. The swap list stays open with five items a page, their icons in a column from y 34 (mnItemMenuDrawListPage), so these are the icons of each page's top row, which the question window these editions grow to six tiles after a trade (mnItemMenuFitMessageWindowToLongItemQuestion) now reaches down over.

References Sint32.

Referenced by mnItemMenuRunCommands().

Definition at lines 193 and 1053 of file menu_item.c.

mnSpawnIconEntries

void mnSpawnIconEntries(ITEM_MENU_STATE *menu, WINDOW *window)

Creates the 32 item icon sprites in window, off screen until placed: slots 0 to 7 at MENU_ICON_HIDDEN_X, the rest 8 pixels further, all at MENU_ICON_HIDDEN_Y, each showing item graphic slot of the same number.

References mnWindowSpriteCreateFromResourceStub() and Sint32.

Referenced by mnItemMenuRunMemberSelection(), mnPsynergyMenuSelectMember(), mnStatusScreenRunEquipmentPage(), mnStatusScreenRunPsynergyPage() and mnStatusScreenShowMemberStatus().

Definition at line 984 of file menu_item.c.

mnItemMenuRunMemberSelection

Sint32 mnItemMenuRunMemberSelection(Uint16 *ownerIds, Uint16 *items)

The party member row of the item menu: moving shows each member's items and status, holding R their equipment; L + A sorts the member's items, a new order each press; A chooses a member who has items and B backs out. The members are paged four at a time by mnMoveGridCursor, which moves the selection and says what to redraw (2 for a new page). Returns the chosen member's id, or -1.

References gmUnitGet(), ItemMenuArrangeKeysString, ItemMenuEquipmentKeyString, mnCreatePartyFigures(), mnCursorPos(), mnItemMenuCollectItems(), mnItemMenuCountItems(), mnItemMenuRefreshMember(), mnItemMenuShowEquipment(), mnItemMenuSort(), mnMarkChosenMember(), mnMoveGridCursor(), mnSpawnIconEntries(), mnStatusPanelDraw(), mnTextDrawMessageAsTilesStub(), mnWindowSpriteCreateFromResourceStub(), mnWindowUpdateOrCreate(), PerWork, result, Sint32, syGameFlagGet(), sySoundPlayStub() and sySynch().

Referenced by mnItemMenuSelectMember().

Definition at lines 1094 and 1140 of file menu_item.c.

mnItemMenuShowEquipment

void mnItemMenuShowEquipment(Sint32 ownerId)

Shows the equipment view of party member ownerId's items in the item window.

References mnHideEntryIcons(), mnItemMenuDrawEquipment(), mnWindowSpriteRedrawSavedRectStub() and Sint32.

Referenced by mnItemMenuRunMemberSelection().

Definition at lines 1132 and 1265 of file menu_item.c.

mnEquipmentMenuUpdateCompatibilityIndicators

void mnEquipmentMenuUpdateCompatibilityIndicators(void)

Event while mnItemMenuSelectTarget chooses a party member to use or give the item to, and while the command grid's cursor is on Give: every 32 ticks, has each party figure nod (ANIM_NOD) if that party member can equip the item, or stand (ANIM_STAND) if not.

References fdSpriteStartAnimationStub(), gmItemCanUnitEquipStub(), Sint32 and TickCount.

Referenced by mnEquipmentMenuStopCompatibilityIndicators(), mnItemMenuChooseCommand() and mnItemMenuSelectTarget().

Definition at lines 1301 and 1451 of file menu_item.c.

mnEquipmentMenuStopCompatibilityIndicators

void mnEquipmentMenuStopCompatibilityIndicators(void)

Ends mnEquipmentMenuUpdateCompatibilityIndicators: puts every party figure back to ANIM_STAND and removes the event.

References fdSpriteStartAnimationStub(), mnEquipmentMenuUpdateCompatibilityIndicators() and syCloseEvent().

Referenced by mnItemMenuChooseCommand() and mnItemMenuSelectTarget().

Definition at lines 1302 and 1478 of file menu_item.c.

mnHideEmptyEntryIcons

void mnHideEmptyEntryIcons(const Uint16 *items)

Hides the icon of each of the 32 list entries whose item is 0. Each of the 32 icon slots must hold a sprite (mnSpawnIconEntries).

References mnIconShow() and Sint32.

Referenced by mnItemMenuDrawIcons(), mnPartyMemberChooserChooseMember() and mnPsynergyMenuDrawPsynergyIcons().

Definition at line 1514 of file menu_item.c.

mnInventoryMakeRoom

Sint32 mnInventoryMakeRoom(Sint32 memberId)

Makes room in memberId's inventory: if no slot is free, removes the whole stack in the first slot that is not equipped.

References gmInventoryRemoveStub(), gmUnitGet(), result and Sint32.

Definition at line 1754 of file menu_item.c.

mnItemMenuGetCommandCursorX

Sint32 mnItemMenuGetCommandCursorX(Sint32 column, Sint32 row)

The cursor's x at the item command in column and row, from the table; 0 outside three columns and three rows.

References ItemMenuCommandColumnXTable and Sint32.

Definition at lines 1793 and 3500 of file menu_item.c.

mnItemMenuGetCommandCursorY

Sint32 mnItemMenuGetCommandCursorY(Sint32 column, Sint32 row)

The cursor's y at the item command in row: 30 in the first row, 38 below.

References Sint32.

Definition at lines 1794 and 3508 of file menu_item.c.

mnItemMenuBuildCommands

void mnItemMenuBuildCommands(Sint8 *commandStates)

Fills commandStates (indexed by ITEM_MENU_COMMAND) with ITEM_COMMAND_STATE_AVAILABLE or _DISABLED for the selected item: Use for items mnItemClassifyUseMode accepts and are not broken, and for field items, Equip for equipment the party member can wear and is not wearing, Remove for worn equipment that is not cursed, Give with someone to give to, Drop unless the item is indispensable, and neither for cursed equipment being worn. Details is always available. Each later test overrides the earlier ones.

References fdHasItemCueStub(), gmItemCanUnitEquipStub(), gmItemGetDefinitionStub() and mnItemClassifyUseMode().

Referenced by mnItemMenuChooseCommand().

Definition at lines 1804 and 2004 of file menu_item.c.

mnItemMenuFitMessageWindowToItemChoices

void mnItemMenuFitMessageWindowToItemChoices(void)

Makes the item menu's message window seven tiles high.

References mnWindowSetBounds().

Referenced by mnItemMenuChooseCommand() and mnItemMenuSelectGiveQuantity().

Definition at lines 1805 and 2782 of file menu_item.c.

mnItemMenuDrawCommands

void mnItemMenuDrawCommands(const Sint8 *commandStates, Sint32 window)

Writes the six command names into window, the disabled ones in grey.

References mnTextDrawMessageAsTilesStub(), mnTextSetColorStub() and Sint32.

Referenced by mnItemMenuChooseCommand().

Definition at lines 1806 and 2087 of file menu_item.c.

fdHasItemCueStub

Sint32 fdHasItemCueStub(Sint32 item)

Returns whether the scene has a script for item on what the leader faces.

Referenced by mnItemClassifyUseMode(), mnItemMenuBuildCommands() and mnItemMenuRunCommands().

Definition at line 1995 of file menu_item.c.

mnItemMenuOpenDetail

Sint32 mnItemMenuOpenDetail(Sint32 itemIndex)

Opens the details window (top left, 13 by 10 tiles) and describes the item in side itemIndex there. Returns 1.

References mnItemMenuDrawItemDetails(), mnPaletteLoadIconsIntoHighlight(), mnWindowUpdateOrCreate() and Sint32.

Definition at line 2219 of file menu_item.c.

mnItemMenuDrawItemDetails

void mnItemMenuDrawItemDetails(Sint32 window, Sint32 item)

Describes item in window with the entry's own count, through mnItemMenuDrawItemDetailsWithCount.

References mnItemMenuDrawItemDetailsWithCount() and Sint32.

Referenced by dbIncreaseItemAndLevelSelectItem(), dbShopTestSelectItem(), mnItemMenuOpenDetail() and mnItemMenuShowDetails().

Definition at line 2330 of file menu_item.c.

mnItemMenuDrawStat

void mnItemMenuDrawStat( Sint32 delta, Sint32 unused, Sint32 window, Sint32 x, Sint32 y)

void mnItemMenuDrawStat( Sint32 statChange, Sint32 unused, Sint32 window, Sint32 x, Sint32 y)

Writes a signed stat change at (x, y) of window: the number, with a plus or minus sign just before its first digit.

References MenuMinusSignString, MenuPlusSignString, mnTextDrawNumberInWindowStub() and Sint32.

Referenced by mnItemMenuDrawItemDetailsWithCount().

Definition at lines 2365 and 2714 of file menu_item.c.

mnItemMenuDrawItemDetailsWithCount

void mnItemMenuDrawItemDetailsWithCount(Sint32 window, Sint32 item, Sint32 count)

Describes an item (an inventory entry) in window, one 8-pixel row a line: its equip bonuses and effects, a curse, the Psynergy it bestows, its uses and its count, or failing all of these whether it is rare or important. count is the count to show, which only Japanese reads; mnItemMenuDrawItemDetails passes -1, the entry's own.

References gmItemGetDefinitionStub(), MenuPointString, mnItemMenuDrawStat(), mnTextDrawMessageAsTilesStub(), mnTextDrawNumberInWindowStub(), mnWindowSetTilemapEntryStub() and Sint32.

Referenced by mnItemMenuDrawItemDetails().

Definition at line 2373 of file menu_item.c.

mnItemMenuFitMessageWindowToLongItemQuestion

void mnItemMenuFitMessageWindowToLongItemQuestion(void)

Makes the item menu's message window six tiles high.

References mnWindowSetBounds().

Referenced by mnItemMenuRunCommands().

Definition at line 2776 of file menu_item.c.

mnQuantityBarFillStub

void mnQuantityBarFillStub(Sint32 count, Sint32 color, void *tiles)

Colours the first count segments of the quantity bar in tiles, each two pixels wide: the left pixel in colour 1, the right in colour color.

Referenced by mnItemMenuSelectGiveQuantity().

Definition at line 2820 of file menu_item.c.

mnItemMenuBuildPagedList

Sint32 mnItemMenuBuildPagedList(PAGED_LIST *list, Sint32 side)

Sets list up over the items of the party member in side, five a page, its cursor on the item chosen last there (or the last item).

References gmUnitGet(), mnItemMenuCountItems() and Sint32.

Referenced by mnItemMenuRunList().

Definition at line 3176 of file menu_item.c.

mnItemMenuShowSelectedRow

Sint32 mnItemMenuShowSelectedRow(Sint32 listWindow, void *unused, PAGED_LIST *list)

Describes the item under the list's cursor in the info window and highlights its row alone.

References mnWindowSetHighlightRect(), Sint32 and sySynch().

Referenced by mnItemMenuRunList().

Definition at line 3211 of file menu_item.c.

mnItemMenuDrawListPage

Sint32 mnItemMenuDrawListPage(Sint32 window, Sint32 unused, const PAGED_LIST *list)

Draws one page of the item list into window: a divider, the page's icons and page numbers, and up to five item names.

References mnPagedListDrawPageNumbers(), mnSetPageIcons(), mnTextDrawMessageAsTilesStub(), mnWindowDrawDividerLineStub(), mnWindowSpriteRedrawSavedRectStub() and Sint32.

Referenced by mnItemMenuRunList().

Definition at line 3263 of file menu_item.c.

Variables in detail

extern const Uint8 MenuQuantityTiles[]

The item menu's quantity bar picture, which mnQuantityBarFillStub fills in under the "How many?" question.

Referenced by mnItemMenuSelectGiveQuantity().

Definition at line 2816 of file menu_item.c.

On this page

MacrosEnumerationsFunctionsVariablesDescriptionMacros in detailITEM_COMMAND_STATE_DISABLEDITEM_COMMAND_STATE_AVAILABLEMESSAGE_YOU_WERE_CURSEDMESSAGE_NOMESSAGE_VIEW_EQUIPMENT_HELPITEM_MODAL_SHORT_XITEM_MODAL_REMOVED_XITEM_CANNOT_TRADE_XITEM_TRADED_XICON_GRID_ROWTRADE_LABEL_XIN_STOCK_LABEL_XmnItemMenuDrawInfomnItemMenuClearInfoITEM_PREVIEW_ON_COPYCOMMAND_CURSOR_XCOMMAND_CURSOR_YITEM_COMMAND_TEXT_XTEXT_COLOR_DISABLEDITEM_DETAILS_WINDOW_WIDTHITEM_DETAILS_HEADING_XITEM_DETAILS_USES_XITEM_DETAILS_NUMBER_XITEM_DETAILS_VALUE_XITEM_DETAILS_MULTIPLIER_XmnTextDrawStringInWindowStubITEM_MENUHOW_MANY_MESSAGEHOW_MANY_XHOW_MANY_YPIECE_MESSAGEHOW_MANY_CURSOR_XITEM_DROP_QUESTION_XEQUIP_YES_XEQUIP_YES_YEQUIP_NO_XEQUIP_NO_YEQUIP_CURSOR_XEQUIP_CURSOR_YEQUIP_PREVIOUS_KEYEQUIP_NEXT_KEYEQUIP_QUESTION_XEQUIP_QUESTIONITEM_PAGE_ICONS_XENTRY_XEnumerations in detailEQUIP_REFUSALITEM_TARGET_MODEITEM_MENU_COMMANDITEM_MENU_STEPFunctions in detailmnItemMenuChooseCommandmnItemMenuCollectItemsmnItemMenuConfirmDropmnItemMenuConfirmEquipmnItemMenuCountItemsmnItemMenuDrawIconsmnItemMenuDrawItemHeadmnItemMenuDrawMessagemnItemMenuGetItemQuantitymnItemMenuIsStatRaisingItemmnItemMenuRefreshMembermnItemMenuRunListmnItemMenuSelectGiveQuantitymnItemMenuSelectMembermnItemMenuSelectTargetmnItemMenuPlaceItemWindowBelowQuestionmnItemMenuPlaceItemWindowBelowItemQuestionmnItemMenuFitMessageWindowToQuestionmnItemMenuFitMessageWindowToItemQuestionmnItemMenuShowDetailsmnItemMenuTryBreakmnItemMenuUsemnItemClassifyUseModemnLoadStatArrowsmnItemMenuClosemnItemMenuRunCommandsmnItemMenuInitmnItemMenuHideAllIconsmnItemMenuRunmnItemMenuDrawEquipPreviewmnItemMenuHideTradedIconsmnSpawnIconEntriesmnItemMenuRunMemberSelectionmnItemMenuShowEquipmentmnEquipmentMenuUpdateCompatibilityIndicatorsmnEquipmentMenuStopCompatibilityIndicatorsmnHideEmptyEntryIconsmnInventoryMakeRoommnItemMenuGetCommandCursorXmnItemMenuGetCommandCursorYmnItemMenuBuildCommandsmnItemMenuFitMessageWindowToItemChoicesmnItemMenuDrawCommandsfdHasItemCueStubmnItemMenuOpenDetailmnItemMenuDrawItemDetailsmnItemMenuDrawStatmnItemMenuDrawItemDetailsWithCountmnItemMenuFitMessageWindowToLongItemQuestionmnQuantityBarFillStubmnItemMenuBuildPagedListmnItemMenuShowSelectedRowmnItemMenuDrawListPageVariables in detailMenuQuantityTiles