15 for (i = 0; i < 40; i++) {
44 for (i = 0; i < 27; i++) {
65 for (i = 0; i < 40; i++) {
88 if (kb < ka || (ka == kb && vb < va)) {
111 for (i = 40; i > 0; i--) {
136 for (i = 0; i < 40; i++) {
141 card = pile->
deck[j];
142 while (j < battle->reserveStart - 1) {
150 for (i = 0; i < 40; i++) {
176 if (anim->
count != 0) {
177 for (i = 0; i < 40; i++) {
178 if (i < anim->count) {
206 for (i = 1; i < 40; i++) {
260 for (j = 0; j < 12; j++) {
283 sprite = &screen->
sprites[first];
284 for (j = 0; j < 6; j++) {
285 sprite[j].
marks[play] = 1;
293 sprite = &screen->
sprites[first];
294 for (j = 0; j < 6; j++) {
295 sprite[j].
marks[play] = 1;
299 for (j = 0; j < 12; j++) {
308 for (j = 0; j < 12; j++) {
355 for (i = 0; i < 6; i++) {
362 screen->
addSprite(screen, i, 0x1800 + i * 0x2900, 0x9000);
369 for (i = 0; i < 6; i++) {
376 screen->
addSprite(screen, i + 6, 0x1800 + i * 0x2900, 0x3200);
388 screen->
addSprite(screen, i + 12, 0x5100 + i * 0x3200, 0x6100);
409 if (battle->
fade != 0) {
410 i = battle->
fade - 1;
413 items->
fader = fader;
431 for (i = 0; i < 15; i++) {
560 switch (anim->
next) {
567 for (i = 0; i < 40; i++) {
679 for (side = 0; side < 2; side++) {
680 for (i = 0; i < 5; i++) {
703 from = range & 0xFFFF;
708 for (i = from; i < to - 1; i++) {
709 for (j = i + 1; j < to; j++) {
710 if (battle->
cards[ids[i]] > battle->
cards[ids[j]]) {
738 for (i = 0; i < 40; i++) {
741 card = pile->
deck[a];
743 pile->
deck[b] = card;
805 for (i = 0; i < 40; i++) {
809 for (i = 0; i < 40; i++) {
814 for (i = 0; i < 40; i++) {
838 if (preloader ==
NULL) {
840 }
else if (preloader->
state == 1 && preloader->
ready != 0) {
978 for (i = 0; i < 10; i++) {
1002 for (i = 0; i < 12; i++) {
1022 if (i < 6 && i < battle->players[0].slotCount) {
1144 if (condition == 0x83 || condition == 0x84) {
1145 for (i = 0; i < 15; i++) {
1347 for (i = pile->
handCount - 1; i >= 0; i--) {
1349 for (j = i; j < pile->
handCount - 1; j++) {
1406 for (i = 0; i < 2; i++) {
1414 values[i] = player->
slotCount * 20 + base;
1429 if (values[i] >= 99) {
1432 if (values[i] <= 0) {
1436 slot->
ap = values[0];
1437 slot->
hp = values[1];
1450 for (pass = 0; pass < 5; pass++) {
1451 for (side = 0; side < 2; side++) {
1452 player = &battle->
players[side];
1453 for (i = 0; i < player->
slotCount; i++) {
1531 for (i = 0; i < count; i++) {
1533 entries[i].
slot = i;
1535 for (i = 0; i < count - 1; i++) {
1536 for (j = i + 1; j < count; j++) {
1537 if (entries[i].card > entries[j].card) {
1539 entries[i] = entries[j];
1545 for (i =
start; i < count - 1; i++) {
1546 drawer.
setCard(entries[i].card + 1);
1557 for (k = 0; k < count; k++) {
1560 for (; j >= 0; j--) {
1633 screen->
openWindow(screen, 5, 5, 13, 0, 110);
1667 items->
fader = fader;
1668 fader->
setColor(fader, 0x80, 0x80, 0x80);
1677 screen->
openWindow(screen, 5, 5, 16, 0, 110);
1679 screen->
openWindow(screen, 5, 5, 17, 0, 110);
1734 screen->
openWindow(screen, 5, 5, 21, 0, 110);
1738 screen->
openWindow(screen, 5, 5, 22, 0, 110);
1917#if VERSION_EU || VERSION_JP
1971 switch (battle->
phase) {
2076 for (i = 0; i < 15; i++) {
2151 for (i = 0; i < 12; i++) {
2167 if (battle->
cards[index] != 13) {
2454 switch (battle->
run) {
2488 switch (battle->
state) {
2504 items->
fader = fader;
2505 fader->
setColor(fader, 0xFF, 0xFF, 0xFF);
2514 items->
fader = fader;
2524 if (battle->
result != 0) {
2525 if (battle->
result != 2) {
s32 CARDGAME_checkPlayCondition(CardBattle *battle, CardScreen *screen, s32 kind)
Whether the condition kind (1-11) of the card being played holds for its side: 1 if it does.
CARDGAME.PRO: the card battle (mode 0x700).
void initCardDrawer(CardDrawer *obj)
Clears a card drawer, gives it its methods and binds it.
s32 CARDGAME_runPutOut(CardBattle *battle, CardBattleItems *items)
A battle step: each side puts out its flagged cards (putOutCards) between messages 0x9A,...
void CARDGAME_layOutPile(CardBattle *battle, CardBattleItems *items, s32 side, s32 which)
Lays out the cards of one of a side's piles (which: 0 the hand; 1 the discards; 2 the deck from deckT...
void CARDGAME_layOutSlots(CardBattle *battle, CardBattleItems *items)
Lays out the slots as sprites (0-5 player 0's, 6-11 player 1's) and each play of record....
void CARDGAME_sumSlotValues(CardBattle *battle, s32 side)
Side's apTotal and hpTotal become the sums of its slot cards' ap and hp.
void CARDGAME_returnOpponentHand(CardBattle *battle, CardBattleItems *items)
Puts side 1's hand back on its pile and renumbers the pile's cards.
void CARDGAME_setCountingCardValues(CardBattle *battle, CardSlot *slot, s32 side, s32 pass)
Sets the values of a slot that holds the pass-th card of CARDGAME_countingCards from the battle's cou...
static void closeDeckWindow(CardBattle *battle, CardBattleItems *items, s32 index)
Closes deck window index with its sound.
static void pickRoundWinner(CardBattle *battle)
Gives the round to the side with the higher total (pile.hpTotal) and runs its win's effect step (0x18...
static void closeBattleResult(CardBattle *battle, CardScreen *screen)
Cross or Triangle closes the battle's result: the player's win goes on to the prize,...
static void markPlayTargets(CardBattle *battle, CardScreen *screen, s32 play)
Marks in each slot sprite's marks[play] whether play of record.plays applies to it,...
void CARDGAME_initBattle(CardBattle *battle, CardBattleItems *items)
Sets up a card battle: the sides' panels, no result, CARD_PHASE_FADE_IN.
void CARDGAME_prepareTurn(CardBattle *battle, CardBattleItems *items)
Clears record.turnState, shows the panel values and sorts the player's hand.
static void checkPlayedCard(CardBattle *battle, CardBattleItems *items)
When the played card's play condition holds, shows its message instead of its effects; else starts it...
s32 CARDGAME_runStartStep(CardBattle *battle, CardBattleItems *items)
Runs step 20 (CARDGAME_stepStart) and then returns its choice + 1: 1 dealt, 2 the player's deck was s...
static void showSlots(CardBattle *battle, CardBattleItems *items, CardAnim *anim)
Scales the slots in, a pair every 4 frames, then shows the plays.
void CARDGAME_resetSpriteFlags(CardBattle *battle)
Sets the 15 sprites' anim.dimmed to whether anim.dimAll is 2, once it is set.
void CARDGAME_updateCardAnims(CardBattle *battle, CardBattleItems *items)
Starts (anim.next) and runs (anim.current) the screen's card animations: the hands',...
void CARDGAME_startStepFade(CardBattle *battle, CardBattleItems *items)
Starts the fade that fade asks for (CARDGAME_fadeColors)
s32 CARDGAME_runBattle(CardBattle *battle, CardBattleItems *items)
A frame of the card battle: the sprites' flags, the card animations, the fades, then the phase,...
u8 CARDGAME_resolveCard(CardBattle *battle, CardBattleItems *items)
Plays out the last card played (record.plays): its effect and its messages, then puts it in its side'...
void CARDGAME_sortCards(CardBattle *battle, s16 *list, s32 range, s32 flags)
Sorts the cards list[from..to) (range: to << 16 | from) by their values, moving opponentDraws (flags ...
s32 CARDGAME_findCardSet(CardBattle *battle, s32 side, s32 start)
Finds three or more of one card (with a CardImage.comboCard) among a side's slots,...
static void countRoundWin(CardBattle *battle, CardBattleItems *items, CardScreen *screen)
Blinks the round winner's wins on its panel with a flash, then counts the win and shows the round's r...
s32 CARDGAME_stepHidePanels(CardBattle *battle, CardBattleItems *items)
Closes the panels once; 1 once they are closed.
static void runKeptCardSteps(CardBattle *battle)
Runs effect step 0x1B for the kept card (keptCard) until keptCount runs out.
static void showPile(CardAnim *anim, CardScreen *screen)
Scales a pile's cards in, one every 4 frames (at least one)
void CARDGAME_putOutCards(CardBattle *battle, s32 side)
Puts side's flagged cards of its pile into its slots, up to effectStep.count of them.
s32 CARDGAME_stepShowPanels(CardBattle *battle, CardBattleItems *items)
Opens the panels once; 1 once they are open.
static void runCardEffects(CardBattle *battle, CardBattleItems *items)
Runs the played card's effect steps one after another, then clears its marks.
static void showPlays(CardBattle *battle, CardBattleItems *items, CardAnim *anim)
Scales the plays in, one every 4 frames, opening each one's gauge after it.
s32 CARDGAME_takeFlaggedCard(CardBattle *battle, CardBattleItems *items)
Takes the first flagged card out of the hand of side record.turnSide into the play record....
static void moveDeckMarker(CardBattle *battle, CardBattleItems *items)
Up and Down move the marker between the three decks; Cross picks the marked one, which blinks.
static void waitPhaseStep(CardBattle *battle, s32 frames)
Goes to the next phaseStep after frames frames.
s32 CARDGAME_setAllCountingValues(CardBattle *battle)
Sets the values of the counting cards out, pass by pass (CARDGAME_setCountingCardValues); whether any...
void CARDGAME_removeMarkedHandCards(CardBattle *battle, CardPile *pile)
Takes the marked cards (effectStep.marked) out of pile's hand.
static void waitRoundResultShown(CardBattle *battle, CardScreen *screen)
Waits for the round's result: its window, or the draw message when the totals are equal.
static void startRounds(CardBattle *battle, CardBattleItems *items)
Starts the rounds: clears the record, shows the slots and opens the panels.
static void hidePile(CardAnim *anim, CardScreen *screen)
Scales a pile's cards out, one every 4 frames (at least one)
static void playComputerTurn(CardBattle *battle, CardBattleItems *items)
The computer plays a card (CARDGAME_pickComputerCard); without one it passes when it would play first...
s32 CARDGAME_runPhase(CardBattle *battle, CardBattleItems *items)
Runs the battle's current phase (phase), after switching to the one asked for in nextPhase; 1 once th...
static void checkBattleWinner(CardBattle *battle, CardScreen *screen)
Once a side has two wins, shows who won the battle; else goes on to the next round.
static void waitRoundResultClosed(CardBattle *battle, CardScreen *screen)
Once the round's result is closed, opens message 19.
static void closeRoundResult(CardBattle *battle, CardScreen *screen)
Cross or Triangle closes the round's result window or message.
static void discardPlayedCard(CardBattle *battle)
Puts the played card in its side's discards (unless it is card 13) and takes it (and the one before w...
void CARDGAME_sortOpponentHand(CardBattle *battle)
Sorts the opponent's hand by its cards' opponentPlans kind, then value.
static void openDeckWindow(CardBattle *battle, CardBattleItems *items, s32 index)
Opens deck window index with its sound.
static void runRoundEndStep(CardBattle *battle)
Runs the round's closing effect step: 0x1C after the player's win, 0x1D after the opponent's.
void CARDGAME_showPanelValues(CardBattle *battle, CardBattleItems *items)
Shows both sides' values on their panels: the points of each colour, the deck, hand and discards,...
static void answerQuitQuestion(CardBattle *battle, CardBattleItems *items)
The quit question: Up and Down choose yes or no, Cross answers, Triangle answers no.
static void startPlay(CardBattle *battle, CardBattleItems *items)
Picks the side that plays next, by the starter and the plays so far, or once three cards are played r...
static void hideSlots(CardBattle *battle, CardBattleItems *items, CardAnim *anim)
Scales the slots out, a pair every 4 frames, then hides the plays.
static void hidePlays(CardBattle *battle, CardBattleItems *items, CardAnim *anim)
Scales the plays out with their gauges, one every 4 frames.
void CARDGAME_returnHandToDeck(CardPile *pile)
Puts pile's hand back on top of its deck.
static void openMenuChoice(CardBattle *battle, CardBattleItems *items)
Once the menu is closed, goes to the picked row's help, back, or the quit question.
void CARDGAME_setSlot(CardBattle *battle, s32 side, s32 card, s32 index)
Puts the battle's card card in side's slot index, with its AP and HP and the order it came out in.
void CARDGAME_shufflePile(CardBattle *battle, s32 base, s32 n)
Shuffles the player's pile's deck[base..base + n) with 40 random swaps.
s32 CARDGAME_runFirstPick(CardBattle *battle, CardBattleItems *items)
Runs step 0xA7 (CARDGAME_startFirstPick) and then keeps who goes first (firstStarter); 1 once done.
void CARDGAME_findOpponentDeckLimits(CardBattle *battle, CardBattleItems *items)
drawEnd: the first card of the opponent's deck above the round's level (round); reserveStart: the end...
static void checkEmptyRows(CardBattle *battle, CardScreen *screen)
When a side has no slots left, the round ends at once, the higher total winning; else the round's res...
void CARDGAME_startBattleMessage(CardBattle *battle, CardBattleItems *items)
Starts the step of battle message prevPhase (CARDGAME_battleMessages)
static void loadChosenDeck(CardBattle *battle, CardBattleItems *items)
Loads the chosen deck (or the default one when it is empty) and the opponent's, fills both piles and ...
void CARDGAME_openPanelsPhase(CardBattle *battle, CardBattleItems *items)
Opens the panels for a phase.
void CARDGAME_updateBattle(CardBattle *battle, CardBattleItems *items)
The card battle task: sets up the battle and fades in, runs it (CARDGAME_runBattle),...
s32 CARDGAME_playRounds(CardBattle *battle, CardBattleItems *items)
Runs the rounds of plays (state record.turnState): each side in turn plays a card,...
s32 CARDGAME_chooseDeck(CardBattle *battle, CardBattleItems *items)
Chooses the player's deck: opens the three deck windows and a marker, Up/Down/Cross pick one,...
void CARDGAME_flagTargetSlots(CardBattle *battle, CardScreen *screen)
Flags (effectStep.marked) the slots that the current play's target kind (record.plays[playCount]....
static void runOpponentCardSets(CardBattle *battle)
Runs effect step 0x1A for each set of three or more of one card among the opponent's slots (CARDGAME_...
static void runPlayerCardSets(CardBattle *battle)
Runs effect step 0x19 for each set of three or more of one card among the player's slots (CARDGAME_fi...
static void playPlayerTurn(CardBattle *battle, CardBattleItems *items)
The player picks a card to play (effect step 0x98); without one they pass when they would play first,...
void CARDGAME_startPileCount(CardBattle *battle, CardBattleItems *items, s32 side, s32 which)
Starts the count of side's hand, discards or deck (which 0-2)
void CARDGAME_loadOpponent(CardBattle *battle, CardBattleItems *items)
Loads the opponent's data (FILE_CARDGAME_OPPONENTS, entry arg - 1): its deck and its card order.
CardBattle * CARDGAME_createBattle(s32 arg)
Creates the card battle against opponent arg (CARDGAME_loadOpponent), with its functions,...
s32 CARDGAME_runBattleMenu(CardBattle *battle, CardBattleItems *items)
The battle menu (record.menuState its state): three help messages, back, and quitting after a yes/no ...
static void moveMenuCursor(CardBattle *battle, CardBattleItems *items)
Up and Down move the menu's cursor (wrapping round its five rows), Cross picks the row,...
static void takePickedCard(CardBattle *battle, CardBattleItems *items)
Takes the picked card into the play and runs its condition's step: when it holds the card is played,...
void CARDGAME_addCard(CardBattle *battle, s32 side, s32 card)
CardBattle.addCard: puts card in side's next slot.
s32 CARDGAME_endRound(CardBattle *battle, CardBattleItems *items)
The end of a round: shows both sides' cards, gives the round to the higher total (pile....
s32 CARDGAME_showPlayedCard(CardBattle *battle, CardBattleItems *items)
Shows the last card played (record.plays) in window 2 for 35 frames (Cross cuts it short),...
void CARDGAME_startNextRound(CardBattle *battle, CardBattleItems *items)
Puts both hands back in the decks, shuffles the player's, clears the round's values and moves on to t...
static void startNextTurn(CardBattle *battle)
Starts the next turn, the other side starting; after two passes the rounds end (state 15)
#define FILE_CARDGAME_OPPONENTS
The opponents of the card battles (CardOpponent)
@ CARD_PHASE_FIRST_PICK
who starts
@ CARD_PHASE_DEAL
six cards to each side
@ CARD_PHASE_PLAYS_AFTER
plays after: any kind but 0
@ CARD_PHASE_PLAYS_BEFORE
plays before the cards are put out: kind 2 cards only
@ CARD_PHASE_NONE
for nextPhase: no switch
@ CARD_RUN_RESOLVE
the card just played (CARDGAME_resolveCard)
@ CARD_RUN_STEP
an effect step (CARDGAME_runEffectStep)
@ CARD_RUN_PHASE
the battle's phase (CARDGAME_runPhase)
#define CARD_ANIM_UNDIM_ALL
CardAnim.dimAll.
@ CARD_ANIM_LAY_OUT_HAND
the hand laid out at once
@ CARD_ANIM_SHOW_OPPONENT_DISCARDS
@ CARD_ANIM_SHOW_HAND
the player's piles...
@ CARD_ANIM_SHOW_DISCARDS
@ CARD_ANIM_SHOW_OPPONENT_DECK
@ CARD_ANIM_HIDE_OPPONENT_DISCARDS
@ CARD_ANIM_HIDE_OPPONENT_DECK
@ CARD_ANIM_LAY_OUT_OPPONENT_HAND
@ CARD_ANIM_HIDE_OPPONENT_HAND
@ CARD_ANIM_SHOW_OPPONENT_HAND
...and the opponent's
@ CARD_ANIM_HIDE_DISCARDS
CardFader * CARDGAME_createFader(u8 blend)
Creates a fader, with the semi-transparency rate BLEND.
CardScreen * CARDGAME_createScreen(s16 *cards)
Creates the card screen over cards, with its functions.
s16 CARDGAME_animPiles[7][2]
the side and pile CARDGAME_updateCardAnims passes to CARDGAME_layOutPile
CardFadeColor CARDGAME_fadeColors[]
CARDGAME_startStepFade's fade colours and blends, by fade - 1.
s32 CARDGAME_slotRowPositions[2][4]
sprite positions, by SHIFT_PAL_SCREEN
u8 CARDGAME_turnStates[]
the next record.turnState state, by step and side
u16 CARDGAME_defaultDeck[]
the deck used when the chosen one is empty: its first 40 cards, as card ids - 1 (CardBattle....
CardOffset CARDGAME_deckWindowPos[3]
the three deck windows
CardBattleMessage CARDGAME_battleMessages[]
the step and nextPhase of CARDGAME_startBattleMessage, by prevPhase
CardMessageWindow CARDGAME_savedScreenState
CardOffset CARDGAME_playedCardPos[2][2]
then the same moved for SHIFT_PAL_SCREEN
s16 CARDGAME_prizeItems[]
the item an opponent gives for a win (CardBattle.prize), by its CardOpponent.prize
s16 CARDGAME_countingCards[]
five card ids, minus one
s32 CARDGAME_scoreHand(CardBattle *battle, s32 side, s32 mask)
Scores the cards in a side's slots, counting runs of the same card.
s32 CARDGAME_pickComputerCard(CardBattle *battle, CardScreen *screen)
Picks the computer's next card, flagging it in effectStep.marked; returns 1 if one was found.
CardMarker * CARDGAME_createMarker(s16 x, s16 y)
Creates the deck marker at x, y, which shows the selected deck window.
CardDeckWindow * CARDGAME_createDeckWindow(s32 deck, s32 x, s32 y)
Creates the window of deck deck at x, y, with how many cards of each colour it has.
GfxState GFX
GFX: the graphics state and its methods.
void CARDGAME_runEffectStep(CardBattle *battle, CardScreen *screen)
Starts the effect step battle->effectStep.next asks for (startEffectStep), then runs the current one ...
s32 CARDGAME_getEffectField(s32 index, u32 field, s32 offset)
One field of card effect index (CardEffect): 0 its condition, 1 its play condition,...
GameFlags FLAGS_00
The flag bitset FLAGS_00 and the event functions.
GameState GAME
The save data, the game mode and the methods.
s32 SHIFT_PAL_SCREEN
moves both display areas 0x18 lines down
FileCache FILE_CACHE
The file cache.
PadState PAD
Controller input: cleared by initPad, then the methods.
#define PAD_PRESSED(button)
One button of pad 1: newly pressed, auto-repeated while held, or held.
CardPreloader * CARDGAME_startPreloader(void)
Starts the preloader of the card game's files (CARDGAME_tickPreloader)
#define FILE_CARDGAME_TIMS
CARDGAME's own pictures, a TIM archive.
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
#define SOUND_WIN_JINGLE
W_JINGLE: a battle won.
#define MUSIC_CARD_BATTLE
CBTLMAIN: the card battles.
#define SOUND_MENU_CLOSE
SYSTEM04.
#define SOUND_MENU_CONFIRM
SYSTEM07.
#define SOUND_MENU_OPEN
SYSTEM03.
#define SOUND_MENU_CANCEL
SYSTEM01.
#define SOUND_MENU_MOVE
SYSTEM06.
#define SOUND_CURSOR
SYSTEM02: a cursor moves.
Task * start(void)
The mode's entry point (MODE_ENTRY_POINTS): starts its root task (update_scene.inc....
The running animation of the cards on the table (CARDGAME_updateCardAnims)
s32 count
the pile's cards
u8 faceDown
the next pile or slots are laid out face down
s32 shown
the sprites scaled so far
u8 dimAll
sets dimmed of the first 15 sprites once
u8 hide
the one that hides what the last one showed
s32 stagger
one more sprite scales every 4 frames
The card battle's task items.
CardPreloader * preloader
the card game's files' (CARDGAME_startPreloader)
CardDeckWindow * deckWindows[3]
CardMarker * marker
the deck choice's
u16 phase
for CardBattle.nextPhase
u16 step
for CardStep.next
The card battle (CARDGAME_createBattle).
u8 fade
the fade to start (CARDGAME_fadeColors), plus one
s32 prize
the item the player wins (GAME.items)
u8 run
what runs this frame (CARD_RUN_*)
u8 phaseStep
the phase's own state
u8 drawEnd
the first card of the opponent's deck above the round's group
void(* putOutCards)(struct CardBattle *battle, s32 side)
u8 playsToResolve
record.playCount, as CARDGAME_resolveCard starts; nothing reads it
void(* setState)(struct CardBattle *task, s32 state)
s16 deckChoice
the player's deck (GAME.decks)
u8 arg
the mode argument: the opponent, from 1
u8 firstStarter
the side that starts the first round
u8 resolveState
CARDGAME_resolveCard's.
u8 opponentLevel
CardOpponent.level.
s16 playerDeck[40]
the player's deck
s16 cards[250]
card ids, minus one (CARDGAME_loadCardImages)
u8 result
2 once the battle is over
u8 playerLost
0 once the player has won the battle
u8 prevDiscarded
the card before the last one played went off too
u8 keptCount
and how many times
s32(* scoreHand)(struct CardBattle *battle, s32 side, s32 mask)
CardPlan opponentPlans[40]
one per card of side 1 (40-79)
s32 phaseTime
a frame count, or the phase's own counter
s16 effectPos
the step of the card's effect script to run next
u8 roundWinner
the side that won the round
void(* shufflePile)(struct CardBattle *battle, s32 base, s32 n)
u8 reserveStart
the first card of the opponent's deck held back (group 7)
CardOpponent * opponents
file FILE_CARDGAME_OPPONENTS
s32 subState
the state of a phase's helpers (CARDGAME_showPlayedCard...)
void(* sortCards)(struct CardBattle *battle, s16 *list, s32 range, s32 flags)
u8 nextPhase
the phase to switch to, if not 0
CardStep savedStep
the step, while the battle menu is open
void(* addCard)(struct CardBattle *battle, s32 side, s32 card)
s16 opponentDeck[40]
the opponent's deck
s32 subTime
and their frame count
u8 counterCards[0x1B]
the cards the computer answers with a kind 4 card, up to an 0xFF
u8 keptCard
the card CARDGAME_keepLastCard kept, plus one
u8 slotCount
the slots added so far
CardDraw opponentDraws[40]
by the opponent's deck card
s16 card
the id plus one in the low 12 bits; bit 15 a flag
u8 group
when the computer draws it (CardDraw.group)
u8 kind
how it plays it (CardPlan.kind)
void(* close)(struct CardDeckWindow *window)
void(* setBlink)(struct CardDeckWindow *window)
Where a card of the opponent's deck is drawn (CardBattle.opponentDraws): the computer draws the cards...
u8 order
its place in the deck
Draws the cards' images (CardImage), from files 0x7E7-0x7EB.
Fades the screen to a colour: a POLY_F4 over it, blended (blend is the semi-transparency rate)
void(* kill)(struct CardFader *fader)
void(* setColor)(struct CardFader *fader, u8 r, u8 g, u8 b)
s32(* isDone)(struct CardFader *fader)
void(* start)(struct CardFader *fader, u8 r, u8 g, u8 b, s32 frames, s32 killWhenDone)
s16 comboCard
the card (from 1) that three or more of it make (CARDGAME_findCardSet), 0 for none
void(* close)(struct CardMarker *marker)
void(* setFast)(struct CardMarker *marker)
void(* setPos)(struct CardMarker *marker, s16 x, s16 y)
s16 choice
the cursor's row
u8 state
1 opening, 2 open, 4 confirmed, 5 closing
An opponent of the card battle: an entry of file FILE_CARDGAME_OPPONENTS, picked by CardBattle....
u8 level
shown after "LV" (card text 0x3E), 4-92
s32 prize
its index in CARDGAME_prizeItems
s16 counterCards[20]
from 1, up to a 0: CardBattle.counterCards before the usual ones
s32 wins
the rounds won shown
A player's cards in a card battle (CardSide.pile)
s16 hpTotal
the sum of its slot cards' hp: the higher one wins the round
s16 deckCount
the cards left in the deck
s16 deck[40]
deckTop on are left
s16 deckTop
the index of the deck's top card
u8 points[5]
one per card colour
s16 apTotal
the sum of its slot cards' ap, which comes off the other side's hpTotal
u8 wins
rounds won: two win the battle
s16 discards[10]
the cards played and lost from the slots, discardCount in use
s16 hand[10]
handCount in use
u8 kind
1-7 (CardDeckCard.kind)
u8 flagged
bit 15 of the card in the opponent's deck
s16 priority
by kind, then by place in the deck
s16 card
the index in the battle's card list
u8 targetKind
its effect's (CardEffect.target)
u8 target
the slot's order, or the card, it was played on
One of the two players of a card battle.
Reads CARDGAME's files into the file cache, one at a time.
s32 ready
the files before the first -2 are in
u8 menuState
CARDGAME_runBattleMenu's state.
u8 turns
the turns of plays this round
u8 turnState
CARDGAME_playRounds' state.
u8 menuCursor
CARDGAME_runBattleMenu's cursor, 0-4.
s8 answer
a step's result: -1 while waiting, then 0 or 1
s8 playCount
the plays in use
u8 turnSide
the side whose turn it is
u8 passes
the turns with no card played: two end the plays
u8 starter
the side that starts the round
CardPlay plays[3]
the cards played this turn, up to three
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(* 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(* resetPanels)(struct CardScreen *screen)
void(* openPanels)(struct CardScreen *screen)
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)
void(* closePanels)(struct CardScreen *screen)
void(* openPanelIcon)(struct CardScreen *screen, s32 side)
void(* closeMessage)(struct CardScreen *screen)
void(* closeWindow)(struct CardScreen *screen, s32 index)
s32(* loadCardImages)(s16 *dst, s16 *player, s16 *opponent)
u8 fadeState
0 dark, 1 fading in, 2 shown
s32(* startBlink)(struct CardScreen *screen, s32 index)
void(* confirmMenu)(struct CardScreen *screen)
s16 opponent
CardBattle.arg.
void(* closeGauge)(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)
s16 opponentLevel
CardBattle.opponentLevel.
Each player's side of a card battle (CardBattle.sides)
A card a player has out (CARDGAME_setSlot)
s16 hp
its hit points, 0 to 99: at 0 it is lost
s16 apBonus
what the effects added to its ap
s16 ap
its attack points, 0 to 99
s16 card
the index in the battle's card list
u8 order
CardBattle.slotCount when it was added.
A slot's card, sorted by id (CARDGAME_findCardSet)
s16 card
its id, minus one
A card on the battle screen (CardScreen.sprites)
u8 ap
the values shown, which count towards the slot's
u8 order
a played card's place in the record, from 1
u8 marks[3]
the plays that apply to the card, drawn as marks
s8 eligible[0x29]
the cards or slots that can be picked
u8 count
the cards picked, or to draw
s32 vars[5]
values each step uses its own way
s8 marked[40]
the cards or slots picked
s32 choice
the card, slot or answer chosen; -1 for none
u8 next
the step to start: CARDGAME_runEffectStep sets it up first
void *(* getEntry)(u32 fileAndIndex)
s32 cardBattleWon
1 when the player won the card battle; updateModeFlags copies it to FLAG_CARD_BATTLE_WON
s8 items[0x193]
counts, up to 99
s32(* getFrameTime)(void)
s32(* getRepeated)(s32 pad)
s32(* getButtonBit)(s32 pad, s32 button)
s32(* getPressed)(s32 pad)
s32(* next)(void)
0 to RANDOM_COUNT - 1
void(* stopSound)(s32 id)
short(* playSound)(s32 id)
returns the voice of a key-on
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
void initTimLoader(TimLoader *obj)
Clears a TIM loader, gives it its methods and binds it.