Skip to Content
The Alchemy Project

src/shop/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. More…

Included by shop.c and shop_tables.c.

Structures

NameDescription
structFORGE_RECIPEWhat the forge makes of one material: one of its results, by weight out of 100.
structSHOP_STATEThe shop's state (heap slot 220, the menus' state), as The Broken Seal's SHOP_STATE, its lists longer here: the windows, the party row, the stock, the hand cursor and its icons, what the player chose, the sanctum service's particles and the item icon grid.

Macros

NameDescription
#defineSHOP_STOCK_ROW_EMPTY 0The stock row the shop code itself names: it sells nothing and stands in for a bad row.
#defineSANCTUM_PARTICLE_COUNT 24The sanctum's particle slots (SHOP_STATE.effects), and the sparkles a burst sends of them.
#defineSANCTUM_BURST_SPARKLES 18
#defineSHOP_QUANTITY_CURSOR_X 120

Enumerations

NameDescription
enumSHOP_ACTION { SHOP_ACTION_BUY, SHOP_ACTION_SELL, SHOP_ACTION_ARTIFACTS, SH … }Buy, Sell, Artifacts and Repair, held in shop->action while it runs.
enumSHOP_TYPE { SHOP_TYPE_ITEMS, SHOP_TYPE_WEAPONS, SHOP_TYPE_ARMOR, SHOP_TY … }A shop's type, the last column of its stock row: the equipment group it sells, as gmItemGetEquipmentGroup sorts items, or a general store, which The Lost Age adds and which lists artifacts of every group.
enumanonymous enum { SHOP_STOCK_ITEMS, SHOP_STOCK_ITEM_COUNT, SHOP_STOCK_ARTIFACT … }The shops' stock, one row per shop (by the stock row a script passes to mnShopRun; row 0 sells nothing and stands in for a row out of range): up to 24 items, then up to 8 artifacts (each list ending with 0 when shorter), then the shop's type.
enumanonymous enum { SHOP_INVENTORY_COLUMNS, SHOP_STOCK_PAGE_ITEMS, SHOP_PARTY_PA … }
enumMENU_GRID_MOVE { MENU_GRID_STAYED, MENU_GRID_MOVED, MENU_GRID_CHANGED_PAGE }What mnGridMoveCursor reports, and so what a list redraws.
enumSHOP_PRICE_KIND { SHOP_PRICE_KIND_BUY, SHOP_PRICE_KIND_SELL, SHOP_PRICE_KIND_R … }What mnShopDrawItemPrice says below an item: its price, or when the price is 0 that the shop does not buy it or that it is not broken; at the forge, the item's condition (mnForgeGetItemCondition) in place of a price.
enumSANCTUM_SERVICE { SANCTUM_SERVICE_REVIVE, SANCTUM_SERVICE_CURE_POISON, SANCTUM … }What the sanctum does for one party member; each kind picks the party member's status it needs, its donation and its cure (shop_sanctum.c).
enumSANCTUM_SPARKLE_STATE { SANCTUM_SPARKLE_START, SANCTUM_SPARKLE_FLYING, SANCTUM_SPARK … }What a sparkle of the sanctum's burst is doing (FIELD_PARTICLE.state, mnSanctumUpdateBurstSparkle).
enumITEM_PICKER_MODE { ITEM_PICKER_DROP, ITEM_PICKER_SHOW }What the item picker chooses an item for (SHOP_STATE.itemMode).
enumFORGE_CONDITION { FORGE_CONDITION_PROCESSED, FORGE_CONDITION_RUSTED }What the forge does with a material, its recipe's second column; the item list shows it from MsgItemCondition on, after "----------" for an item the forge has no recipe for.

Variables

