item_menu.c
The battle item menu.
games/tbs/src/window/battle_command/item_menu.c on GitHub
The battle item menu. Part of battle_command.c, the menu object, compiled only through it.
Functions
Item_ClassifyUseAbility
s32 Item_ClassifyUseAbility(s32 unit, s32 item)
Says whether member unit can use inventory entry item in battle: 0
yes; 1 no, "Using this will have no effect." (no item, an item that only
teaches Psynergy while equipped, one with no action, or equipment the
member cannot equip); 2 not in battle, "Cannot be used during battle."
(its action lacks BATTLE_OK). A broken item (INVENTORY_BROKEN) is not
tested here. The item command lists the usable items first by it.
Used by Battle_CollectPartyCommands, ItemList_SelectEntry.
Vram_CopyTile
void Vram_CopyTile(u32 sourceTile, u32 destinationTile)
Copies one 4bpp tile of BG character block 0 to another, each given as a tilemap entry whose palette and flip bits are ignored. The battle lists copy the frame's top and bottom tees to tiles 0x200, 0x201, 0x210 and 0x211 as they open. XXX: what shows those copies is not found; tiles 0x200 to 0x27f are also the second text-tile range (UiWork_SetAltFlagAndClearTable), and a tilemap entry naming one of the four would settle it.
Used by BattleMenu_RunActionSelection, ItemList_SelectEntry.
ItemList_SelectEntry
s32 ItemList_SelectEntry(s32 owner, u16 *entries, s32 count)
The battle item list for unit owner: count inventory entries (ended by
0), five to a page, each with its icon and name: plain when usable,
colour 4 when Item_ClassifyUseAbility refuses it, colour 2 when broken;
the window above names the one under the cursor (MsgItemPlainName), or
says it cannot be used in battle. Returns the chosen entry's
place in entries, or -1 when cancelled, when the link battle's time
runs out, or when there are no items. A refused item stays on the list
with its reason ("It's broken.", and the classifier's messages). The
item command runs it (Battle_CollectPartyCommands).
Used by Battle_CollectPartyCommands.