29 for (row = 0; row < 2; row++) {
30 for (col = 0; col < 6 && card <
CARD_COUNT; col++) {
73 for (i = 0; i < grid->
shown; i++) {
77 card = grid->
first + i;
89 icon.
draw(x + 0x27, y + 0x34);
101 digits[1] = j + 0x1E;
103 for (j = 0, dx = 0x27; j < 3; j++, dx += 7) {
104 if (digits[j] != 0) {
111 digits[0] = j + 0x1E;
116 digits[1] = j + 0x1E;
117 for (j = 0, dx = 0x3A; j < 2; j++, dx += 7) {
118 if (digits[j] != 0) {
141 for (i = 0; i < grid->
turned; i++) {
142 card = grid->
first + i;
160 card = grid->
first + i;
174 switch (grid->
state) {
214 if (++grid->
frame >= 11) {
244#define SCENE_TASK Task
245#define SCENE_CHILD CardAlbum
246#define SCENE_CREATE OVL_NAME(createAlbum)
247#define SCENE_PRIM_BUFFERS 0xF000
248#define SCENE_OT_SHIFT 3
276 (*items)->setDepth(*items, album->
depth - 3);
292 if (album->
page > 0) {
343 if (album->
card == 0x45 || album->
card == 0x70 || album->
card == 0x9B ||
344 album->
card == 0xC6 || album->
card == 0xF1) {
416 if (album->
blink != 0) {
417 if (album->
page > 0) {
447 }
else if (kind == 2) {
468 }
else if (album->
card == 0x45 || album->
card == 0x70 || album->
card == 0x9B || album->
card == 0xC6 ||
469 album->
card == 0xF1) {
530 if (album->
slot >= 6) {
534 if (album->
slot < 6) {
539 if (--album->
slot < 0) {
550 if (slot != album->
slot) {
554 for (; i >= 0; i--) {
560 }
else if (slot < i) {
568 if (album->
slot == -1) {
584 if (--album->
page < 0) {
592 if (prev != album->
page) {
635 if (album->
step == 0) {
690 switch (album->
state) {
s32 STCRDABM_pageHasCards(CardAlbumGrid *grid)
1 when the grid's page holds a seen card (or runs past the last card)
static void STCRDABM_browseAlbum(CardAlbum *album, CardAlbumWindows *win)
The album open: L1/R1 turn the page, the pad moves the cursor between the page's cards seen; triangle...
s32 STCRDABM_cursorBlink[6]
The cursor's CLUT row on each frame of its blink.
void STCRDABM_setPage(CardAlbumGrid *grid, s32 first)
Turns the grid to the page whose first card is first (grid->setPage)
void STCRDABM_updateGrid(CardAlbumGrid *grid)
The card grid's task: draws the page's cards; on a page turn, turns its 12 slots one every 2 frames o...
s32 STCRDABM_filesLoading(void)
Whether the card data or the strings are still loading.
void STCRDABM_drawAlbum(CardAlbum *album)
Draws the album: the scrolling background, its panels as they open, the blinking previous and next pa...
void STCRDABM_drawTurningSlots(CardAlbumGrid *grid)
Draws the slots turned so far over the cards, flashing the ones with a seen card.
void STCRDABM_findPageCards(CardAlbum *album)
Notes which slots of the current page hold a seen card, and whether any does.
void STCRDABM_showPageInfo(CardAlbum *album, CardAlbumWindows *win, s32 show)
Shows the title, help and page number and, while the album takes input, the previous and next page hi...
CardAlbum * STCRDABM_createAlbum(void)
Creates the album (task), on the top layer.
void STCRDABM_createWindows(CardAlbum *album, CardAlbumWindows *win)
Creates the album's text windows (the page's and the selected card's), in front of the album.
CardAlbumFuncs STCRDABM_funcs
void STCRDABM_loadFiles(void)
Loads the album's images and requests the card data and the card names, effects and album strings.
static void STCRDABM_moveAlbumCursor(CardAlbum *album, CardAlbumWindows *win)
The pad moves the cursor between the page's slots (two rows of six) to the next card seen that way,...
void STCRDABM_drawCards(CardAlbumGrid *grid, s32 previous)
Draws the page's cards, or the page being turned when previous != 0: a seen card's image,...
void STCRDABM_updateAlbum(CardAlbum *album, CardAlbumWindows *win)
The album's task: loads the files and creates its windows, then runs and draws it; once the screen ha...
CardAlbumGrid * STCRDABM_createGrid(CardAlbum *album)
Creates the album's card grid (task), on the top layer.
void STCRDABM_runAlbum(CardAlbum *album, CardAlbumWindows *win)
The album's steps: opens it, then turns pages with L1 and R1, moves the cursor between the seen cards...
static void STCRDABM_turnAlbumPage(CardAlbum *album, CardAlbumWindows *win)
The page turned: shows the new page's cards, fading the card's details in or out when the page gains ...
void STCRDABM_showCardInfo(CardAlbum *album, CardAlbumWindows *win, s32 show)
Shows the card under the cursor (album->card = page * 12 + slot + 1) once the player has seen it: its...
void STCRDABM_loadIcons(CardAlbumGrid *grid)
Loads the images of the grid's page of cards, from grid->first, into VRAM's 6x2 grid of card images.
STCRDABM.PRO: the card album (scene 0x1200).
s32 STCRDABM_updateLerp(MenuLerp *lerp)
void STCRDABM_hideCards(CardAlbumGrid *grid)
s32 STCRDABM_updateFade(PanelAnim *fade)
void STCRDABM_updateHiding(CardAlbumGrid *grid)
#define STCRDABM_IMAGES
TIM archive.
void STCRDABM_startFade(PanelAnim *fade, s32 fadeIn)
#define STCRDABM_FILE_DATA
void STCRDABM_startLerp(MenuLerp *lerp, s32 from, s32 to, s32 frames)
ScreenFade * STCRDABM_createFader(void)
#define STCRDABM_SPRITES
sprite bank
void initCardDrawer(CardDrawer *obj)
Clears a card drawer, gives it its methods and binds it.
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...
#define TEXT_CARD_NAMES
CARDNM.
#define TEXT_CARD_EFFECTS
CARDST.
#define TEXT_CARD_ALBUM
CRDABM: STCRDABM's.
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...
#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_MENU_CANCEL
SYSTEM01.
#define SOUND_MENU_MOVE
SYSTEM06.
void initSpriteDrawer(SpriteDrawer *obj)
Clears a sprite drawer to neutral (no scale, gray tint, follows the scroll), gives it its methods and...
s32(* updateFade)(PanelAnim *fade)
void(* startFade)(PanelAnim *fade, s32 fadeIn)
s32(* filesLoading)(void)
Draws the cards of a page and animates the page turns.
void(* setPage)(struct CardAlbumGrid *grid, s32 first)
void(* nextSubstate)(struct CardAlbumGrid *task)
void(* nextState)(struct CardAlbumGrid *task)
s32 prevFirst
the page being turned
s32 first
first card of the page
void(* setState)(struct CardAlbumGrid *task, s32 state)
s32 turned
slots turned so far
void(* hide)(struct CardAlbumGrid *grid)
TextWindow * stat2
card data [2]
TextWindow * stat1
card data [1]
TextWindow * count
copies the player has
TextWindow * level
card data [5]
void(* setState)(struct CardAlbum *task, s32 state)
PanelAnim infoFade
the card's details
void(* nextState)(struct CardAlbum *task)
void(* nextSubstate)(struct CardAlbum *task)
Draws the cards' images (CardImage), from files 0x7E7-0x7EB.
void(* setClutPos)()
(x, y)
void(* setImagePos)()
(x, y)
void(* setLayer)()
(id, depth)
u8 points
what it adds to its colour
s32(* isLoading)(s32 file)
void(* request)(s32 file)
void *(* getEntry)(u32 fileAndIndex)
void(* requestMode)(s32 mode, s32 arg)
s8 cards[0x13D]
counts, up to CARD_COPIES_MAX
void(* start)(struct ScreenFade *fade, s32 fadeIn, s32 frames)
TASK_DONE when done.
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)
A text window (createTextWindow): up to six text buffers (0 is shown, 1-5 are "work" buffers that con...
void(* setRightAlign)()
no prototype: callers would truncate u8 args
void(* setVisible)(struct TextWindow *obj, u8 arg)
Uploads TIM images to VRAM (initTimLoader); acts on TIM_LOADER.
void(* setImagePos)()
(x, y)
void(* loadArchive)()
(archive): each image 64 halfwords to the right
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)
void initTimLoader(TimLoader *obj)
Clears a TIM loader, gives it its methods and binds it.