Skip to Content
The Alchemy Project

src/shop/shop_internal.h

What every part of the shop object shares: its includes, the shop actions and sanctum services, and the values that differ by edition. More…

Included by shop.c, shop_buy.c, shop_cursor.c, shop_inn.c, shop_item_picker.c, shop_repair.c, shop_run.c, shop_sanctum.c, shop_sell.c, shop_stock.c and shop_tables.c.

Macros

NameDescription
#defineINN_ID_XIAN 5The inn the inn's own code names (mnInnCheckIn's innId, a row of InnPricesPerGuest); each town's script names its own inn where it opens it.
#defineSHOP_CANNOT_REMOVE_STATUS (discardStatus, selectionResult)
#defineSHOP_CONFIRM_MENU_X GERMAN_OR(6, 7)The shop's Yes/No menu (shop_run.c): one column further left in German.
#defineSHOP_PRICE_NUMBER_X FRENCH_OR(24, 32)An item's price and the word after it in the price window that the buy, sell and repair lists share (mnShopDrawItemPrice, shop_buy.c), in pixels: French moves both 8 left, Spanish the word 8 right.
#defineSHOP_PRICE_LABEL_X BY_LANGUAGE(72, 72, 72, 80, 64, 72)
#defineSHOP_EMPTY_GRID_X ITALIAN_OR(20, 8)Where the item grid (mnShopDrawMemberItems, shop_sell.c), shared by the sell, repair and drop screens and the equip prompt, writes MsgNoItems for a party member with no items, in pixels.
#defineSHOP_EMPTY_GRID_Y ITALIAN_OR(12, 20)
#defineSHOP_MONEY_WINDOW_WIDTH JAPANESE_OR(11, 12)Outside Japan the coins window (SHOP_STATE.moneyWindow) is a tile wider, and every counter's item description (mnShopDrawMessage, shop_buy.c) is drawn as tiles (mnTextDrawMessageAsTilesStub) rather than into a text canvas.
#defineSHOP_DRAW_MESSAGE
#defineSANCTUM_PRICE_WINDOW_X GERMAN_OR(0, 1)The sanctum's fee window (shop_sanctum.c), wider for the German and French text.
#defineSANCTUM_PRICE_WINDOW_WIDTH BY_LANGUAGE(23, 23, 30, 23, 25, 23)
#defineITEM_PICKER_WINDOW_X JAPANESE_OR(16, 14)The item picker's small window (shop_item_picker.c): two tiles wider, and two further left, outside Japan.
#defineITEM_PICKER_WINDOW_WIDTH JAPANESE_OR(14, 16)
#defineSHOP_ITEM_NOTE_X JAPANESE_OR(8, 0)The x of the note below an item's name, in pixels: shop_buy.c and shop_item_picker.c both draw it.
#defineSHOP_QUANTITY_CURSOR_X BY_LANGUAGE(128, 128, 120, 128, 120, 128)The quantity cursor's x, in pixels: shop_buy.c and shop_sell.c both place it.

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 }A shop's type, the last column of its stock row: the equipment group it sells, as gmItemGetEquipmentGroup sorts items.
enumSHOP_STOCK_ROW { SHOP_STOCK_ROW_EMPTY, SHOP_STOCK_ROW_VALE_WEAPONS, SHOP_STOC … }The stock rows the shop code itself names; each town's script names its own shops' rows where it opens them.
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).
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 fee and its cure (shop_sanctum.c).
enumanonymous enum { SHOP_STOCK_ITEMS, SHOP_STOCK_ITEM_COUNT, SHOP_STOCK_ARTIFACT … }Shop stock table layout (mnShopRun; SHOP_STOCK_ROW_EMPTY stands in for a row out of range).

Variables

NameDescription
extern const Uint16ShopQuantityBarSegmentOffsets [30]The shop's tables (shop_tables.c).
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 Sint16ShopUnusedItemIds [21]Unused: a list of items ended by 0, which nothing reads: the Long Sword to the Muramasa, the Short Sword, Mint, the Demon Axe, Asura's Armor, the Cotton Shirt, the Travel Vest, Herb, Nut and the id after the Water of Life.
extern const Sint16ShopStockTable [SHOP_STOCK_ROWS][SHOP_STOCK_COLUMNS]Every shop's stock, a row by stock row: its items, artifacts and type.
extern const Sint8SanctumServiceTunes [4]The tune each service's burst plays.
extern const Sint8InnPricesPerGuest [12]The coins a night costs each living guest, by inn: Vale, Vault, Bilibin, Kolima, Imil, Xian, Altin, Kalay, Lunpa, Tolbi, Suhalla, Lalivero, in the order of their area names.

Description

What every part of the shop object shares: its includes, the shop actions and sanctum services, and the values that differ by edition. shop.c includes it before the parts, and each part includes it too, so that a part read on its own still resolves.

Macros in detail

INN_ID_XIAN

#define INN_ID_XIAN 5

The inn the inn's own code names (mnInnCheckIn's innId, a row of InnPricesPerGuest); each town's script names its own inn where it opens it.

Referenced by mnInnCheckIn() and scLacquerRoomsBTalkToInnkeeper().

Definition at line 49 of file shop_internal.h.

SHOP_CANNOT_REMOVE_STATUS

#define SHOP_CANNOT_REMOVE_STATUS(discardStatus, selectionResult)

Referenced by mnItemPickerSelectItem().

Definition at lines 114 and 117 of file shop_internal.h.

SHOP_CONFIRM_MENU_X

#define SHOP_CONFIRM_MENU_X GERMAN_OR(6, 7)

The shop's Yes/No menu (shop_run.c): one column further left in German.

Referenced by mnShopAskYesNo().

Definition at line 125 of file shop_internal.h.

