This folder holds The Broken Seal's counters: shops that buy, sell and repair, the artifact counter and the Game Ticket gifts, the sanctum's healing services, the inn, and the item picker that asks which item to drop when an item is found with every bag full.
See also: Windows, the windows and messages the counters are made of; Menus, which share their work block; and Game rules, the items and their counters.
| File | What it holds |
|---|---|
| shop.c | the guide to the shop object: it includes shop_internal.h, then the parts in shop/ in ROM order |
| shop_internal.h | the object's includes, the shop actions and sanctum services, and the values that differ by edition |
| shopspr.s | the hand, gem, arrow, price and quantity sprite tiles |
The guide's comment says where to start, and each part's second line says what it holds: head -2 shop/*.c lists them. A part includes the private header, so it resolves when opened on its own, but it is compiled only through shop.c. The ROM shows the counters as one object; the parts are ours, cut where one family ends and the next begins. Link order is in games/tbs/objects.tsv, from shop.
The work block's layout, struct ShopRuntime, is in include/shop.h and the prototypes in games/tbs/include/unit/shop/. Scene overlays import these functions by name (games/tbs/src/scene/import/), and code in other banks calls them through the far-call table games/tbs/src/system/far_call/SHOP.S (the ...Far names), so a rename crosses folders.
| Prefix | What it acts on |
|---|---|
| Shop_ | the shops' screens, and anything every counter shares |
| ShopCursor_ | the hand cursor |
| UiMessage_ | the shopkeeper's messages: show, wait, choose |
| EventTable_ | the stock rows |
| Sanctum_ | the sanctum's services |
| Inn_ | the inn |
| Battle_, BattleUnit_, BattleFx_, AudioCommand_, NodeChain_ | things the engine names elsewhere |
The comment markers are in Matching.
A shop's ordinary items are its row of sStockTable, always for sale. Its artifacts work differently: they are not kept per shop at all. Each rare item has one counter for the whole game (Item_AdjustCounter, in ../game/game/inventory.c), and a shop's artifact list is built when it opens from every item of the shop's type whose counter is above zero (shop/run.c). The counters move with the items:
So an artifact first stocked in one town is then sold by every shop of its type, and a rare item the party gives up turns up for sale again. The flag per row is what keeps a revisited shop from adding its artifacts a second time.
Every counter (shop, sanctum, inn, artifact counter) uses the same heap block, HEAP_SLOT_MENU, as struct ShopRuntime: Shop_InitializeCursorWork takes it and Shop_ReleaseCursorWork gives it back. The field menu's screens use the same slot through their own views, so a counter and the field menu are never open together.
The counters are named for what the player meets at them; the stock row's columns (SHOP_STOCK_) from what artifacts.c reads at each place; the actions and services from the choices their windows offer in the English release.
Still unknown:
Source: src/shop