Skip to Content
The Alchemy Project

src/window/screens_icon_menu.c

Collecting the party's battle commands, then the icon menus: a row of command icons with a label window, the selected icon pulsing, as the field menu, the File Screen, the transfer screens, the shops, the sanctums, Yes or No and Coins or Lucky Medals use it. More…

Included by screens.c.

Macros

NameDescription
#defineSUMMON_WINDOW_X JAPANESE_OR(9, 10)While a party member's commands are chosen (mnBattleCollectPartyCommands), where the Japanese layout differs: the chosen summon's window and the columns of its first Djinn cost, the element icon and then the count, and the chosen item's window, in tiles; the party member's portrait, and the chosen command's icon beside the summon list, beside the chosen summon and beside the Djinn list, in pixels.
#defineBATTLE_SUMMON_WINDOW_WIDTH JAPANESE_OR(16, 17)
#defineBATTLE_SUMMON_ELEMENT_COLUMN JAPANESE_OR(10, 11)
#defineBATTLE_SUMMON_COST_COLUMN JAPANESE_OR(11, 12)
#defineBATTLE_ITEM_WINDOW_WIDTH JAPANESE_OR(15, 16)
#defineBATTLE_PORTRAIT_X JAPANESE_OR(4, 0)
#defineBATTLE_SUMMON_ICON_X JAPANESE_OR(88, 80)
#defineSUMMON_CHOSEN_ICON_X JAPANESE_OR(48, 56)
#defineDJINN_MENU_ICON_X JAPANESE_OR(144, 140)
#defineBATTLE_COMMAND_NAME_X FRENCH_OR(14, 16)Where "Attack" is written in its window once chosen, in pixels.
#definePSYNERGY_MENU_ICON_X BY_LANGUAGE(48, 48, 48, 40, 40, 48)The chosen command's icon beside the Psynergy list, in pixels.
#defineATTACK_ICON_X 64The chosen command's icon beside the window that names Attack, the chosen Psynergy, the chosen Djinni or the chosen item, and beside the item list, in pixels.
#definePSYNERGY_CHOSEN_ICON_X 40
#defineDJINN_CHOSEN_ICON_X 64
#defineITEM_MENU_ICON_X 96
#defineITEM_CHOSEN_ICON_X 48
#defineFLEE_PRIORITY 32766Flee's priority, above every other action's: the party flees first in the turn.
#defineOVERFLOWED_PRIORITY 2000The priority an action takes when its Agility roll runs past 32767.
#defineCOMMAND_ICON_X (state) ((state)->icons[0].oam.f.x)The x of the first command icon's sprite.
#defineICON_MENU_BOTTOM_ROW 17The icon menus' bottom row, in tiles, where most of them stand; a Yes or No may stand at the top, row 0, instead.
#defineICON_ROW_LINES 24The lines an icon row covers: its label window's three tiles.
#definePULSE_OVERHANG_X (scale) ((((scale) - Q_8_8(1)) * 12 + 255) / 256)How far the selected icon overhangs its place while it pulses at the 8.8 scale: on each side, half its 24-pixel width grown by the scale, rounded up; and past its row, half its 32-pixel height grown by the scale, rounded, and a line more.
#definePULSE_OVERHANG_LINES (scale)
#defineLABEL_RIGHT BY_LANGUAGE(80, 128, 128, 128, 160, 128)The label area is narrower in Japanese and wider in French.
#defineHELP_X SPANISH_OR(6, 0)The Spanish descriptions are indented.
#defineENTRY_WIDTH BY_LANGUAGE(5, 7, 7, 9, 9, 7)The entries' width and the windows' places and widths, in tiles, and where the lines of text start, in pixels, are fitted to each language's text.
#definePASSWORD_UPPER_X BY_LANGUAGE(9, 8, 7, 5, 5, 7)
#definePASSWORD_UPPER_WIDTH BY_LANGUAGE(13, 14, 16, 21, 20, 17)
#definePASSWORD_LOWER_X BY_LANGUAGE(5, 4, 4, 3, 3, 3)
#definePASSWORD_LOWER_WIDTH BY_LANGUAGE(21, 22, 22, 25, 25, 25)
#defineTRANSFER_UPPER_X BY_LANGUAGE(9, 6, 6, 4, 5, 5)
#defineTRANSFER_UPPER_WIDTH BY_LANGUAGE(13, 18, 18, 22, 20, 20)
#defineTRANSFER_TITLE_X BY_LANGUAGE(0, 12, 6, 2, 2, 2)
#defineTRANSFER_LOWER_X BY_LANGUAGE(5, 5, 2, 1, 1, 1)
#defineTRANSFER_LOWER_WIDTH BY_LANGUAGE(21, 21, 26, 28, 28, 28)
#definePASSWORD_TEXT_X 8
#definePASSWORD_TEXT_Y 0
#definePASSWORD_LINE_HEIGHT 11
#definePAIR_WIDTH BY_LANGUAGE(7, 9, 9, 9, 10, 10)The label window's width for each language.