NameDescription
extern const Uint8ShopPriceTiles []The shop's price label, sprite tiles beside an item's price (price.4bpp).
extern const Uint8ShopQuantityTiles []The shop's quantity label, beside the count of an item bought (quantity.4bpp).
extern const Uint16ShopQuantityBarSegmentOffsets [30]Where each of the quantity bar's 30 segments starts in its tile buffer: a byte column of a 4-bit tile, so four segments to a tile and the next tile 32 bytes on, eight tiles in all.
extern const Uint16ShopPriceDigitTileOffsets [5]Where each of a price's five digits starts in its tile buffer, ones first.
extern const Sint16ShopGameTicketCreditCosts [30]The shop credit each Game Ticket costs, by how many have been given: five at each price: 300, then 500 doubling to 8000.
extern const Sint16ShopStockTable [SHOP_STOCK_ROWS][SHOP_STOCK_COLUMNS]The shops' stock, one row per shop: up to 24 items, then up to 8 artifacts (each list ending with 0 when shorter), then the shop's type, which an item shop, SHOP_TYPE_ITEMS, leaves at 0.
extern const FORGE_RECIPEForgeRecipes []What the forge makes of each material, ended by an item of -1: a rare material may become any of its results, by weight out of 100, and a rusted weapon always becomes its one result.
extern const Sint8SanctumServiceTunes [4]The tune each service's burst plays.
extern const Sint8InnPricesPerGuest [16]The coins a night costs each living guest, by inn: Daila, Madra, Alhafra, Garoh, Mikasalla, Naribwe, Kibombo, Yallam, the Apojii Islands, Izumo, Champa, the Shaman Village, Contigo, Loho and Prox, as their scripts open them.

Description

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.c includes it before the parts, and each part includes it too, so that a part read on its own still resolves. It places no bytes.

Macros in detail

SHOP_STOCK_ROW_EMPTY

#define SHOP_STOCK_ROW_EMPTY 0

The stock row the shop code itself names: it sells nothing and stands in for a bad row.

Referenced by mnShopOpenDebugShop() and mnShopRun().

Definition at line 90 of file shop_internal.h.

SANCTUM_PARTICLE_COUNT

#define SANCTUM_PARTICLE_COUNT 24

The sanctum's particle slots (SHOP_STATE.effects), and the sparkles a burst sends of them.

Referenced by mnSanctumRunMemberIconBurst() and mnSanctumUpdateBurst().

Definition at line 146 of file shop_internal.h.

SANCTUM_BURST_SPARKLES

#define SANCTUM_BURST_SPARKLES 18

Referenced by mnSanctumRunMemberIconBurst().

Definition at line 147 of file shop_internal.h.

SHOP_QUANTITY_CURSOR_X

#define SHOP_QUANTITY_CURSOR_X 120

#define SHOP_QUANTITY_CURSOR_X 104

#define SHOP_QUANTITY_CURSOR_X 128

Referenced by mnShopSelectBuyCount() and mnShopSelectSellCount().

Definition at lines 275, 278 and 280 of file shop_internal.h.

Enumerations in detail

SHOP_ACTION

enum SHOP_ACTION

Buy, Sell, Artifacts and Repair, held in shop->action while it runs. The forge, which The Lost Age adds, runs the sell counter's screens as a counter of its own.

EnumeratorValueDescription
SHOP_ACTION_BUY
SHOP_ACTION_SELL
SHOP_ACTION_ARTIFACTS
SHOP_ACTION_REPAIR
SHOP_ACTION_FORGE

Definition at line 47 of file shop_internal.h.

SHOP_TYPE

enum SHOP_TYPE

A shop's type, the last column of its stock row: the equipment group it sells, as gmItemGetEquipmentGroup sorts items, or a general store, which The Lost Age adds and which lists artifacts of every group. It picks the artifacts the shop lists and which of the keepers' lines it says: the inn and the forge take the weapon shop's type, whose lines are the messages as given.

EnumeratorValueDescription
SHOP_TYPE_ITEMSEQUIPMENT_GROUP_NONE
SHOP_TYPE_WEAPONSEQUIPMENT_GROUP_WEAPON
SHOP_TYPE_ARMOREQUIPMENT_GROUP_ARMOR
SHOP_TYPE_GENERAL_STORE3
SHOP_TYPE_EVERY_GROUP4Unused: lists every group's artifacts, as a general store does, but no stock row has it and nothing else sets it.

Definition at line 61 of file shop_internal.h.

anonymous enum

enum { SHOP_STOCK_ITEMS, SHOP_STOCK_ITEM_COUNT, SHOP_STOCK_ARTIFACTS, SHOP_STOCK_ARTIFACT_COUNT, … }

The shops' stock, one row per shop (by the stock row a script passes to mnShopRun; row 0 sells nothing and stands in for a row out of range): up to 24 items, then up to 8 artifacts (each list ending with 0 when shorter), then the shop's type.

EnumeratorValueDescription
SHOP_STOCK_ITEMS0the first ordinary item's column
SHOP_STOCK_ITEM_COUNT24ordinary items a row holds
SHOP_STOCK_ARTIFACTS24the first artifact's column
SHOP_STOCK_ARTIFACT_COUNT8artifacts a row holds
SHOP_STOCK_TYPE32the shop's type (SHOP_TYPE)
SHOP_STOCK_COLUMNS33
SHOP_STOCK_ROWS32stock rows (row 0 sells nothing / out-of-range fallback)

