Skip to Content
The Alchemy Project

include/menu/menu.h

What the menus share with the window module, the shops and the debug rooms: the item list's sort orders, the strings and tables the menus draw from, and the functions each side calls of the other.

Included by battle_internal.h, battle_effect_internal.h, level.c, shop_test.c, field_engine_internal.h, field_internal.h, field_psynergy_internal.h, lucky_dice.c, script_commands_internal.h, super_lucky_dice.c, credits.c, menu_internal.h, menu_tables.c, clear.c, epilogue.c, emote_pop_tilted.c, title.c, world_map.c, shop_internal.h and window_internal.h.

Macros

NameDescription
#defineLIST_ORDER_TYPE_MASK 0x7fThe item menu's sort orders (MenuListOrderItemsFirst and the three after it): one byte per group, an item type, with LIST_ORDER_EQUIPPED for only the equipped items of that type, ending with LIST_ORDER_END.
#defineLIST_ORDER_EQUIPPED 0x80
#defineLIST_ORDER_END 255
#defineLIST_PAGE_SIZE 5The rows a page of the item and Psynergy lists shows.
#defineMENU_MEMBER_Y 26The y of the menus' row of party figures, and of the chosen member's, lowered below the rest.
#defineMENU_MEMBER_CHOSEN_Y 30

Enumerations

NameDescription
enumLIST_SORT { LIST_SORT_EQUIPPED_THEN_ITEMS, LIST_SORT_EQUIPPED_THEN_EQUIP … }The item menu's four sort orders (mnItemMenuSort), which L + A cycles through in this order.
enumCREDITS_MODE { CREDITS_MODE_STORY_CRAWL, CREDITS_MODE_FIRST_PAGE }mnCreditsRun's modes: the title's story crawl over the slideshow, or the staff credits from a page, CREDITS_MODE_FIRST_PAGE being their first.

Functions