Functions

NameDescription
Sint32mnBattleCollectPartyCommands (BATTLE_ACTION *commands, Uint16 *actors, Sint32 commandCount)Collects the party's commands for a turn into commands, one for each of the commandCount units in actors, with two nested functions: the party panels' clear and the link wait's message (mnLinkDrawWaitingForOpponent).
voidmnIconMenuDrawIcons (void)Draws the icon menu's icons, an event of the icon menus (mnIconMenuOpen).
void *mnIconMenuOpen (void)Allocates and clears the icon menu's state, which lives in HEAP_SLOT_ICON_MENU until mnIconMenuClose frees it, and starts the event that draws its icons.
voidmnIconMenuClose (void)Stops drawing the icons, closes the label window and releases each loaded icon before freeing the icon menu's state (HEAP_SLOT_ICON_MENU), then waits a tick.
Sint32mnIconMenuRun (Sint32 init)Selects an icon position with wrapped directional input.
static inline Sint32mnAbsoluteDifference (Sint32 difference, Sint32 lhs, Sint32 rhs)Returns the distance between lhs and rhs, reusing their supplied difference.
Sint32mnIconMenuAnimateTo (Sint32 start, Sint32 goal)Moves the selection from start to goal one icon at a time with the cursor sound, redrawing the label each step and waiting MenuSelectionStepDelays[icons still to go] ticks at each (12 more at the first), then 48 ticks on the goal before the confirm sound: a menu choice made for the player to watch (mnAnimateSelectionToEntry).
voidmnCommandIconLoadIntoSlot (Sint32 slot, Sint32 index)Decodes command icon index into the VRAM cache entry slot, through a block it allocates and frees.
voidmnIconMenuAddIcon (Sint32 icon)Appends a command icon while the menu has room for one (ICON_MENU_STATE's six entries).
voidmnIconMenuCenter (Sint32 row, Sint32 width, Sint32 resourceBase)Centres the icons and their label window together on tile row row.
voidmnIconMenuLayoutIcons (Sint32 x, Sint32 y, Sint32 width, Sint32 resourceBase)Places the icons three tiles apart from tile (x, y), then opens their label window, width + 2 tiles wide, just after them.
static __inline__ Sint32mnIconMenuReadCommandPos (Sint8 *table, Sint32 index)Reads one entry of a field menu table (MenuTopEntryPositionByCommand).
Sint32mnFieldMenuSelectCommand (Sint32 selection)The field menu's row of icons: Psynergy, Djinn, Item and Status, without Djinn when the party has none.
Sint32mnAnimateSelectionToEntry (Sint32 start, Sint32 command)Opens the field command menu and animates from start to the command's icon.
Sint32mnFileListSelectAction (void)The File Screen's row of icons, from the save summaries: New Game, Continue, Copy and Erase for one or two files (starting on Continue); no New Game or Copy with three; with every file cleared no Continue, and only Erase with three such files; then Battle and Update when they are enabled.
voidmnPasswordLevelMenuDrawContents (void)When the chosen password level changes, clears the lower window's text area (from x 8 to LABEL_RIGHT) and lists what a password of that level carries: Gold five lines, Silver three, Bronze two.
voidmnTransferMethodMenuDrawHelp (void)Redraws the chosen transfer method's help in the lower window.
Sint32mnIconMenuChooseSendOption (Sint32 mode)Selects the transfer method or the password level (mode, enum SEND_OPTION_MENU), with a heading window above and an explanation of the selected icon below, redrawn by an event while the menu runs.
Sint32mnSelectShopCommand (Sint32 selection)Selects a shop command (Buy, Sell, Artifacts, Repair), centred on the bottom row, starting on position selection, and returns the position chosen.
Sint32mnSelectSanctumService (Sint32 selection)Selects a Sanctum service (Revive, Cure Poison, Repel Evil, Remove Curse), centred on the bottom row, starting on position selection.
Sint32mnYesNoMenuRun (Sint32 bottom, Sint32 msg, Sint32 labelWidth, Sint32 selection)Selects Yes or No, starting on selection; cancelling answers No.
Sint32mnYesNoMenuRunAt (Sint32 x, Sint32 y, Sint32 selection)Selects Yes or No with the icons from tile (x, y), starting on selection; cancelling answers No.
Sint32mnSelectCoinsOrMedals (Sint32 selection)Selects Coins or Lucky Medals, centred on the bottom row, starting on selection, and returns the position chosen.
voidmnDebugSceneSelectSchedule (void)Unused: starts the debug scene and entrance selector as an event.

Description

Collecting the party's battle commands, then the icon menus: a row of command icons with a label window, the selected icon pulsing, as the field menu, the File Screen, the transfer screens, the shops, the sanctums, Yes or No and Coins or Lucky Medals use it. Part of screens.c.

Macros in detail

SUMMON_WINDOW_X

#define SUMMON_WINDOW_X JAPANESE_OR(9, 10)

While a party member's commands are chosen (mnBattleCollectPartyCommands), where the Japanese layout differs: the chosen summon's window and the columns of its first Djinn cost, the element icon and then the count, and the chosen item's window, in tiles; the party member's portrait, and the chosen command's icon beside the summon list, beside the chosen summon and beside the Djinn list, in pixels.

Referenced by mnBattleCollectPartyCommands().

Definition at line 12 of file screens_icon_menu.c.

BATTLE_SUMMON_WINDOW_WIDTH

#define BATTLE_SUMMON_WINDOW_WIDTH JAPANESE_OR(16, 17)

Referenced by mnBattleCollectPartyCommands().

Definition at line 13 of file screens_icon_menu.c.

BATTLE_SUMMON_ELEMENT_COLUMN

#define BATTLE_SUMMON_ELEMENT_COLUMN JAPANESE_OR(10, 11)

Referenced by mnBattleCollectPartyCommands().

Definition at line 14 of file screens_icon_menu.c.

BATTLE_SUMMON_COST_COLUMN

#define BATTLE_SUMMON_COST_COLUMN JAPANESE_OR(11, 12)

Referenced by mnBattleCollectPartyCommands().

Definition at line 15 of file screens_icon_menu.c.

BATTLE_ITEM_WINDOW_WIDTH

#define BATTLE_ITEM_WINDOW_WIDTH JAPANESE_OR(15, 16)

Referenced by mnBattleCollectPartyCommands().

Definition at line 16 of file screens_icon_menu.c.

BATTLE_PORTRAIT_X

#define BATTLE_PORTRAIT_X JAPANESE_OR(4, 0)

Referenced by mnBattleCollectPartyCommands().

Definition at line 17 of file screens_icon_menu.c.

BATTLE_SUMMON_ICON_X

#define BATTLE_SUMMON_ICON_X JAPANESE_OR(88, 80)

Referenced by mnBattleCollectPartyCommands().

Definition at line 18 of file screens_icon_menu.c.

SUMMON_CHOSEN_ICON_X

#define SUMMON_CHOSEN_ICON_X JAPANESE_OR(48, 56)

Referenced by mnBattleCollectPartyCommands().

Definition at line 19 of file screens_icon_menu.c.

DJINN_MENU_ICON_X

#define DJINN_MENU_ICON_X JAPANESE_OR(144, 140)

Referenced by mnBattleCollectPartyCommands().

Definition at line 20 of file screens_icon_menu.c.

BATTLE_COMMAND_NAME_X

#define BATTLE_COMMAND_NAME_X FRENCH_OR(14, 16)

Where "Attack" is written in its window once chosen, in pixels.

Referenced by mnBattleCollectPartyCommands().

Definition at line 23 of file screens_icon_menu.c.

PSYNERGY_MENU_ICON_X

#define PSYNERGY_MENU_ICON_X BY_LANGUAGE(48, 48, 48, 40, 40, 48)

The chosen command's icon beside the Psynergy list, in pixels.

Referenced by mnBattleCollectPartyCommands().

Definition at line 26 of file screens_icon_menu.c.

ATTACK_ICON_X

#define ATTACK_ICON_X 64

The chosen command's icon beside the window that names Attack, the chosen Psynergy, the chosen Djinni or the chosen item, and beside the item list, in pixels.

Referenced by mnBattleCollectPartyCommands().

Definition at line 31 of file screens_icon_menu.c.

PSYNERGY_CHOSEN_ICON_X

#define PSYNERGY_CHOSEN_ICON_X 40

Referenced by mnBattleCollectPartyCommands().

Definition at line 32 of file screens_icon_menu.c.

DJINN_CHOSEN_ICON_X

#define DJINN_CHOSEN_ICON_X 64

Referenced by mnBattleCollectPartyCommands().

Definition at line 33 of file screens_icon_menu.c.

ITEM_MENU_ICON_X

#define ITEM_MENU_ICON_X 96

Referenced by mnBattleCollectPartyCommands().

Definition at line 34 of file screens_icon_menu.c.

ITEM_CHOSEN_ICON_X

#define ITEM_CHOSEN_ICON_X 48

Referenced by mnBattleCollectPartyCommands().

Definition at line 35 of file screens_icon_menu.c.

FLEE_PRIORITY

#define FLEE_PRIORITY 32766

Flee's priority, above every other action's: the party flees first in the turn.

Referenced by mnBattleCollectPartyCommands().

Definition at line 39 of file screens_icon_menu.c.

OVERFLOWED_PRIORITY

#define OVERFLOWED_PRIORITY 2000

The priority an action takes when its Agility roll runs past 32767.

Referenced by mnBattleCollectPartyCommands().

Definition at line 41 of file screens_icon_menu.c.

COMMAND_ICON_X

#define COMMAND_ICON_X(state) ((state)->icons[0].oam.f.x)

The x of the first command icon's sprite.

Referenced by mnBattleCollectPartyCommands().

Definition at line 44 of file screens_icon_menu.c.

ICON_MENU_BOTTOM_ROW

#define ICON_MENU_BOTTOM_ROW 17

The icon menus' bottom row, in tiles, where most of them stand; a Yes or No may stand at the top, row 0, instead.

Referenced by mnAnimateSelectionToEntry(), mnFieldMenuSelectCommand(), mnFileListSelectAction(), mnIconMenuAddIcon(), mnIconMenuChooseSendOption(), mnIconMenuDrawIcons(), mnSelectCoinsOrMedals(), mnSelectSanctumService(), mnSelectShopCommand() and mnYesNoMenuRun().

Definition at line 931 of file screens_icon_menu.c.

ICON_ROW_LINES

#define ICON_ROW_LINES 24

The lines an icon row covers: its label window's three tiles.

Referenced by mnIconMenuDrawIcons().

Definition at line 933 of file screens_icon_menu.c.

PULSE_OVERHANG_X

#define PULSE_OVERHANG_X(scale) ((((scale) - Q_8_8(1)) * 12 + 255) / 256)

How far the selected icon overhangs its place while it pulses at the 8.8 scale: on each side, half its 24-pixel width grown by the scale, rounded up; and past its row, half its 32-pixel height grown by the scale, rounded, and a line more.

Referenced by mnIconMenuDrawIcons().

Definition at line 939 of file screens_icon_menu.c.

PULSE_OVERHANG_LINES

#define PULSE_OVERHANG_LINES(scale)

Referenced by mnIconMenuDrawIcons().

Definition at line 940 of file screens_icon_menu.c.

LABEL_RIGHT

#define LABEL_RIGHT BY_LANGUAGE(80, 128, 128, 128, 160, 128)

The label area is narrower in Japanese and wider in French.

Referenced by mnPasswordLevelMenuDrawContents().

Definition at line 1502 of file screens_icon_menu.c.

HELP_X

#define HELP_X SPANISH_OR(6, 0)

The Spanish descriptions are indented.

Definition at line 1555 of file screens_icon_menu.c.

ENTRY_WIDTH

#define ENTRY_WIDTH BY_LANGUAGE(5, 7, 7, 9, 9, 7)

The entries' width and the windows' places and widths, in tiles, and where the lines of text start, in pixels, are fitted to each language's text.

Referenced by mnIconMenuChooseSendOption().

Definition at line 1657 of file screens_icon_menu.c.

PASSWORD_UPPER_X

#define PASSWORD_UPPER_X BY_LANGUAGE(9, 8, 7, 5, 5, 7)

Referenced by mnIconMenuChooseSendOption().

Definition at line 1658 of file screens_icon_menu.c.

PASSWORD_UPPER_WIDTH

#define PASSWORD_UPPER_WIDTH BY_LANGUAGE(13, 14, 16, 21, 20, 17)

Referenced by mnIconMenuChooseSendOption().

Definition at line 1659 of file screens_icon_menu.c.

PASSWORD_LOWER_X

#define PASSWORD_LOWER_X BY_LANGUAGE(5, 4, 4, 3, 3, 3)

Referenced by mnIconMenuChooseSendOption().

Definition at line 1660 of file screens_icon_menu.c.

PASSWORD_LOWER_WIDTH

#define PASSWORD_LOWER_WIDTH BY_LANGUAGE(21, 22, 22, 25, 25, 25)

Referenced by mnIconMenuChooseSendOption().

Definition at line 1661 of file screens_icon_menu.c.

TRANSFER_UPPER_X

#define TRANSFER_UPPER_X BY_LANGUAGE(9, 6, 6, 4, 5, 5)

Referenced by mnIconMenuChooseSendOption().

Definition at line 1662 of file screens_icon_menu.c.

TRANSFER_UPPER_WIDTH

#define TRANSFER_UPPER_WIDTH BY_LANGUAGE(13, 18, 18, 22, 20, 20)

Referenced by mnIconMenuChooseSendOption().

Definition at line 1663 of file screens_icon_menu.c.

TRANSFER_TITLE_X

#define TRANSFER_TITLE_X BY_LANGUAGE(0, 12, 6, 2, 2, 2)

Referenced by mnIconMenuChooseSendOption().

Definition at line 1664 of file screens_icon_menu.c.

TRANSFER_LOWER_X

#define TRANSFER_LOWER_X BY_LANGUAGE(5, 5, 2, 1, 1, 1)

Referenced by mnIconMenuChooseSendOption().

Definition at line 1665 of file screens_icon_menu.c.

TRANSFER_LOWER_WIDTH

#define TRANSFER_LOWER_WIDTH BY_LANGUAGE(21, 21, 26, 28, 28, 28)

Referenced by mnIconMenuChooseSendOption().

Definition at line 1666 of file screens_icon_menu.c.

PASSWORD_TEXT_X

#define PASSWORD_TEXT_X 8

#define PASSWORD_TEXT_X 0

Referenced by mnIconMenuChooseSendOption().

Definition at lines 1672 and 1676 of file screens_icon_menu.c.

PASSWORD_TEXT_Y

#define PASSWORD_TEXT_Y 0

#define PASSWORD_TEXT_Y 4

Referenced by mnIconMenuChooseSendOption().

Definition at lines 1673 and 1677 of file screens_icon_menu.c.

PASSWORD_LINE_HEIGHT

#define PASSWORD_LINE_HEIGHT 11

#define PASSWORD_LINE_HEIGHT 12

Referenced by mnIconMenuChooseSendOption().

Definition at lines 1674 and 1678 of file screens_icon_menu.c.

PAIR_WIDTH

#define PAIR_WIDTH BY_LANGUAGE(7, 9, 9, 9, 10, 10)

The label window's width for each language.

Referenced by mnSelectCoinsOrMedals().

Definition at line 1867 of file screens_icon_menu.c.

Functions in detail

mnBattleCollectPartyCommands

Sint32 mnBattleCollectPartyCommands(BATTLE_ACTION *commands, Uint16 *actors, Sint32 commandCount)

Collects the party's commands for a turn into commands, one for each of the commandCount units in actors, with two nested functions: the party panels' clear and the link wait's message (mnLinkDrawWaitingForOpponent). Unlike The Broken Seal's, each round first appends the forced actions of statused members (mnBattlePartySplitChoosers), whose count is added to the result; B on the party's row undoes a reserve swap; Switch swaps a reserve member in (mnBattlePartyChooseReserve after choosing the slot); Status lists the reserve as well; and the Djinn tutorial's hint follows an unleash.

References btCameraSetCommandViewStub(), btDjinnCountStandbyStub(), btHighlightSetModesStub(), btObjectPutStub(), btPartyPrepareReserveOwnersStub(), btSummonUpdateAvailabilityStub(), btUnitListIdsStub(), DebugMode, gmAbilityGetDefinitionStub(), gmDjinnGetAbilityIdStub(), gmDjinnIsSetStub(), gmItemGetDefinitionStub(), gmSummonDefinitionGetNearStub(), gmUnitGet(), LinkPeerSignatures, LinkStatusWork, MainRoutineStateWork, mnAbilityIconLoadIntoSlot(), mnBattleClassifyEntryKind(), mnBattleCommandRowRun(), mnBattleDjinnMenuRun(), mnBattleItemMenuRun(), mnBattleMenuUpdateEachTick(), mnBattlePartyChooseReserve(), mnBattlePartySplitChoosers(), mnBattlePsynergyMenuRun(), mnBattleRefuseFlee(), mnBattleStatusScreenRun(), mnBattleSummonMenuRun(), mnBattleTargetRunSelection(), mnCommandIconReloadSlot(), mnDjinnGetGiveTutorialMessage(), mnGraphicsExpandVRAMTilesByColorTable(), mnItemCheckBattleUse(), mnItemIconLoadIntoSlot(), mnMessageAllTyped(), mnMessageShowAndWait(), mnPageArrowsDraw(), mnPartyStatusDraw(), mnPartyStatusHighlightMembers(), mnPortraitLoad(), mnRangeIconBuildTiles(), mnTextDrawMessageAsTiles(), mnTextDrawNumberAtOffset(), mnTextDrawWideStringAtOffset(), mnTextFillCanvasBackground(), mnTextSetColor(), mnWindowClose(), mnWindowCreate(), mnWindowMarkVisibleTextTiles() and 18 more.

Definition at line 54 of file screens_icon_menu.c.

mnIconMenuDrawIcons

void mnIconMenuDrawIcons(void)

Draws the icon menu's icons, an event of the icon menus (mnIconMenuOpen). Each icon is a 32x32, 256-colour sprite, and one at x 0 is not drawn; the selected one pulses, double-size, between 1.19 and 1.31 times its size, in front of the others. While a screen transition runs, it widens window 1 over the icon row so the icons show through: from the first icon on the row's lines, keeping each line's right edge, and around the selected icon on the lines it overhangs, below a row at the top or above one at the bottom.

References Sint32, syOAMAddSpriteAtDepth(), syOAMMatrixAllocateFromTransform(), TickCount, VramCacheEntries and WindowSpriteBounceScales.

Referenced by mnIconMenuClose() and mnIconMenuOpen().

Definition at line 950 of file screens_icon_menu.c.

mnIconMenuOpen

void *mnIconMenuOpen(void)

Allocates and clears the icon menu's state, which lives in HEAP_SLOT_ICON_MENU until mnIconMenuClose frees it, and starts the event that draws its icons. Every icon menu starts here.

References mnIconMenuDrawIcons(), syHeapSlotAllocateEWRAM() and sySetEvent().

Referenced by mnAnimateSelectionToEntry(), mnFieldMenuSelectCommand(), mnFileListSelectAction(), mnIconMenuChooseSendOption(), mnSelectCoinsOrMedals(), mnSelectSanctumService(), mnSelectShopCommand(), mnYesNoMenuRun() and mnYesNoMenuRunAt().

Definition at line 1114 of file screens_icon_menu.c.

mnIconMenuClose

void mnIconMenuClose(void)

Stops drawing the icons, closes the label window and releases each loaded icon before freeing the icon menu's state (HEAP_SLOT_ICON_MENU), then waits a tick.

References mnIconMenuDrawIcons(), mnWindowClose(), Sint32, syCloseEvent(), syHeapSlotRelease(), sySynch() and syVRAMCacheFreeEntry().

Referenced by mnAnimateSelectionToEntry(), mnFieldMenuSelectCommand(), mnFileListSelectAction(), mnIconMenuChooseSendOption(), mnSelectCoinsOrMedals(), mnSelectSanctumService(), mnSelectShopCommand(), mnYesNoMenuRun() and mnYesNoMenuRunAt().

Definition at line 1127 of file screens_icon_menu.c.

mnIconMenuRun

Sint32 mnIconMenuRun(Sint32 init)

Selects an icon position with wrapped directional input. A returns the position; B or Start returns -1. Redraws the label only after a move: the message labelBase + position when the layout set a labelBase, else the icon's command name.

References mnTextDrawMessageAsTiles(), mnWindowSpritePrepareForRedraw(), PerWork, Sint32, sySoundPlayStub() and sySynch().

Referenced by mnFieldMenuSelectCommand(), mnFileListSelectAction(), mnIconMenuChooseSendOption(), mnSelectCoinsOrMedals(), mnSelectSanctumService(), mnSelectShopCommand(), mnYesNoMenuRun() and mnYesNoMenuRunAt().

Definition at line 1152 of file screens_icon_menu.c.

mnAbsoluteDifference

static inline Sint32 mnAbsoluteDifference(Sint32 difference, Sint32 lhs, Sint32 rhs)

Returns the distance between lhs and rhs, reusing their supplied difference.

References Sint32.

Referenced by mnIconMenuAnimateTo().

Definition at line 1205 of file screens_icon_menu.c.

mnIconMenuAnimateTo

Sint32 mnIconMenuAnimateTo(Sint32 start, Sint32 goal)

Moves the selection from start to goal one icon at a time with the cursor sound, redrawing the label each step and waiting MenuSelectionStepDelays[icons still to go] ticks at each (12 more at the first), then 48 ticks on the goal before the confirm sound: a menu choice made for the player to watch (mnAnimateSelectionToEntry). Returns goal.

References MenuSelectionStepDelays, mnAbsoluteDifference(), mnTextDrawMessageAsTiles(), mnWindowSpritePrepareForRedraw(), Sint32, sySoundPlayStub() and sySynch().

Referenced by mnAnimateSelectionToEntry().

Definition at line 1218 of file screens_icon_menu.c.

mnCommandIconLoadIntoSlot

void mnCommandIconLoadIntoSlot(Sint32 slot, Sint32 index)

Decodes command icon index into the VRAM cache entry slot, through a block it allocates and frees.

References Sint32, syDecompressByteLZ(), syHeapAllocate(), syHeapRelease(), syResourceGetTableEntry() and syVRAMCacheLoad().

Referenced by mnIconMenuAddIcon().

Definition at line 1276 of file screens_icon_menu.c.

mnIconMenuAddIcon

void mnIconMenuAddIcon(Sint32 icon)

Appends a command icon while the menu has room for one (ICON_MENU_STATE's six entries). It starts on the bottom row; mnIconMenuCenter or mnIconMenuLayoutIcons places the row. Its VRAM cache entry is taken unchecked.

References mnCommandIconLoadIntoSlot(), Sint32 and syVRAMCacheFindFreeEntry().

Referenced by mnAnimateSelectionToEntry(), mnFieldMenuSelectCommand(), mnFileListSelectAction(), mnIconMenuChooseSendOption(), mnSelectCoinsOrMedals(), mnSelectSanctumService(), mnSelectShopCommand(), mnYesNoMenuRun() and mnYesNoMenuRunAt().

Definition at line 1291 of file screens_icon_menu.c.

mnIconMenuCenter

void mnIconMenuCenter(Sint32 row, Sint32 width, Sint32 resourceBase)

Centres the icons and their label window together on tile row row. A nonzero resourceBase is the first label message; otherwise each icon is labelled by its command name. The icons stand three tiles apart and the label window, width + 2 tiles wide and 3 tall, follows them; the centring counts two thirds of the window's width.

References mnWindowCreate() and Sint32.

Referenced by mnAnimateSelectionToEntry(), mnFieldMenuSelectCommand(), mnFileListSelectAction(), mnIconMenuChooseSendOption(), mnSelectCoinsOrMedals(), mnSelectSanctumService(), mnSelectShopCommand() and mnYesNoMenuRun().

Definition at line 1319 of file screens_icon_menu.c.

mnIconMenuLayoutIcons

void mnIconMenuLayoutIcons(Sint32 x, Sint32 y, Sint32 width, Sint32 resourceBase)

Places the icons three tiles apart from tile (x, y), then opens their label window, width + 2 tiles wide, just after them.

References mnWindowCreate() and Sint32.

Referenced by mnYesNoMenuRunAt().

Definition at line 1345 of file screens_icon_menu.c.

mnIconMenuReadCommandPos

static __inline__ Sint32 mnIconMenuReadCommandPos(Sint8 *table, Sint32 index)

Reads one entry of a field menu table (MenuTopEntryPositionByCommand).

References Sint32.

Referenced by mnFieldMenuSelectCommand().

Definition at line 1369 of file screens_icon_menu.c.

mnFieldMenuSelectCommand

Sint32 mnFieldMenuSelectCommand(Sint32 selection)

The field menu's row of icons: Psynergy, Djinn, Item and Status, without Djinn when the party has none. selection is the command to start on and the result the command chosen (FIELD_MENU_COMMAND), or -1 when cancelled; two tables turn commands into icon positions and back.

References gmPartySumDjinnCountsStub(), MenuTopEntryCommandByPosition, MenuTopEntryPositionByCommand, mnIconMenuAddIcon(), mnIconMenuCenter(), mnIconMenuClose(), mnIconMenuOpen(), mnIconMenuReadCommandPos(), mnIconMenuRun(), result and Sint32.

Referenced by mnFieldMenuRun().

Definition at line 1378 of file screens_icon_menu.c.

mnAnimateSelectionToEntry

Sint32 mnAnimateSelectionToEntry(Sint32 start, Sint32 command)

Opens the field command menu and animates from start to the command's icon. Returns the final icon position after closing the menu.

References mnIconMenuAddIcon(), mnIconMenuAnimateTo(), mnIconMenuCenter(), mnIconMenuClose(), mnIconMenuOpen(), mnPartyStatusCloseWithMenu(), mnPartyStatusOpenAndWait() and Sint32.

Referenced by scWorldMapExplainGivingDjinn() and scWorldMapMeetEcho().

Definition at line 1427 of file screens_icon_menu.c.

mnFileListSelectAction

Sint32 mnFileListSelectAction(void)

The File Screen's row of icons, from the save summaries: New Game, Continue, Copy and Erase for one or two files (starting on Continue); no New Game or Copy with three; with every file cleared no Continue, and only Erase with three such files; then Battle and Update when they are enabled. Returns the action chosen (FILE_ACTION) by its position; with Battle off, the action after Erase is Update's. With no files it returns FILE_ACTION_NEW_GAME at once, and -1 when cancelled or the backup memory cannot be read.

References MenuSaveSlotActionByPosition, mnIconMenuAddIcon(), mnIconMenuCenter(), mnIconMenuClose(), mnIconMenuOpen(), mnIconMenuRun(), mnSaveScanFileSummaries(), result, Sint32, TitleBattleOptionEnabled and TitleUpdateOptionEnabled.

Referenced by scInit().

Definition at line 1452 of file screens_icon_menu.c.

mnPasswordLevelMenuDrawContents

void mnPasswordLevelMenuDrawContents(void)

When the chosen password level changes, clears the lower window's text area (from x 8 to LABEL_RIGHT) and lists what a password of that level carries: Gold five lines, Silver three, Bronze two.

References mnTextDrawMessageAsTiles(), mnWindowClearInteriorTiles() and Sint32.

Referenced by mnIconMenuChooseSendOption().

Definition at line 1507 of file screens_icon_menu.c.

mnTransferMethodMenuDrawHelp

void mnTransferMethodMenuDrawHelp(void)

Redraws the chosen transfer method's help in the lower window. Spanish, French and Italian describe two methods, the password and everything else as the cable; French clears the window with mnWindowSpriteClearList and redraws only when the description changes.

References mnTextDrawMessage(), mnWindowSpriteClearList() and Sint32.

Referenced by mnIconMenuChooseSendOption().

Definition at line 1561 of file screens_icon_menu.c.

mnIconMenuChooseSendOption

Sint32 mnIconMenuChooseSendOption(Sint32 mode)

Selects the transfer method or the password level (mode, enum SEND_OPTION_MENU), with a heading window above and an explanation of the selected icon below, redrawn by an event while the menu runs. Returns the place chosen, or -1 when cancelled.

References mnIconMenuAddIcon(), mnIconMenuCenter(), mnIconMenuClose(), mnIconMenuOpen(), mnIconMenuRun(), mnPasswordLevelMenuDrawContents(), mnTextDrawMessage(), mnTransferMethodMenuDrawHelp(), mnWindowClose(), mnWindowCreate(), mnWindowSpritePrepareForRedraw(), result, Sint32, syCloseEvent(), sySetEvent() and sySynch().

Referenced by scClearEnterPassword() and scInit().

Definition at line 1685 of file screens_icon_menu.c.

mnSelectShopCommand

Sint32 mnSelectShopCommand(Sint32 selection)

Selects a shop command (Buy, Sell, Artifacts, Repair), centred on the bottom row, starting on position selection, and returns the position chosen.

References mnIconMenuAddIcon(), mnIconMenuCenter(), mnIconMenuClose(), mnIconMenuOpen(), mnIconMenuRun(), result and Sint32.

Definition at line 1770 of file screens_icon_menu.c.

mnSelectSanctumService

Sint32 mnSelectSanctumService(Sint32 selection)

Selects a Sanctum service (Revive, Cure Poison, Repel Evil, Remove Curse), centred on the bottom row, starting on position selection.

References mnIconMenuAddIcon(), mnIconMenuCenter(), mnIconMenuClose(), mnIconMenuOpen(), mnIconMenuRun(), result and Sint32.

Definition at line 1793 of file screens_icon_menu.c.

mnYesNoMenuRun

Sint32 mnYesNoMenuRun(Sint32 bottom, Sint32 msg, Sint32 labelWidth, Sint32 selection)

Selects Yes or No, starting on selection; cancelling answers No. The icons stand on the bottom row when bottom is set, else at the top; msg is the first label message, or 0 for the command names, and labelWidth the label window's width, 3 when 0.

References mnIconMenuAddIcon(), mnIconMenuCenter(), mnIconMenuClose(), mnIconMenuOpen(), mnIconMenuRun() and Sint32.

Referenced by mnSaveEraseSelectedFile(), mnSaveToChosenFile() and scInit().

Definition at line 1816 of file screens_icon_menu.c.

mnYesNoMenuRunAt

Sint32 mnYesNoMenuRunAt(Sint32 x, Sint32 y, Sint32 selection)

Selects Yes or No with the icons from tile (x, y), starting on selection; cancelling answers No.

References mnIconMenuAddIcon(), mnIconMenuClose(), mnIconMenuLayoutIcons(), mnIconMenuOpen(), mnIconMenuRun() and Sint32.

Definition at line 1849 of file screens_icon_menu.c.

mnSelectCoinsOrMedals

Sint32 mnSelectCoinsOrMedals(Sint32 selection)

Selects Coins or Lucky Medals, centred on the bottom row, starting on selection, and returns the position chosen.

References mnIconMenuAddIcon(), mnIconMenuCenter(), mnIconMenuClose(), mnIconMenuOpen(), mnIconMenuRun(), result and Sint32.

Referenced by scLemuriaSpringRunSpringGame().

Definition at line 1871 of file screens_icon_menu.c.

mnDebugSceneSelectSchedule

void mnDebugSceneSelectSchedule(void)

Unused: starts the debug scene and entrance selector as an event.

References mnDebugSceneSelectRun() and sySetEvent().

Definition at line 1885 of file screens_icon_menu.c.