Definition at line 76 of file shop_internal.h.

anonymous enum

enum { SHOP_INVENTORY_COLUMNS, SHOP_STOCK_PAGE_ITEMS, SHOP_PARTY_PAGE_MEMBERS, SHOP_STACK_LIMIT }

EnumeratorValueDescription
SHOP_INVENTORY_COLUMNS5Icons a row in a party member's 15-slot inventory grid, 16 pixels apart.
SHOP_STOCK_PAGE_ITEMS7Stock items a page of the buy screen, 32 pixels apart.
SHOP_PARTY_PAGE_MEMBERS4Party members a page of the party row, 24 pixels apart.
SHOP_STACK_LIMIT30The most of one item a party member can carry, and so buy at once.

Definition at line 92 of file shop_internal.h.

enum MENU_GRID_MOVE

What mnGridMoveCursor reports, and so what a list redraws.

EnumeratorValueDescription
MENU_GRID_STAYED0
MENU_GRID_MOVED1within its page: the cursor and the entry
MENU_GRID_CHANGED_PAGE2To another page: the page's party figures are made again too

Definition at line 105 of file shop_internal.h.

SHOP_PRICE_KIND

enum SHOP_PRICE_KIND

What mnShopDrawItemPrice says below an item: its price, or when the price is 0 that the shop does not buy it or that it is not broken; at the forge, the item's condition (mnForgeGetItemCondition) in place of a price.

EnumeratorValueDescription
SHOP_PRICE_KIND_BUY0buying: the price, even when it is 0
SHOP_PRICE_KIND_SELL1selling: the shop does not buy it
SHOP_PRICE_KIND_REPAIR2repairing: it is not broken
SHOP_PRICE_KIND_FORGE3forging: "Processed" or "Rusted"

Definition at line 116 of file shop_internal.h.

SANCTUM_SERVICE

enum SANCTUM_SERVICE

What the sanctum does for one party member; each kind picks the party member's status it needs, its donation and its cure (shop_sanctum.c).

EnumeratorValueDescription
SANCTUM_SERVICE_REVIVEfor a downed party member (HP 0)
SANCTUM_SERVICE_CURE_POISONfor poison or deadly poison
SANCTUM_SERVICE_REPEL_EVILfor a haunted party member
SANCTUM_SERVICE_REMOVE_CURSEfor any curse bit set

Definition at line 126 of file shop_internal.h.

SANCTUM_SPARKLE_STATE

enum SANCTUM_SPARKLE_STATE

What a sparkle of the sanctum's burst is doing (FIELD_PARTICLE.state, mnSanctumUpdateBurstSparkle).

EnumeratorValueDescription
SANCTUM_SPARKLE_START0placed on a ring around the burst's centre, aimed inside it
SANCTUM_SPARKLE_FLYING1flying in; starts again on arrival
SANCTUM_SPARKLE_LAST_FLIGHT2set as the burst ends: freed on arrival

Definition at line 136 of file shop_internal.h.

ITEM_PICKER_MODE

enum ITEM_PICKER_MODE

What the item picker chooses an item for (SHOP_STATE.itemMode).

EnumeratorValueDescription
ITEM_PICKER_DROP0an item to drop, by gmInventoryCheckDiscard
ITEM_PICKER_SHOW1an item to show, by gmInventoryCheckUnequip

Definition at line 150 of file shop_internal.h.

FORGE_CONDITION

enum FORGE_CONDITION

What the forge does with a material, its recipe's second column; the item list shows it from MsgItemCondition on, after "----------" for an item the forge has no recipe for.

EnumeratorValueDescription
FORGE_CONDITION_PROCESSED0"Processed": a rare material
FORGE_CONDITION_RUSTED1"Rusted": a rusty weapon

Definition at line 159 of file shop_internal.h.

Variables in detail

ShopPriceTiles

extern const Uint8 ShopPriceTiles[]

The shop's price label, sprite tiles beside an item's price (price.4bpp).

Referenced by mnShopCreatePriceSprite().

Definition at line 284 of file shop_internal.h.

ShopQuantityTiles

extern const Uint8 ShopQuantityTiles[]

The shop's quantity label, beside the count of an item bought (quantity.4bpp).

Referenced by mnShopSelectQuantity().

Definition at line 287 of file shop_internal.h.