Skip to Content
The Alchemy Project

src/menu/menu_shared.c

The pieces the menu screens share: windows, the status panel, numbers, icons, the party figures, the hand cursor, paged lists, palettes and the Start watch. More…

Included by menu.c.

Macros

NameDescription
#defineSTATUS_PANEL_TEXT_X JAPANESE_OR(40, 32)The status panel's name and status column starts further left in the international editions, whose status labels are longer, and so does "Can't equip" (MsgCannotEquip).
#defineSTATUS_PANEL_CANNOT_EQUIP_X JAPANESE_OR(16, 0)
#defineSTATUS_PANEL_LEARN_NAME_Y SPANISH_OR(56, 48)A Psynergy item's panel: Spanish puts "Learned" or "Will learn" above the Psynergy's name, the other editions below it.
#defineSTATUS_PANEL_LEARN_STATUS_Y SPANISH_OR(48, 56)
#defineWINDOW_KEEP_EXISTING 0x100mnWindowUpdateOrCreate's flags: its own bit, which keeps an existing window as it is without redrawing its saved rectangle, over the low byte of WINDOW_FLAG_ flags a new window opens with.
#defineWINDOW_ATTRS_MASK 0xff
#defineNUMBER_PIXELS_PER_DIGIT 8The pixels the field allows each digit.
#definePARTY_FIGURE_GROUND_Y 482The ground every menu figure stands on, far below the screen: the field's placement draws a sprite further in front the lower its ground, so the figures stand in front of the windows, each raised from there to its row.
#defineCURSOR_BOB_STEP () ((TickCount >> 1) & 7)The cursor bobs through an 8-step table, one step every two ticks.
#defineLIST_ORDER_MAX_LENGTH 32The most bytes a list order copies, its LIST_ORDER_END included.
#definePAGE_LABEL_FIRST '1'The page indicator: the window font's digit tiles for pages 1, 2, ..., between the two page arrows.

Enumerations

NameDescription
enumSTAT_ARROW { STAT_ARROW_UP, STAT_ARROW_DOWN }Which of the two arrows a menu loaded into its resourceSlots (mnLoadStatArrows, or mnLoadDjinnArrows in the Djinn menu) stands beside a stat that would change.

Functions

