Alchemy
Loading...
Searching...
No Matches

shop_internal.h

Go to the documentation of this file.
1#ifndef ALCHEMY_SHOP_INTERNAL_H
2#define ALCHEMY_SHOP_INTERNAL_H
3
4/// @file
5/// What every part of the shop object shares: its includes, the shop actions
6/// and sanctum services, and the values that differ by edition. shop.c
7/// includes it before the parts, and each part includes it too, so that a
8/// part read on its own still resolves.
9
10#include "unit/shop/shop.h"
12#include "battle.h"
13#include "debug.h"
14#include "field.h"
15#include "game.h"
16#include "graphics.h"
17#include "menu.h"
18#include "minigame.h"
19#include "sound.h"
20#include "system.h"
21#include "mem.h"
22#include "edition.h"
23#include "types.h"
24#include "scene.h"
25#include "global_cells.h"
26#include "party_state.h"
27#include "battle_system.h"
28#include "object_runtime.h"
29#include "dma.h"
30#include "callback_scheduler.h"
31#include "resource.h"
32#include "shop.h"
33#include "ui.h"
34#include "tbs_edition.h"
35#include "io_reg.h"
36#include "text/msg_ids.h"
37#include "keystate.h"
38#include "node_chain.h"
39#include "game_state.h"
40#include "songs.h"
41#include "item.h"
42#include "item_ids.h"
43#include "vram_tab.h"
44#include "fixed_math.h"
45#include "far_runtime.h"
46#include "lib.h"
48#include "inn_runtime.h"
49#include "field_runtime.h"
50#include "battle_calc.h"
51#include "field_obj.h"
52#include "heap_state.h"
53#include "flags.h"
54
55/// English menu entries 48..51 establish the four shop actions.
61};
62
63/// These service kinds select the existing condition, fee and cure branches.
69};
70
72
73// BUG: the original item picker tests its selection result rather than the
74// discard error, so it never shows the cannot-remove message for error -3.
75#ifdef BUGFIX
76#define SHOP_CANNOT_REMOVE_STATUS(discardStatus, selectionResult) \
77 (discardStatus)
78#else
79#define SHOP_CANNOT_REMOVE_STATUS(discardStatus, selectionResult) \
80 (selectionResult)
81#endif
82
83// Edition-specific text and window layout values.
84#if (LANGUAGE == LANGUAGE_GERMAN)
85#define SHOP_CONFIRM_MENU_X 6
86#else
87#define SHOP_CONFIRM_MENU_X 7
88#endif
89
90#if (LANGUAGE == LANGUAGE_FRENCH)
91#define SHOP_PRICE_NUMBER_X 0x18
92#define SHOP_PRICE_LABEL_X 0x40
93#elif (LANGUAGE == LANGUAGE_SPANISH)
94#define SHOP_PRICE_NUMBER_X 0x20
95#define SHOP_PRICE_LABEL_X 0x50
96#else
97#define SHOP_PRICE_NUMBER_X 0x20
98#define SHOP_PRICE_LABEL_X 0x48
99#endif
100
101#if (LANGUAGE == LANGUAGE_ITALIAN)
102#define SHOP_EMPTY_GRID_X 20
103#define SHOP_EMPTY_GRID_Y 12
104#else
105#define SHOP_EMPTY_GRID_X 8
106#define SHOP_EMPTY_GRID_Y 20
107#endif
108
109#if TBS_PATCH_1
110#define SHOP_MONEY_WINDOW_WIDTH 12
111#define SHOP_DRAW_MESSAGE UiText_DrawCharacterAtOffsetFar
112#else
113#define SHOP_MONEY_WINDOW_WIDTH 11
114#define SHOP_DRAW_MESSAGE UiText_DrawResourceFar
115#endif
116
117#if (LANGUAGE == LANGUAGE_GERMAN)
118#define SANCTUM_PRICE_WINDOW_X 0
119#define SANCTUM_PRICE_WINDOW_WIDTH 30
120#elif (LANGUAGE == LANGUAGE_FRENCH)
121#define SANCTUM_PRICE_WINDOW_X 1
122#define SANCTUM_PRICE_WINDOW_WIDTH 25
123#else
124#define SANCTUM_PRICE_WINDOW_X 1
125#define SANCTUM_PRICE_WINDOW_WIDTH 23
126#endif
127
128#if TBS_PATCH_1
129#define SHOP_USE_WINDOW_X 14
130#define SHOP_USE_WINDOW_WIDTH 16
131#else
132#define SHOP_USE_WINDOW_X 16
133#define SHOP_USE_WINDOW_WIDTH 14
134#endif
135
136// The x of the note below an item's name, in pixels: buy.c and
137// item_picker.c both draw it.
138#if TBS_PATCH_1
139#define SHOP_ITEM_NOTE_X 0
140#else
141#define SHOP_ITEM_NOTE_X 8
142#endif
143
144// The quantity cursor's x, in pixels: buy.c and sell.c both place it.
145#if (LANGUAGE == LANGUAGE_GERMAN) || (LANGUAGE == LANGUAGE_FRENCH)
146#define SHOP_QUANTITY_CURSOR_X 120
147#else
148#define SHOP_QUANTITY_CURSOR_X 128
149#endif
150
151#endif
The battle calculation tables: hit chances, HP and PP damage and recovery.
BattleUnit_Recalculate, which recalculates a unit's stats.
The task scheduler: tasks, their order and the scheduler's state.
The engine calls the debug menus import, and their palette swatch tiles.
DMA channel registers, and the DMA and CPU fills.
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
Declares nothing: an empty header kept for the files that include it.
Field objects and actors, and the scene transition styles.
The field's runtime work: map cells, scene records and regions, map markers and FieldWork.
16.16 fixed-point constants, sine and cosine, and the library division.
FixedPointPosition, a position in 16.16 fixed point.
Game flags, named where their meaning is shown.
GameState, the game's state: play time, coins, the scene and the leader's position,...
The work slots of gWorkSlot, read through their own names.
The screen blend's globals and the graphics routines.
The heap's work slots and HeapState.
InnRuntimeState, an inn's work.
The hardware's I/O registers and their bits, as pret names them.
Items: their definitions, types, flags and effects.
Item numbers, named from the English release.
The keypad state the VBlank interrupt keeps.
Declares nothing of its own: it only includes types.h and edition.h.
The heaps: allocating and freeing blocks.
The reel game's title lettering.
NodeChain, a chain of menu nodes.
ObjectRuntime, a field object's runtime state, and the object snapshots.
Declares nothing of its own: it only includes static_assert.h and game_state.h.
FIELD_AT_OFFSET and the entity and camera views older scene code reads.
ShopRuntime, a shop's work, and the shop screen's tiles.
@ SHOP_INVENTORY_COLUMNS
@ SHOP_STOCK_PAGE_ITEMS
SanctumService
These service kinds select the existing condition, fee and cure branches.
@ SANCTUM_SERVICE_EXORCISE
@ SANCTUM_SERVICE_REVIVE
@ SANCTUM_SERVICE_REMOVE_CURSE
@ SANCTUM_SERVICE_CURE_POISON
ShopAction
English menu entries 48..51 establish the four shop actions.
@ SHOP_ACTION_SELL
@ SHOP_ACTION_REPAIR
@ SHOP_ACTION_ARTIFACTS
@ SHOP_ACTION_BUY
Song and sound effect ids, indices into gSound_SongTable.
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
Values that differ by patch level or language, chosen once for their code.
The integer types, TRUE, UNUSED and the fixed-address macros.
UiWork, the window system's work, and the status screen's cursors.
The sprite VRAM block cache and its owners.