NameDescription
voidmnHideEntryIcons (void)Moves the 32 entry icons off screen before a screen lays them out again.
voidmnDjinnMenuDrawPage (struct DJINN_MENU_BACKDROP *backdrop, Sint32 page)Routines the menus and the window module call of each other and of the field and game modules.
voidfdScriptFinishScreenTransitionStub (void)
voidmnItemMenuArrangeCategoryItemIcons (Uint16 *items)Places the icon of each worn weapon, armor, shield and helm at x 216, on its slot's row of mnItemMenuDrawEquipment's window; the others stay off screen.
voidmnItemMenuDrawEquippedItemNames (Sint32 window, Uint16 *items)Writes the name of each equipped item of the inventory into window, below its slot's label: the weapon, the helm, the shield, then the armor.
voidgmPartyAdjustCoinsStub (Sint32 amount)
Sint32gmPartyListMembersStub (Sint16 *unitIds)
Sint32gmPartySumDjinnCountsStub (Sint32 element)
void *mnStringFormatPlayTime (Sint32 ticks, Uint8 *out)Writes the play time ticks into out as hours and minutes, "hhh:mm" with the hours right-aligned in three characters, and returns out.
Sint32mnItemMenuRun (void)The menu module's functions in the order of its stub table.
Sint32mnPsynergyMenuRun (void)The field menu's Psynergy screen (mnFieldMenuRun, FIELD_MENU_PSYNERGY), over the field, which stops meanwhile.
Sint32mnStatusScreenRun (void)The Status screen, the field menu's Status, over the field: saves the background palettes and the window tiles it draws over, sets up the party row, the five command icons and, when the party has Djinn, the Djinn figures, runs the status pages, then puts everything back.
Sint32mnPartyMemberChooserOpen (void)Lets the player choose one party member, over the field.
Sint32mnIconCreateHandCursor (struct WINDOW *window, Sint32 x, Sint32 y)Creates a hand cursor sprite in window at (x, y), loading the hand's tiles into a free VRAM block.
voidmnIconShow (struct WINDOW_SPR *icon)Shows an icon at its place, unscaled.
Sint32mnDjinnMenuRun (void)Runs the Djinn menu over the field: the field menu's Djinn screen (mnFieldMenuRun, FIELD_MENU_DJINN), and the Djinn tutorial.
voidmnItemMenuDrawItemDetails (Sint32 window, Sint32 item)Describes item in window with the entry's own count, through mnItemMenuDrawItemDetailsWithCount.
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.
voidmnPaletteLoadIconsIntoHighlight (void)Lends HIGHLIGHT_PALETTE to the element icons: copies the first sprite palette, the icons' colours, into it, then WINDOW_BACKGROUND_COLOR over its TEXT_BACKGROUND_COLOR.
voidmnUpdatePartyFigures (void)An event while the party figures show: places each party member's figure at its menu position and scale through the projected placement.
voidmnCreatePartyFigures (Sint32 first)Replaces the menu's party figures with up to four party members' figures, from party place first on, standing (ANIM_STAND), and counts the party.
voidmnShowPartyFigures (struct WINDOW *window, Sint32 originX, Sint32 originY)Creates the first four party members' figures in a row from tile (originX, originY) inside window, three tiles apart, and starts placing them each tick (mnUpdatePartyFigures).
voidmnReleasePartyFigures (void)Destroys the menu's party figures and stops placing them.
voidmnDjinnFiguresInitTopRow (void)Replaces the four Djinn figures with one Djinni of each element (DjinnFiguresSpriteIds) walking (ANIM_WALK), at FIGURE_START_X and MENU_FIGURE_HIDDEN_Y until the screen moves them, and starts placing them each tick (mnDjinnFiguresUpdateTopRow).
voidmnDjinnFiguresReleaseTopRow (void)Destroys the four Djinn figures and stops placing them.
voidmnDjinnFiguresSetShown (Sint32 shown)Shows the Djinn figures of the top row (nonzero) or hides them (0).
voidmnDjinnFiguresReplaceSlot (Sint32 index, Sint32 kind, Sint32 animation)Replaces Djinn figure index with a Djinni of element kind (DjinnFiguresSpriteIds) playing animation.
voidmnDjinnFiguresSetSlotPos (Sint32 index, Sint32 x, Sint32 y)Moves Djinn figure index to screen pixel (x, y), if it exists.
voidmnDjinnFiguresSetSlotFacing (Sint32 index, Sint32 facing)Turns Djinn figure index to face facing (FACING), if it exists.
voidmnDjinnFiguresSetSlotPhase (Sint32 index, Sint32 scale)Sets Djinn figure index's scale, if it exists: a positive scale grows towards full size, a negative one holds at its size.
Sint32mnTitleShowTitleScreen (Sint32 prompt)The title module's functions in the order of its stub table.
voidmnTitleAfterIntroNoOperation (void)Unused: an empty entry the stub table keeps.
voidmnTitleBeforeLogosNoOperation (void)Unused: an empty entry the stub table keeps.
Sint32mnTitleShowPublisherLogo (Sint32 mode)Shows the publisher's logo with its chime.
Sint32mnTitleShowCamelotLogo (void)Shows the Camelot logo for two seconds, cycling the four pictures of its flag.
Sint32mnTitleIntroRun (Sint32 unused)The intro (menu/title_intro.c): it takes a flag, 1 from the title and 0 before the prologue, that it never reads.
Sint32mnCreditsRun (Sint32 mode)The credits module's functions in the order of its stub table.
voidmnEndingImageStart (void)Starts the ending's images (the epilogue scene calls it first): resets the event table and the scroll, adds mnEndingImageScroll, sets up BG2, BG3 and blending, and builds the border strips.
voidmnEndingImageShow (Sint32 resource, Uint8 *map, Sint32 pos)Shows a scrolling image on the hidden one of the two BG character blocks.
voidmnEndingImageSetTargetRow (Uint16 row)Sets the row the ending's scrolling image moves to, in pixels from its top, at most EndingImageSpeed a tick.
voidmnEndingImageWaitForScroll (void)Waits, for at most 300 ticks, until the scroll reaches its row.
voidmnEndingImageLowerTopStrip (Sint32 enable)Moves the top strip's eight sprites to y 120 when enable is set, and to y 0 otherwise.
Sint32mnBattleClassifyEntryKind (const struct ABILITY_DEFINITION *entry)Classifies ability act's effect for target selection: the hint mnBattleTargetRunSelection shows on a party member and starts on (enum BATTLE_TARGET_HINT).

