Skip to Content
The Alchemy Project

include/window/screens.h

The screens object's functions and tables that code outside it uses: the Status screen's cursor stops, the file list and File Screen choices, the battle menus, the menu headings and the Yes/No menu.

Included by battle_internal.h, battle_effect_internal.h, level.c, psynergy_test.c, shop_test.c, field_engine_cues.c, menu_internal.h, clear.c, contigo.c, icon_menu_tables.c, screen_tables.c and window_internal.h.

Structures

NameDescription
structBAR_PATTERN_ROWA row of MenuBarPatternRows: the two words a menu bar's tile pair is XORed with (mnRangeIconBuildTiles).

Macros

NameDescription
#defineRANGE_PATTERN_SET_COUNT 2The twelve Psynergy range icons, built in two sets of six (mnBuildPatternTiles for the Status menu, mnRangeIconBuildTiles for the battle menu): range n takes icon n - 1, and ABILITY_RANGE_ALL the last, RANGE_ICON_ALL.
#defineRANGE_PATTERN_COUNT 6
#defineRANGE_ICON_ALL (RANGE_PATTERN_SET_COUNT * RANGE_PATTERN_COUNT - 1)
#defineMENU_STATE_SIZE 3308The bytes of the menu state, heap block HEAP_SLOT_MENU: SHOP_STATE's size, the largest of the screens' views of it.

Enumerations

NameDescription
enumITEM_BATTLE_USE { ITEM_BATTLE_USE_OK, ITEM_BATTLE_USE_NO_EFFECT, ITEM_BATTLE_U … }Whether a party member can use an item in battle, as mnItemCheckBattleUse returns it: the battle item menu answers a refusal with "Using this will have no effect." or "Cannot be used during battle.", and the item lists draw a refused item in yellow.
enumMENU_TITLE_PICTURE { MENU_TITLE_SAVE, MENU_TITLE_CONTINUE, MENU_TITLE_COPY, MENU_ … }The 64x16 headings of MenuTitlePictures that mnTitleCreate shows, in their order: the file menu's, in FILE_LIST_PURPOSE's order, then the Pause and Settings headings.
enumFILE_ACTION { FILE_ACTION_NEW_GAME, FILE_ACTION_CONTINUE, FILE_ACTION_COPY … }The file menu's choices, as mnFileListSelectAction returns them (MenuSaveSlotActionByPosition).
enumFIELD_MENU_COMMAND { FIELD_MENU_PSYNERGY, FIELD_MENU_DJINN, FIELD_MENU_ITEM, FIEL … }The field menu's commands, as mnFieldMenuSelectCommand takes and returns them (MenuTopEntryCommandByPosition).
enumFILE_LIST_PURPOSE { FILE_LIST_SAVE, FILE_LIST_CONTINUE, FILE_LIST_COPY, FILE_LIS … }What the file list is choosing a file for (mnFileListSelectFile, and mnSaveChooseAndLoadFile for the File Screen), which decides the files the cursor may stop on.
enumTRANSFER_METHOD { TRANSFER_METHOD_PASSWORD, TRANSFER_METHOD_CABLE }The transfer method menu's choices, in their order.
enumPASSWORD_LEVEL { PASSWORD_LEVEL_GOLD, PASSWORD_LEVEL_SILVER, PASSWORD_LEVEL_B … }The password level menu's choices, in their order: how much of the game a password carries.
enumSEND_OPTION_MENU { SEND_OPTION_TRANSFER_METHOD, SEND_OPTION_PASSWORD_LEVEL }What mnIconMenuChooseSendOption offers.
enumYES_NO { YES, NO }What mnYesNoMenuRun and mnYesNoMenuRunAt return.

Functions

