Shops, Sanctums, Inns & Forge
This page is a guide to the games/tla/src/shop/ folder of the Alchemy project.
Every town counter in Golden Sun: The Lost Age runs from its code, from weapon
shops and inns to sanctums and Sunshine's Forge.
These blocking UI routines take over whenever Felix buys gear, rests at an inn, or revives a fallen ally at a Sanctum. Beyond The Broken Seal's counters, The Lost Age adds General Stores, Sunshine's Forge in Yallam, and an item picker reused by Naribwe's fortune teller.
The sections below cover Sunshine's Forge and how it rolls and delivers forged equipment, followed by notes on shops, sanctums, inns, the item picker, and a file map. Conceptual context is given in Dialogue, Menus & Shops.
Sunshine's Forge (shop_forge.c)

mnForgeRun reuses the Sell UI filtered to forgeable items, backed by weighted
recipe tables in shop_tables.c. The 9 forgeable materials
each roll among 4–7 weighted outcomes (a Tear Stone can become a Cloud Wand
or a Spirit Ring), while the 11 rusty weapons each map to one fixed weapon.
The output is rolled at drop-off and saved in MainRoutineStateWork. It is
finished as soon as Felix talks to Yallam's innkeeper across the counter
(staying the night is not required), after which Sunshine's wife sells him the
finished item.
Shops, sanctums, inns, and the item picker

- Shops and General Stores (
mnShopRun,shop_tables.c): Each shop gets one table row across 4 dialogue voices (Weapon, Armor, Item, and General Store). General Stores resell global rare artifacts of every equipment category tracked in Game Logic & Tables. Shops buy at 75% (50% if broken), repair at 25%, and track a deterministic hidden coin-spent tally for Game Tickets. - Sanctums (
shop_sanctum.c,mnSanctumRun): Revive, Cure Poison, Repel Evil, and Remove Curse share one light-show sequence, differing only in their status check, clear mask, and fee. - Inns (
shop_inn.c,mnInnCheckIn): Inns charge per living party member; downed allies are neither billed nor healed. - Item picker (
shop_item_picker.c,mnItemPickerRun): Reuses the Sell UI without a shopkeeper for full-pack drops. Naribwe's fortune teller also reuses it for the choice of any unequipped or removable item.
File map
| File(s) | Role |
|---|---|
shop.c, shop_internal.h | Parent translation unit #includeing all shop_*.c parts into one object |
shop_run.c, shop_buy.c, shop_sell.c, shop_repair.c, shop_cursor.c | mnShopRun loop across Buy, Sell, Artifacts, and Repair |
shop_tables.c, shop_stock.c | Master shop stock table and Sunshine's Forge recipe and weight tables |
shop_forge.c | mnForgeRun: Sunshine's smithy in Yallam |
shop_sanctum.c, shop_inn.c, shop_item_picker.c, stubs.s | Sanctum, inn, item picker, and jump-table stubs exported to scene overlays |
Source files
| File | Description |
|---|---|
shop.c | The shop object: every counter the party trades at. |
shop_buy.c | Buying: the stock list, the money and party windows, quantities and prices. |
shop_cursor.c | The quantity bar, the price digits and their sprites, the field's tint behind the sanctum and the Djinn, the hand cursor's glides, and loading a picture into VRAM. |
shop_forge.c | The forge: its recipes, the materials the party holds and the roll for the result. |
shop_inn.c | The inn: room prices, checking in and the night's sleep. |
shop_internal.h | What every part of the shop object shares: its includes, its state, the counters and services it runs, the stock table's columns and the tables shop_tables.c holds. |
shop_item_picker.c | The forge's counter; the item picker scripts use to choose one of a party member's items, to show Naribwe's fortune teller or to drop; and the grid of item icons the shop's windows draw. |
shop_repair.c | Repairing broken items. |
shop_run.c | Running a shop: the artifacts it lists, opening its state, the counter's loop and the message helpers every counter uses. |
shop_sanctum.c | The sanctum's services, their donations and their sparkles. |
shop_sell.c | Selling: choosing a party member, the item grid and the sale. |
shop_stock.c | The Game Ticket counter and every shop's stock. |
shop_tables.c | The shop's tables: the quantity bar's and the price digits' tile offsets, the Game Ticket costs, the gift items, every shop's stock, the forge's recipes, the sanctum's tunes and the inns' prices. |