Variables

NameDescription
extern Uint8StatusScreenCursorWidths []The width in tiles of each status row's highlight on the status page (enum UNIT_STAT).
extern Uint8MenuListOrderItemsFirst []The item menu's sort orders (LIST_SORT, mnCopyListOrder): one item type per byte, with LIST_ORDER_EQUIPPED for only the equipped items of that type, ending with LIST_ORDER_END.
extern Uint8MenuListOrderEquippedThenItems []LIST_SORT_EQUIPPED_THEN_ITEMS: the equipped items, the items that are not equipment, then the other equipment.
extern Uint8MenuListOrderEquippedThenEquipment []LIST_SORT_EQUIPPED_THEN_EQUIPMENT: the equipped items, the other equipment, then the rest.
extern Uint8MenuListOrderEquipmentFirst []LIST_SORT_EQUIPMENT_FIRST: the equipment first, the rest last.
extern Uint8MenuMinusSignString-, before a stat change that is not a gain (mnItemMenuDrawStat).
extern Uint8MenuPlusSignString+, before a stat gain.
extern Sint8MenuTopEntryCommandByPosition []The field menu's four icons: the command at each place, and the place of each command.
extern Sint8MenuTopEntryPositionByCommand []The icon position + 1 of each field menu command (FIELD_MENU_COMMAND), in the same two rows; without Djinn, Djinn starts on the first icon.
extern const Uint8StatusMenuLevelLetterString []L, before a level in the file list (screens_save.c).
extern Uint8MenuClassChangeArrowTile []The down arrow from the class now to the class an equipment would give (backdrop.4bpp), which mnWatchStart blinks every four ticks at CLASS_CHANGE_ARROW_TILE.
extern const Uint8MenuColonString []: and the sixteen hex digits, for the debug rooms' flag and destination lists.
extern const Uint8MenuHexDigitsString []The flag browser's column heading, one hex digit a column.
extern Uint8MenuSelectionStepDelays []The ticks a selection made for the player to watch waits at each step, by the icons still to go (mnIconMenuAnimateTo).

Description

What the menus share with the window module, the shops and the debug rooms: the item list's sort orders, the strings and tables the menus draw from, and the functions each side calls of the other.

Macros in detail

LIST_ORDER_TYPE_MASK

#define LIST_ORDER_TYPE_MASK 0x7f

The item menu's sort orders (MenuListOrderItemsFirst and the three after it): one byte per group, an item type, with LIST_ORDER_EQUIPPED for only the equipped items of that type, ending with LIST_ORDER_END.

Referenced by mnItemMenuSort().

Definition at line 14 of file menu.h.

LIST_ORDER_EQUIPPED

#define LIST_ORDER_EQUIPPED 0x80

Referenced by MenuListOrderEquippedThenEquipment, MenuListOrderEquippedThenItems and mnItemMenuSort().

Definition at line 15 of file menu.h.

LIST_ORDER_END

#define LIST_ORDER_END 255

Referenced by MenuListOrderEquipmentFirst, MenuListOrderEquippedThenEquipment, MenuListOrderEquippedThenItems, MenuListOrderItemsFirst, mnCopyListOrder() and mnItemMenuSort().

Definition at line 16 of file menu.h.

LIST_PAGE_SIZE

#define LIST_PAGE_SIZE 5

The rows a page of the item and Psynergy lists shows.

Referenced by mnItemMenuBuildPagedList(), mnItemMenuDrawListPage(), mnItemMenuRunList(), mnItemMenuShowSelectedRow(), mnPsynergyMenuBuildPagedList(), mnPsynergyMenuDrawPage(), mnPsynergyMenuRunList() and mnPsynergyMenuShowSelectedRow().

Definition at line 38 of file menu.h.

#define MENU_MEMBER_Y 26

