247 if (buy->
step != 0) {
248 for (i = 0, n = 0; i < 3; i++) {
384 if (buy->
step == 0) {
393 if (buy->
step == 0) {
397 if (buy->
step != 0) {
411 if (buy->
step == 0) {
497 if (buy->
step != 0) {
653 switch (buy->
state) {
700 for (i = 0; i < 4; i++) {
784 for (i = 0; i < 4; i++) {
800 if (--sell->
type < 0) {
804 if (++sell->
type >= 4) {
808 if (old != sell->
type) {
892 if (sell->
step != 0) {
926 if (old != sell->
choice) {
998 for (i = 0; i < 4; i++) {
1162 if (sell->
step != 0) {
1175 switch (sell->
state) {
GfxState GFX
GFX: the graphics state and its methods.
GameState GAME
The save data, the game mode and the methods.
#define TASK_INIT
Tasks: every game object is a task, a heap block that starts with this header and is updated once per...
Cursor * createCursor(s16 layerId, s32 depth, s16 x, s16 y)
A menu cursor on a layer at (x, y)
#define TEXT_ITEM_SHOP
ITSHOP: STITSHOP's.
FileCache FILE_CACHE
The file cache.
#define ITEM_KIND_ACCESSORY
#define STRETCH_SPRITE(sprite, level, x, y)
#define SCREEN_LAYER
The layer over the whole screen that most modes create first and draw their menus on (FIELDSTG and ST...
ShopInfo * STITSHOP_createInfo(s32 selling, s32 item)
Creates the details panel (task) of the item selected, when buying or selling.
ShopItemList * STITSHOP_createItemList(ShopDialog *dialog, s32 type, s32 selling)
Creates the item list (task) of a dialog: the items of the shop type when buying, the bag's of the it...
STITSHOP.PRO: the item shop.
#define FILE_SHOP_SPRITES
The shop's sprite sheet; the next file is its texture archive.
#define PAD_PRESSED(button)
One button of pad 1: newly pressed, auto-repeated while held, or held.
#define PAD_REPEATED(button)
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
#define SOUND_MENU_CONFIRM
SYSTEM07.
#define SOUND_SELECT
Sounds the overlays share, with SOUNDTST's names.
#define SOUND_MENU_CANCEL
SYSTEM01.
#define SOUND_MENU_MOVE
SYSTEM06.
#define SOUND_CURSOR
SYSTEM02: a cursor moves.
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
s32 STITSHOP_sellLists[]
The item list each kind of sale shows.
ItemShopFuncs STITSHOP_funcs
The shop's helpers.
void(* setPos)()
(cursor, x, y)
void(* setVisible)()
(cursor, visible)
void *(* getEntry)(u32 fileAndIndex)
s32(* getPartyMember)(u32 index)
s8 items[0x193]
counts, up to 99
s32(* isKind)(s32 item, s32 kind)
ItemInfo.kind == kind.
struct ItemInfo *(* get)(s32 item)
getItem
u16 sellPrice
0: cannot be sold
void(* equip)(s32 partner, s32 slot, s32 item, s32 fromBag)
s32(* updateFade)(PanelAnim *fade)
void(* startFade)(PanelAnim *fade, s32 fadeIn)
s32(* compareEquip)(s32 partner, s32 item)
s32(* canEquip)(s32 partner, s32 item)
The main task of the shop (STITSHOP_createShop)
void(* showMoney)(struct ItemShop *shop)
TextWindow * quantityLabel
The dialog to buy an item (STITSHOP_createBuy)
void(* nextState)(struct ShopBuy *task)
void(* setSubstate)(struct ShopBuy *task, s32 substate)
void(* showItem)(struct ShopBuy *buy, s32 item, s32 quantity)
s32 partner
the one the marker is over
s32 markerFrame
the marker's clut row, 0-7
void(* nextSubstate)(struct ShopBuy *task)
What ShopBuy and ShopSell start with, and are passed to the item list as: the list shows its selectio...
void(* nextSubstate)(struct ShopInfo *task)
void(* turnPage)(struct ShopInfo *info)
void(* showItem)(struct ShopInfo *info, s32 item, s32 quantity)
void(* close)(struct ShopInfo *info)
void(* refreshPartner)(struct ShopInfo *info, s32 member)
void(* freezeCursor)(struct ShopItemList *list, s32 frozen)
void(* close)(struct ShopItemList *list)
void(* showCursor)(struct ShopItemList *list, s32 visible)
void(* start)(struct ShopItemList *list)
void(* listBag)(struct ShopItemList *list)
s32(* getSelected)(struct ShopItemList *list)
TextWindow * quantityLabel
The dialog to sell an item (STITSHOP_createSell)
void(* nextState)(struct ShopSell *task)
void(* showItem)(struct ShopSell *sell, s32 item, s32 quantity)
void(* setSubstate)(struct ShopSell *task, s32 substate)
s32 blink
the quantity's arrows are shown
short(* playSound)(s32 id)
returns the voice of a key-on
Draws sprites from a sprite sheet (such as file 0x277, the menu graphics): a sheet has a table of fra...
void(* setScale)()
(x, y, z), ONE = 1.0
void(* setLayerId)()
(id, depth)
void(* setClutRow)()
(row)
void(* draw)()
(sheet, frame, x, y)
void(* setTexture)()
(x, y)
void(* setRightAlign)()
no prototype: callers would truncate u8 args
void(* setVisible)(struct TextWindow *obj, u8 arg)
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find
TextWindow * createTextWindow(s16 layerId, s16 style, s16 x, s16 y)
A text window on a layer, in a font style, at (x, y)
static void STITSHOP_openSellQuantity(ShopSell *sell, ShopSellWindows *win)
Once the quantity's panel has opened: shows how many to sell, up to all of the item the bag holds.
void STITSHOP_createBuyWindows(ShopBuy *buy, ShopBuyWindows *win)
Creates the buying dialog's windows: the quantity, the total with its yes and no, and the cursor.
static void STITSHOP_chooseBuyQuantity(ShopBuy *buy, ShopBuyWindows *win)
The quantity to buy: up/down change it by one, left/right by ten, up to what the money and the bag's ...
void STITSHOP_updateBuy(ShopBuy *buy, ShopBuyWindows *win)
The buying dialog's task: creates its windows, starting at a quantity of 1, then runs and draws it.
ShopSell * STITSHOP_createSell(ItemShop *shop)
Creates the selling dialog (task), when sell is chosen in the shop.
void STITSHOP_runSell(ShopSell *sell, ShopSellWindows *win)
The selling dialog: pick the kind of item, then the item in the list, how many, and confirm.
static void STITSHOP_confirmBuy(ShopBuy *buy, ShopBuyWindows *win)
Yes or no to the total: yes buys the items (at most 99 in the bag) and pays for them,...
void STITSHOP_createSellWindows(ShopSell *sell, ShopSellWindows *win)
Creates the selling dialog's windows: the cursor, the four kinds of sale, the quantity,...
void STITSHOP_showQuantity(ShopBuy *buy, ShopBuyWindows *win, s32 show)
Shows the quantity to buy; or hides it.
static void STITSHOP_chooseEquipPartner(ShopBuy *buy, ShopBuyWindows *win)
The marker over the partner to equip: left/right move it to the next partner who can equip the item,...
static void STITSHOP_endEquipped(ShopBuy *buy, ShopBuyWindows *win)
Once the message that the item was equipped has closed: back to the list when none is left in the bag...
static void STITSHOP_confirmSell(ShopSell *sell, ShopSellWindows *win)
Sell or no to the total: sell takes the items from the bag and adds their price to the money (up to 9...
void STITSHOP_drawBuy(ShopBuy *buy, ShopBuyWindows *win)
Draws the buying screen's frames, the quantity's blinking arrows and the marker over a partner.
static void STITSHOP_openSellTypes(ShopSell *sell, ShopSellWindows *win)
Once the panel has opened: shows the four kinds of items to sell (items, weapons, armor,...
void STITSHOP_drawSell(ShopSell *sell, ShopSellWindows *win)
Draws the selling screen's frames, and the quantity's blinking arrows.
void STITSHOP_updateSell(ShopSell *sell, ShopSellWindows *win)
The selling dialog's task: creates its windows, starting at a quantity of 1, then runs and draws it.
static void STITSHOP_pickBuyItem(ShopBuy *buy, ShopBuyWindows *win)
The item list: cross picks the item under the cursor, unless the bag holds 99 of it or the money is s...
static void STITSHOP_confirmEquip(ShopBuy *buy, ShopBuyWindows *win)
Yes or no to equipping what was bought: cross answers, triangle declines.
static void STITSHOP_reopenSellList(ShopSell *sell, ShopSellWindows *win)
Brings the list back while the total's panel closes: its cursor and page move up when the last row so...
void STITSHOP_runBuy(ShopBuy *buy, ShopBuyWindows *win)
The buying dialog: pick the item in the list, how many, confirm, then (equipment) whether to equip it...
static void STITSHOP_startBuyQuantity(ShopBuy *buy, ShopBuyWindows *win)
Closes the list and works out the most of the item that can be bought: what the money pays for (an it...
static void STITSHOP_openBuyTotal(ShopBuy *buy, ShopBuyWindows *win)
Once the total's panel has opened: shows the total with yes and no, the cursor on yes.
static void STITSHOP_chooseSellQuantity(ShopSell *sell, ShopSellWindows *win)
The quantity to sell: up/down change it by one, left/right by ten, up to what the bag holds; cross go...
static void STITSHOP_closeSellQuantity(ShopSell *sell, ShopSellWindows *win)
Hides the quantity and closes its panel, then goes on to the total, or back to the list after triangl...
static void STITSHOP_endEquipQuestion(ShopBuy *buy, ShopBuyWindows *win)
Once the question's panel has closed: on yes goes on to pick the partner, on no back to the list.
void STITSHOP_showBuyItem(ShopBuy *buy, s32 item, s32 quantity)
Shows the item selected in the list, and the quantity, in the details panel (buy->showItem)
static void STITSHOP_openSellTotal(ShopSell *sell, ShopSellWindows *win)
Once the total's panel has opened: shows what the items sell for with sell and no,...
static void STITSHOP_closeSellTotal(ShopSell *sell, ShopSellWindows *win)
Hides the total and closes its panel; back to the kinds of items when none of the kind is left,...
static void STITSHOP_showEquipMarker(ShopBuy *buy, ShopBuyWindows *win)
Once the message's panel has opened: shows the marker over the first partner who can equip the item (...
static void STITSHOP_closeEquipQuestion(ShopBuy *buy, ShopBuyWindows *win)
Hides the question about equipping and closes its panel, and the message's too when the answer was no...
ShopBuy * STITSHOP_createBuy(ItemShop *shop)
Creates the buying dialog (task), when buy is chosen in the shop.
void STITSHOP_showBuyTotal(ShopBuy *buy, ShopBuyWindows *win, s32 show)
Shows the total price with yes and no to confirm the purchase; or hides them.
static void STITSHOP_chooseSellType(ShopSell *sell, ShopSellWindows *win)
Up/down choose the kind of items to sell; cross lists the bag's items of that kind,...
static void STITSHOP_openEquipQuestion(ShopBuy *buy, ShopBuyWindows *win)
Once the question's panels have opened: asks whether to equip what was bought, the cursor on yes.
void STITSHOP_showSellItem(ShopSell *sell, s32 item, s32 quantity)
Shows the item selected in the list, and the quantity, in the details panel (sell->showItem)
static void STITSHOP_endBuyTotal(ShopBuy *buy, ShopBuyWindows *win)
Once the total's panel has closed: asks whether to equip what was bought when a partner of the party ...
static void STITSHOP_closeSellTypes(ShopSell *sell, ShopSellWindows *win)
Hides the kinds of items and the cursor and closes their panel.