NameDescription
static __inline__ Uint32mnXorWord (Uint32 word, Uint32 mask)One word of a tile XORed with a row's mask: the marks mnBuildPatternTiles and mnRangeIconBuildTiles make on a range icon's two tiles.
Sint32mnCommandIconReloadSlot (Sint32 slotIndex, Sint32 icon)Decodes command icon icon (RESOURCE_COMMAND_ICONS, 1 KB of 256-colour pixels) in a block taken from HEAP_SLOT_ICON_TRANSFER, reloads VRAM cache entry slotIndex with it and returns the entry's first tile.
voidmnBattleMenuUpdateEachTick (void)An event while the party's commands are chosen (mnBattleCollectPartyCommands): eases the battle view a third of the way to BATTLE_MENU_STATE.targetViewOffset each tick (a pixel at least), draws the sprites of BATTLE_MENU_STATE.icons that are shown (the chosen command's and ability's icons, the party member's portrait) and slides the page arrows.
Sint32mnBattleCommandRowRun (Sint32 mode, Sint32 fleeAllowed)Runs a battle command row: the commands as icons along the bottom of the screen, the selected one pulsing as a sprite and named in a window, until a command is chosen.
Sint32mnBattleTargetRunSelection (Sint32 selection, Sint32 mode, Uint32 spread, Uint32 kind)Lets the player choose the target of an action of unit selection, with a cursor over the aimed unit and smaller markers on the others its range covers.
Sint32mnBattleStatusScreenRun (Uint16 *list, Sint32 listCount, Sint32 member)Runs the Status screen for party member member until B is pressed or the link battle's time runs out: the party member's level, experience, HP and PP, class, stats, Djinn, elements and statuses, with a help line for the item under the cursor.
Sint32mnBattleRefuseFlee (void)Tests whether the party may not run from this battle: a link battle, battle type 3, which no battle sets, or a party once challenged (BATTLE_STATE.challengeFlag).
Sint32mnBattlePsynergyMenuRun (Sint32 unitId, Uint16 *actions, Sint32 count)The battle Psynergy list for unit unitId: count abilities of actions (ended by 0), five to a page, each with its icon, name, PP cost, element and range icon, in TEXT_COLOR_YELLOW when not usable in battle, TEXT_COLOR_RED when the unit's PP fall short and TEXT_COLOR_PINK while its Psynergy is sealed; the window above describes the one under the cursor.
Sint32mnBattleSummonMenuRun (Sint32 unusedA, Sint32 unusedB, const Uint8 *standby)The battle summon list: the summons the party holds enough Djinn for (gmSummonListLearnedStub, DJINN_RECOVERY_TABLE.summonMask), four to a page, those standby can pay for first, each with its Djinn cost by element, the others in TEXT_COLOR_RED.
Sint32mnBattleItemMenuRun (Sint32 member, Uint16 *entries, Sint32 count)The battle item list for unit member: count inventory entries (ended by 0), five to a page, each with its icon and name: plain when usable, TEXT_COLOR_YELLOW when mnItemCheckBattleUse refuses it, TEXT_COLOR_RED when broken; the window above names the one under the cursor (MsgItemDescription), or says it cannot be used in battle.
Sint32mnItemCheckBattleUse (Sint32 member, Sint32 item)Says whether party member unit can use inventory entry itemId in battle: ITEM_BATTLE_USE_OK; ITEM_BATTLE_USE_NO_EFFECT, "Using this will have no effect." (no item, an item that only teaches Psynergy while equipped, one with no action, or equipment the party member cannot equip); or ITEM_BATTLE_USE_NOT_IN_BATTLE, "Cannot be used during battle." (its action lacks ABILITY_USABLE_IN_BATTLE).
Sint32mnItemIconLoadIntoSlot (Sint32 item, Sint32 slot)Builds the icon of inventory item resource (the count above one and both marks) in a transfer block taken from HEAP_SLOT_ICON_TRANSFER, reloads VRAM cache entry index with it and returns the entry's first tile.
voidmnIconMenuDrawIcons (void)Draws the icon menu's icons, an event of the icon menus (mnIconMenuOpen).
Sint32mnLinkCreateCountdownLabelWindow (void)Opens the link battle timer's 6x4 window at the upper left, labelled "TIME", and returns it; mnBattleMenuUpdateEachTick draws the seconds.
voidbtMessageWaitForAdvanceAtStub (Sint32 x, Sint32 y)Shows the advance cursor bobbing at (x, y) and waits for A, B, L or R.
voidsySoundSetBGMVolumeTargetStub (Sint32 target, Sint32 step)Sets the BGM volume target (BGM_UNITY_SCALE full) and its step a frame.
voidfdPlayQueuedMusicStub (void)Plays the music fdQueueMusic remembered, if any.
voidfdActorTableSnapshotStub (void)Saves up to 32 actors into SnapshotObjects so that they can be put back.
Sint32mnFileListSelectFile (Sint32 selectedFile, Sint32 purpose)The file list: lists the three files with each one's leader and area (or why it cannot be chosen) and, for the file under the cursor, its summary, its party and its Djinn, in that file's window colours.
voidmnTitleBob (struct WINDOW_SPR *object)Bobs the two sprites of a pair (see mnTitleCreate) up and down by MenuTitleBobOffsets, one step every four frames.
struct WINDOW_SPR *mnTitleCreate (Sint32 picture, struct WINDOW *window, Sint32 x, Sint32 y)Shows heading picture of MenuTitlePictures as two 32x16 sprites side by side at (x, y) in window, at depth OAM_DEPTH_FRONT - 2, and returns the left one (the right one follows it in the window's list).
voidmnWindowSpritePulse (struct WINDOW_SPR *object)Makes the sprite object pulse: scales it about its centre by WindowSpritePulseScales (16.16, used as 8.8), one step every two ticks, and puts it at depth OAM_DEPTH_FRONT - 3.
voidmnGraphicsMergeShiftedTileRows (Uint32 *first, Uint32 *second, Uint32 *output, Sint32 shift)Merges two 4bpp tiles row by row into output: second moved shift pixels, drawn over first.
voidmnFileListUpdatePulse (void)The event that makes the file list's highlight glow.

Variables

NameDescription
extern Uint8PageArrowTiles []The two tiles of the link screen's page arrows, which mnPageArrowsDraw shifts and merges into the window border each tick.
extern Sint32MenuTitlePictures []The file menu's 64x16 headings by number, each drawn as two 32x16 sprites (mnTitleLoad; graphics/ui/menu_titles.s).
extern const FIXEDWindowSpritePulseScales []The eight scales mnWindowSpritePulse pulses the settings menu's selected icon through.
extern const Sint8NameEntryCaretWave []Eight offsets, 0 to 3 and back, that make the name entry screen's caret circle: the x offset leads the y offset by five steps.
extern const Uint8NameEntryKeyboardTilemap []The name entry screen keyboard's compressed tilemap, the Spanish edition's with its own letters.

Description

The screens object's functions and tables that code outside it uses: the Status screen's cursor stops, the file list and File Screen choices, the battle menus, the menu headings and the Yes/No menu.

Macros in detail

RANGE_PATTERN_SET_COUNT

#define RANGE_PATTERN_SET_COUNT 2

The twelve Psynergy range icons, built in two sets of six (mnBuildPatternTiles for the Status menu, mnRangeIconBuildTiles for the battle menu): range n takes icon n - 1, and ABILITY_RANGE_ALL the last, RANGE_ICON_ALL.

Referenced by mnBuildPatternTiles() and mnRangeIconBuildTiles().

Definition at line 34 of file screens.h.

RANGE_PATTERN_COUNT

#define RANGE_PATTERN_COUNT 6

Referenced by mnBuildPatternTiles() and mnRangeIconBuildTiles().

Definition at line 35 of file screens.h.

RANGE_ICON_ALL

#define RANGE_ICON_ALL (RANGE_PATTERN_SET_COUNT * RANGE_PATTERN_COUNT - 1)

Referenced by mnBattleDjinnMenuShowChangePreview(), mnBattlePsynergyMenuRun(), mnBattleStatusScreenRun() and mnStatusScreenDrawPsynergyPage().

Definition at line 36 of file screens.h.

#define MENU_STATE_SIZE 3308

The bytes of the menu state, heap block HEAP_SLOT_MENU: SHOP_STATE's size, the largest of the screens' views of it. Each screen's run function takes the block as it opens and releases it as it closes.

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

Definition at line 113 of file screens.h.

Enumerations in detail

ITEM_BATTLE_USE

enum ITEM_BATTLE_USE

Whether a party member can use an item in battle, as mnItemCheckBattleUse returns it: the battle item menu answers a refusal with "Using this will have no effect." or "Cannot be used during battle.", and the item lists draw a refused item in yellow.

EnumeratorValueDescription
ITEM_BATTLE_USE_OK0
ITEM_BATTLE_USE_NO_EFFECT1
ITEM_BATTLE_USE_NOT_IN_BATTLE2

Definition at line 56 of file screens.h.

enum MENU_TITLE_PICTURE

The 64x16 headings of MenuTitlePictures that mnTitleCreate shows, in their order: the file menu's, in FILE_LIST_PURPOSE's order, then the Pause and Settings headings.

EnumeratorValueDescription
MENU_TITLE_SAVE
MENU_TITLE_CONTINUE
MENU_TITLE_COPY
MENU_TITLE_ERASE
MENU_TITLE_BATTLE
MENU_TITLE_TRANSFER
MENU_TITLE_UPDATE
MENU_TITLE_PAUSE
MENU_TITLE_SETTINGS

Definition at line 81 of file screens.h.

FILE_ACTION

enum FILE_ACTION

The file menu's choices, as mnFileListSelectAction returns them (MenuSaveSlotActionByPosition).

EnumeratorValueDescription
FILE_ACTION_NEW_GAME0
FILE_ACTION_CONTINUE1
FILE_ACTION_COPY2
FILE_ACTION_ERASE3
FILE_ACTION_BATTLE4
FILE_ACTION_UPDATE5

Definition at line 100 of file screens.h.

FIELD_MENU_COMMAND

enum FIELD_MENU_COMMAND

The field menu's commands, as mnFieldMenuSelectCommand takes and returns them (MenuTopEntryCommandByPosition).

EnumeratorValueDescription
FIELD_MENU_PSYNERGY1
FIELD_MENU_DJINN2
FIELD_MENU_ITEM3
FIELD_MENU_STATUS4

Definition at line 117 of file screens.h.

FILE_LIST_PURPOSE

enum FILE_LIST_PURPOSE

What the file list is choosing a file for (mnFileListSelectFile, and mnSaveChooseAndLoadFile for the File Screen), which decides the files the cursor may stop on.

EnumeratorValueDescription
FILE_LIST_SAVEsaving: any file, empty ones too
FILE_LIST_CONTINUEcontinuing: files not yet cleared
FILE_LIST_COPYcopying: any file with data
FILE_LIST_ERASEerasing: any file with data
FILE_LIST_BATTLEthe title's Battle: files that have found a Djinni
FILE_LIST_CLEAREDthe title's Send: cleared files only
FILE_LIST_UPDATEthe title's Update: files saved before FLAG_REUNION was set

Definition at line 128 of file screens.h.

TRANSFER_METHOD

enum TRANSFER_METHOD

The transfer method menu's choices, in their order.

EnumeratorValueDescription
TRANSFER_METHOD_PASSWORD0
TRANSFER_METHOD_CABLE1

Definition at line 141 of file screens.h.

PASSWORD_LEVEL

enum PASSWORD_LEVEL

The password level menu's choices, in their order: how much of the game a password carries.

EnumeratorValueDescription
PASSWORD_LEVEL_GOLD0levels, Djinn, stats, items and coins
PASSWORD_LEVEL_SILVER1levels, Djinn and stats
PASSWORD_LEVEL_BRONZE2levels and Djinn

Definition at line 149 of file screens.h.

SEND_OPTION_MENU

enum SEND_OPTION_MENU

What mnIconMenuChooseSendOption offers.

EnumeratorValueDescription
SEND_OPTION_TRANSFER_METHOD0Password or Cable
SEND_OPTION_PASSWORD_LEVEL1Gold, Silver or Bronze

Definition at line 157 of file screens.h.

YES_NO

enum YES_NO

What mnYesNoMenuRun and mnYesNoMenuRunAt return.

EnumeratorValueDescription
YES0
NO1

Definition at line 164 of file screens.h.

Functions in detail

mnXorWord

static __inline__ Uint32 mnXorWord(Uint32 word, Uint32 mask)

One word of a tile XORed with a row's mask: the marks mnBuildPatternTiles and mnRangeIconBuildTiles make on a range icon's two tiles.

Referenced by mnBuildPatternTiles() and mnRangeIconBuildTiles().

Definition at line 25 of file screens.h.

btMessageWaitForAdvanceAtStub

void btMessageWaitForAdvanceAtStub(Sint32 x, Sint32 y)

Shows the advance cursor bobbing at (x, y) and waits for A, B, L or R.

Referenced by mnBattleCommandRowRun().

Definition at line 68 of file screens.h.

sySoundSetBGMVolumeTargetStub

void sySoundSetBGMVolumeTargetStub(Sint32 target, Sint32 step)

Sets the BGM volume target (BGM_UNITY_SCALE full) and its step a frame.

Referenced by mnSaveProgressClose() and mnSaveProgressOpen().

Definition at line 70 of file screens.h.

fdPlayQueuedMusicStub

void fdPlayQueuedMusicStub(void)

Plays the music fdQueueMusic remembered, if any.

Referenced by mnSaveProgressClose().

Definition at line 72 of file screens.h.

fdActorTableSnapshotStub

void fdActorTableSnapshotStub(void)

Saves up to 32 actors into SnapshotObjects so that they can be put back.

Referenced by mnSaveToChosenFile() and mnSaveToFile().

Definition at line 74 of file screens.h.

Variables in detail

PageArrowTiles

extern Uint8 PageArrowTiles[]

The two tiles of the link screen's page arrows, which mnPageArrowsDraw shifts and merges into the window border each tick.

Referenced by mnBattleStatusDrawPageArrows() and mnPageArrowsDraw().

Definition at line 172 of file screens.h.

extern Sint32 MenuTitlePictures[]

The file menu's 64x16 headings by number, each drawn as two 32x16 sprites (mnTitleLoad; graphics/ui/menu_titles.s).

Referenced by mnTitleLoad().

Definition at line 181 of file screens.h.

NameEntryKeyboardTilemap

extern const Uint8 NameEntryKeyboardTilemap[]

The name entry screen keyboard's compressed tilemap, the Spanish edition's with its own letters.

Referenced by mnNameEntryEditMemberName().

Definition at line 192 of file screens.h.