144 for (side = 0; side < 2; side++) {
145 for (i = 0; i < 5; i++) {
156 for (j = 0; j < 2; j++) {
157 for (k = 0; k < 5; k++) {
211 for (i = 0; i < 15; i++) {
238 screen->
addSprite(screen, 17, 0xE500, 0x6100);
252 screen->
scaleSprite(screen, 17, 8, 0x1000, 0x1000);
305 for (j = 0; j < 40; j++) {
348 }
else if (side == 0) {
355 for (i = 0; i < 40; i++) {
421 for (k = 0; k < 40; k++) {
458 screen->
startMove(screen, last, 15, x + 0x1800, 0x6100);
583 for (j = pile->
deckTop; j < 40; j++) {
584 deck[j] = deck[j + 1];
592 for (i = 0; i < 40; i++) {
607 for (i = 0; i < 40; i++) {
663#if VERSION_EU || VERSION_JP
671#if VERSION_EU || VERSION_JP
676 for (j = 0; j < 40; j++) {
705 screen->
openMessage(screen, 0x35, 0, 0, side == 0 ? 2 : 0);
724 for (i = 39, found = 0; i >= 0; i--) {
738 if (i < battle->drawEnd) {
766 for (n = 0; n < 40; n++) {
801#elif VERSION_EU || VERSION_JP
803 screen->
openMessage(screen, 0x35, 0, 0, side == 0 ? 2 : 0);
CARDGAME.PRO: the card battle (mode 0x700).
void initCardDrawer(CardDrawer *obj)
Clears a card drawer, gives it its methods and binds it.
@ CARD_ANIM_LAY_OUT_HAND
the hand laid out at once
@ CARD_ANIM_SHOW_HAND
the player's piles...
@ CARD_ANIM_LAY_OUT_OPPONENT_HAND
@ CARD_ANIM_SHOW_OPPONENT_HAND
...and the opponent's
s32 CARDGAME_discardPositions[][2]
x, y per side
GfxState GFX
GFX: the graphics state and its methods.
#define PAD_PRESSED(button)
One button of pad 1: newly pressed, auto-repeated while held, or held.
static void takeChosenCard(CardBattle *battle, s32 side)
Takes card effectStep.choice out of side's deck (for the computer, a reserve card goes from the botto...
void CARDGAME_startDiscardCount(CardBattle *battle, CardScreen *screen, s32 side)
Starts a count of side's discards and deck (effectStep.vars[0] and effectStep.vars[1])
s32 CARDGAME_drainColorValues(CardBattle *battle, CardScreen *screen)
Counts both sides' colour values (pile.points) down by one each effectStep.vars[2] frames,...
s32 CARDGAME_drawFromDeck(CardBattle *battle, CardScreen *screen, s32 side, s32 which)
Moves the card just put in the hand into place, then takes card effectStep.choice out of the deck (ta...
void CARDGAME_takeCardToHand(CardBattle *battle, CardScreen *screen, s32 side, s32 which)
Adds card effectStep.choice of a side's discards (which 4) or deck to its hand.
s32 CARDGAME_keepLastCard(CardBattle *battle, CardScreen *screen)
Keeps the last card played in keptCard (as card + 1) and counts it (keptCount); 1.
s32 CARDGAME_discardPickedCard(CardBattle *battle, CardScreen *screen, s32 side, s32 from)
Moves sprite 17 to the side's spot, then puts card effectStep.vars[4] on the side's discards and take...
s32 CARDGAME_returnUsedCards(CardBattle *battle, CardScreen *screen, s32 side)
Counts the panel's discards down into its deck, then puts the side's discards back into its deck; 1 o...
void CARDGAME_startDraw(CardBattle *battle, CardScreen *screen, s32 count)
Starts drawing count cards (effectStep.count)
s32 CARDGAME_markDrawnCards(CardBattle *battle, CardScreen *screen, s32 side)
Marks (effectStep.marked) the cards side draws from its deck: from its top for the player,...
static void takeMarkedCard(CardBattle *battle, s32 side)
Takes the last marked card out of side's deck (for the computer, a reserve card goes from the bottom)...
s32 CARDGAME_stepColorValue(CardBattle *battle, CardScreen *screen, s32 side, s32 color)
Moves a side's colour value (pile.points[color]) one step each effectStep.vars[2] frames towards usin...
static void takeChosenDiscard(CardBattle *battle, s32 side)
Takes card effectStep.choice out of side's used pile, shifting the cards after it up.
void CARDGAME_startColorDrain(CardBattle *battle, CardScreen *screen)
Starts CARDGAME_drainColorValues.
s32 CARDGAME_discardHand(CardBattle *battle, CardScreen *screen, s32 side)
Counts a side's hand cards over to its discards on its panel, one every 7 frames, then moves them; 1 ...
void CARDGAME_startCloseGauge(CardBattle *battle, CardScreen *screen)
Closes the gauge of the card before the last one.
static void showPileCounts(CardBattle *battle, CardScreen *screen)
Shows both sides' deck, hand and discard counts on their panels.
void CARDGAME_startColorChange(CardBattle *battle, CardScreen *screen, s32 amount, s32 interval)
Starts CARDGAME_stepColorValue: amount (effectStep.vars[3], below 0 to take) one at a time,...
s32 CARDGAME_discardPrevCard(CardBattle *battle, CardScreen *screen)
Puts the card played before the last one (record.plays[playCount - 2]) on its side's discards once it...
void CARDGAME_drawMarkedCards(CardBattle *battle, CardScreen *screen, s32 side)
Moves side's marked deck cards to its hand and opens its panel.
s32 CARDGAME_drawNewCards(CardBattle *battle, CardScreen *screen, s32 side)
Moves the cards drawn into the hand (from effectStep.vars[4] on) into place one at a time (goToNextCa...
void CARDGAME_startHandCount(CardBattle *battle, CardScreen *screen, s32 side)
Starts a count of side's hand and discards (effectStep.vars[0] and effectStep.vars[1])
static void goToNextCard(CardBattle *battle, CardScreen *screen, s32 side)
Goes on to the next drawn card, or once all are in place to the deck's empty message or the wait befo...
void CARDGAME_showPileCard(CardBattle *battle, CardScreen *screen, s32 side, s32 which)
Shows side's card at effectStep.choice as sprite 17: of its hand (which 0) or its deck (1)
s32 CARDGAME_stepShakeAway(CardBattle *battle, CardScreen *screen, s32 index)
Shakes sprite index, then shrinks it to nothing; 1 once done.
SoundState SOUND
rsin and rcos (libgte) read rsin_tbl[a - 0x800] and the like: their addresses before the table fall i...
#define SOUND_COUNT
SYSTEM10: a number counts up or down.
u8 faceDown
the next pile or slots are laid out face down
u8 hide
the one that hides what the last one showed
The card battle (CARDGAME_createBattle).
u8 drawEnd
the first card of the opponent's deck above the round's group
s16 cards[250]
card ids, minus one (CARDGAME_loadCardImages)
u8 keptCount
and how many times
void(* shufflePile)(struct CardBattle *battle, s32 base, s32 n)
u8 reserveStart
the first card of the opponent's deck held back (group 7)
u8 keptCard
the card CARDGAME_keepLastCard kept, plus one
CardDraw opponentDraws[40]
by the opponent's deck card
u8 order
its place in the deck
Draws the cards' images (CardImage), from files 0x7E7-0x7EB.
u8 state
1 opening, 2 open, 4 confirmed, 5 closing
A player's cards in a card battle (CardSide.pile)
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 discards[10]
the cards played and lost from the slots, discardCount in use
s16 hand[10]
handCount in use
s16 card
the index in the battle's card list
s8 playCount
the plays in use
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(* closePanel)(struct CardScreen *screen, s32 side)
void(* setPanelValue)(struct CardScreen *screen, s32 side, u32 which, s32 value)
void(* scaleSprite)(struct CardScreen *screen, s32 index, s32 duration, s32 scaleX, s32 scaleY)
void(* setPanelFlags)(struct CardScreen *screen, s32 bits)
void(* clearPanelFlags)(struct CardScreen *screen)
void(* startMove)(struct CardScreen *screen, s32 index, s32 duration, s32 x, s32 y)
void(* openMessage)(struct CardScreen *screen, s32 message, s32 prompt, s16 choice, s32 place)
s32(* getHandOffset)(s32 count, s32 index)
void(* setSpriteScale)(struct CardScreen *screen, s32 index, s32 scaleX, s32 scaleY)
void(* closeMessage)(struct CardScreen *screen)
s32(* startBlink)(struct CardScreen *screen, s32 index)
void(* closeGauge)(struct CardScreen *screen, s32 index)
s32(* addSprite)(struct CardScreen *screen, s32 index, s32 x, s32 y)
void(* openPanel)(struct CardScreen *screen, s32 side)
u8 marks[3]
the plays that apply to the card, drawn as marks
s32 time
a frame count, or the step's own sub-state
u8 count
the cards picked, or to draw
u8 state
the step's own state
s32 vars[5]
values each step uses its own way
u8 nextState
the state to set up first, if not 0
u8 flags
the step's own: the rows to pick from, the deck run out...
s8 marked[40]
the cards or slots picked
s32 choice
the card, slot or answer chosen; -1 for none
s32(* getFrameTime)(void)
short(* playSound)(s32 id)
returns the voice of a key-on