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, the cancel sound and text colours. More…
Included by menu.c.
Macros
| Name | Description | |
|---|---|---|
#define | WINDOW_KEEP_EXISTING 0x100 | mnWindowUpdateOrCreate: keep an existing window as it is, without redrawing its saved rectangle. |
#define | WINDOW_STYLE_MASK 0xff | |
#define | STATUS_PANEL_NAME_X JAPANESE_OR(40, 32) | Japanese draws the name and the ailment labels 8 pixels further right, the Lv label through mnTextDrawStringInWindowStub, and the equip panel's "cannot equip" line 16 pixels in, as the class panel's is. |
#define | STATUS_PANEL_CANNOT_EQUIP_X JAPANESE_OR(16, 0) | |
#define | STATUS_PANEL_LEARN_NAME_Y SPANISH_OR(56, 48) | |
#define | STATUS_PANEL_LEARN_NOTE_Y SPANISH_OR(48, 56) | |
#define | CLASS_CHANGE_ARROW_TILE 298 | The tile of BG character block 0 that holds the class change's down arrow, which mnWatchStart blinks. |
#define | STATUS_PANEL_LOWER_ONLY 0x100 | A status panel request: the panel's kind in the low byte, and a bit to draw only its lower part. |
#define | STATUS_PANEL_KIND_MASK 0xff | |
#define | MESSAGE_CLASS_NAME ((Sint32)&MsgClassName) | The status panel's messages, as its functions pass them. |
#define | MESSAGE_EXP_LABEL ((Sint32)&MsgExpLabel) | |
#define | MESSAGE_PANEL_STAT_LABEL ((Sint32)&MsgPanelAttackLabel) | |
#define | MESSAGE_ABILITY_NAME ((Sint32)&MsgAbilityName) | |
#define | MESSAGE_POISON_LABEL ((Sint32)&MsgPoisonLabel) | |
#define | MESSAGE_VENOM_LABEL ((Sint32)&MsgVenomLabel) | |
#define | MESSAGE_CURSE_LABEL ((Sint32)&MsgCurseLabel) | |
#define | MESSAGE_HAUNT_LABEL ((Sint32)&MsgHauntLabel) | |
#define | MESSAGE_CANNOT_EQUIP ((Sint32)&MsgCannotEquip) | |
#define | MESSAGE_WILL_LEARN ((Sint32)&MsgWillLearn) | |
#define | MESSAGE_LEARNED ((Sint32)&MsgLearned) | |
#define | NUMBER_PIXELS_PER_DIGIT 8 | The pixels the field allows each digit. |
#define | DIGIT_COUNT_LIMIT 16 | Where mnCountDigits would stop counting: past an Sint32's 10 digits, so it only bounds the loop. |
#define | CURSOR_BOB_STEP () ((TickCount >> 1) & 7) | The hand cursor's step through MenuCursorBobY, one every two ticks. |
#define | LIST_ORDER_MAX_LENGTH 32 | The most bytes a list order copies, its LIST_ORDER_END included. |
#define | PAGE_LABEL_FIRST 49 | The tile of page 1's number; each later page's is the tile after. |
Enumerations
| Name | Description | |
|---|---|---|
enum | STATUS_PANEL_KIND { STATUS_PANEL_EXPERIENCE, STATUS_PANEL_EQUIP, STATUS_PANEL_LE … } | What the status panel shows in its lower part (STATUS_PANEL_KIND_MASK's bits): the experience, the equipment, the Psynergy learned, the class, the stats, or the equipment with the class it would give. |
enum | STAT_ARROW { STAT_ARROW_UP, STAT_ARROW_DOWN } | The stat arrows: the small up and down arrows the menu loads into its two VRAM cache slots (mnLoadStatArrows). |
enum | PAGED_LIST_MOVE { PAGED_LIST_UNMOVED, PAGED_LIST_ROW_MOVED, PAGED_LIST_PAGE_TU … } | What mnPagedListHandleInput did with the keys this tick. |
Functions
| Name | Description | |
|---|---|---|
void | 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. |
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). |
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. |
Sint32 | mnWindowUpdateOrCreate ( Sint32 *handle, Sint32 x, Sint32 y, Sint32 w, Sint32 h, Sint32 flags) | Creates *handle's window if absent and returns 1. |
void | mnWindowCloseIfOpen (void **handle, Sint32 release) | Closes *handle's window if present, erasing it at once when release is set, then sets the handle to NULL. |
void | gmUnitUpdateClassStub (Sint32 owner) | Works out a character's class, Psynergy and base elements again. |
void | mnStatusPanelDraw (WINDOW *unused, Sint32 owner, Sint32 slot, Sint32 mode) | Draws the status panel of the Item and Psynergy screens for party member owner (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 mode's 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 Sint32 | mnCountDigits (Sint32 number) | Returns how many decimal digits number has, but at least 2: a number under 10 has its one digit counted twice, as the units and as the leading digit. |
void | mnTextDrawNumberRightAligned (Sint32 number, Sint32 window, Sint32 x, Sint32 y) | Draws number right-aligned in a field ending at pixel x of window, 8 pixels a digit and at least two digits wide: the HP and PP figures outside Japan. |
void | mnStatusPanelDrawHpPp (UNIT *unit, Sint32 window) | Draws a party member's HP and PP into window as two rows, "HP current/maximum" at pixel row 40 and "PP current/maximum" at row 48. |
Sint32 | mnIconCreateStatChangeArrow (WINDOW *window, Sint32 x, Sint32 y, Sint32 variant) | Shows a stat change arrow, up or down (STAT_ARROW), at (x, y) of window. |
void | mnTextDrawStatComparison (const UNIT *after, const UNIT *before, Sint32 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. |
Sint32 | mnIconCreateHandCursor (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. |
void | mnIconShow (WINDOW_SPR *icon) | Shows an icon at its place, unscaled. |
void | mnReloadMemberPortrait (Sint32 menu, Sint32 unit) | Loads the graphics of party member unit into menu entry slot 0. |
WINDOW * | mnCursorCreate (void *state) | Opens the menu's top-left window (13 by 5 tiles) with a divider, puts the hand cursor in it, hidden, and adds the up and down arrow icons at its right edge when a VRAM entry is free. |
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. |
void | mnCursorPos (Sint32 xOffset, Sint32 yOffset) | Places the hand cursor at (xOffset, yOffset) inside the menu's window, bobbing. |
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. skipSlide is the member ITEM_MENU_STATE calls completionFlag: the item commands and mnItemMenuShowMessage set it, so the cursor stays put once after them. |
void | mnPsynergyMenuPlaceEntryIcons (Sint32 x, Sint32 y, Sint32 width) | 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. |
void | mnPsynergyMenuPlaceEntryIconsDefault (void) | Unused: lays the entry icons out eight to a row from (108, 40). |
void | mnPsynergyMenuPlaceEntryIcon (WINDOW_SPR **slot, Sint32 index, Sint32 originX, Sint32 originY, Sint32 columns) | Places the icon in *slot at cell index of a grid of 16x16 cells, columns wide, from (originX, originY), and shows it; an index past the last entry is taken as 0. |
void | mnItemMenuPlaceIcon (WINDOW_SPR **slot, Sint32 slotIndex, Sint32 originX, Sint32 originY, Sint32 columns) | Places the icon in *slot at slotIndex in a columns-wide grid of 24x16 cells from (originX, originY), and shows it; a slotIndex past INVENTORY_SLOTS is taken as 0. |
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. |
void | mnItemMenuShowMessage (Sint32 msg, Sint32 x, Sint32 y) | Shows message in the item menu, with the hand cursor hidden meanwhile. |
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. |
Sint32 | mnItemMenuSort (Uint16 *inventory, Sint32 mode) | Sorts a party member's INVENTORY_SLOTS inventory slots by the list order of mode: items are grouped by the order's item types and, within a type, run from the highest item id down. |
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. |
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. |
void | mnPagedListDrawPageNumbers (Sint32 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 the highlight palette and the others in the window's. |
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. |
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. |
void | mnSetPageIcons ( Sint32 pageSize, Sint32 first, Sint32 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. |
void | mnDrawCoins (Sint32 window) | Writes the party's coins and the "Coins" label into window: the info window of the Item and Psynergy screens' party member choice. |
void | mnWindowSetBounds ( WINDOW *window, Sint32 x, Sint32 y, Sint32 width, Sint32 height) | Moves and resizes a window, in tiles. |
Sint32 | mnUseSoundPlay (Sint32 sound) | Plays one of the menus' use sounds for mnAbilityPlayUseSound, and returns 1, which nothing reads. |
void | mnWatchStart (void) | An event while the menus watch for Start: blinks the class change's down arrow every four ticks, and on Start plays the cancel sound, sets FLAG_MENU_START_PRESSED and removes itself. |
void | mnStartWatchingStart (void) | Starts watching for Start: clears FLAG_MENU_START_PRESSED and adds mnWatchStart. |
void | mnStopWatchingStart (void) | Stops watching for Start, if Start has not removed the watch already. |
void | mnTextSetNormalColor (void) | Unused: draws the next text in TEXT_COLOR_NORMAL. |
void | mnTextSetRedColor (void) | Unused: draws the next text in TEXT_COLOR_RED. |
void | mnTextSetYellowColor (void) | Unused: draws the next text in TEXT_COLOR_YELLOW. |
Variables
| Name | Description | |
|---|---|---|
extern const Uint8 | StatusPanelLvString [] | The status panel's level label: Lv; Nv. in Spanish, Niv in French. |
extern Uint8 | MenuCursorBobX [] | The hand cursor's bob in x, a step every two ticks (mnCursorPos). |
extern Uint8 | MenuCursorBobY [] | The hand cursor's bob in y: 0, -1, -1, -2, -2, -1, -1, 0. |
Description
The pieces the menu screens share: windows, the status panel, numbers, icons,
the party figures, the hand cursor, paged lists, palettes, the cancel sound
and text colours. Part of menu.c.
Macros in detail
WINDOW_KEEP_EXISTING
#define WINDOW_KEEP_EXISTING 0x100
mnWindowUpdateOrCreate: keep an existing window as it is, without redrawing
its saved rectangle. The low byte of its flags is the new window's
(WINDOW_FLAG_*).
Referenced by mnItemMenuShowMessage(), mnStatusPanelDraw() and mnWindowUpdateOrCreate().
Definition at line 10 of file menu_shared.c.
WINDOW_STYLE_MASK
#define WINDOW_STYLE_MASK 0xff
Referenced by mnWindowUpdateOrCreate().
Definition at line 11 of file menu_shared.c.
STATUS_PANEL_NAME_X
#define STATUS_PANEL_NAME_X JAPANESE_OR(40, 32)
Japanese draws the name and the ailment labels 8 pixels further right, the Lv
label through mnTextDrawStringInWindowStub, and the equip panel's "cannot
equip" line 16 pixels in, as the class panel's is. Spanish swaps the learn
panel's two lines: the note above the Psynergy's name.
Referenced by mnStatusPanelDraw().
Definition at line 88 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 89 of file menu_shared.c.
STATUS_PANEL_LEARN_NAME_Y
#define STATUS_PANEL_LEARN_NAME_Y SPANISH_OR(56, 48)
Referenced by mnStatusPanelDraw().
Definition at line 90 of file menu_shared.c.
STATUS_PANEL_LEARN_NOTE_Y
#define STATUS_PANEL_LEARN_NOTE_Y SPANISH_OR(48, 56)
Referenced by mnStatusPanelDraw().
Definition at line 91 of file menu_shared.c.
CLASS_CHANGE_ARROW_TILE
#define CLASS_CHANGE_ARROW_TILE 298
The tile of BG character block 0 that holds the class change's down arrow,
which mnWatchStart blinks.
Referenced by mnStatusPanelDraw() and mnWatchStart().
Definition at line 95 of file menu_shared.c.
STATUS_PANEL_LOWER_ONLY
#define STATUS_PANEL_LOWER_ONLY 0x100
A status panel request: the panel's kind in the low byte, and a bit to draw only its lower part.
Referenced by mnItemMenuDrawEquipPreview() and mnStatusPanelDraw().
Definition at line 99 of file menu_shared.c.
STATUS_PANEL_KIND_MASK
#define STATUS_PANEL_KIND_MASK 0xff
Referenced by mnStatusPanelDraw().
Definition at line 100 of file menu_shared.c.
MESSAGE_CLASS_NAME
#define MESSAGE_CLASS_NAME ((Sint32)&MsgClassName)
The status panel's messages, as its functions pass them.
Referenced by mnStatusPanelDraw().
Definition at line 116 of file menu_shared.c.
MESSAGE_EXP_LABEL
#define MESSAGE_EXP_LABEL ((Sint32)&MsgExpLabel)
Referenced by mnStatusPanelDraw().
Definition at line 117 of file menu_shared.c.
MESSAGE_PANEL_STAT_LABEL
#define MESSAGE_PANEL_STAT_LABEL ((Sint32)&MsgPanelAttackLabel)
Referenced by mnStatusPanelDraw().
Definition at line 118 of file menu_shared.c.
MESSAGE_ABILITY_NAME
#define MESSAGE_ABILITY_NAME ((Sint32)&MsgAbilityName)
Referenced by mnStatusPanelDraw().
Definition at line 119 of file menu_shared.c.
MESSAGE_POISON_LABEL
#define MESSAGE_POISON_LABEL ((Sint32)&MsgPoisonLabel)
Referenced by mnStatusPanelDraw().
Definition at line 120 of file menu_shared.c.
MESSAGE_VENOM_LABEL
#define MESSAGE_VENOM_LABEL ((Sint32)&MsgVenomLabel)
Referenced by mnStatusPanelDraw().
Definition at line 121 of file menu_shared.c.
MESSAGE_CURSE_LABEL
#define MESSAGE_CURSE_LABEL ((Sint32)&MsgCurseLabel)
Referenced by mnStatusPanelDraw().
Definition at line 122 of file menu_shared.c.
MESSAGE_HAUNT_LABEL
#define MESSAGE_HAUNT_LABEL ((Sint32)&MsgHauntLabel)
Referenced by mnStatusPanelDraw().
Definition at line 123 of file menu_shared.c.
MESSAGE_CANNOT_EQUIP
#define MESSAGE_CANNOT_EQUIP ((Sint32)&MsgCannotEquip)
Referenced by mnStatusPanelDraw().
Definition at line 124 of file menu_shared.c.
MESSAGE_WILL_LEARN
#define MESSAGE_WILL_LEARN ((Sint32)&MsgWillLearn)
Referenced by mnStatusPanelDraw().
Definition at line 125 of file menu_shared.c.
MESSAGE_LEARNED
#define MESSAGE_LEARNED ((Sint32)&MsgLearned)
Referenced by mnStatusPanelDraw().
Definition at line 126 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 370 of file menu_shared.c.
DIGIT_COUNT_LIMIT
#define DIGIT_COUNT_LIMIT 16
Where mnCountDigits would stop counting: past an Sint32's 10 digits, so it
only bounds the loop.
Referenced by mnCountDigits().
Definition at line 373 of file menu_shared.c.
CURSOR_BOB_STEP
#define CURSOR_BOB_STEP() ((TickCount >> 1) & 7)
The hand cursor's step through MenuCursorBobY, one every two ticks.
Referenced by mnCursorPos().
Definition at line 664 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 921 of file menu_shared.c.
PAGE_LABEL_FIRST
#define PAGE_LABEL_FIRST 49
The tile of page 1's number; each later page's is the tile after.
Referenced by mnPagedListDrawPageNumbers().
Definition at line 1173 of file menu_shared.c.
Enumerations in detail
STATUS_PANEL_KIND
enum STATUS_PANEL_KIND
What the status panel shows in its lower part (STATUS_PANEL_KIND_MASK's
bits): the experience, the equipment, the Psynergy learned, the class, the
stats, or the equipment with the class it would give.
| Enumerator | Value | Description |
|---|---|---|
STATUS_PANEL_EXPERIENCE | 0 | |
STATUS_PANEL_EQUIP | 2 | |
STATUS_PANEL_LEARN | 4 | |
STATUS_PANEL_CLASS | 6 | |
STATUS_PANEL_STATS | 8 | |
STATUS_PANEL_EQUIP_CLASS | 9 |
Definition at line 105 of file menu_shared.c.
STAT_ARROW
enum STAT_ARROW
The stat arrows: the small up and down arrows the menu loads into its two
VRAM cache slots (mnLoadStatArrows).
| Enumerator | Value | Description |
|---|---|---|
STAT_ARROW_UP | ||
STAT_ARROW_DOWN |
Definition at line 481 of file menu_shared.c.
PAGED_LIST_MOVE
enum PAGED_LIST_MOVE
What mnPagedListHandleInput did with the keys this tick.
| Enumerator | Value | Description |
|---|---|---|
PAGED_LIST_UNMOVED | -1 | nothing moved, or the list is empty |
PAGED_LIST_ROW_MOVED | 0 | the cursor moved on the page |
PAGED_LIST_PAGE_TURNED | 1 |
Definition at line 1033 of file menu_shared.c.
Functions in detail
mnResumeFieldEvents
void 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(), syGameFlagClear() and syResumeOverlayEvents().
Referenced by mnDjinnMenuRun(), mnItemMenuRun(), mnPsynergyMenuRun() and mnStatusScreenRun().
Definition at line 16 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(), Sint32, syGameFlagSet() and sySuspendOverlayEvents().
Referenced by mnDjinnMenuRun(), mnItemMenuRun(), mnPsynergyMenuRun() and mnStatusScreenRun().
Definition at line 28 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 38 of file menu_shared.c.
mnWindowUpdateOrCreate
Sint32 mnWindowUpdateOrCreate( Sint32 *handle, Sint32 x, Sint32 y, Sint32 w, Sint32 h, Sint32 flags)
Creates *handle's window if absent and returns 1. Otherwise returns 0,
redrawing its saved rectangle unless flags has WINDOW_KEEP_EXISTING set.
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 52 of file menu_shared.c.
mnWindowCloseIfOpen
void mnWindowCloseIfOpen(void **handle, Sint32 release)
Closes *handle's window if present, erasing it at once when release is set,
then sets the handle to NULL.
References mnWindowCloseStub() and Sint32.
Referenced by mnDjinnMenuRunPreview(), mnDjinnMenuShowMemberStatus(), mnItemMenuClose() and mnItemMenuShowMessage().
Definition at line 75 of file menu_shared.c.
mnStatusPanelDraw
void mnStatusPanelDraw(WINDOW *unused, Sint32 owner, Sint32 slot, Sint32 mode)
Draws the status panel of the Item and Psynergy screens for party member owner (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 mode's panel kind asks for. slot is the inventory slot of the item the panel is about, for the equipment and Psynergy item panels. The first parameter, the status window, is not used: the window is the menu state's.
Opens the window on first use and keeps it in the state's statusWindow;
unless mode has STATUS_PANEL_LOWER_ONLY, the portrait it creates replaces the
state's cursor. The equipment panel equips the item on the real unit for a
moment and puts the unit back from a heap copy it frees before returning.
References gmInventoryEquipStub(), gmItemCanUnitEquipStub(), gmItemGetDefinitionStub(), gmUnitCalculateStub(), gmUnitGet(), gmUnitUpdateClassStub(), mnPortraitCreateStub(), mnStatusPanelDrawHpPp(), mnStatusScreenListStatuses(), mnTextDrawMessageAsTilesStub(), mnTextDrawNumberInWindowStub(), mnTextDrawStatComparison(), mnTextDrawStringAtOffsetStub(), mnWindowClearInteriorTilesStub(), mnWindowSetTilemapEntryStub(), mnWindowSpriteClearListStub(), mnWindowUpdateOrCreate(), Sint32, StatusPanelLvString, syHeapAllocate(), syHeapRelease(), sySynch() and syWordsCopy().
Referenced by mnItemMenuChooseCommand(), mnItemMenuDrawEquipPreview(), mnItemMenuRunCommands(), mnItemMenuRunMemberSelection(), mnItemMenuSelectTarget(), mnPsynergyMenuRunList(), mnPsynergyMenuRunSteps(), mnPsynergyMenuSelectMember() and mnPsynergyMenuSelectTarget().
Definition at line 144 of file menu_shared.c.
mnCountDigits
static inline Sint32 mnCountDigits(Sint32 number)
Returns how many decimal digits number has, but at least 2: a number under 10 has its one digit counted twice, as the units and as the leading digit.
References Sint32.
Referenced by mnTextDrawNumberRightAligned().
Definition at line 377 of file menu_shared.c.
mnTextDrawNumberRightAligned
void mnTextDrawNumberRightAligned(Sint32 number, Sint32 window, Sint32 x, Sint32 y)
Draws number right-aligned in a field ending at pixel x of window, 8 pixels a digit and at least two digits wide: the HP and PP figures outside Japan. Japanese pads them with spaces, its font's space as wide as a digit; the Latin font's space is narrower, so each figure gets a field as wide as its digits instead.
References mnCountDigits(), mnTextDrawNumberAtOffsetStub() and Sint32.
Referenced by mnStatusPanelDrawHpPp().
Definition at line 398 of file menu_shared.c.
mnStatusPanelDrawHpPp
void mnStatusPanelDrawHpPp(UNIT *unit, Sint32 window)
Draws a party member's HP and PP into window as two rows, "HP current/maximum" at pixel row 40 and "PP current/maximum" at row 48. The current HP is yellow below a quarter of the maximum, and red at 0.
References mnTextDrawNumberRightAligned(), mnTextDrawStringAtOffsetStub(), mnTextSetColorStub(), Sint32, StatusPanelHpString, StatusPanelPpString and StatusPanelSlashString.
Referenced by mnStatusPanelDraw().
Definition at line 416 of file menu_shared.c.
mnTextDrawStatComparison
void mnTextDrawStatComparison(const UNIT *after, const UNIT *before, Sint32 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(), mnTextDrawNumberAtOffsetStub() and Sint32.
Referenced by mnStatusPanelDraw().
Definition at line 490 of file menu_shared.c.
mnIconCreateHandCursor
Sint32 mnIconCreateHandCursor(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.
References mnVRAMBlockLoadResourceStub(), mnWindowSpriteCreateStub(), Sint32 and syVRAMCacheFindFreeEntry().
Referenced by mnCursorCreate() and mnOpenBackdropScreen().
Definition at line 543 of file menu_shared.c.
mnIconShow
void mnIconShow(WINDOW_SPR *icon)
Shows an icon at its place, unscaled.
Referenced by mnHideEmptyEntryIcons(), mnHideEntryIcons(), mnItemMenuArrangeCategoryItemIcons(), mnItemMenuDrawItemHead(), mnItemMenuPlaceIcon(), mnItemMenuRunCommands(), mnItemMenuRunList(), mnItemMenuSelectMember(), mnItemMenuSelectTarget(), mnPlaceEntryIconInGrid(), mnPsynergyMenuPlaceEntryIcon(), mnPsynergyMenuRunList(), mnPsynergyMenuSelectPartySlot(), mnPsynergyMenuSelectTarget(), mnSetPageIcons() and mnStatusScreenSelectMember().
Definition at line 561 of file menu_shared.c.
mnReloadMemberPortrait
void mnReloadMemberPortrait(Sint32 menu, Sint32 unit)
Loads the graphics of party member unit into menu entry slot 0. 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 575 of file menu_shared.c.
mnCursorCreate
WINDOW *mnCursorCreate(void *state)
Opens the menu's top-left window (13 by 5 tiles) with a divider, puts the
hand cursor in it, hidden, and adds the up and down arrow icons at its right
edge when a VRAM entry is free. Returns the window.
References mnIconCreateHandCursor(), mnVRAMBlockLoadResourceStub(), mnWindowDrawDividerLineStub(), mnWindowSpriteCreateStub(), mnWindowUpdateOrCreate(), Sint32 and syVRAMCacheFindFreeEntry().
Referenced by mnItemMenuInit() and mnStatusScreenInit().
Definition at line 583 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 fdRenderApplyProjectedPlacementAtDepthStub(), gmPartyCountMembersStub() and Sint32.
Definition at line 628 of file menu_shared.c.
mnCursorPos
void mnCursorPos(Sint32 xOffset, Sint32 yOffset)
Places the hand cursor at (xOffset, yOffset) inside the menu's 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 668 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. skipSlide is the member
ITEM_MENU_STATE calls completionFlag: the item commands and
mnItemMenuShowMessage set it, so the cursor stays put once after them. It is
read through the Psynergy menu's view, where the member is unsigned.
References Sint32 and sySynch().
Referenced by mnDjinnMenuRunPreview(), mnDjinnMenuSelectDjinn(), mnItemMenuChooseCommand(), mnItemMenuConfirmDrop(), mnItemMenuConfirmEquip(), mnItemMenuSelectGiveQuantity(), mnItemMenuSelectMember(), mnPsynergyMenuSelectPartySlot(), mnPsynergyMenuSelectTarget(), mnStatusScreenRunStatusPage() and mnStatusScreenSelectMember().
Definition at line 686 of file menu_shared.c.
mnPsynergyMenuPlaceEntryIcons
void mnPsynergyMenuPlaceEntryIcons(Sint32 x, Sint32 y, Sint32 width)
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 lines 749 and 759 of file menu_shared.c.
mnPsynergyMenuPlaceEntryIconsDefault
void mnPsynergyMenuPlaceEntryIconsDefault(void)
Unused: lays the entry icons out eight to a row from (108, 40).
References mnPsynergyMenuPlaceEntryIcons().
Definition at line 752 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 cell index of a grid of 16x16 cells, columns wide, from (originX, originY), and shows it; an index past the last entry is taken as 0.
References mnIconShow() and Sint32.
Referenced by mnPsynergyMenuPlaceEntryIcons().
Definition at line 785 of file menu_shared.c.
mnItemMenuPlaceIcon
void mnItemMenuPlaceIcon(WINDOW_SPR **slot, Sint32 slotIndex, Sint32 originX, Sint32 originY, Sint32 columns)
Places the icon in *slot at slotIndex in a columns-wide grid of 24x16 cells
from (originX, originY), and shows it; a slotIndex past INVENTORY_SLOTS is
taken as 0.
References mnIconShow() and Sint32.
Referenced by mnItemMenuPlaceIcons().
Definition at line 806 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 824 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.
With y == -1 the message goes into the info window; otherwise a modal window
sized to the message opens at (x, y). With x == -1 the message stays up and
FLAG_INFO_WINDOW_HOLDS_MESSAGE records that the info window holds it;
otherwise it waits for A, B or Start and clears it again.
References mnTextDrawMessageStub(), mnTextGetMessageSizeStub(), mnWindowCloseIfOpen(), mnWindowSetBounds(), mnWindowSpriteClearListStub(), mnWindowSpriteRedrawSavedRectStub(), mnWindowUpdateOrCreate(), PerWork, Sint32, syGameFlagSet() and sySynch().
Referenced by mnItemMenuRunCommands(), mnItemMenuTryBreak(), mnItemMenuUse() and mnPsynergyMenuRunSteps().
Definition at line 861 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 lines 923 and 999 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: 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 928 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.
count entries are shown pageSize at a time; *cursor is the row on the page
and *page the page. Vertical lists (horizontal 0) move the cursor with Up and
Down and turn pages with Left and Right; horizontal lists the other way
round. Moving past either end wraps round; turning to a shorter page pulls
the cursor up to its last entry. Returns a PAGED_LIST_MOVE.
References mnPageArrowsDrawStub(), PerWork, result, Sint32, syInputResetKeyRepeat() and sySoundPlayStub().
Referenced by mnItemMenuRunList(), mnPsynergyMenuRunList(), mnStatusScreenRunEquipmentPage() and mnStatusScreenRunPsynergyPage().
Definition at line 1047 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(), mnPsynergyMenuRun(), mnStatusScreenRun() and mnStatusScreenRunPartyRow().
Definition at line 1140 of file menu_shared.c.
mnPagedListDrawPageNumbers
void mnPagedListDrawPageNumbers(Sint32 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 the highlight palette and the others in the window's.
References mnWindowSetTilemapEntryStub() and Sint32.
Referenced by mnItemMenuDrawListPage(), mnPsynergyMenuDrawPage(), mnStatusScreenDrawEquipmentPage(), mnStatusScreenDrawPsynergyPage() and mnStatusScreenShowDjinnList().
Definition at line 1178 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.
Referenced by mnItemMenuShowSelectedRow(), mnPsynergyMenuShowSelectedRow(), mnStatusScreenDrawSelectionCursor(), mnStatusScreenShowEquipmentRow() and mnStatusScreenShowPsynergyRow().
Definition at line 1219 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.
References syDMAXCopy().
Referenced by mnItemMenuOpenDetail() and mnItemMenuShowDetails().
Definition at line 1282 of file menu_shared.c.
mnSetPageIcons
void mnSetPageIcons( Sint32 pageSize, Sint32 first, Sint32 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 1298 of file menu_shared.c.
mnDrawCoins
void mnDrawCoins(Sint32 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(), mnWindowDrawDividerLineStub() and Sint32.
Referenced by mnItemMenuRunCommands() and mnPsynergyMenuSelectMember().
Definition at line 1324 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.
Referenced by mnItemMenuFitMessageWindowToItemChoices(), mnItemMenuFitMessageWindowToItemQuestion(), mnItemMenuFitMessageWindowToLongItemQuestion(), mnItemMenuFitMessageWindowToQuestion(), mnItemMenuPlaceItemWindowBelowItemQuestion(), mnItemMenuPlaceItemWindowBelowQuestion(), mnItemMenuSelectTarget() and mnItemMenuShowMessage().
Definition at line 1335 of file menu_shared.c.
mnUseSoundPlay
Sint32 mnUseSoundPlay(Sint32 sound)
Plays one of the menus' use sounds for mnAbilityPlayUseSound, and returns 1,
which nothing reads.
References Sint32 and sySoundPlayStub().
Referenced by mnAbilityPlayUseSound().
Definition at line 1349 of file menu_shared.c.
mnWatchStart
void mnWatchStart(void)
An event while the menus watch for Start: blinks the class change's down
arrow every four ticks, and on Start plays the cancel sound, sets
FLAG_MENU_START_PRESSED and removes itself.
References MenuClassChangeArrowTile, PerWork, Sint32, syCloseEvent(), syGameFlagSet(), sySoundPlayStub(), syWordsCopy(), syWordsFill() and TickCount.
Referenced by mnStartWatchingStart() and mnStopWatchingStart().
Definition at line 1358 of file menu_shared.c.
mnStartWatchingStart
void mnStartWatchingStart(void)
Starts watching for Start: clears FLAG_MENU_START_PRESSED and adds
mnWatchStart.
References mnWatchStart(), Sint32, syGameFlagClear() and sySetEvent().
Referenced by mnItemMenuRun(), mnPsynergyMenuRun() and mnStatusScreenRun().
Definition at line 1397 of file menu_shared.c.
mnStopWatchingStart
void mnStopWatchingStart(void)
Stops watching for Start, if Start has not removed the watch already.
References mnWatchStart(), Sint32, syCloseEvent() and syGameFlagGet().
Referenced by mnItemMenuRun(), mnPsynergyMenuRun() and mnStatusScreenRun().
Definition at line 1404 of file menu_shared.c.
mnTextSetNormalColor
void mnTextSetNormalColor(void)
Unused: draws the next text in TEXT_COLOR_NORMAL.
References mnTextSetColorStub().
Definition at line 1413 of file menu_shared.c.
mnTextSetRedColor
void mnTextSetRedColor(void)
Unused: draws the next text in TEXT_COLOR_RED.
References mnTextSetColorStub().
Definition at line 1419 of file menu_shared.c.
mnTextSetYellowColor
void mnTextSetYellowColor(void)
Unused: draws the next text in TEXT_COLOR_YELLOW.
References mnTextSetColorStub().
Definition at line 1425 of file menu_shared.c.
Variables in detail
StatusPanelLvString
extern const Uint8 StatusPanelLvString[]
The status panel's level label: Lv; Nv. in Spanish, Niv in French.
Referenced by mnStatusPanelDraw().
Definition at line 129 of file menu_shared.c.