NameDescription
Sint32mnResumeFieldEvents (void)Resumes the overlay events and tileset animations when a menu closes, and clears FLAG_WEATHER_HELD and FLAG_PALETTE_BLEND_HELD: undoes mnSuspendFieldEvents.
Sint32mnSuspendFieldEvents (void)Suspends the overlay events and tileset animations while a menu is open, and sets FLAG_PALETTE_BLEND_HELD and FLAG_WEATHER_HELD, so that the field's palette blend and weather stand still behind it (see mnResumeFieldEvents, which undoes it).
voidmnInitState (Sint32 unused)Clears the whole menu state and sets its defaults: no side selected, one entry in each side, and a 1x1 cursor grid.
Sint32mnWindowUpdateOrCreate ( WINDOW **handle, Sint32 x, Sint32 y, Sint32 w, Sint32 h, Sint32 flags)Opens the window kept in *handle at tile (x, y), w by h tiles, or, if it is already open, clears it to its saved rectangle (unless flags has WINDOW_KEEP_EXISTING).
voidmnWindowCloseIfOpen (WINDOW **handle, Sint32 instant)Closes the window kept in *handle, if any, and clears the handle; nonzero instant closes it at once rather than shrinking it.
voidmnStatusPanelDraw (WINDOW *unused, Sint32 member, Sint32 slot, Sint32 mode)Draws the status panel of the Item and Psynergy screens for party member member (window at tile 0,5, 13 by 12): the name, up to two statuses or the level, the party member's portrait, and below them what the panel kind in mode (STAT_PANEL_KIND) asks for. slot is the inventory slot of the item the panel is about, for the equipment and Psynergy item panels.
static inline Sint32mnCountDigits (Sint32 number)Returns how many decimal digits number has, but at least 2: 0-99 give 2, 100-999 give 3, 1000-9999 give 4.
voidmnTextDrawNumberRightAligned (Sint32 number, WINDOW *window, Sint32 x, Sint32 y)Draws number right-aligned in a field that ends at pixel column x and allows 8 pixels for each digit, at least two digits wide.
voidmnStatusPanelDrawHpPp (UNIT *unit, WINDOW *window)Draws a character's HP and PP into window as two rows, "HP current/maximum" at pixel row 40 and "PP current/maximum" at row 48.
voidmnTextDrawStatComparison (const UNIT *after, const UNIT *before, WINDOW *window)Writes Attack, Defense and Agility into a status window as they are now (before), and beside each one that changes its new value (after) with an up or down arrow: the equipment preview.
Sint32mnIconCreateHandCursorUnusedArgument (WINDOW *window, Sint32 unused, Sint32 x, Sint32 y)Unused: mnIconCreateHandCursor with a second argument it ignores.
Sint32mnIconCreateHandCursor (WINDOW *window, Sint32 x, Sint32 y)Creates the menu's hand cursor sprite in window at (x, y), loading the hand's tiles into a free VRAM block.
voidmnIconShow (WINDOW_SPR *object)Shows a menu icon at its stored position, without rotation or scaling.
voidmnReloadMemberPortrait (const void *unused, Sint32 member)Changes the portrait on screen (portrait slot 0) to party member member's, keeping its sprite.
WINDOW *mnCursorCreate (void *state)Opens the menu's top-left window (13 by 5 tiles) and puts the hand cursor in it, hidden for now, as sideIcon[0].
voidmnCreatePartyFigures ( void *parent, Sint32 originX, Sint32 originY, Sint32 spacing, Sint32 unused)Creates a standing figure for each active party member, side by side in window parent: from (originX, originY) in tiles from the window's corner, each figure 16 + spacing pixels after the last, at full scale.
voidmnReleasePartyFigures (void)Releases the party figures mnCreatePartyFigures created and stops their placement event.
voidmnPlacePartyFigures (void)Event: each tick, places every party member sprite created by mnCreatePartyFigures at its menu position and scale, through the field's projected placement.
voidmnCursorPos (Sint32 xOffset, Sint32 yOffset)Places the hand cursor at (xOffset, yOffset) inside the menu's top-left window, bobbing.
voidmnCursorSlide (Sint32 x, Sint32 y)Slides the hand cursor from where it is to (x, y) inside the menu's top-left window over two ticks, in 1/16 pixel steps.
voidmnCursorNoOperation (void)Unused: does nothing.
voidmnPsynergyMenuPlaceEntryIconsDefault (void)Lays the entry icons out eight to a row from (108, 40).
voidmnPsynergyMenuPlaceEntryIcons (Sint32 originX, Sint32 originY, Sint32 columns)Lays the menu's entry icons (up to 32) out in a grid of 16x16 cells, columns wide, from (originX, originY); empty slots keep their place.
voidmnPsynergyMenuPlaceEntryIcon (WINDOW_SPR **slot, Sint32 index, Sint32 originX, Sint32 originY, Sint32 columns)Places the icon in *slot at grid cell index (an index above 31 is taken as 0) of a grid of 16x16 cells, columns wide, from (originX, originY), and shows it.
voidmnItemMenuPlaceIcon (WINDOW_SPR **slot, Sint32 slotIndex, Sint32 originX, Sint32 originY, Sint32 columns)Places the icon at slotIndex in a columns-wide grid of 24x16 cells starting at (originX, originY), and shows it.
voidmnItemMenuPlaceIcons (Sint32 layout)Lays the inventory's INVENTORY_SLOTS item icons out five to a row from (116, y): y is 56 for layout 1 and 40 otherwise.
voidmnItemMenuShowMessage (Sint32 msg, Sint32 x, Sint32 y)Shows message in the item menu, with the hand cursor hidden meanwhile: in a small window at tile (x, y) fitted to it, or with y -1 in the description window along the bottom.
Sint32mnItemMenuSort (Uint16 *inventory, Sint32 mode)Sorts a party member's INVENTORY_SLOTS inventory slots by the list order of mode (LIST_SORT): items are grouped by the order's item types and, within a type, run from the highest item id down.
voidmnCopyListOrder (Sint32 mode, Uint8 *order)Copies the list order of mode (LIST_SORT; any other mode takes LIST_SORT_ITEMS_FIRST's) into order, up to and including its LIST_ORDER_END and at most LIST_ORDER_MAX_LENGTH bytes.
Sint32mnPagedListHandleInput (Sint32 horizontal, Sint32 count, Sint32 pageSize, Sint32 *cursor, Sint32 *page)Moves a paged list's cursor and page with the d-pad's repeating keys: Up and Down move the row and Left and Right turn the page, or, when horizontal is set, the other way round.
voidmnPaletteLightenHighlight (Sint32 paletteNumber)Copies WINDOW_PALETTE into background palette paletteNumber and lightens its WINDOW_BACKGROUND_COLOR by HIGHLIGHT_LIGHTEN_STEPS in each channel: the highlight colour of the menu's selected rows.
voidmnPagedListDrawPageNumbers (WINDOW *window, Sint32 itemCount, Sint32 pageSize, Sint32 selectedPage, Sint32 rightEdge)Draws a paged list's page numbers on the top border of window, ending at tile rightEdge: one digit per page between the page arrows, selectedPage in HIGHLIGHT_PALETTE and the others in WINDOW_PALETTE.
voidmnWindowSetHighlightRect (const WINDOW *window, Sint32 x, Sint32 y, Sint32 width, Sint32 height, Uint32 palette)Switches a rectangle of a window's text between WINDOW_PALETTE (normal) and HIGHLIGHT_PALETTE (the highlight made by mnPaletteLightenHighlight): palette is the new palette number.
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 (as mnStatusScreenRun does for palettes 0 and 1).
voidmnSetPageIcons ( Sint32 pageSize, Sint32 first, WINDOW *window, Sint32 x, Sint32 y)Shows the icons of one page of a list, one row of 16 pixels each from (x, y): entries first to first + pageSize - 1, stopping early at an empty icon slot or the state's itemCount.
voidmnDrawCoins (WINDOW *window)Writes the party's coins and the "Coins" label into window: the info window of the Item and Psynergy screens' party member choice.
voidmnWindowSetBounds ( WINDOW *window, Sint32 x, Sint32 y, Sint32 width, Sint32 height)Moves and resizes a window, in tiles.
voidmnWindowHoldTilemapUpload (void)Holds back the window tilemap's upload (holdTilemapUpload), so that what a menu draws meanwhile appears at once when mnWindowReleaseTilemapUpload lets it go.
voidmnWindowReleaseTilemapUpload (void)Lets the window tilemap be uploaded again after mnWindowHoldTilemapUpload.
Sint32mnUseSoundPlay (Sint32 sound)Plays the sound of an item's or Psynergy's use (mnItemPlayUseSound).
voidmnWatchStart (void)Event while a menu runs: on Start, plays the cancel sound, sets FLAG_MENU_START_PRESSED and removes itself.
voidmnStartWatchingStart (void)Starts watching for Start: clears FLAG_MENU_START_PRESSED and adds mnWatchStart.
voidmnStopWatchingStart (void)Stops watching for Start, if Start has not removed the watch already.
voidmnWindowPaletteSetNormalTextColor (void)Makes the text drawn after it TEXT_COLOR_NORMAL.
voidmnWindowPaletteSetNoHpTextColor (void)Makes the text drawn after it TEXT_COLOR_NO_HP.
voidmnWindowPaletteSetLowHpTextColor (void)Makes the text drawn after it TEXT_COLOR_LOW_HP.

Description

The pieces the menu screens share: windows, the status panel, numbers, icons, the party figures, the hand cursor, paged lists, palettes and the Start watch. Part of menu.c.

Macros in detail

STATUS_PANEL_TEXT_X

#define STATUS_PANEL_TEXT_X JAPANESE_OR(40, 32)

The status panel's name and status column starts further left in the international editions, whose status labels are longer, and so does "Can't equip" (MsgCannotEquip).

Referenced by mnStatusPanelDraw().

Definition at line 10 of file menu_shared.c.

STATUS_PANEL_CANNOT_EQUIP_X

#define STATUS_PANEL_CANNOT_EQUIP_X JAPANESE_OR(16, 0)

Referenced by mnStatusPanelDraw().

Definition at line 11 of file menu_shared.c.

STATUS_PANEL_LEARN_NAME_Y

#define STATUS_PANEL_LEARN_NAME_Y SPANISH_OR(56, 48)

A Psynergy item's panel: Spanish puts "Learned" or "Will learn" above the Psynergy's name, the other editions below it.

Referenced by mnStatusPanelDraw().

Definition at line 15 of file menu_shared.c.

STATUS_PANEL_LEARN_STATUS_Y

#define STATUS_PANEL_LEARN_STATUS_Y SPANISH_OR(48, 56)

Referenced by mnStatusPanelDraw().

Definition at line 16 of file menu_shared.c.

WINDOW_KEEP_EXISTING

#define WINDOW_KEEP_EXISTING 0x100

mnWindowUpdateOrCreate's flags: its own bit, which keeps an existing window as it is without redrawing its saved rectangle, over the low byte of WINDOW_FLAG_ flags a new window opens with.

Referenced by mnItemMenuShowMessage(), mnStatusPanelDraw() and mnWindowUpdateOrCreate().

Definition at line 21 of file menu_shared.c.

WINDOW_ATTRS_MASK

#define WINDOW_ATTRS_MASK 0xff

Referenced by mnWindowUpdateOrCreate().

Definition at line 22 of file menu_shared.c.

NUMBER_PIXELS_PER_DIGIT

#define NUMBER_PIXELS_PER_DIGIT 8

The pixels the field allows each digit. The Latin font's digits are 7 pixels wide, so the digits themselves take a pixel less each.

Referenced by mnTextDrawNumberRightAligned().

Definition at line 308 of file menu_shared.c.

PARTY_FIGURE_GROUND_Y

#define PARTY_FIGURE_GROUND_Y 482

The ground every menu figure stands on, far below the screen: the field's placement draws a sprite further in front the lower its ground, so the figures stand in front of the windows, each raised from there to its row.

Referenced by mnPlacePartyFigures().

Definition at line 637 of file menu_shared.c.

CURSOR_BOB_STEP

#define CURSOR_BOB_STEP() ((TickCount >> 1) & 7)

The cursor bobs through an 8-step table, one step every two ticks.

Referenced by mnCursorPos().

Definition at line 674 of file menu_shared.c.

LIST_ORDER_MAX_LENGTH

#define LIST_ORDER_MAX_LENGTH 32

The most bytes a list order copies, its LIST_ORDER_END included.

Referenced by mnCopyListOrder() and mnItemMenuSort().

Definition at line 932 of file menu_shared.c.

PAGE_LABEL_FIRST

#define PAGE_LABEL_FIRST '1'

The page indicator: the window font's digit tiles for pages 1, 2, ..., between the two page arrows.

Referenced by mnPagedListDrawPageNumbers().

Definition at line 1035 of file menu_shared.c.

Enumerations in detail

STAT_ARROW

enum STAT_ARROW

Which of the two arrows a menu loaded into its resourceSlots (mnLoadStatArrows, or mnLoadDjinnArrows in the Djinn menu) stands beside a stat that would change.

EnumeratorValueDescription
STAT_ARROW_UP
STAT_ARROW_DOWN

Definition at line 412 of file menu_shared.c.

Functions in detail

mnResumeFieldEvents

Sint32 mnResumeFieldEvents(void)

Resumes the overlay events and tileset animations when a menu closes, and clears FLAG_WEATHER_HELD and FLAG_PALETTE_BLEND_HELD: undoes mnSuspendFieldEvents.

References fdTilesetAnimationResumeAllStub(), gmFlagClearStub(), Sint32 and syResumeOverlayEvents().

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

Definition at line 27 of file menu_shared.c.

mnSuspendFieldEvents

Sint32 mnSuspendFieldEvents(void)

Suspends the overlay events and tileset animations while a menu is open, and sets FLAG_PALETTE_BLEND_HELD and FLAG_WEATHER_HELD, so that the field's palette blend and weather stand still behind it (see mnResumeFieldEvents, which undoes it).

References fdTilesetAnimationSuspendAllStub(), gmFlagSetStub(), Sint32 and sySuspendOverlayEvents().

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

Definition at line 45 of file menu_shared.c.

mnInitState

void mnInitState(Sint32 unused)

Clears the whole menu state and sets its defaults: no side selected, one entry in each side, and a 1x1 cursor grid.

References Sint32.

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

Definition at line 55 of file menu_shared.c.

mnWindowUpdateOrCreate

Sint32 mnWindowUpdateOrCreate( WINDOW **handle, Sint32 x, Sint32 y, Sint32 w, Sint32 h, Sint32 flags)

Opens the window kept in *handle at tile (x, y), w by h tiles, or, if it is already open, clears it to its saved rectangle (unless flags has WINDOW_KEEP_EXISTING). Returns 1 when it opened a new window.

References mnWindowCreateStub(), mnWindowSpriteRedrawSavedRectStub() and Sint32.

Referenced by mnCursorCreate(), mnDjinnMenuRunPreview(), mnDjinnMenuShowMemberStatus(), mnItemMenuOpenDetail(), mnItemMenuRunList(), mnItemMenuRunMemberSelection(), mnItemMenuShowMessage(), mnOpenBackdropScreen(), mnPsynergyMenuRunList(), mnPsynergyMenuSelectMember(), mnStatusPanelDraw(), mnStatusScreenRunEquipmentPage(), mnStatusScreenRunPsynergyPage(), mnStatusScreenRunStatusPage() and mnStatusScreenShowMemberStatus().

Definition at line 70 of file menu_shared.c.

mnWindowCloseIfOpen

void mnWindowCloseIfOpen(WINDOW **handle, Sint32 instant)

Closes the window kept in *handle, if any, and clears the handle; nonzero instant closes it at once rather than shrinking it.

References mnWindowCloseStub() and Sint32.

Referenced by mnDjinnMenuRunPreview(), mnDjinnMenuShowMemberStatus(), mnItemMenuClose() and mnItemMenuShowMessage().

Definition at line 93 of file menu_shared.c.

mnStatusPanelDraw

void mnStatusPanelDraw(WINDOW *unused, Sint32 member, Sint32 slot, Sint32 mode)

Draws the status panel of the Item and Psynergy screens for party member member (window at tile 0,5, 13 by 12): the name, up to two statuses or the level, the party member's portrait, and below them what the panel kind in mode (STAT_PANEL_KIND) asks for. slot is the inventory slot of the item the panel is about, for the equipment and Psynergy item panels.

References gmInventoryEquipStub(), gmItemCanUnitEquipStub(), gmItemGetDefinitionStub(), gmUnitCalculateStub(), gmUnitGetStub(), mnPortraitCreateStub(), mnStatusPanelDrawHpPp(), mnStatusScreenListStatuses(), mnTextDrawMessageAsTilesStub(), mnTextDrawNumberInWindowStub(), mnTextDrawStatComparison(), mnTextDrawStringAtOffsetStub(), mnWindowClearInteriorTilesStub(), mnWindowSpriteClearListStub(), mnWindowUpdateOrCreate(), Sint32, StatusPanelLevelString, syHeapAllocate(), syHeapRelease(), sySynch() and syWordsCopy().

Referenced by mnItemMenuChooseCommand(), mnItemMenuDrawEquipPreview(), mnItemMenuRunCommands(), mnItemMenuRunMemberSelection(), mnItemMenuSelectTarget(), mnPsynergyMenuRunList(), mnPsynergyMenuRunSteps(), mnPsynergyMenuSelectMember() and mnPsynergyMenuSelectTarget().

Definition at line 107 of file menu_shared.c.

mnCountDigits

static inline Sint32 mnCountDigits(Sint32 number)

Returns how many decimal digits number has, but at least 2: 0-99 give 2, 100-999 give 3, 1000-9999 give 4.

References Sint32.

Referenced by mnTextDrawNumberRightAligned().

Definition at line 312 of file menu_shared.c.

mnTextDrawNumberRightAligned

void mnTextDrawNumberRightAligned(Sint32 number, WINDOW *window, Sint32 x, Sint32 y)

Draws number right-aligned in a field that ends at pixel column x and allows 8 pixels for each digit, at least two digits wide.

References mnCountDigits(), mnTextDrawNumberAtOffsetStub(), Sint32 and width.

Referenced by mnStatusPanelDrawHpPp().

Definition at line 333 of file menu_shared.c.

mnStatusPanelDrawHpPp

void mnStatusPanelDrawHpPp(UNIT *unit, WINDOW *window)

Draws a character's HP and PP into window as two rows, "HP current/maximum" at pixel row 40 and "PP current/maximum" at row 48.

References mnTextDrawNumberRightAligned(), mnTextDrawStringAtOffsetStub(), mnTextDrawStringInWindowStub(), mnTextSetColorStub(), StatusPanelHpString, StatusPanelPpString and StatusPanelSlashString.

Referenced by mnStatusPanelDraw().

Definition at line 350 of file menu_shared.c.

mnTextDrawStatComparison

void mnTextDrawStatComparison(const UNIT *after, const UNIT *before, WINDOW *window)

Writes Attack, Defense and Agility into a status window as they are now (before), and beside each one that changes its new value (after) with an up or down arrow: the equipment preview.

References mnIconCreateStatChangeArrow(), mnTextDrawMessageAsTilesStub() and mnTextDrawNumberAtOffsetStub().

Referenced by mnStatusPanelDraw().

Definition at line 421 of file menu_shared.c.

mnIconCreateHandCursorUnusedArgument

Sint32 mnIconCreateHandCursorUnusedArgument(WINDOW *window, Sint32 unused, Sint32 x, Sint32 y)

Unused: mnIconCreateHandCursor with a second argument it ignores.

References IconResourceTiles, mnWindowSpriteCreateStub(), Sint32, syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Definition at line 470 of file menu_shared.c.

mnIconCreateHandCursor

Sint32 mnIconCreateHandCursor(WINDOW *window, Sint32 x, Sint32 y)

Creates the menu's hand cursor sprite in window at (x, y), loading the hand's tiles into a free VRAM block.

References IconResourceTiles, mnWindowSpriteCreateStub(), Sint32, syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Referenced by mnCursorCreate() and mnPsynergyMenuCreateEntryGrid().

Definition at line 490 of file menu_shared.c.

mnIconShow

void mnIconShow(WINDOW_SPR *object)

Shows a menu icon at its stored position, without rotation or scaling.

Referenced by mnHideEmptyEntryIcons(), mnHideEntryIcons(), mnItemMenuDrawItemHead(), mnItemMenuPlaceEquippedIcons(), mnItemMenuPlaceIcon(), mnItemMenuRunCommands(), mnItemMenuRunList(), mnItemMenuSelectMember(), mnItemMenuSelectTarget(), mnPlaceEntryIconInGrid(), mnPsynergyMenuPlaceEntryIcon(), mnPsynergyMenuRunList(), mnPsynergyMenuSelectPartySlot(), mnPsynergyMenuSelectTarget(), mnSetPageIcons(), mnStatusScreenHideStatusIcons(), mnStatusScreenSelectMember() and mnStatusScreenShowStatusIcons().

Definition at line 516 of file menu_shared.c.

mnReloadMemberPortrait

void mnReloadMemberPortrait(const void *unused, Sint32 member)

Changes the portrait on screen (portrait slot 0) to party member member's, keeping its sprite. The calling menu argument is not used.

References mnPortraitReloadStub() and Sint32.

Referenced by mnPartyMemberChooserChooseMember(), mnPsynergyMenuRunList(), mnPsynergyMenuSelectMember(), mnPsynergyMenuSelectTarget(), mnStatusScreenRunEquipmentPage(), mnStatusScreenRunPartyRow(), mnStatusScreenRunPsynergyPage() and mnStatusScreenRunStatusPage().

Definition at line 530 of file menu_shared.c.

mnCursorCreate

WINDOW *mnCursorCreate(void *state)

Opens the menu's top-left window (13 by 5 tiles) and puts the hand cursor in it, hidden for now, as sideIcon[0].

References mnIconCreateHandCursor(), mnWindowUpdateOrCreate(), Sint32 and state.

Referenced by mnItemMenuInit(), mnPsynergyMenuCreateEntryGrid() and mnStatusScreenInit().

Definition at line 537 of file menu_shared.c.

mnCreatePartyFigures

void mnCreatePartyFigures( void *parent, Sint32 originX, Sint32 originY, Sint32 spacing, Sint32 unused)

Creates a standing figure for each active party member, side by side in window parent: from (originX, originY) in tiles from the window's corner, each figure 16 + spacing pixels after the last, at full scale.

References fdPartyGetCharacterSpriteStub(), fdSpriteCreateStub(), fdSpriteStartAnimationStub(), gmPartyListMembersStub(), mnPlacePartyFigures(), Sint32 and sySetEvent().

Referenced by mnItemMenuInit(), mnPsynergyMenuCreateEntryGrid(), mnStatusScreenInit() and mnStatusScreenRunPartyRow().

Definition at line 564 of file menu_shared.c.

mnReleasePartyFigures

void mnReleasePartyFigures(void)

Releases the party figures mnCreatePartyFigures created and stops their placement event.

References fdSpriteDestroyStub(), gmPartyListMembersStub(), mnPlacePartyFigures(), Sint32 and syCloseEvent().

Referenced by mnItemMenuClose(), mnPsynergyMenuCloseWindows() and mnStatusScreenRunPartyRow().

Definition at line 608 of file menu_shared.c.

mnPlacePartyFigures

void mnPlacePartyFigures(void)

Event: each tick, places every party member sprite created by mnCreatePartyFigures at its menu position and scale, through the field's projected placement.

References fdRenderApplyProjectedPlacementStub(), gmPartyCountMembersStub() and Sint32.

Referenced by mnCreatePartyFigures(), mnDjinnMenuRunPreview(), mnDjinnMenuShowHelp(), mnDjinnMenuShowMemberStatus(), mnItemMenuShowDetails(), mnReleasePartyFigures(), mnStatusScreenRunEquipmentPage(), mnStatusScreenRunPsynergyPage() and mnStatusScreenRunStatusPage().

Definition at line 642 of file menu_shared.c.

mnCursorPos

void mnCursorPos(Sint32 xOffset, Sint32 yOffset)

Places the hand cursor at (xOffset, yOffset) inside the menu's top-left window, bobbing.

References MenuCursorBobX, MenuCursorBobY and Sint32.

Referenced by mnDjinnMenuRunPreview(), mnDjinnMenuSelectDjinn(), mnDjinnMenuShowHelp(), mnItemMenuChooseCommand(), mnItemMenuConfirmDrop(), mnItemMenuConfirmEquip(), mnItemMenuRunList(), mnItemMenuRunMemberSelection(), mnItemMenuSelectGiveQuantity(), mnItemMenuSelectTarget(), mnPartyMemberChooserChooseMember(), mnPsynergyMenuRunList(), mnPsynergyMenuSelectMember(), mnPsynergyMenuSelectTarget(), mnStatusScreenRunEquipmentPage(), mnStatusScreenRunPartyRow(), mnStatusScreenRunPsynergyPage() and mnStatusScreenRunStatusPage().

Definition at line 678 of file menu_shared.c.

mnCursorSlide

void mnCursorSlide(Sint32 x, Sint32 y)

Slides the hand cursor from where it is to (x, y) inside the menu's top-left window over two ticks, in 1/16 pixel steps.

References Sint32 and sySynch().

Referenced by mnDjinnMenuRunPreview(), mnDjinnMenuSelectDjinn(), mnItemMenuChooseCommand(), mnItemMenuConfirmDrop(), mnItemMenuConfirmEquip(), mnItemMenuSelectGiveQuantity(), mnItemMenuSelectMember(), mnPsynergyMenuSelectPartySlot(), mnPsynergyMenuSelectTarget(), mnStatusScreenRunStatusPage() and mnStatusScreenSelectMember().

Definition at line 693 of file menu_shared.c.

mnCursorNoOperation

void mnCursorNoOperation(void)

Unused: does nothing.

Definition at line 756 of file menu_shared.c.

mnPsynergyMenuPlaceEntryIconsDefault

void mnPsynergyMenuPlaceEntryIconsDefault(void)

Lays the entry icons out eight to a row from (108, 40). Nothing calls it.

References mnPsynergyMenuPlaceEntryIcons().

Definition at line 761 of file menu_shared.c.

mnPsynergyMenuPlaceEntryIcons

void mnPsynergyMenuPlaceEntryIcons(Sint32 originX, Sint32 originY, Sint32 columns)

Lays the menu's entry icons (up to 32) out in a grid of 16x16 cells, columns wide, from (originX, originY); empty slots keep their place.

References mnPsynergyMenuPlaceEntryIcon() and Sint32.

Referenced by mnPsynergyMenuPlaceEntryIconsDefault() and mnPsynergyMenuRefreshMemberPsynergy().

Definition at line 768 of file menu_shared.c.

mnPsynergyMenuPlaceEntryIcon

void mnPsynergyMenuPlaceEntryIcon(WINDOW_SPR **slot, Sint32 index, Sint32 originX, Sint32 originY, Sint32 columns)

Places the icon in *slot at grid cell index (an index above 31 is taken as 0) of a grid of 16x16 cells, columns wide, from (originX, originY), and shows it.

References mnIconShow() and Sint32.

Referenced by mnPsynergyMenuPlaceEntryIcons().

Definition at line 794 of file menu_shared.c.

mnItemMenuPlaceIcon

void mnItemMenuPlaceIcon(WINDOW_SPR **slot, Sint32 slotIndex, Sint32 originX, Sint32 originY, Sint32 columns)

Places the icon at slotIndex in a columns-wide grid of 24x16 cells starting at (originX, originY), and shows it. A slotIndex above INVENTORY_SLOTS, which the item menu never passes, is taken as 0.

References mnIconShow() and Sint32.

Referenced by mnItemMenuPlaceIcons().

Definition at line 815 of file menu_shared.c.

mnItemMenuPlaceIcons

void mnItemMenuPlaceIcons(Sint32 layout)

Lays the inventory's INVENTORY_SLOTS item icons out five to a row from (116, y): y is 56 for layout 1 and 40 otherwise.

References mnItemMenuPlaceIcon() and Sint32.

Referenced by mnItemMenuRefreshMember().

Definition at line 833 of file menu_shared.c.

mnItemMenuShowMessage

void mnItemMenuShowMessage(Sint32 msg, Sint32 x, Sint32 y)

Shows message in the item menu, with the hand cursor hidden meanwhile: in a small window at tile (x, y) fitted to it, or with y -1 in the description window along the bottom. With x -1 it stays there for the next screen (FLAG_MENU_INFO_KEPT); otherwise it waits for A, B or Start.

References gmFlagSetStub(), mnTextDrawMessageAsTilesStub(), mnTextDrawMessageStub(), mnTextGetMessageSizeStub(), mnWindowCloseIfOpen(), mnWindowSetBounds(), mnWindowSpriteClearListStub(), mnWindowSpriteRedrawSavedRectStub(), mnWindowUpdateOrCreate(), PerPush, Sint32, sySynch() and width.

Referenced by mnItemMenuRunCommands(), mnItemMenuTryBreak(), mnItemMenuUse() and mnPsynergyMenuRunSteps().

Definition at line 868 of file menu_shared.c.

mnItemMenuSort

Sint32 mnItemMenuSort(Uint16 *inventory, Sint32 mode)

Sorts a party member's INVENTORY_SLOTS inventory slots by the list order of mode (LIST_SORT): items are grouped by the order's item types and, within a type, run from the highest item id down.

References gmItemGetDefinitionStub(), mnCopyListOrder() and Sint32.

Referenced by mnItemMenuRunMemberSelection() and mnStatusScreenRunEquipmentPage().

Definition at line 937 of file menu_shared.c.

mnCopyListOrder

void mnCopyListOrder(Sint32 mode, Uint8 *order)

Copies the list order of mode (LIST_SORT; any other mode takes LIST_SORT_ITEMS_FIRST's) into order, up to and including its LIST_ORDER_END and at most LIST_ORDER_MAX_LENGTH bytes.

References MenuListOrderEquipmentFirst, MenuListOrderEquippedThenEquipment, MenuListOrderEquippedThenItems, MenuListOrderItemsFirst and Sint32.

Referenced by mnItemMenuSort().

Definition at line 1008 of file menu_shared.c.

mnPagedListHandleInput

Sint32 mnPagedListHandleInput(Sint32 horizontal, Sint32 count, Sint32 pageSize, Sint32 *cursor, Sint32 *page)

Moves a paged list's cursor and page with the d-pad's repeating keys: Up and Down move the row and Left and Right turn the page, or, when horizontal is set, the other way round. Returns 1 when the page turned, 0 when the row moved and -1 when nothing did.

References mnPageArrowsDrawStub(), PerRepeat, Sint32, syInputResetKeyRepeat() and sySoundPlayStub().

Referenced by mnItemMenuRunList(), mnPsynergyMenuRunList(), mnStatusScreenRunEquipmentPage() and mnStatusScreenRunPsynergyPage().

Definition at line 1041 of file menu_shared.c.

mnPaletteLightenHighlight

void mnPaletteLightenHighlight(Sint32 paletteNumber)

Copies WINDOW_PALETTE into background palette paletteNumber and lightens its WINDOW_BACKGROUND_COLOR by HIGHLIGHT_LIGHTEN_STEPS in each channel: the highlight colour of the menu's selected rows.

References Sint32 and syDMAXCopy().

Referenced by mnDjinnMenuRun(), mnItemMenuRun(), mnItemMenuShowDetails(), mnItemPrepareUsePalette(), mnPsynergyMenuRun() and mnStatusScreenLoadIconPalettes().

Definition at line 1138 of file menu_shared.c.

mnPagedListDrawPageNumbers

void mnPagedListDrawPageNumbers(WINDOW *window, Sint32 itemCount, Sint32 pageSize, Sint32 selectedPage, Sint32 rightEdge)

Draws a paged list's page numbers on the top border of window, ending at tile rightEdge: one digit per page between the page arrows, selectedPage in HIGHLIGHT_PALETTE and the others in WINDOW_PALETTE.

References mnWindowSetTilemapEntryStub() and Sint32.

Referenced by mnItemMenuDrawListPage(), mnPsynergyMenuDrawPage(), mnStatusScreenDrawEquipmentPage() and mnStatusScreenDrawPsynergyPage().

Definition at line 1174 of file menu_shared.c.

mnWindowSetHighlightRect

void mnWindowSetHighlightRect(const WINDOW *window, Sint32 x, Sint32 y, Sint32 width, Sint32 height, Uint32 palette)

Switches a rectangle of a window's text between WINDOW_PALETTE (normal) and HIGHLIGHT_PALETTE (the highlight made by mnPaletteLightenHighlight): palette is the new palette number.

References Sint32, state and width.

Referenced by mnItemMenuShowSelectedRow(), mnPsynergyMenuShowSelectedRow(), mnStatusScreenDrawSelectionCursor(), mnStatusScreenShowEquipmentRow() and mnStatusScreenShowPsynergyRow().

Definition at line 1217 of file menu_shared.c.

mnPaletteLoadIconsIntoHighlight

void mnPaletteLoadIconsIntoHighlight(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 (as mnStatusScreenRun does for palettes 0 and 1).

References syDMAXCopy().

Referenced by mnItemMenuOpenDetail(), mnItemMenuShowDetails() and mnItemPrepareUsePalette().

Definition at line 1284 of file menu_shared.c.

mnSetPageIcons

void mnSetPageIcons( Sint32 pageSize, Sint32 first, WINDOW *window, Sint32 x, Sint32 y)

Shows the icons of one page of a list, one row of 16 pixels each from (x, y): entries first to first + pageSize - 1, stopping early at an empty icon slot or the state's itemCount. Hides all the others.

References mnIconShow() and Sint32.

Referenced by mnItemMenuDrawListPage(), mnPsynergyMenuDrawPage(), mnStatusScreenDrawEquipmentPage() and mnStatusScreenDrawPsynergyPage().

Definition at line 1300 of file menu_shared.c.

mnDrawCoins

void mnDrawCoins(WINDOW *window)

Writes the party's coins and the "Coins" label into window: the info window of the Item and Psynergy screens' party member choice.

References MainRoutineStateWork, mnTextDrawMessageAsTilesStub(), mnTextDrawNumberAtOffsetStub() and mnWindowDrawDividerLineStub().

Referenced by mnItemMenuRunCommands() and mnPsynergyMenuSelectMember().

Definition at line 1326 of file menu_shared.c.

mnWindowSetBounds

void mnWindowSetBounds( WINDOW *window, Sint32 x, Sint32 y, Sint32 width, Sint32 height)

Moves and resizes a window, in tiles.

References Sint32 and width.

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

Definition at line 1338 of file menu_shared.c.

mnWindowHoldTilemapUpload

void mnWindowHoldTilemapUpload(void)

Holds back the window tilemap's upload (holdTilemapUpload), so that what a menu draws meanwhile appears at once when mnWindowReleaseTilemapUpload lets it go. Nothing calls it: the screens set holdTilemapUpload themselves.

Definition at line 1353 of file menu_shared.c.

mnWindowReleaseTilemapUpload

void mnWindowReleaseTilemapUpload(void)

Lets the window tilemap be uploaded again after mnWindowHoldTilemapUpload. Nothing calls it.

Definition at line 1360 of file menu_shared.c.

mnUseSoundPlay

Sint32 mnUseSoundPlay(Sint32 sound)

Plays the sound of an item's or Psynergy's use (mnItemPlayUseSound). Returns 1, which nothing reads.

References Sint32 and sySoundPlayStub().

Referenced by mnAbilityPlayUseSound().

Definition at line 1367 of file menu_shared.c.

mnWatchStart

void mnWatchStart(void)

Event while a menu runs: on Start, plays the cancel sound, sets FLAG_MENU_START_PRESSED and removes itself.

References gmFlagSetStub(), PerPush, syCloseEvent() and sySoundPlayStub().

Referenced by mnStartWatchingStart() and mnStopWatchingStart().

Definition at line 1375 of file menu_shared.c.

mnStartWatchingStart

void mnStartWatchingStart(void)

Starts watching for Start: clears FLAG_MENU_START_PRESSED and adds mnWatchStart.

References gmFlagClearStub(), mnWatchStart() and sySetEvent().

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

Definition at line 1387 of file menu_shared.c.

mnStopWatchingStart

void mnStopWatchingStart(void)

Stops watching for Start, if Start has not removed the watch already.

References gmFlagGetStub(), mnWatchStart() and syCloseEvent().

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

Definition at line 1394 of file menu_shared.c.

mnWindowPaletteSetNormalTextColor

void mnWindowPaletteSetNormalTextColor(void)

Makes the text drawn after it TEXT_COLOR_NORMAL. Nothing calls it or the two after it; the status panel sets its colours with mnTextSetColorStub.

References mnTextSetColorStub().

Definition at line 1404 of file menu_shared.c.

mnWindowPaletteSetNoHpTextColor

void mnWindowPaletteSetNoHpTextColor(void)

Makes the text drawn after it TEXT_COLOR_NO_HP.

References mnTextSetColorStub().

Definition at line 1410 of file menu_shared.c.

mnWindowPaletteSetLowHpTextColor

void mnWindowPaletteSetLowHpTextColor(void)

Makes the text drawn after it TEXT_COLOR_LOW_HP.

References mnTextSetColorStub().

Definition at line 1416 of file menu_shared.c.