SHOP_PRICE_NUMBER_X

#define SHOP_PRICE_NUMBER_X FRENCH_OR(24, 32)

An item's price and the word after it in the price window that the buy, sell and repair lists share (mnShopDrawItemPrice, shop_buy.c), in pixels: French moves both 8 left, Spanish the word 8 right.

Referenced by mnShopDrawItemPrice().

Definition at line 130 of file shop_internal.h.

SHOP_PRICE_LABEL_X

#define SHOP_PRICE_LABEL_X BY_LANGUAGE(72, 72, 72, 80, 64, 72)

Referenced by mnShopDrawItemPrice().

Definition at line 131 of file shop_internal.h.

SHOP_EMPTY_GRID_X

#define SHOP_EMPTY_GRID_X ITALIAN_OR(20, 8)

Where the item grid (mnShopDrawMemberItems, shop_sell.c), shared by the sell, repair and drop screens and the equip prompt, writes MsgNoItems for a party member with no items, in pixels.

Referenced by mnShopDrawMemberItems().

Definition at line 136 of file shop_internal.h.

SHOP_EMPTY_GRID_Y

#define SHOP_EMPTY_GRID_Y ITALIAN_OR(12, 20)

Referenced by mnShopDrawMemberItems().

Definition at line 137 of file shop_internal.h.

SHOP_MONEY_WINDOW_WIDTH

#define SHOP_MONEY_WINDOW_WIDTH JAPANESE_OR(11, 12)

Outside Japan the coins window (SHOP_STATE.moneyWindow) is a tile wider, and every counter's item description (mnShopDrawMessage, shop_buy.c) is drawn as tiles (mnTextDrawMessageAsTilesStub) rather than into a text canvas.

Referenced by mnInnCheckIn(), mnSanctumRun(), mnShopChooseMember() and mnShopSelectBuy().

Definition at line 142 of file shop_internal.h.

SHOP_DRAW_MESSAGE

#define SHOP_DRAW_MESSAGE

Referenced by mnShopDrawMessage().

Definition at line 143 of file shop_internal.h.

SANCTUM_PRICE_WINDOW_X

#define SANCTUM_PRICE_WINDOW_X GERMAN_OR(0, 1)

The sanctum's fee window (shop_sanctum.c), wider for the German and French text.

Referenced by mnSanctumRunPartyService().

Definition at line 148 of file shop_internal.h.

SANCTUM_PRICE_WINDOW_WIDTH

#define SANCTUM_PRICE_WINDOW_WIDTH BY_LANGUAGE(23, 23, 30, 23, 25, 23)

Referenced by mnSanctumRunPartyService().

Definition at line 149 of file shop_internal.h.

ITEM_PICKER_WINDOW_X

#define ITEM_PICKER_WINDOW_X JAPANESE_OR(16, 14)

The item picker's small window (shop_item_picker.c): two tiles wider, and two further left, outside Japan.

Referenced by mnItemPickerSelectItem().

Definition at line 153 of file shop_internal.h.

ITEM_PICKER_WINDOW_WIDTH

#define ITEM_PICKER_WINDOW_WIDTH JAPANESE_OR(14, 16)

Referenced by mnItemPickerSelectItem().

Definition at line 154 of file shop_internal.h.

SHOP_ITEM_NOTE_X

#define SHOP_ITEM_NOTE_X JAPANESE_OR(8, 0)

The x of the note below an item's name, in pixels: shop_buy.c and shop_item_picker.c both draw it.

Referenced by mnItemPickerDrawItem() and mnShopDrawItemPrice().

Definition at line 158 of file shop_internal.h.

SHOP_QUANTITY_CURSOR_X

#define SHOP_QUANTITY_CURSOR_X BY_LANGUAGE(128, 128, 120, 128, 120, 128)

The quantity cursor's x, in pixels: shop_buy.c and shop_sell.c both place it.

Referenced by mnShopSelectBuyCount() and mnShopSelectSellCount().

Definition at line 161 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.

EnumeratorValueDescription
SHOP_ACTION_BUY
SHOP_ACTION_SELL
SHOP_ACTION_ARTIFACTS
SHOP_ACTION_REPAIR

Definition at line 29 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. It picks the artifacts the shop lists and which of the keepers' lines it says.

EnumeratorValueDescription
SHOP_TYPE_ITEMSEQUIPMENT_GROUP_NONE
SHOP_TYPE_WEAPONSEQUIPMENT_GROUP_WEAPON
SHOP_TYPE_ARMOREQUIPMENT_GROUP_ARMOR

Definition at line 40 of file shop_internal.h.

SHOP_STOCK_ROW

enum SHOP_STOCK_ROW

The stock rows the shop code itself names; each town's script names its own shops' rows where it opens them.

EnumeratorValueDescription
SHOP_STOCK_ROW_EMPTY0sells nothing; stands in for a bad row
SHOP_STOCK_ROW_VALE_WEAPONS1
SHOP_STOCK_ROW_VALE_ARMOR2
SHOP_STOCK_ROW_XIAN_WEAPONS16Xian's weapon, armor and item shops, the warriors' shops, which greet the party with lines of their own (SHOP_STATE.warriorShop).
SHOP_STOCK_ROW_XIAN_ARMOR17
SHOP_STOCK_ROW_XIAN_ITEMS18

Definition at line 53 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 67 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 fee 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 77 of file shop_internal.h.

anonymous enum

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

Shop stock table layout (mnShopRun; SHOP_STOCK_ROW_EMPTY stands in for a row out of range).

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_ROWS35rows, indexed by the stock row a script
SHOP_INVENTORY_COLUMNS5passes
SHOP_STOCK_PAGE_ITEMS7stock items a page of the buy screen, 32 pixels apart

Definition at line 87 of file shop_internal.h.