The y of the menus' row of party figures, and of the chosen member's, lowered below the rest.

Referenced by mnItemMenuInit(), mnMarkChosenMember(), mnPartyMemberChooserOpen() and mnStatusScreenShowDjinnList().

Definition at line 42 of file menu.h.

#define MENU_MEMBER_CHOSEN_Y 30

Referenced by mnMarkChosenMember().

Definition at line 43 of file menu.h.

Enumerations in detail

LIST_SORT

enum LIST_SORT

The item menu's four sort orders (mnItemMenuSort), which L + A cycles through in this order.

EnumeratorValueDescription
LIST_SORT_EQUIPPED_THEN_ITEMS0The equipped items, the items that
LIST_SORT_EQUIPPED_THEN_EQUIPMENT1are not equipment, then the other equipment (MenuListOrderEquippedThenItems). The equipped items, the other equipment, then the rest (MenuListOrderEquippedThenEquipment).
LIST_SORT_EQUIPMENT_FIRST2The equipment first (MenuListOrderEquipmentFirst).
LIST_SORT_ITEMS_FIRST3The items that are not equipment
LIST_SORT_COUNT4first (MenuListOrderItemsFirst).

Definition at line 20 of file menu.h.

CREDITS_MODE

enum CREDITS_MODE

mnCreditsRun's modes: the title's story crawl over the slideshow, or the staff credits from a page, CREDITS_MODE_FIRST_PAGE being their first.

EnumeratorValueDescription
CREDITS_MODE_STORY_CRAWL1
CREDITS_MODE_FIRST_PAGE2

Definition at line 95 of file menu.h.

Functions in detail

fdScriptFinishScreenTransitionStub

void fdScriptFinishScreenTransitionStub(void)

Referenced by mnInnPlaySleep().

Definition at line 77 of file menu.h.

gmPartyAdjustCoinsStub

void gmPartyAdjustCoinsStub(Sint32 amount)

Referenced by btAwardSpoils(), fdLuckyDiceRun(), fdSuperLuckyDiceRun(), fdTalkToActor(), mnInnPlaySleep(), mnSanctumRunPartyService(), mnShopBuyDone(), mnShopRepairItem() and mnShopSellItem().

Definition at line 80 of file menu.h.

gmPartyListMembersStub

Sint32 gmPartyListMembersStub(Sint16 *unitIds)

Referenced by mnCreatePartyFigures(), mnDjinnMenuRun(), mnDjinnMenuRunPreview(), mnForgePartyHasMaterial(), mnInnPlaySleep(), mnItemMenuRun(), mnPartyMemberChooserOpen(), mnPsynergyMenuRun(), mnSaveBuildFileSummary(), mnShopInitState(), mnStatusScreenMovePartyMember() and mnStatusScreenRun().

Definition at line 81 of file menu.h.

gmPartySumDjinnCountsStub

Sint32 gmPartySumDjinnCountsStub(Sint32 element)

Referenced by mnBattleStatusScreenRun(), mnDjinnMenuDrawPage(), mnFieldMenuSelectCommand(), mnSaveBuildFileSummary(), mnStatusScreenDrawStatusPage(), mnStatusScreenRun() and mnStatusScreenRunStatusPage().

Definition at line 82 of file menu.h.

Variables in detail

StatusScreenCursorWidths

extern Uint8 StatusScreenCursorWidths[]

The width in tiles of each status row's highlight on the status page (enum UNIT_STAT).

Referenced by mnStatusScreenDrawSelectionCursor().

Definition at line 47 of file menu.h.

StatusMenuLevelLetterString

extern const Uint8 StatusMenuLevelLetterString[]

L, before a level in the file list (screens_save.c).

Referenced by mnFileListDrawSummary().

Definition at line 61 of file menu.h.

extern Uint8 MenuClassChangeArrowTile[]

The down arrow from the class now to the class an equipment would give (backdrop.4bpp), which mnWatchStart blinks every four ticks at CLASS_CHANGE_ARROW_TILE.

Referenced by mnWatchStart().

Definition at line 73 of file menu.h.