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…
#include "types.h"#include "window/cursor.h"#include "stddef.h"#include "static_assert.h"#include "system.h"#include "game/main_routine_state.h"#include "edition.h"#include "window/window_sprite.h"#include "battle/battle.h"#include "window/window.h"#include "debug/debug.h"#include "field/field.h"#include "game/game.h"#include "graphics/graphics.h"#include "menu/menu.h"#include "sound/sound.h"#include "text/msg_ids.h"#include "shop/shop.h"#include "battle/battle_unit.h"#include "game/item.h"#include "flags.h"#include "game/game_flags.h"#include "game/character.h"#include "fixed_math.h"#include "field/field_script.h"#include "field/field_engine.h"#include "game/character_ids.h"#include "game/stubs.h"#include "menu/stubs.h"#include "window/stubs.h"#include "field/field_particle.h"
Included by shop.c and shop_tables.c.
Structures
| Name | Description | |
|---|---|---|
struct | FORGE_RECIPE | What the forge makes of one material: one of its results, by weight out of 100. |
struct | SHOP_STATE | The 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
| Name | Description | |
|---|---|---|
#define | SHOP_STOCK_ROW_EMPTY 0 | The stock row the shop code itself names: it sells nothing and stands in for a bad row. |
#define | SANCTUM_PARTICLE_COUNT 24 | The sanctum's particle slots (SHOP_STATE.effects), and the sparkles a burst sends of them. |
#define | SANCTUM_BURST_SPARKLES 18 | |
#define | SHOP_QUANTITY_CURSOR_X 120 |
Enumerations
| Name | Description | |
|---|---|---|
enum | SHOP_ACTION { SHOP_ACTION_BUY, SHOP_ACTION_SELL, SHOP_ACTION_ARTIFACTS, SH … } | Buy, Sell, Artifacts and Repair, held in shop->action while it runs. |
enum | SHOP_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. |
enum | anonymous 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. |
enum | anonymous enum { SHOP_INVENTORY_COLUMNS, SHOP_STOCK_PAGE_ITEMS, SHOP_PARTY_PA … } | |
enum | MENU_GRID_MOVE { MENU_GRID_STAYED, MENU_GRID_MOVED, MENU_GRID_CHANGED_PAGE } | What mnGridMoveCursor reports, and so what a list redraws. |
enum | SHOP_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. |
enum | SANCTUM_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). |
enum | SANCTUM_SPARKLE_STATE { SANCTUM_SPARKLE_START, SANCTUM_SPARKLE_FLYING, SANCTUM_SPARK … } | What a sparkle of the sanctum's burst is doing (FIELD_PARTICLE.state, mnSanctumUpdateBurstSparkle). |
enum | ITEM_PICKER_MODE { ITEM_PICKER_DROP, ITEM_PICKER_SHOW } | What the item picker chooses an item for (SHOP_STATE.itemMode). |
enum | FORGE_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
| Name | Description | |
|---|---|---|
extern const Uint8 | ShopPriceTiles [] | The shop's price label, sprite tiles beside an item's price (price.4bpp). |
extern const Uint8 | ShopQuantityTiles [] | The shop's quantity label, beside the count of an item bought (quantity.4bpp). |
extern const Uint16 | ShopQuantityBarSegmentOffsets [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 Uint16 | ShopPriceDigitTileOffsets [5] | Where each of a price's five digits starts in its tile buffer, ones first. |
extern const Sint16 | ShopGameTicketCreditCosts [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 Sint16 | ShopStockTable [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_RECIPE | ForgeRecipes [] | 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 Sint8 | SanctumServiceTunes [4] | The tune each service's burst plays. |
extern const Sint8 | InnPricesPerGuest [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.
| Enumerator | Value | Description |
|---|---|---|
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.
| Enumerator | Value | Description |
|---|---|---|
SHOP_TYPE_ITEMS | EQUIPMENT_GROUP_NONE | |
SHOP_TYPE_WEAPONS | EQUIPMENT_GROUP_WEAPON | |
SHOP_TYPE_ARMOR | EQUIPMENT_GROUP_ARMOR | |
SHOP_TYPE_GENERAL_STORE | 3 | |
SHOP_TYPE_EVERY_GROUP | 4 | Unused: 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.
| Enumerator | Value | Description |
|---|---|---|
SHOP_STOCK_ITEMS | 0 | the first ordinary item's column |
SHOP_STOCK_ITEM_COUNT | 24 | ordinary items a row holds |
SHOP_STOCK_ARTIFACTS | 24 | the first artifact's column |
SHOP_STOCK_ARTIFACT_COUNT | 8 | artifacts a row holds |
SHOP_STOCK_TYPE | 32 | the shop's type (SHOP_TYPE) |
SHOP_STOCK_COLUMNS | 33 | |
SHOP_STOCK_ROWS | 32 | stock 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 }
| Enumerator | Value | Description |
|---|---|---|
SHOP_INVENTORY_COLUMNS | 5 | Icons a row in a party member's 15-slot inventory grid, 16 pixels apart. |
SHOP_STOCK_PAGE_ITEMS | 7 | Stock items a page of the buy screen, 32 pixels apart. |
SHOP_PARTY_PAGE_MEMBERS | 4 | Party members a page of the party row, 24 pixels apart. |
SHOP_STACK_LIMIT | 30 | The most of one item a party member can carry, and so buy at once. |
Definition at line 92 of file shop_internal.h.
MENU_GRID_MOVE
enum MENU_GRID_MOVE
What mnGridMoveCursor reports, and so what a list redraws.
| Enumerator | Value | Description |
|---|---|---|
MENU_GRID_STAYED | 0 | |
MENU_GRID_MOVED | 1 | within its page: the cursor and the entry |
MENU_GRID_CHANGED_PAGE | 2 | To 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.
| Enumerator | Value | Description |
|---|---|---|
SHOP_PRICE_KIND_BUY | 0 | buying: the price, even when it is 0 |
SHOP_PRICE_KIND_SELL | 1 | selling: the shop does not buy it |
SHOP_PRICE_KIND_REPAIR | 2 | repairing: it is not broken |
SHOP_PRICE_KIND_FORGE | 3 | forging: "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).
| Enumerator | Value | Description |
|---|---|---|
SANCTUM_SERVICE_REVIVE | for a downed party member (HP 0) | |
SANCTUM_SERVICE_CURE_POISON | for poison or deadly poison | |
SANCTUM_SERVICE_REPEL_EVIL | for a haunted party member | |
SANCTUM_SERVICE_REMOVE_CURSE | for 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).
| Enumerator | Value | Description |
|---|---|---|
SANCTUM_SPARKLE_START | 0 | placed on a ring around the burst's centre, aimed inside it |
SANCTUM_SPARKLE_FLYING | 1 | flying in; starts again on arrival |
SANCTUM_SPARKLE_LAST_FLIGHT | 2 | set 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).
| Enumerator | Value | Description |
|---|---|---|
ITEM_PICKER_DROP | 0 | an item to drop, by gmInventoryCheckDiscard |
ITEM_PICKER_SHOW | 1 | an 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.
| Enumerator | Value | Description |
|---|---|---|
FORGE_CONDITION_PROCESSED | 0 | "Processed": a rare material |
FORGE_CONDITION_RUSTED | 1 | "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.