9 switch (screen->
state) {
528 if (bits & 0x10000) {
531 if (bits & 0x40000) {
558 if (bits & 0x20000) {
561 if (bits & 0x80000) {
595 for (i = 0; i < count; i++) {
635 loader->
setImagePos(0x140 + slot / 8 * 16, 0x100 + slot % 8 * 32);
656 for (i = 0; i < 40; i++) {
662 for (i = 0; i < 40; i++) {
664 drawer.
setCard(opponent[i] + 1);
666 dst[i + 40] = opponent[i];
668 for (i = 0; i < 9; i++) {
674 for (i = 0; i < 100; i++) {
719 screen->
cards = cards;
CARDGAME.PRO: the card battle (mode 0x700).
void initCardDrawer(CardDrawer *obj)
Clears a card drawer, gives it its methods and binds it.
void CARDGAME_updateScreen(CardScreen *screen, CardScreenItems *items)
The card screen's task: makes its cursor and text windows, then each frame updates its blinkers,...
void CARDGAME_setPanelFlags(CardScreen *screen, s32 bits)
CardScreen.setPanelFlags: sets the panels' blink flags from bits, two to a flag: the even bits the pl...
void CARDGAME_setPanelValue(CardScreen *screen, s32 side, u32 which, s32 value)
CardScreen.setPanelValue: sets one of side's panel values: its points (0 to 4), its deck,...
s32 CARDGAME_startSpriteRecovery(CardScreen *screen, s32 index)
Starts a sprite's effect 2 with the recovery sound (state 8), and then its blink.
void CARDGAME_confirmMessage(CardScreen *screen)
Confirms the message window's choice: the cursor nudges, then it closes.
s32 CARDGAME_startSpriteFlip(CardScreen *screen, s32 index)
Starts turning a sprite over (state 4, CARDGAME_flipSprite)
s32 CARDGAME_startBlinkerMove(CardScreen *screen, s32 index, u8 duration, s16 x, s32 y)
Starts moving blinker index to x, y over duration frames.
void CARDGAME_resetPanels(CardScreen *screen)
Puts both panels away at once.
void CARDGAME_openWindow(CardScreen *screen, s32 index, s16 layout, s32 value, s32 x, s32 y)
Opens window index (CardScreen.windows) at x, y, with its layout and value.
void CARDGAME_openPanels(CardScreen *screen)
Slides both panels in, over 20 frames.
void CARDGAME_closeWindow(CardScreen *screen, s32 index)
Closes window index.
void CARDGAME_openPanelIcon(CardScreen *screen, s32 side)
Grows side's panel icon over 12 frames.
void CARDGAME_closeMessage(CardScreen *screen)
Closes the message window.
void CARDGAME_setMessageChoice(CardScreen *screen, s32 choice)
Puts the message window's cursor on choice.
s32 CARDGAME_getCardColor(CardScreen *screen, s32 index)
CardScreen.getCardColor: the colour of the screen's card index.
void CARDGAME_closePanelIcon(CardScreen *screen, s32 side)
Shrinks side's panel icon over 6 frames.
void CARDGAME_openMenuWindow(CardScreen *screen, s16 row)
Opens the menu window with the cursor on row.
void CARDGAME_closePanels(CardScreen *screen)
Slides both panels out, over 10 frames.
s32 CARDGAME_showBlinker(CardScreen *screen, s32 index, s16 x, s16 y)
Shows blinker index, still, at x, y.
void CARDGAME_startSpriteSlide(CardScreen *screen, s32 index, s32 duration, s32 x, s32 y)
Starts moving a sprite to x, y over duration without sounds (state 3)
s32 CARDGAME_setSpriteScaleTarget(CardScreen *screen, s32 index, s32 duration, s32 scaleX, s32 scaleY, s32 instant)
Scales a sprite to scaleX, scaleY: at once when instant is 1, else over duration (state 2)
void CARDGAME_confirmMenuWindow(CardScreen *screen)
Confirms the menu window's row: the cursor nudges, then it closes.
void CARDGAME_openGauge(CardScreen *screen, s32 index, s16 value)
Opens gauge index showing value, over 10 frames.
void CARDGAME_clearPanelFlags(CardScreen *screen)
CardScreen.clearPanelFlags: clears both panels' blink flags.
void CARDGAME_closeGauge(CardScreen *screen, s32 index)
Closes gauge index, over 5 frames.
void CARDGAME_closePanel(CardScreen *screen, s32 side)
Slides side's panel out over 5 frames, stopping the other's.
void CARDGAME_openPanel(CardScreen *screen, s32 side)
Slides side's panel in over 10 frames, stopping the other's.
void CARDGAME_closeMenuWindow(CardScreen *screen)
Closes the menu window.
CardScreen * CARDGAME_createScreen(s16 *cards)
Creates the card screen over cards, with its functions.
void CARDGAME_openMessage(CardScreen *screen, s32 message, s32 prompt, s16 choice, s32 place)
Opens the message window at place with message, asking prompt with the cursor on choice.
s32 CARDGAME_addSprite(CardScreen *screen, s32 index, s32 x, s32 y)
CardScreen.addSprite: puts a card sprite, still and at full size, at x, y.
void CARDGAME_setSpriteScale(CardScreen *screen, s32 index, s32 scaleX, s32 scaleY)
CardScreen.setSpriteScale: scales a sprite at once.
void CARDGAME_scaleSprite(CardScreen *screen, s32 index, s32 duration, s32 scaleX, s32 scaleY)
CardScreen.scaleSprite: scales a sprite over duration.
s32 CARDGAME_loadCardImages(s16 *dst, s16 *player, s16 *opponent)
CardScreen.loadCardImages: loads the images of the player's 40 cards, the opponent's 40,...
void CARDGAME_startSpriteMove(CardScreen *screen, s32 index, s32 duration, s32 x, s32 y)
Starts moving a sprite to x, y over duration (state 2), with a sound at the start and the end.
void CARDGAME_loadCardImage(TimLoader *loader, u8 *image, s32 slot)
Loads a card's image to VRAM slot slot, in columns of eight, with its CLUT.
void CARDGAME_setMenuWindowRow(CardScreen *screen, s16 row)
Puts the menu window's cursor on row.
void CARDGAME_dealSprites(CardScreen *screen, s16 duration, s16 count, s32 x, s32 y)
CardScreen.dealSprites: lays out count sprites as a hand from x, y, at once (duration 0) or moving th...
s32 CARDGAME_startSpriteBlink(CardScreen *screen, s32 index)
Starts a sprite's blink (state 11), with the confirm sound.
s32 CARDGAME_startSpriteJitter(CardScreen *screen, s32 index)
Starts a sprite's jitter (state 6, CARDGAME_jitterSprite), with effect 1.
s32 CARDGAME_startSpriteEffect(CardScreen *screen, s32 index, s32 which)
Starts a sprite's effect 3 (which 0) for 36 frames, or 4 for 28.
s32 CARDGAME_startSpriteFly(CardScreen *screen, s32 index, s32 duration, s32 x, s32 y)
Starts a sprite's flight to x, y and back (state 5, CARDGAME_flySprite), after it grows for 16 frames...
s32 CARDGAME_startSpriteShake(CardScreen *screen, s32 index)
Starts a sprite's shake (state 7, CARDGAME_shakeSprite), with effect 1.
s32 CARDGAME_getOtherCard(s32 index)
Card index of CARDGAME_otherCards.
void CARDGAME_setSpriteCard(CardScreen *screen, s32 sprite, s32 index)
CardScreen.setSpriteCard: shows the screen's card index on sprite, with its AP, HP,...
void CARDGAME_setSpriteMove(CardScreen *screen, s32 index, s32 duration, s32 x, s32 y)
Sets a sprite's move to x, y over duration, from where it is.
s32 CARDGAME_removeSprite(CardScreen *screen, s32 index)
CardScreen.removeSprite: hides a sprite.
s16 CARDGAME_commonCards[]
the cards everyone has, after the two decks in the card list
s16 CARDGAME_otherCards[]
the 100 cards whose images CARDGAME_loadCardImages loads after the decks (CARDGAME_getOtherCard)
GfxState GFX
GFX: the graphics state and its methods.
Cursor * createCursor(s16 layerId, s32 depth, s16 x, s16 y)
A menu cursor on a layer at (x, y)
Heap HEAP
The functions that return what a call left in v0 (allocMemHigh, findTask) and the ones that take othe...
void CARDGAME_updateMenuWindow(CardScreen *screen, CardScreenItems *items)
A menu window (CardScreen.menuState): it opens, shows text file 0x10 with the cursor on menuRow,...
s32 CARDGAME_getHandOffset(s32 count, s32 index)
CardScreen.getHandOffset: how far the hand's card index is from its first: 0x2900 a card up to six ca...
void CARDGAME_updateMessageWindow(CardScreen *screen, CardScreenItems *items)
The message window: it opens at its place, shows its prompt (showMessagePrompt) and message (showMess...
void CARDGAME_updateBlinkers(CardScreen *screen, CardScreenItems *items)
Moves and draws the twelve blinkers.
void CARDGAME_updatePanels(CardScreen *screen, CardScreenItems *items)
Runs and draws both panels and their icons.
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
#define SOUND_RECOVERY
RECOVERY.
#define SOUND_MENU_CLOSE
SYSTEM04.
#define SOUND_MENU_CONFIRM
SYSTEM07.
#define SOUND_SELECT
Sounds the overlays share, with SOUNDTST's names.
#define SOUND_MENU_OPEN
SYSTEM03.
void CARDGAME_updateSprites(CardScreen *screen, CardScreenItems *items)
Animates the sprites, then draws them: the moving ones first.
Draws the cards' images (CardImage), from files 0x7E7-0x7EB.
u8 kind
an index in CARD_KINDS
u8 tim[0x620]
its header, a 256-colour CLUT block and the image block
u8 points
what it adds to its colour
u8 prompt
what it asks: 0 nothing, else a choice with the cursor
s16 choice
the cursor's row
u8 state
1 opening, 2 open, 4 confirmed, 5 closing
s32 place
in CARDGAME_messageWindowPositions
s16 event
for a frame, until CARDGAME_slidePanel clears it: 2 the panel started sliding in, 1 it slid out; noth...
s16 apTotal
the values shown (CARDGAME_setPanelValue)
u8 points[5]
one per card colour
s16 winsX
where the rounds won are shown
s16 boxX
the discards' box, which slides on its own
The battle screen's task items.
TextWindow * panelTexts[2]
the label under each side's panel (CARDGAME_drawPanelIcon)
TextWindow * moreTexts[8]
The battle screen (created by CARDGAME_createScreen): the two panels, the cards on the table and the ...
CardMessageWindow message
void(* setSpriteCard)(struct CardScreen *screen, s32 sprite, s32 index)
void(* openWindow)(struct CardScreen *screen, s32 index, s16 layout, s32 value, s32 x, s32 y)
void(* closePanel)(struct CardScreen *screen, s32 side)
s16 * cards
the battle's card list
s32(* startFly)(struct CardScreen *screen, s32 index, s32 duration, s32 x, s32 y)
void(* dealSprites)(struct CardScreen *screen, s16 duration, s16 count, s32 x, s32 y)
void(* openMenu)(struct CardScreen *screen, s16 row)
void(* setPanelValue)(struct CardScreen *screen, s32 side, u32 which, s32 value)
void(* scaleSprite)(struct CardScreen *screen, s32 index, s32 duration, s32 scaleX, s32 scaleY)
s32(* getCardColor)(struct CardScreen *screen, s32 index)
void(* setPanelFlags)(struct CardScreen *screen, s32 bits)
void(* nextState)(struct CardScreen *task)
void(* clearPanelFlags)(struct CardScreen *screen)
void(* startMove)(struct CardScreen *screen, s32 index, s32 duration, s32 x, s32 y)
void(* resetPanels)(struct CardScreen *screen)
void(* openPanels)(struct CardScreen *screen)
void(* setMessageChoice)(struct CardScreen *screen, s32 choice)
s32(* startShake)(struct CardScreen *screen, s32 index)
void(* openMessage)(struct CardScreen *screen, s32 message, s32 prompt, s16 choice, s32 place)
s32(* getHandOffset)(s32 count, s32 index)
void(* closeMenu)(struct CardScreen *screen)
void(* confirmMessage)(struct CardScreen *screen)
s32(* removeSprite)(struct CardScreen *screen, s32 index)
s32(* startEffect)(struct CardScreen *screen, s32 index, s32 which)
void(* setSpriteScale)(struct CardScreen *screen, s32 index, s32 scaleX, s32 scaleY)
void(* closePanels)(struct CardScreen *screen)
s32(* startJitter)(struct CardScreen *screen, s32 index)
void(* openPanelIcon)(struct CardScreen *screen, s32 side)
void(* closeMessage)(struct CardScreen *screen)
s32 spriteFlags
this frame: bit 0 a sprite is animated, bit 1 a flying one landed
void(* closeWindow)(struct CardScreen *screen, s32 index)
s32(* loadCardImages)(s16 *dst, s16 *player, s16 *opponent)
s32(* startBlink)(struct CardScreen *screen, s32 index)
void(* confirmMenu)(struct CardScreen *screen)
void(* closeGauge)(struct CardScreen *screen, s32 index)
s32(* showBlinker)(struct CardScreen *screen, s32 index, s16 x, s16 y)
s32(* startFlip)(struct CardScreen *screen, s32 index)
void(* setMenuRow)(struct CardScreen *screen, s16 row)
void(* closePanelIcon)(struct CardScreen *screen, s32 side)
void(* openGauge)(struct CardScreen *screen, s32 index, s16 value)
s32(* addSprite)(struct CardScreen *screen, s32 index, s32 x, s32 y)
void(* startSlide)(struct CardScreen *screen, s32 index, s32 duration, s32 x, s32 y)
void(* openPanel)(struct CardScreen *screen, s32 side)
s32(* startBlinkerMove)(struct CardScreen *screen, s32 index, u8 duration, s16 x, s32 y)
s32(* startRecovery)(struct CardScreen *screen, s32 index)
A card on the battle screen (CardScreen.sprites)
s32 growTime
the frames it grows for before it flies (CARDGAME_flySprite)
s16 index
in the battle's card list
u8 ap
the values shown, which count towards the slot's
s16 color
the card's colour, from 0
u8 effect
1-4, drawn by CARDGAME_drawSpriteEffect
s32 value
by its layout: a string, a card, or points | colour << 4
s16 layout
in CARDGAME_windowLayouts
void(* setVisible)()
(cursor, visible)
s32(* getFrameTime)(void)
void(* zero)(void *ptr, s32 size)
short(* playSound)(s32 id)
returns the voice of a key-on
void(* setLines)()
no prototype: callers would truncate u8 args
Uploads TIM images to VRAM (initTimLoader); acts on TIM_LOADER.
void(* setClutPos)()
(x, y)
void(* setImagePos)()
(x, y)
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.
void CARDGAME_updateWindows(CardScreen *screen, CardScreenItems *items)
Runs and draws the six windows.
void CARDGAME_drawBackground(CardScreen *screen)
Draws the scrolling background, which fades in through its palettes (fadeState 1) and then stays.
void CARDGAME_updateGauges(CardScreen *screen, CardScreenItems *items)
Runs and draws the three gauges.