115 if (slot > inventoryCount - 1)
116 slot = inventoryCount - 1;
124 Shop_DrawMsg(descriptionWindow, itemId + MsgItemPlainName);
140 slot = (slot + inventoryCount) % inventoryCount;
146 slot = (slot + inventoryCount) % inventoryCount;
153 while (slot >= inventoryCount)
160 if (slot >= inventoryCount)
248 quantityLimit = stackQuantity;
275 s32 sellingReplacedItem = 0;
281 sellingReplacedItem = 1;
296 if (sellingReplacedItem)
297 message = MsgOldItemSellOffer;
299 message = MsgDamagedSellOffer;
301 message = MsgSellTotal;
303 message = MsgRareSellOffer;
305 message = MsgSellOffer;
310 if (rare || sellingReplacedItem)
313 message = MsgChangedMind;
319 for (soldCount = 0; soldCount < count; soldCount++)
324 if (rare || sellingReplacedItem)
void Shop_DrawParty(struct UiWindow *window, s32 selected, s32 itemId)
Shows the chosen member walking and the others standing, and draws at four fifths of their size the m...
s32 Shop_SalePrice(s32 inventoryEntry)
Returns what the shops pay for an inventory entry: nothing for an indispensable item,...
void Shop_DrawMoney(void)
Draws the party's coins in the coins window, in the edition's layout.
void Shop_DrawMsg(struct UiWindow *window, s32 message)
Shows message, an item's description, in the help window; a NULL window is ignored.
s32 Shop_SelectQuantity(s32 minimum, s32 maximum, s32 price)
Chooses how many items to buy or sell, returning the quantity above minimum or -1 when cancelled.
void Shop_DrawItemPrice(struct UiWindow *window, s32 itemId, s32 price, s32 priceKind)
Draws the item's name and below it its price.
void Shop_PlaceCursor(struct UiWindow *window, s32 x, s32 y)
Starts the hand cursor's glide to (x, y) pixels inside window (the screen when it is NULL),...
struct BattleUnit * UnitGetFar(u32 owner)
struct ItemDefinition * Item_GetDirectFar(s32 item)
s32 Inventory_CountFar(s32 owner)
s32 Shop_GetSelectionState(s32 owner, s32 slot)
Far call to Inventory_GetQuantity.
s32 Inventory_DiscardFar(s32 owner, s32 slot)
s32 Party_AdjustCoinsFar(s32 amount)
void AudioCommand_PlayFar(s32 id)
void RenderOutput_PrepareForRedrawFar(struct UiWindow *window)
struct UiWindow * UiWindow_CreateFar(s32 x, s32 y, s32 width, s32 height, s32 attrs)
struct RenderOutput * RenderOutput_CreateLoadedFar(s32 code, s32 layers, struct UiWindow *input, s32 x, s32 y)
void UiText_DrawResourceFar(s32 arg0, struct UiWindow *arg1, s32 arg2, s32 arg3)
void UiWork_FinalizeFar(struct UiWindow *work, s32 release)
void UiWork_PushValueSlotFar(u32 value, u32 kind)
void WaitFrames(s32 frames)
The game's frame loop: runs frames frames and returns.
@ ITEM_RARE
selects the shop's rare item offers
volatile u32 gKeysPressed
Keys that went down this frame.
volatile u32 gKeysRepeat
Pressed keys, repeating while held: after 19 frames, then every 6.
s32 Shop_SelectRepair(s32 unitId)
Lets the player choose items to repair from the member's grid, one at a time, with each one's repair ...
void UiMessage_ShowAndRestoreState(s32 messageId)
Shows a shopkeeper's line as UiMessage_ShowAndWait does, hiding the hand cursor while it shows and pu...
s32 UiMessage_ShowChoice(s32 choice)
Runs the Yes or No choice beside the shopkeeper's line and returns it, keeping the hand cursor's moti...
void UiMessage_ShowAndWait(s32 messageId)
Shows a shopkeeper's line and waits for its window to finish, one more frame included.
s32 Shop_SelectSellNum(s32 unitId, s32 slot)
Asks how many to sell when the item is a stack of more than one, and returns the count (1 otherwise,...
s32 Shop_SelectSell(s32 unitId)
Lets the player choose items to sell from the member's grid, one at a time, with each one's price and...
s32 Shop_PickUnit(void)
Lets the player choose whose items to sell or repair, with the coins window and the member's item gri...
void Shop_SellItem(s32 unitId, s32 slot, s32 count)
Sells count of the item in slot: refuses an item the shop does not buy or one equipped and cursed on,...
void Shop_DrawUnitGrid(struct UiWindow *window, s32 unitId)
Draws the member's items as icons in rows of five, or a line saying it has none.
What every part of the shop object shares: its includes, the shop actions and sanctum services,...
#define SHOP_QUANTITY_CURSOR_X
#define SHOP_EMPTY_GRID_X
#define SHOP_MONEY_WINDOW_WIDTH
#define SHOP_EMPTY_GRID_Y
#define SE_MENU_CURSOR_MOVE
A unit in battle: a party member's or an enemy's stats, Psynergy, items, Djinn and ailments.
u16 inventory[15]
Items held, one entry each: bits 15..11 quantity | 10 broken | 9 equipped | 8..0 item id (INVENTORY_*...
An item's definition: its price, type, who can equip it, its bonuses and unleash, its effects and the...
A render output: a sprite in a window's output list (a character, an icon or a portrait),...
u8 sentinel
depth slot it is drawn at (254 for glyphs)
s8 active
its UI_SPRITE_ motion; 0 while free
struct RenderOutput * anchor
the cursor's sprite, moved with its OAM
A shop's work: its windows, the party members' icons, the stock, the cursor and its icons,...
struct UiWindow * itemWindow
struct ShopCursor cursor
the hand cursor
s16 partyMemberIds[9]
the party in order (Party_ListActiveOwners)
struct UiWindow * moneyWindow
the coins window
s8 partyAction
the counter chosen (enum ShopAction)
u8 mode
passed on as the hand cursor's kind; set to 12 at first
A window: a framed rectangle of the tilemap with its sprite outputs, its opening or closing animation...