18 for (i = 0; i < 6; i++) {
35 for (i = 0; i < 6; i++) {
37 grid->
cards[i] = cards[i];
76 for (i = 0; i < grid->
shown; i++, cards++) {
87 drawer.
draw(x + 0x27, y + 0x46);
101 for (j = dx = 0; j < 3; j++, dx += 7) {
102 if (digits[j] != 0) {
109 digits[0] = j + 0x1E;
114 digits[1] = j + 0x1E;
115 for (j = dx = 0; j < 2; j++, dx += 7) {
116 if (digits[j] != 0) {
136 for (i = 0; i < grid->
turned; i++) {
150 switch (grid->
state) {
188 if (++grid->
frame >= 11) {
217 for (i = 0; i < 6; i++, cards++) {
218 grid->
cards[i] = *cards;
void initCardDrawer(CardDrawer *obj)
Clears a card drawer, gives it its methods and binds it.
void STCRDSHP_setCards(CardPackGrid *grid, s32 *cards)
Turns the grid over to six new cards (grid->setCards): keeps the old ones to draw while the slots tur...
CardPackGrid * STCRDSHP_createGrid(CardShop *owner, s32 *cards)
Creates the grid of six cards, copying the cards given.
void STCRDSHP_loadIcons(CardPackGrid *grid)
Loads the images of the grid's cards into VRAM, one cell each, up to the first empty one.
void STCRDSHP_drawCards(CardPackGrid *grid, s32 previous)
Draws the cards drawn (or the ones being turned over): each card's image, its numbers or its kind's m...
void STCRDSHP_drawTurningSlots(CardPackGrid *grid)
Draws the cover over each slot turned so far, in the palette of the turn's current frame.
void STCRDSHP_updateGrid(CardPackGrid *grid)
The grid's task: covers its slots one by one (every 2 frames) above the old cards,...
STCRDSHP.PRO: the card packs (mode 0x1300).
#define CARD_PACK_IDS
The cards are drawn from 315 ids (1-314)
#define FILE_CARDSHOP_SPRITES
The sprite sheet of the screen, the shop's textures and the card data (five files,...
void STCRDSHP_updateHiding(CardPackGrid *grid)
void STCRDSHP_hideCards(CardPackGrid *grid)
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...
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...
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.
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
Draws the cards' images (CardImage), from files 0x7E7-0x7EB.
void(* setClutPos)()
(x, y)
void(* setImagePos)()
(x, y)
void(* setLayer)()
(id, depth)
Draws the six cards drawn from a pack, and turns them over.
void(* nextSubstate)(struct CardPackGrid *task)
s32 turned
slots turned so far
void(* setCards)(struct CardPackGrid *grid, s32 *cards)
s32 prevCards[6]
the cards being turned
struct CardShop * owner
never read
void(* setState)(struct CardPackGrid *task, s32 state)
void(* nextState)(struct CardPackGrid *task)
void(* hide)(struct CardPackGrid *grid)
The card shop's main task (STCRDSHP_createShop): buy cards, open packs or edit the decks.
void *(* getEntry)(u32 fileAndIndex)
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(* setLayerId)()
(id, depth)
void(* setClutRow)()
(row)
void(* draw)()
(sheet, frame, x, y)
void(* setTexture)()
(x, y)
void * createTask(void(*update)(), s32 size, s32 childrenSize)
createTaskWithId for a task nothing needs to find