11 for (i = 0; i < 14; i++) {
32 for (i = 0; i < list->
pageSize; i++) {
37 item = list->
items[index];
39 if (index < list->count && item != 0) {
50 if (list->
pages >= 2) {
51 if (list->
page != 0) {
63 for (i = 0; i < list->
pageSize; i++) {
91 for (i = 0; i < list->
pageSize; i++) {
96 item = list->
items[index];
98 if (index >= list->
count || item == 0) {
101 x = (i % 2) * 0x83 + 0x28;
102 y = (i % list->
pageSize) / 2 * 0xE + 0x24;
108 if (list->
pages >= 2) {
117 if (list->
page != 0) {
183 switch (list->
state) {
198 if (--list->
page < 0) {
206 if (page != list->
page) {
221 last = (page + 1) * list->
pageSize - 1;
222 if (last > list->
count - 1) {
223 last = list->
count - 1;
337 for (i = 0; i < n; i++) {
GfxState GFX
GFX: the graphics state and its 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.
#define TEXT_ITEM_NAMES
ITMNAM.
#define FILE_MENU_SPRITES
Files the engine loads by number.
FileCache FILE_CACHE
The file cache.
#define SCREEN_LAYER
The layer over the whole screen that most modes create first and draw their menus on (FIELDSTG and ST...
void STITSHOP_listSellable(ShopItemList *list)
Lists the bag's items of the list's type that can be sold, those with a sell price (list->listBag,...
void STITSHOP_refreshItemList(ShopItemList *list)
Lists the sellable items again, shows the page and the selection in the dialog (list->refresh)
s32 STITSHOP_getSelectedItem(ShopItemList *list)
The item at the list's selection, of the shop's or of the bag's sellable ones (list->getSelected)
void STITSHOP_closeItemList(ShopItemList *list)
Closes the list (list->close): hides the cursor and fades it out.
void STITSHOP_createItemListWindows(ShopItemList *list, ShopItemListWindows *win)
Creates the item list's windows: 14 items in two columns, the page number, the L1 and R1 labels (lowe...
void STITSHOP_updateItemList(ShopItemList *list, ShopItemListWindows *win)
The item list: L1 and R1 turn its pages, the d-pad moves in the page, and the dialog shows the select...
void STITSHOP_showItemPage(ShopItemList *list, ShopItemListWindows *win, s32 show)
Shows the page of items, the page number and the arrows' labels; or hides them.
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...
void STITSHOP_runItemList(ShopItemList *list, ShopItemListWindows *win)
The list's states: lists the shop's items or the bag's, fades in, then fades out when closed.
void STITSHOP_drawItemList(ShopItemList *list)
Draws the list's frame, the items' icons and the blinking page arrows.
void STITSHOP_showListCursor(ShopItemList *list, s32 visible)
Shows the list's cursor at the selection and takes the d-pad, or hides it and stops (list->showCursor...
void STITSHOP_startItemList(ShopItemList *list)
Runs the list's states again (list->start), to reopen it after the quantity and the yes/no.
void STITSHOP_freezeListCursor(ShopItemList *list, s32 frozen)
Freezes the list's cursor (still, in palette 7) and its input, or lets them go again (list->freezeCur...
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_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...
ItemShopFuncs STITSHOP_funcs
The shop's helpers.
void(* setPos)()
(cursor, x, y)
void(* setVisible)()
(cursor, visible)
void *(* getEntry)(u32 fileAndIndex)
s32(* getCategory)(s32 item)
getItemCategory
struct ItemInfo *(* get)(s32 item)
getItem
s32(* list)(s32 type, s16 *out)
listItems
u16 sellPrice
0: cannot be sold
s32 count
the items of the shop getShopItems returned
s32(* updateFade)(PanelAnim *fade)
void(* startFade)(PanelAnim *fade, s32 fadeIn)
s16 *(* getShopItems)(s32 shop)
What ShopBuy and ShopSell start with, and are passed to the item list as: the list shows its selectio...
void(* showItem)(struct ShopDialog *dialog, s32 item, s32 quantity)
The list of the items to buy or sell (STITSHOP_createItemList)
void(* freezeCursor)(struct ShopItemList *list, s32 frozen)
void(* close)(struct ShopItemList *list)
void(* refresh)(struct ShopItemList *list)
void(* nextState)(struct ShopItemList *task)
s16 items[0x194]
the bag's items that can be sold
void(* showCursor)(struct ShopItemList *list, s32 visible)
void(* start)(struct ShopItemList *list)
void(* listBag)(struct ShopItemList *list)
s32(* getSelected)(struct ShopItemList *list)
s32 clutRow
the arrows' blink
s32 type
the shop, or the item type to sell
ShopDialog * dialog
ShopBuy or ShopSell.
s32 selling
0: the shop's items, 1: the bag's
void(* setState)(struct ShopItemList *task, s32 state)
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
#define PALETTE_WHITE
The text windows' palettes (TextWindow.palette, setPalette): rows of the font's CLUTs,...
#define PALETTE_GREY
what is unavailable
TextWindow * createTextWindow(s16 layerId, s16 style, s16 x, s16 y)
A text window on a layer, in a font style, at (x, y)